instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>I'm trying to do a file system backup of a RedHat Enterprise Linux v4 server using Symantec Backup Exec 11d (Rev 7170). The backup server is Windows Server 2003.</p>
<p>I can browse the target server to create a selection list, and when I do a test run it completes successfully.</p>
<p>However, when I run a real backup, the job fails immediately during the "processing" phase with the error: </p>
<p><em>e000fe30 - A communications failure has occured.</em></p>
<p>I've tried opening ports (10000, 1025-9999), etc. But no joy. Any ideas?</p>
|
<p>Sure sounds like firewall issues. Try stopping iptables, and running again. Also, RALUS can dump a log file - which may give some more to go on. </p>
<p>I use the older UNIX agent myself, which uses port 6101 IIRC - but I believe that the newer client uses tcp/10000 for control and 1024-65535 for transfer.</p>
<p>Last resort is to fire up a network sniffer. ;)</p>
|
<p>To clarify the answer, the solution was to open up the tcp ports from 1024-65535.</p>
<p>The iptables looked liked this:</p>
<pre><code>[root@MYSERVER ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:443
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5801
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5802
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5804
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5901
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5902
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5904
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:9099
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:10000
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:1025
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
</code></pre>
<p>I executed this command to add the new rule: </p>
<pre><code>[root@MYSERVER ~]# iptables -I RH-Firewall-1-INPUT 14 -p tcp -m tcp --dport 1024:65535 -j ACCEPT
</code></pre>
<p>Then they looked like this: </p>
<pre><code>[root@MYSERVER ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:443
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5801
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5802
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5804
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpts:1025:65535
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5901
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5902
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5904
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:9099
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:10000
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:1025
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
</code></pre>
<p>Save the iptables when you've verified that it works: </p>
<pre><code>[root@MYSERVER ~]# service iptables save
</code></pre>
| 4,128
|
<p>I run a rather complex project with several independent applications. These use however a couple of shared components. So I have a source tree looking something like the below.</p>
<ul>
<li>My Project
<ul>
<li>Application A</li>
<li>Shared1</li>
<li>Shared2 </li>
<li>Application B </li>
<li>Application C</li>
</ul></li>
</ul>
<p>All applications have their own MSBuild script that builds the project and all the shared resources it needs. I also run these builds on a CruiseControl controlled continuous integration build server. </p>
<p>When the applications are deployed they are deployed on several servers to distribute load. This means that it’s <em>extremely</em> important to keep track of what build/revision is deployed on each of the different servers (we need to have the current version in the DLL version, for example “1.0.0.68”). </p>
<p>It’s equally important to be able to recreate a revision/build that been built to be able to roll back if something didn’t work out as intended (o yes, that happends ...). Today we’re using SourceSafe for source control but that possible to change if we could present good reasons for that (SS it’s actually working ok for us <em>so</em> far). </p>
<p>Another principle that we try to follow is that it’s only code that been build and tested by the integration server that we deploy further. </p>
<h2>"CrusieControl Build Labels" solution</h2>
<p>We had several ideas on solving the above. The first was to have the continuous integration server build and locally deploy the project and test it (it does that now). As you probably know a successful build in CruiseControl generates a build label and I guess we somehow could use that to set the DLL version of our executables (so build label 35 would create a DLL like “1.0.0.35” )? The idea was also to use this build label to label the <strong>complete</strong> source tree. Then we probably could check out by that label and recreate the build later on. </p>
<p>The reason for labeling the complete tree is to include not only the actual application code (that’s in one place in the source tree) but also all the shared items (that’s in different places in the tree). So a successful build of “Application A” would label to whole tree with label “ApplicationA35” for example. </p>
<p>There might however be an issue when trying to recreate this build and setting the DLL version before deploying as we then don’t have access to the CruiseControl generated build label anymore. If all CrusieControl build labels were unique for all the projects we could use only the number for labeling but that’s not the case (both application A and B could at the same time be on build 35) so we have to include the application name in the label. Hence SourceSafe label “Application35”. <strong>How can I then recreate build 34 and set 1.0.0.34 to the DLL version numbers once we built build 35?</strong></p>
<h2>"Revision number" solution</h2>
<p>Someone told me that Subversion for example creates a revision number for the entire source tree on every check in – <strong>is this the case? Has SourceSafe something similar?</strong> If this is correct the idea is then to grab that revision number when getting latest and build on the CruiseControl server. The revision number could then be used to set the DLL version number (to for example “1.0.0.5678”). I guess we could then get this specific revision for the Subversion if needed and that then would include that application and all the shared items to be able to recreate a specific version from the past. <strong>Would that work and could this also be achived using SourceSafe?</strong></p>
<h2>Summarize</h2>
<p>So the two main requirements are:</p>
<ol>
<li>Be able to <strong>track build/revision number of the build and deployed DLL.</strong></li>
<li>Be able to <strong>rebuild a past revision/build, set the old build/revision number on the executables of that build</strong> (to comply with requirement 1).</li>
</ol>
<p><strong>So how would you solve this?</strong> What would be your preferred approach and <strong>how</strong> would you solve it (or do you have a totally different idea?)? **Pleased give detailed answers. **</p>
<p><em>Bonus question</em> What are the difference between a revision number and a build number and when would one really need both?</p>
|
<p>Your scheme is sound and achievable in VSS (although I would suggest you consider an alternative, VSS is really an outdated product).</p>
<p>For your "CI" Build - you would do the Versioning take a look at <a href="http://msbuildtasks.tigris.org/" rel="nofollow noreferrer">MSBuild Community Tasks Project</a> which has a "Version" tasks. Typically you will have a "Version.txt" in your source tree and the MSBuild task will increment the "Release" number while the developers control the Major.Minor.Release.Revision numbers (that's how a client of mine wanted it). You can use revision if you prefer.</p>
<p>You then would have a "FileUpdate" tasks to edit the AssemblyInfo.cs file with that version, and your EXE's and "DLL's" will have the desired version.</p>
<p>Finally the VSSLabel task will label all your files appropriately.</p>
<p>For your "Rebuild" Build - you would modify your "Get" to get files from that Label, obviously not execute the "Version" task (as you are SELECTING a version to build) and then the FileUpdate tasks would use that version number.</p>
<p>Bonus question:</p>
<p>These are all "how you want to use them" - I would use build number for, well the build number, that is what I'd increment. If you are using CI you'll have very many builds - the vast majority with no intention of ever deploying anywhere.</p>
<p>The major and minor are self evident - but revision I've always used for a "Hotfix" indicator. I intend to have a "1.3" release - which would in reality be a product with say 1.3.1234.0 version. While working on 1.4 - I find a bug - and need a hot fix as 1.3.2400.1. Then when 1.4 is ready - it would be say 1.4.3500.0</p>
|
<p>UppercuT can do all of this with a custom packaging task to split the applications up. And to get the version number of the source, you might think about Subversion.</p>
<p>It's also insanely easy to get started.</p>
<p><a href="http://code.google.com/p/uppercut/" rel="nofollow noreferrer">http://code.google.com/p/uppercut/</a></p>
<p>Some good explanations here: <a href="http://ferventcoder.com/category/uppercut.aspx" rel="nofollow noreferrer">UppercuT</a></p>
| 8,209
|
<p>The discussion of Dual vs. Quadcore is as old as the Quadcores itself and the answer is usually "it depends on your scenario". So here the scenario is a Web Server (Windows 2003 (not sure if x32 or x64), 4 GB RAM, IIS, ASP.net 3.0).</p>
<p>My impression is that the CPU in a Webserver does not need to be THAT fast because requests are usually rather lightweight, so having more (slower) cores should be a better choice as we got many small requests.</p>
<p>But since I do not have much experience with IIS load balancing and since I don't want to spend a lot of money only to find out I've made the wrong choice, can someone who has a bit more experience comment on whether or not More Slower or Fewer Faster cores is better?</p>
|
<p>For something like a webserver, dividing up the tasks of handling each connection is (relatively) easy. I say it's safe to say that web servers is one of the most common (and ironed out) uses of parallel code. And since you are able to split up much of the processing into multiple discrete threads, more cores actually does benefit you. This is one of the big reasons why shared hosting is even possible. If server software like IIS and Apache couldn't run requests in parallel it would mean that every page request would have to be dished out in a queue fashion...likely making load times unbearably slow.</p>
<p>This also why high end server Operating Systems like Windows 2008 Server Enterprise support something like 64 cores and 2TB of RAM. These are applications that can actually take advantage of that many cores.</p>
<p>Also, since each request is likely has low CPU load, you can probably (for some applications) get away with more slower cores. But obviously having each core faster can mean being able to get each task done quicker and, in theory, handle more tasks and more server requests.</p>
|
<p>The more the better. As programming languages start to become more complex and abstract, the more processing power that will be required.</p>
<p>Atleat Jeff believes <a href="https://blog.stackoverflow.com/2008/04/our-dedicated-server/">Quadcore is better</a>.</p>
| 2,584
|
<p>I simply wondered whether people thought it was worth learning to use the MSBuild syntax in order to customise the build process for a .net project, or whether it is really not worth it given the ease with which one can build a project using visual studio. </p>
<p>I am thinking in terms of nightly builds, etc., but then couldn't I use a scheduled event which uses the command-line build option built into VS? Are there superior tools out there?</p>
|
<p>@kronoz<br>
I would say YES.<br>
The neat thing about MSBuild is that if you modify your csproj files to include custom build steps then those steps will happen from within VS or from MSBuild. Also if you ever have a build server you will not need to install full VS, only the SDK to build your projects.</p>
|
<blockquote>
<p>@kronoz I would say YES. The neat
thing about MSBuild is that if you
modify your csproj files to include
custom build steps then those steps
will happen from within VS or from
MSBuild. Also if you ever have a build
server you will not need to install
full VS, only the SDK to build your
projects.</p>
</blockquote>
<p>==> This is not entirely true. For example, building a setup project on a build server will require Visual studio to be installed!!</p>
| 7,021
|
<p>What are your favorite (G)Vim plugins/scripts?</p>
|
<p><a href="http://www.vim.org/scripts/script.php?script_id=1658" rel="noreferrer">Nerdtree</a></p>
<p>The NERD tree allows you to explore your filesystem and to open files and
directories. It presents the filesystem to you in the form of a tree which you
manipulate with the keyboard and/or mouse. It also allows you to perform
simple filesystem operations. </p>
<p>The tree can be toggled easily with :NERDTreeToggle which can be mapped to a more suitable key. The keyboard shortcuts in the NERD tree are also easy and intuitive.</p>
<p>Edit: Added synopsis</p>
|
<p>During maintenance of a very big and old C++ project I've created two plugins and these are the only ones I use:</p>
<ul>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1638" rel="nofollow noreferrer">SourceCodeObedience</a> </li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=2507" rel="nofollow noreferrer">0scan</a></li>
</ul>
<p>0scan substitute for me taglist, buflist, files explorers, and other things like quick convenience file search.</p>
<p>SourceCodeObedience is very convenient cscope and ctags code surfing with stored history of all your searches with 'Filter' feature.</p>
<p>I use them not because they are mine but because they do the complete job and helps me to maintain of ~1Gb unfamiliar code base.</p>
| 4,184
|
<p>Related to my <a href="https://stackoverflow.com/questions/28975/anyone-using-couchdb">CouchDB</a> question.</p>
<p>Can anyone explain MapReduce in terms a numbnuts could understand?</p>
|
<p>Going all the way down to the basics for Map and Reduce.</p>
<hr>
<p><strong>Map</strong> is a function which "transforms" items in some kind of list to another kind of item and put them back in the same kind of list.</p>
<p>suppose I have a list of numbers: [1,2,3] and I want to double every number, in this case, the function to "double every number" is function x = x * 2. And without mappings, I could write a simple loop, say</p>
<pre><code>A = [1, 2, 3]
foreach (item in A) A[item] = A[item] * 2
</code></pre>
<p>and I'd have A = [2, 4, 6] but instead of writing loops, if I have a map function I could write</p>
<pre><code>A = [1, 2, 3].Map(x => x * 2)
</code></pre>
<p>the x => x * 2 is a function to be executed against the elements in [1,2,3]. What happens is that the program takes each item, execute (x => x * 2) against it by making x equals to each item, and produce a list of the results.</p>
<pre><code>1 : 1 => 1 * 2 : 2
2 : 2 => 2 * 2 : 4
3 : 3 => 3 * 2 : 6
</code></pre>
<p>so after executing the map function with (x => x * 2) you'd have [2, 4, 6].</p>
<hr>
<p><strong>Reduce</strong> is a function which "collects" the items in lists and perform some computation on <em>all</em> of them, thus reducing them to a single value.</p>
<p>Finding a sum or finding averages are all instances of a reduce function. Such as if you have a list of numbers, say [7, 8, 9] and you want them summed up, you'd write a loop like this</p>
<pre><code>A = [7, 8, 9]
sum = 0
foreach (item in A) sum = sum + A[item]
</code></pre>
<p>But, if you have access to a reduce function, you could write it like this</p>
<pre><code>A = [7, 8, 9]
sum = A.reduce( 0, (x, y) => x + y )
</code></pre>
<p>Now it's a little confusing why there are 2 arguments (0 and the function with x and y) passed. For a reduce function to be useful, it must be able to take 2 items, compute something and "reduce" that 2 items to just one single value, thus the program could reduce each pair until we have a single value.</p>
<p>the execution would follows:</p>
<pre><code>result = 0
7 : result = result + 7 = 0 + 7 = 7
8 : result = result + 8 = 7 + 8 = 15
9 : result = result + 9 = 15 + 9 = 24
</code></pre>
<p>But you don't want to start with zeroes all the time, so the first argument is there to let you specify a seed value specifically the value in the first <code>result =</code> line.</p>
<p>say you want to sum 2 lists, it might look like this:</p>
<pre><code>A = [7, 8, 9]
B = [1, 2, 3]
sum = 0
sum = A.reduce( sum, (x, y) => x + y )
sum = B.reduce( sum, (x, y) => x + y )
</code></pre>
<p>or a version you'd more likely to find in the real world:</p>
<pre><code>A = [7, 8, 9]
B = [1, 2, 3]
sum_func = (x, y) => x + y
sum = A.reduce( B.reduce( 0, sum_func ), sum_func )
</code></pre>
<hr>
<p>Its a good thing in a DB software because, with Map\Reduce support you can work with the database without needing to know how the data are stored in a DB to use it, thats what a DB engine is for.</p>
<p>You just need to be able to "tell" the engine what you want by supplying them with either a Map or a Reduce function and then the DB engine could find its way around the data, apply your function, and come up with the results you want all without you knowing how it loops over all the records.</p>
<p>There are indexes and keys and joins and views and a lot of stuffs a single database could hold, so by shielding you against how the data is actually stored, your code are made easier to write and maintain.</p>
<p>Same goes for parallel programming, if you only specify what you want to do with the data instead of actually implementing the looping code, then the underlying infrastructure could "parallelize" and execute your function in a simultaneous parallel loop for you.</p>
|
<p>I don't want to sound trite, but this helped me so much, and it's pretty simple:</p>
<pre><code>cat input | map | reduce > output
</code></pre>
| 4,866
|
<p>I've written PL/SQL code to denormalize a table into a much-easer-to-query form. The code uses a temporary table to do some of its work, merging some rows from the original table together.</p>
<p>The logic is written as a <a href="http://www.oreillynet.com/lpt/a/3136" rel="nofollow noreferrer">pipelined table function</a>, following the pattern from the linked article. The table function uses a <code>PRAGMA AUTONOMOUS_TRANSACTION</code> declaration to permit the temporary table manipulation, and also accepts a cursor input parameter to restrict the denormalization to certain ID values.</p>
<p>I then created a view to query the table function, passing in all possible ID values as a cursor (other uses of the function will be more restrictive).</p>
<p>My question: is this all really necessary? Have I completely missed a much more simple way of accomplishing the same thing?</p>
<p>Every time I touch PL/SQL I get the impression that I'm typing way too much.</p>
<p><strong>Update:</strong> I'll add a sketch of the table I'm dealing with to give everyone an idea of the denormalization that I'm talking about. The table stores a history of employee jobs, each with an activation row, and (possibly) a termination row. It's possible for an employee to have multiple simultaneous jobs, as well as the same job over and over again in non-contiguous date ranges. For example:</p>
<pre><code>| EMP_ID | JOB_ID | STATUS | EFF_DATE | other columns...
| 1 | 10 | A | 10-JAN-2008 |
| 2 | 11 | A | 13-JAN-2008 |
| 1 | 12 | A | 20-JAN-2008 |
| 2 | 11 | T | 01-FEB-2008 |
| 1 | 10 | T | 02-FEB-2008 |
| 2 | 11 | A | 20-FEB-2008 |
</code></pre>
<p>Querying that to figure out who is working when in what job is non-trivial. So, my denormalization function populates the temporary table with just the date ranges for each job, for any <code>EMP_ID</code>s passed in though the cursor. Passing in <code>EMP_ID</code>s 1 and 2 would produce the following:</p>
<pre><code>| EMP_ID | JOB_ID | START_DATE | END_DATE |
| 1 | 10 | 10-JAN-2008 | 02-FEB-2008 |
| 2 | 11 | 13-JAN-2008 | 01-FEB-2008 |
| 1 | 12 | 20-JAN-2008 | |
| 2 | 11 | 20-FEB-2008 | |
</code></pre>
<p>(<code>END_DATE</code> allows <code>NULL</code>s for jobs that don't have a predetermined termination date.)</p>
<p>As you can imagine, this denormalized form is much, much easier to query, but creating it--so far as I can tell--requires a temporary table to store the intermediate results (e.g., job records for which the activation row has been found, but not the termination...yet). Using the pipelined table function to populate the temporary table and then return its rows is the only way I've figured out how to do it.</p>
|
<p>I think a way to approach this is to use analytic functions...</p>
<p>I set up your test case using:</p>
<pre><code>create table employee_job (
emp_id integer,
job_id integer,
status varchar2(1 char),
eff_date date
);
insert into employee_job values (1,10,'A',to_date('10-JAN-2008','DD-MON-YYYY'));
insert into employee_job values (2,11,'A',to_date('13-JAN-2008','DD-MON-YYYY'));
insert into employee_job values (1,12,'A',to_date('20-JAN-2008','DD-MON-YYYY'));
insert into employee_job values (2,11,'T',to_date('01-FEB-2008','DD-MON-YYYY'));
insert into employee_job values (1,10,'T',to_date('02-FEB-2008','DD-MON-YYYY'));
insert into employee_job values (2,11,'A',to_date('20-FEB-2008','DD-MON-YYYY'));
commit;
</code></pre>
<p>I've used the <strong>lead</strong> function to get the next date and then wrapped it all as a sub-query just to get the "A" records and add the end date if there is one.</p>
<pre><code>select
emp_id,
job_id,
eff_date start_date,
decode(next_status,'T',next_eff_date,null) end_date
from
(
select
emp_id,
job_id,
eff_date,
status,
lead(eff_date,1,null) over (partition by emp_id, job_id order by eff_date, status) next_eff_date,
lead(status,1,null) over (partition by emp_id, job_id order by eff_date, status) next_status
from
employee_job
)
where
status = 'A'
order by
start_date,
emp_id,
job_id
</code></pre>
<p>I'm sure there's some use cases I've missed but you get the idea. Analytic functions are your friend :)</p>
<pre><code>EMP_ID JOB_ID START_DATE END_DATE
1 10 10-JAN-2008 02-FEB-2008
2 11 13-JAN-2008 01-FEB-2008
2 11 20-FEB-2008
1 12 20-JAN-2008
</code></pre>
|
<p>I couldn't agree with you more, HollyStyles. I also used to be a TSQL guy, and find some of Oracle's idiosyncrasies more than a little perplexing. Unfortunately, temp tables aren't as convenient in Oracle, and in this case, other existing SQL logic is expecting to directly query a table, so I give it this view instead. There's really no application logic that exists outside of the database in this system.</p>
<p>Oracle developers do seem to use cursors much more eagerly than I would have thought. Given the bondage & discipline nature of PL/SQL, that's all the more surprising.</p>
| 4,043
|
<p>I have been using PLA filament for two years now and have had good prints. ABS on the other hand has not been so good, so my choice of filament is PLA. </p>
<p>I am getting ready to do a sign for the American Legion and the colors are black, blue, and red and are 0.8 mm thin. The black letters are 4" x 2.5", blue are 3" x 2" and the red are 7.75" x 5.5". I plan to treat them with UV protection spray and attach them with clear epoxy to white back lit Plexiglass. </p>
<p>As the letters are quite thin, my question is how well will this hold up in the weather? The sign hangs on a pole that points east & west so the letters will be facing north and south. The original was painted with spray paint and the red paint south side faded to the point you could hardly see it at all. The sign had been there for some time and was done at a professional sign company.</p>
|
<p>I printed a handle for a rather big rolling door in natural PLA (From Fabberparts) - no UV protection. It's on the weather side of the house and is exposed to direct sun half the day.</p>
<p>And after three years cycling to all the German seasons it's still absolutely fine. Also, Wikipedia told me that PLA has good UV resistance - so you should be fine IMHO.</p>
<p>Here is a good blog post about your question: <a href="https://www.iepas.ucar.edu/using-pla-for-long-term-outdoor-applications/" rel="nofollow noreferrer">Using PLA for Long-Term Outdoor Applications</a>.</p>
<p>Update: After ~ 8 Years the door handle ist still fine.</p>
|
<p>Keep in mind that PLA has a much lower temperature point, where is starts getting flexible. I once had PLA-printed parts in my car in the summer for three hours and when I came back, they where bent. </p>
<p>I don't know about the weather conditions in your local environment, but if you experience hot temperatures and your sign is hanging in direct sunlight, I would suggest to make sure you secure the letters against bending (e.g. cover them with a coat of epoxy or something like this).</p>
| 410
|
<p>I have been using Solidworks and AutoCAD to create STL file of a 3D model I want to print. I slice the STL file using Freesteel Z level slicer (<a href="http://www.freesteel.co.uk/wpblog/slicer/" rel="nofollow">http://www.freesteel.co.uk/wpblog/slicer/</a>) and save the slices in a bmp format. </p>
<p>My 3d print has an array of circular channels, all of one radius. I expected the bmp slice to contain the circular shapes looking exactly identical to each other. However, I don't obtain the exact same replicas. Looks like the pixel-wise mapping has not been done uniformly. (View <a href="http://s24.postimg.org/p7w09zvkl/snippet.png" rel="nofollow">http://s24.postimg.org/p7w09zvkl/snippet.png</a> for the image). </p>
<p>I want each and every circle to be represented by exactly the same set of pixels in the bmp image, so that all of the circular contours are identical. (I do not prefer changing the pixel resolution.)</p>
<p>How can I overcome this problem? Are there any better tools which would lead to a perfectly uniform pixel-wise mapping? </p>
<p>Thanks! </p>
<p>PJ </p>
|
<p>Your objective has a serious constraint regarding the pixel resolution. Within that limitation, the software (slicer) you are using will generate "best guess" images, particularly dependent on floating point math. There may be a single combination of circular shapes (radius) and spacing for these shapes that provides your objective, but that's likely not a practical exercise.</p>
<p>You have not indicated if you've tried other slicers, which would be the primary direction. A list of choices can be found here:</p>
<p><a href="https://all3dp.com/best-3d-printing-software-tools/" rel="nofollow">Free Slicing Program List</a></p>
<p>Another option that you can consider, not included in this list, is to use OpenSCAD, import the STL file, then use the projection() command to manually slice and export the image file. I use the term "manually" but the program can be coded to perform this task automatically, and there is a command line feature to OpenSCAD that may be useful.</p>
<p>Note also that the output of these slicers and/or OpenSCAD may exceed the resolution you desire. Manipulation of the image with a graphics editor could result in the same floating point disarray as you perform the changes.</p>
|
<p>Your objective has a serious constraint regarding the pixel resolution. Within that limitation, the software (slicer) you are using will generate "best guess" images, particularly dependent on floating point math. There may be a single combination of circular shapes (radius) and spacing for these shapes that provides your objective, but that's likely not a practical exercise.</p>
<p>You have not indicated if you've tried other slicers, which would be the primary direction. A list of choices can be found here:</p>
<p><a href="https://all3dp.com/best-3d-printing-software-tools/" rel="nofollow">Free Slicing Program List</a></p>
<p>Another option that you can consider, not included in this list, is to use OpenSCAD, import the STL file, then use the projection() command to manually slice and export the image file. I use the term "manually" but the program can be coded to perform this task automatically, and there is a command line feature to OpenSCAD that may be useful.</p>
<p>Note also that the output of these slicers and/or OpenSCAD may exceed the resolution you desire. Manipulation of the image with a graphics editor could result in the same floating point disarray as you perform the changes.</p>
| 258
|
<p>Im using Prusa Slicer 2.1 for my FlyingBear Ghost 4.</p>
<p>I just changed my 0.4 mm nozzle for a 0.2 mm but it seems to jam in the heater probably due to too much filament trying to get out by the nozzle. Where is the setting to reduce the filement speed and how much I should reduce it?</p>
<p>Here are my settings:
<a href="https://drive.google.com/file/d/1j_RsFQI1EtfSzptggYjGehpdlJlX7rsK/view?usp=sharing" rel="nofollow noreferrer">Config.txt</a></p>
|
<p>0.2 mm and 0.4 mm are half the diameter, but the maximum flow is not just half: Flow scales with the area. The 0.4 mm nozzle has an area 4 times as the 0.2 mm one:</p>
<p><span class="math-container">$\frac{A_1} {A_2}=\frac {0.2^2}{0.1^2}=4$</span></p>
<p>You need to reduce <code>print speed</code> or the <code>volumetric flow</code> by this factor or make sure your printer can handle the increased flow by reducing the viscosity of the melt - for example by increasing the print temperature.</p>
<p>Also note, that a 0.2 mm nozzle can't be operated with layer heights above 0.15 mm.</p>
|
<p>The discussion about slowing the print speed is important, but in my experience it is not at the root of the problem, and slowing down printing may make it worse.</p>
<p>If ny "heater" you mean the complete hot-end, then I suspect you are jamming in the cooler part of the hot-end. This cooler part is separated from the heater itself by the heat break, which is often a thin-walled metal tube.</p>
<p>The hot side of the heat break is heated by the heater. The cooler-end, the cool side of the heat break, is cooled by two things:</p>
<ol>
<li>cold filament being moved through it and</li>
<li>airflow from the fan over the heat sink fins.</li>
</ol>
<p>It is heated by:</p>
<ol>
<li>Thermal conduction through the thin metal tube</li>
<li>Convection airflow from the hot-end vertically and over the cooler-end</li>
<li>Hot filament being pulled through the heat break during retraction.</li>
</ol>
<p>When you are printing with a smaller cross-section of extruded filament, the slicer program should adjust the flow rate and speeds based on the lesser volume of plastic extruded for a given pressure. Unfortunately, this is less plastic, so the filament cools the cooler end of the heat break less than it would if the feed rate were higher. As a result, the temperature of the cooler end goes up. If there is insufficient airflow to keep the cooler side below the softening point of filament, the filament softens and jams inside the cooler end.</p>
<p>Of course, if your jam actually is in the hot end, this discussion is not relevant.</p>
<p>But, I have found with my Prusa i3m3 that I have had problems with jamming in the cooler end, especially when I printed filament with a higher melting temperature, ABS in this case. I reduced the area of the airflow so that no air could pass through other than by passing over the heat sink fins, and the ABS printed correctly.</p>
<p>All of 3D printing is a balance of one factor against another. It is hard to lose, though, by increasing the cooler-end temperature. All will seem well until you print something with a lower flow, or a higher retraction rate, or you try using a higher temperature for the same filament. Then the jam can unexpectedly occur, or, perhaps worse, it can be an intermittent jam, or there can be a lot to sticktion, and printing becomes prone to gaps, or occasional under extrusion.</p>
| 1,743
|
<p>The minimum spanning tree problem is to take a connected weighted graph and find the subset of its edges with the lowest total weight while keeping the graph connected (and as a consequence resulting in an acyclic graph).</p>
<p>The algorithm I am considering is:</p>
<ul>
<li>Find all cycles.</li>
<li>remove the largest edge from each cycle.</li>
</ul>
<p>The impetus for this version is an environment that is restricted to "rule satisfaction" without any iterative constructs. It might also be applicable to insanely parallel hardware (i.e. a system where you expect to have several times more degrees of parallelism then cycles).</p>
<p>Edits:</p>
<p>The above is done in a stateless manner (all edges that are not the largest edge in any cycle are selected/kept/ignored, all others are removed).</p>
|
<p>What happens if two cycles overlap? Which one has its longest edge removed first? Does it matter if the longest edge of each is shared between the two cycles or not?</p>
<p>For example:</p>
<pre><code>V = { a, b, c, d }
E = { (a,b,1), (b,c,2), (c,a,4), (b,d,9), (d,a,3) }
</code></pre>
<p>There's an a -> b -> c -> a cycle, and an a -> b -> d -> a</p>
|
<p>@Tynan The system can be described (somewhat over simplified) as a systems of rules describing categorizations. "Things are in category A if they are in B but not in C", "Nodes connected to nodes in Z are also in Z", "Every category in M is connected to a node N and has 'child' categories, also in M for every node connected to N". It's slightly more complicated than this. (I have shown that by creating unstable rules you can model a turning machine but that's beside the point.) It can't explicitly define iteration or recursion but can operate on recursive data with rules like the 2nd and 3rd ones.</p>
<p>@Marcin, Assume that there are an unlimited number of processors. It is trivial to show that the program can be run in O(n^2) for n being the longest cycle. With better data structures, this can be reduced to O(n*O(set lookup function)), I can envision hardware (quantum computers?) that can evaluate all cycles in constant time. giving a O(1) solution to the MST problem.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Reverse-Delete_algorithm" rel="nofollow noreferrer">Reverse-delete algorithm</a> seems to provide a partial proof of correctness (that the proposed algorithm will not produce a non-minimal spanning tree) this is derived by arguing that mt algorithm will remove every edge that the Reverse-delete algorithm will. However I'm not sure how to show that my algorithm won't delete more than that algorithm. </p>
<p>Hhmm....</p>
| 5,815
|
<p>My JavaScript is pretty nominal, so when I saw this construction, I was kind of baffled:</p>
<pre><code>var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
shareProxiesPref.disabled = proxyTypePref.value != 1;
</code></pre>
<p>Isn't it better to do an if on <code>proxyTypePref.value</code>, and then declare the var inside the result, only if you need it?</p>
<p>(Incidentally, I also found this form very hard to read in comparison to the normal usage. There were a set of two or three of these conditionals, instead of doing a single if with a block of statements in the result.)</p>
<hr>
<p><strong>UPDATE:</strong></p>
<p>The responses were very helpful and asked for more context. The code fragment is from Firefox 3, so you can see the code here:</p>
<p><a href="http://mxr.mozilla.org/firefox/source/browser/components/preferences/connection.js" rel="nofollow noreferrer">http://mxr.mozilla.org/firefox/source/browser/components/preferences/connection.js</a></p>
<p>Basically, when you look at the <strong>Connect</strong> preferences window in Firefox, clicking the proxy <strong>modes</strong> (radio buttons), causes various form elements to enable|disable.</p>
|
<p>It depends on the context of this code. If it's running on page load, then it would be better to put this code in an if block.</p>
<p>But, if this is part of a validation function, and the field switches between enabled and disabled throughout the life of the page, then this code sort of makes sense.</p>
<p>It's important to remember that setting disabled to false also alters page state.</p>
|
<p>It's hard to say what's better to do without more context.</p>
<p>If this code being executed every time that proxyTypePref changes, then you're always going to need set <code>shareProxiesPref.disabled</code>.</p>
<p>I would agree than an if statement would be a bit more readable than the current code.</p>
<blockquote>
<p>Isn't it better to do an if on <code>proxyTypePref.value</code>, and then declare the var inside the result, only if you need it?</p>
</blockquote>
<p>If you're talking strictly about variable declaration, then it doesn't matter whether or not you put it inside an if statement. Any Javascript variable declared inside a function is in scope for the entire function, regardless of where it is declared.</p>
<p>If you're talking about the execution of <code>document.getElementById</code>, then yes, it is much better to not make that call if you don't have to.</p>
| 4,668
|
<p>I have a winform app that calls a web service to check for updates. This works in dev and it also works everywhere else I've tried it, just not on the installed copy on my machine (which happens to be the same in dev).</p>
<p>The error is:</p>
<p>Cannot execute a program. The command being executed was "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /noconfig /fullpaths @"C:\Documents and Settings\Giovanni.DOUBLE-AFSSZ043\Local Settings\Temp\squ8oock.cmdline".</p>
<p>The firewall is disabled and I've looked for "C:\Documents and Settings\Giovanni.DOUBLE-AFSSZ043\Local Settings\Temp\squ8oock.cmdline" and it is not there. Note that every time I try to use the web service the ".cmdline" file is different, for example the second time I ran it it was "dae8rgen.cmdline." No matter what name it has, I can never find the file.</p>
<p>Any suggestions?</p>
|
<p>The ".cmdline" file is an autogenerated file produced by the .NET framework. The application is attempting to real-time compile an XML Serializer used to parse the data from the web service.</p>
<p>Have you verified that you can execute "csc.exe" from a command-line window? Even just typing "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe /?" should get you a list of compiler options (or should give you an error if you don't have permissions to execute it).</p>
<p>What user account are you running this under, and does it have permissions to execute .exe files in the windows directory? Similarly, I know you said this happens with the installed copy on your machine, but is it possible it's executing off a network share and receiving limited Code Access Security permissions which would prevent it from running local executables?</p>
<p>For reference, here is a KB article showing a similar error that can occur in ASP.NET when the user account doesn't have enough permissions.
<a href="http://support.microsoft.com/kb/315904" rel="nofollow noreferrer">http://support.microsoft.com/kb/315904</a></p>
|
<p>If AppLocker is enforced, please allow below (add as path exception) </p>
<p><code>c:\windows\MICROSOFT.NET\FRAMEWORK\V2.0.50727\CSC.EXE</code>
<code>c:\windows\MICROSOFT.NET\FRAMEWORK\V2.0.50727\CVTRES.EXE</code></p>
| 8,764
|
<p>I think most people know how to do this via the GUI (right click table, properties), but doing this in T-SQL totally rocks.</p>
|
<pre>
CREATE TABLE #tmpSizeChar (
table_name sysname ,
row_count int,
reserved_size varchar(50),
data_size varchar(50),
index_size varchar(50),
unused_size varchar(50))
CREATE TABLE #tmpSizeInt (
table_name sysname ,
row_count int,
reserved_size_KB int,
data_size_KB int,
index_size_KB int,
unused_size_KB int)
SET NOCOUNT ON
INSERT #tmpSizeChar
EXEC sp_msforeachtable 'sp_spaceused ''?'''
INSERT INTO #tmpSizeInt (
table_name,
row_count,
reserved_size_KB,
data_size_KB,
index_size_KB,
unused_size_KB
)
SELECT [table_name],
row_count,
CAST(SUBSTRING(reserved_size, 0, PATINDEX('% %', reserved_size)) AS int)reserved_size,
CAST(SUBSTRING(data_size, 0, PATINDEX('% %', data_size)) AS int)data_size,
CAST(SUBSTRING(index_size, 0, PATINDEX('% %', index_size)) AS int)index_size,
CAST(SUBSTRING(unused_size, 0, PATINDEX('% %', unused_size)) AS int)unused_size
FROM #tmpSizeChar
/*
DROP TABLE #tmpSizeChar
DROP TABLE #tmpSizeInt
*/
SELECT * FROM #tmpSizeInt
ORDER BY reserved_size_KB DESC
</pre>
|
<p>Check out this, I know it works in 2005 (<a href="https://learn.microsoft.com/sql/relational-databases/system-catalog-views/sys-database-files-transact-sql" rel="nofollow noreferrer">Microsoft Documentation</a>):</p>
<p>Here is is for the pubs DB
<pre><code>
select *
from pubs.sys.database_files
</pre></code></p>
<p>Returns the size and max_size.</p>
| 2,482
|
<p>I am wondering what experiences people are having using the ASP.NET MVC Framework? In particular I am looking for feedback on the type of experience folks are having using the framework.</p>
<p>What are people using for their view engine? What about the db layer, NHibernate, LINQ to SQL or something else?</p>
<p>I know stackoverflow uses MVC, so please say this site.</p>
<p>Thank you.</p>
<hr>
<p>Why the choice of NHibernate over anything else? I am not against NHibernate, just wondering the rational.</p>
|
<p>I've been getting into some pretty heavy use of NHibernate with ASP.NET MVC lately, and am really loving it.</p>
|
<blockquote>
<p>Why the choice of NHibernate over
anything else?</p>
</blockquote>
<p>It's a very powerful tool, and is (relatively) easy to learn. It takes away all the monotony and repetitiveness of manually implementing object-relational mapping.</p>
| 4,379
|
<p>Let's aggregate a list of free quality web site design templates. There are a million of these sites out there, but most are repetitive and boring. </p>
<p>I'll start with <a href="http://www.freecsstemplates.org/" rel="noreferrer">freeCSStemplates.org</a></p>
<p>I also think other sites should follow some sort of standards, for example here are freeCSStemplates standards</p>
<ul>
<li>Released for FREE under the Creative Commons Attribution 2.5 license </li>
<li>Very lightweight in terms of images </li>
<li>Tables-free (ie. they use no tables for layout purposes) </li>
<li>W3C standards compliant and valid (XHTML Strict) </li>
<li>Provided with public domain photos, generously provided by PDPhoto.org and Wikimedia Commons </li>
</ul>
|
<p>Check out:</p>
<ul>
<li><a href="http://www.oswd.org/" rel="noreferrer">Open Source Web Designs</a></li>
<li><a href="http://cssremix.com/" rel="noreferrer">CSS Remix</a></li>
<li><a href="http://bestwebgallery.com/" rel="noreferrer">Best Web Gallery</a></li>
<li><a href="http://www.cssbased.com/" rel="noreferrer">CSS Based</a></li>
<li><a href="http://www.cssbeauty.com/gallery/" rel="noreferrer">CSS Beauty</a></li>
<li><a href="http://www.my3w.org" rel="noreferrer">CSS Genius</a></li>
</ul>
|
<p>+1 for <a href="http://www.csszengarden.com/" rel="nofollow noreferrer">Zen garden.</a></p>
<p>I like the resources at <a href="http://inobscuro.com/" rel="nofollow noreferrer">inobscuro.com</a></p>
| 2,481
|
<p>Is it possible to upload a file from a client's computer to the server through a web service? The client can be running anything from a native desktop app to a thin ajax client.</p>
|
<p>It's certainly possible to send binary files via web services (eg. SOAP), but you usually have to do some kind of encoding such as base64, which increases the amount of data to send. One of the most efficient ways to send an arbitrary binary file is via an HTTP PUT operation, since there is no encoding overhead. Not all clients necessarily have an easy way to do this, but it's worth looking.</p>
<p>The other side of that coin is how to get the data off the user's disk an on to the network connection. A "thin ajax client" might not have the requisite permissions to read files from the user's disk. On the other hand, a desktop app implementation would be able to do so without any problem.</p>
|
<p>I'm not a master in "webservice", but if you develop the webservice (and the client), you always can convert the binary file to <a href="http://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">BASE64</a> in the client (can do in java... and i soupose in ajax too) and transfer as "string", in the other side, in the webservice encode to binary from BASE64...</p>
<p>It's one idea, that's work, but maybe not "correct" in all enviroment.</p>
| 3,288
|
<p>For some strange, bizarre reason, my images in my website just will not display on webkit based languages (such as safari and chrome).</p>
<p>This is the image tag</p>
<pre><code><img src="images/dukkah.jpg" class="imgleft"/>
</code></pre>
<p>Not only does it not display in the website, it wont display when accessed directly at <code>http://kilkin.massiveatom.com/kilkin/images/dukkah.jpg</code></p>
<p>...Why?</p>
|
<p>Imagemagick reports that this particular image is saved in CMYK colorspace instead of the more standard RGB. Try converting it, it should be more compatible with the webkit rendering engine.</p>
<p>Imagemagick is available for download from <a href="http://www.imagemagick.org/script/index.php" rel="nofollow noreferrer"><a href="http://www.imagemagick.org/script/index.php" rel="nofollow noreferrer">http://www.imagemagick.org/script/index.php</a></a> - it's available for windows and *NIX systems.</p>
|
<p>I tried the url you gave in FireFox 3 and IE 6, IE 6 won't show it either, firefox works. My guess is that there is something wrong with the jpg file.</p>
| 6,514
|
<p>Without resorting to PInvoke, is there a way in .net to find out what windows are open? This is slightly different than asking what applications are running in memory. For example, Firefox could be running, but could be more than one window. Basically, I just want to be privy to the same information that the taskbar (and <code>alt-tab</code>?) is.</p>
<p>Also, once I have a reference to a window, is there any way to programatically give it focus?</p>
<p>Is there any way to do this with managed code?</p>
|
<p>You could check out the new <a href="http://msdn.microsoft.com/en-us/library/ms747327.aspx" rel="nofollow noreferrer">UI Automation</a> stuff in .NET 3.5. It is supposed to mask a whole lot of the PInovke stuff and works with web and WPF applications.</p>
<p>I haven't used it yet, so I don't have a more specific place to direct you, but it might fit the bill.</p>
|
<p>I'm afraid there is no way you can do it without PInvoke. To give focus to some window you should call SetForegroundWindow function, see <a href="http://www.codeproject.com/KB/cs/windowhider.aspx" rel="nofollow noreferrer">this</a> article for details.</p>
| 5,640
|
<p>I would like to print a custom version of something akin to this rugged case that was originally created using injection molding:</p>
<p><a href="https://i.stack.imgur.com/oL8JW.jpg" rel="nofollow noreferrer" title="ea weather proofed tablet with over-molded rubber"><img src="https://i.stack.imgur.com/oL8JW.jpg" alt="ea weather proofed tablet with over-molded rubber" title="ea weather proofed tablet with over-molded rubber" /></a></p>
<p>The outside consists of a material that is a bit softer than the main body.</p>
<p>It is used to protect the electronics against drops when the case falls onto the floor.</p>
<p>Unfortunately, I don't know which material this is, and I don't know which method I could use to measure its softness.</p>
<p>I would therefore like to ask if anybody has experience with such a softer outer hull and can tell me which material could be used when I want to 3D print it.</p>
<p>I would like to use this case in a hospital environment.</p>
|
<p>I do it a couple of ways.</p>
<p>I use TPU which is pretty good for impacts and either make it thick or stiffen it with another filament as an inside or outside shell.</p>
<p>But TPU is what you want for this project because it's flexible in the way you need it to be.</p>
|
<p>Case designers usually use TPU for flexibility and polycarbonate for stiffness</p>
| 2,201
|
<p>I need to get a log of user access to our <code>SQL Server</code> so I can track <strong>average</strong> and <strong>peak concurrency usage</strong>. Is there a hidden table or something I'm missing that has this information for me? To my knowledge the application I'm looking at does not track this at the application level.</p>
<p>I'm currently working on <code>SQL Server 2000</code>, but will moving to <code>SQL Server 2005</code> shortly, so solutions for both are greatly appreciated.</p>
|
<p>In SQL Server 2005, go to tree view on the left and select Server (name of the actual server) > Management > Activity Monitor. Hope this helps.</p>
|
<ul>
<li>on <code>2000</code> you can use <code>sp_who2</code> or the <code>dbo.sysprocesses</code> system table</li>
<li>on <code>2005</code> take a look at the <code>sys.dm_exec_sessions</code> DMV</li>
</ul>
<p>Below is an example</p>
<pre><code>SELECT COUNT(*) AS StatusCount,CASE status
WHEN 'Running' THEN 'Running - Currently running one or more requests'
WHEN 'Sleeping ' THEN 'Sleeping - Currently running no requests'
ELSE 'Dormant – Session is in prelogin state' END status
FROM sys.dm_exec_sessions
GROUP BY status
</code></pre>
| 2,777
|
<p>I need a database that could be stored network drive and would allow multiple users (up to 20) to use it without any server software.</p>
<p>I'm considering MS Access or Berkeley DB.</p>
<p>Can you share your experience with file databases? <br>
Which one did you use, did you have any problems with it?</p>
|
<p>I would suggest <a href="http://www.sqlite.org/index.html" rel="noreferrer">SQLite</a> because the entire database is stored in a single file, and it quite safely handles multiple users accessing it at the same time. There are several different libraries that you can use for your client application and there is no server software needed.</p>
<p>One of the strengths is that it mimics SQL servers so closely that if you need to convert from using a database file to a full-fledged SQL Server, most of your queries in your client won't need to change. You'll just need to migrate the data over to the new server database (which I wouldn't be surprised if there are programs to convert SQLite databases to MySQL databases, for example.)</p>
|
<p>I have been using Access for some time and in a variety of situations, including on-line. I have found that Access works well if it is properly set up according to the <a href="http://msdn.microsoft.com/en-us/library/aa167840.aspx" rel="nofollow noreferrer">guidelines</a>. One advantage of Access is that it includes everything in one package: Forms, Query Building, Reports, Database Management, and VBA. In addition, it works well with all other Office applications. The Access 2007 runtime can be obtained free from <a href="http://www.microsoft.com/downloads/details.aspx?familyid=d9ae78d9-9dc6-4b38-9fa6-2c745a175aed&displaylang=en" rel="nofollow noreferrer">here</a>, which makes distribution less expensive. Access is certainly unsuitable for large operations, but it should be quite suitable for twenty users. EDIT: <a href="http://office.microsoft.com/en-us/access/HP051868081033.aspx" rel="nofollow noreferrer">Microsoft</a> puts the number of concurrent users at 255.</p>
| 5,545
|
<p>I am attempting to print the Benchy boat but every attempt so far has been unsuccessful. The print has a sort of slope/blob on the nose of the boat, which emerges after the first 30 layers.</p>
<p><a href="https://i.stack.imgur.com/vx2cM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vx2cM.jpg" alt="defect"></a></p>
<p>Here you can see the front of the boat already arching up:</p>
<p><a href="https://i.stack.imgur.com/q9Z6A.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q9Z6A.jpg" alt="defect 2"></a></p>
<p>I have tried decreasing speed to 40 mm/s but the issue remains.</p>
<p><strong>Printer</strong>: Geetech Prusa I3 Pro B</p>
<p>XY Accelleration: 1000 mm/s<sup>2</sup></p>
<p>XY Jerk: 20 mm/s</p>
<p>Retraction Accelleration: 2000 mm/s<sup>2</sup></p>
<p>Extruder Jerk: 5 mm/s</p>
<p>Printing Speed: 50 mm/s</p>
<p>Travel Speed: 120 mm/s</p>
<p>Layer Height: 0.1 mm</p>
<p>Infill: 60% (Lines)</p>
<p>Material: PLA, 200 °C, 1.75mm filament, retraction enabled.</p>
|
<p>Looks like curling from to much being extruded and no cooling I had the same problem added part cooling and problem was gone </p>
|
<p>The lines along the length of the boat also appear to be wobbling, can you confirm this? Have you used this material before? The layers should look straight and equal.
<a href="https://i.stack.imgur.com/PvV5g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PvV5g.png" alt="enter image description here"></a></p>
<p>I have 2 candidates:
If the lines indeed wobble it may be over extrusion. The excess material pushing the extruded line over the edge. (check the diameter of the filament with a caliper and adjust the extrusion rate if needed)</p>
<p>Or it can be shrinking. 60% infill is quite high. You could try 20 or 30% (less material and more air => less distortion), or adjusting cooling.</p>
<p>Hope it helps, good luck! </p>
| 849
|
<p>I am modifying some Slic3r config parameters and comparing the results. How can I have two instances (or equivalent: I would like to see two model windows with their associated configuration screens) of Slic3r at the same time? I'm on OS X, but if there is a generic (e.g. within Slic3r) solution that will be preferrable.</p>
|
<p>From a terminal window, run the command</p>
<pre><code>open -n -a slic3r
</code></pre>
<p>Each time the command is executed, a new instance of Slic3r is created.</p>
<p>As per Carl's note, keep in mind that both instances of Slic3r will be sharing the same configuration files, so it will be safest not to save configuration changes while both are open.</p>
|
<p>From a terminal window, run the command</p>
<pre><code>open -n -a slic3r
</code></pre>
<p>Each time the command is executed, a new instance of Slic3r is created.</p>
<p>As per Carl's note, keep in mind that both instances of Slic3r will be sharing the same configuration files, so it will be safest not to save configuration changes while both are open.</p>
| 1,081
|
<p>I suspect that one of my applications eats more CPU cycles than I want it to. The problem is - it happens in bursts, and just looking at the task manager doesn't help me as it shows immediate usage only.</p>
<p>Is there a way (on Windows) to track the history of CPU & Memory usage for some process. E.g. I will start tracking "firefox", and after an hour or so will see a graph of its CPU & memory usage during that hour.</p>
<p>I'm looking for either a ready-made tool or a programmatic way to achieve this.</p>
|
<p>Press <kbd>Win</kbd>+<kbd>R</kbd>, type <code>perfmon</code> and press <kbd>Enter</kbd>. When the Performance window is open, click on the <strong>+</strong> sign to add new counters to the graph. The counters are different aspects of how your PC works and are grouped by similarity into groups called "Performance Object".</p>
<p>For your questions, you can choose the "Process", "Memory" and "Processor" performance objects. You then can see these counters in real time</p>
<p>You can also specify the utility to save the performance data for your inspection later. To do this, select "Performance Logs and Alerts" in the left-hand panel. (It's right under the System Monitor console which provides us with the above mentioned counters. If it is not there, click "File" > "Add/remove snap-in", click Add and select "Performance Logs and Alerts" in the list".) From the "Performance Logs and Alerts", create a new monitoring configuration under "Counter Logs". Then you can add the counters, specify the sampling rate, the log format (binary or plain text) and log location.</p>
|
<p>I use taskinfo for history graph of CPU/RAM/IO speed.
<a href="http://www.iarsn.com/taskinfo.html" rel="nofollow noreferrer">http://www.iarsn.com/taskinfo.html</a></p>
<p>But bursts of unresponsiveness, sounds more like interrupt time due to a falty HD/SS drive. </p>
| 9,474
|
<p>I have a "Status" class in C#, used like this:</p>
<pre><code>Status MyFunction()
{
if(...) // something bad
return new Status(false, "Something went wrong")
else
return new Status(true, "OK");
}
</code></pre>
<p>You get the idea.
All callers of MyFunction <em>should</em> check the returned Status:</p>
<pre><code>Status myStatus = MyFunction();
if ( ! myStatus.IsOK() )
// handle it, show a message,...
</code></pre>
<p>Lazy callers however can ignore the Status.</p>
<pre><code>MyFunction(); // call function and ignore returned Status
</code></pre>
<p>or </p>
<pre><code>{
Status myStatus = MyFunction();
} // lose all references to myStatus, without calling IsOK() on it
</code></pre>
<p>Is it possible to make this impossible? e.g. an throw exception</p>
<p><strong>In general</strong>: is it possible to write a C# class on which you <em>have</em> to call a certain function?</p>
<p>In the C++ version of the Status class, I can write a test on some private bool bIsChecked in the <em>destructor</em> and ring some bells when someone doesn't check this instance.</p>
<p>What is the equivalent option in C#?
I read somewhere that "You don't want a destructor in your C# class"</p>
<p>Is the Dispose method of the IDisposable interface an option?</p>
<p>In this case there are no unmanaged resources to free.
Additionally, it is not determined <em>when</em> the GC will dispose the object.
When it eventually gets disposed, is it still possible to know where and when you ignored that specific Status instance?
The "using" keyword does help, but again, it is not <em>required</em> for lazy callers.</p>
|
<p>I know this doesn't answer your question directly, but if "something went wrong" within your function (unexpected circumstances) I think you should be throwing an exception rather than using status return codes.</p>
<p>Then leave it up to the caller to catch and handle this exception if it can, or allow it to propogate if the caller is unable to handle the situation.</p>
<p>The exception thrown could be of a custom type if this is appropriate.</p>
<p>For <em>expected</em> alternative results, I agree with @Jon Limjap's suggestion. I'm fond of a bool return type and prefixing the method name with "Try", a la:</p>
<pre><code>bool TryMyFunction(out Status status)
{
}
</code></pre>
|
<p>You can throw an exception by:</p>
<pre><code>throw MyException;
[global::System.Serializable]
public class MyException : Exception
{
//
// For guidelines regarding the creation of new exception types, see
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
// and
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
//
public MyException () { }
public MyException ( string message ) : base( message ) { }
public MyException ( string message, Exception inner ) : base( message, inner ) { }
protected MyException (
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context )
: base( info, context ) { }
}
</code></pre>
<p>The above exception is fully customizable to your requirements.</p>
<p>One thing I would say is this, I would leave it to the caller to check the return code, it is their responsability you just provide the means and interface. Also, It is a lot more efficient to use return codes and check the status with an if statement rather than trhowing exceptions. If it really is an <em>Exceptional</em> circumstance, then by all means throw away... but say if you failed to open a device, then it might be more prudent to stick with the return code.</p>
| 4,001
|
<p>And on top of that, are there cases where one has to use the global assembly cache or where one cannot use it?</p>
|
<ul>
<li>Loading assemblies from GAC mean less overhead and security that your application will always load correct version of .NET library</li>
<li>You shouldn't ngen assemblies that are outside of GAC, because there will be almost no performance gain, in many cases even loss in performance.</li>
<li>You're already using GAC, because all standard .NET assemblies are actually in GAC and ngened (during installation).</li>
<li>Using GAC for your own libraries adds complexity into deployment, I would try to avoid it at all costs.</li>
<li>Your users need to be logged as administrators during installation if you want to put something into GAC, quite a problem for many types of applications.</li>
</ul>
<p>So to sum it all, start simple and if you later see major performance gains if you put your assemblies into GAC and NGEN them, go for it, otherwise don't bother. GAC is more suitable for frameworks where there is expectation for library to be shared among more applications, in 99% of cases, you don't need it.</p>
|
<p>In all my life, I have had maybe one application where I had to put an assembly in the GAC, simply because these assemblies were part of a framework that a number of applications would use it, and it seemed right to put them into the GAC.</p>
| 4,349
|
<p>I build up an array of strings with</p>
<pre><code>string[] parts = string.spilt(" ");
</code></pre>
<p>And get an array with X parts in it, I would like to get a copy of the array of strings starting at element </p>
<pre><code>parts[x-2]
</code></pre>
<p>Other than the obvious brute force approach (make a new array and insert strings), is there a more elegant way to do this in C#?</p>
|
<p>How about Array.Copy?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa310864(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa310864(VS.71).aspx</a></p>
<blockquote>
<p>Array.Copy Method (Array, Int32, Array, Int32, Int32)</p>
<p>Copies a range of elements from an Array starting at the specified source index and pastes them to another Array starting at the specified destination index. The length and the indexes are specified as 32-bit integers.</p>
</blockquote>
|
<p>Use <a href="http://msdn.microsoft.com/en-us/library/system.array.copy(VS.80).aspx" rel="nofollow noreferrer">Array.Copy</a>. It has an overload that does what you need: </p>
<blockquote>
<p>Array.Copy (Array, Int32, Array,
Int32, Int32)<br>
<em>Copies a range of elements from an Array starting at the specified source
index and pastes them to another Array
starting at the specified destination
index.</em></p>
</blockquote>
| 5,087
|
<p>How do I find the start of the week (both Sunday and Monday) knowing just the current time in C#?</p>
<p>Something like:</p>
<pre><code>DateTime.Now.StartWeek(Monday);
</code></pre>
|
<p>Use an extension method:</p>
<pre><code>public static class DateTimeExtensions
{
public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
{
int diff = (7 + (dt.DayOfWeek - startOfWeek)) % 7;
return dt.AddDays(-1 * diff).Date;
}
}
</code></pre>
<p>Which can be used as follows:</p>
<pre><code>DateTime dt = DateTime.Now.StartOfWeek(DayOfWeek.Monday);
DateTime dt = DateTime.Now.StartOfWeek(DayOfWeek.Sunday);
</code></pre>
|
<pre><code>public static System.DateTime getstartweek()
{
System.DateTime dt = System.DateTime.Now;
System.DayOfWeek dmon = System.DayOfWeek.Monday;
int span = dt.DayOfWeek - dmon;
dt = dt.AddDays(-span);
return dt;
}
</code></pre>
| 5,897
|
<p>I have a .exe and many plug-in .dll modules that the .exe loads. (I have source for both.) A cross-platform (with source) solution would be ideal, but the platform can be narrowed to WinXP and Visual Studio (7.1/2003 in my case).</p>
<p>The built-in VS leak detector only gives the line where new/malloc was called from, but I have a wrapper for allocations, so a full symbolic stack trace would be best.</p>
<p>The detector would also be able to detect for a leak in both the .exe and its accompanying plug-in .dll modules.</p>
|
<p>I personally use <a href="http://vld.codeplex.com" rel="noreferrer">Visual Leak Detector</a>, though it can cause large delays when large blocks are leaked (it displays the contents of the entire leaked block).</p>
|
<p>Try <a href="http://www.codeproject.com/KB/applications/leakfinder.aspx" rel="nofollow noreferrer">Jochen Kalmbach's Memory Leak Detector</a> on Code Project.
The URL to the latest version was somewhere in the comments when I last checked.</p>
| 4,531
|
<p>I've been looking at ways to implement gmail-like messaging inside a browser, and arrived at the <a href="http://en.wikipedia.org/wiki/Comet_(programming)" rel="noreferrer">Comet</a> concept. However, I haven't been able to find a good .NET implementation that allows me to do this within IIS (our application is written in ASP.NET 2.0). </p>
<p>The solutions I found (or could think of, for that matter) require leaving a running thread per user - so that it could return a response to him once he gets a message. This doesn't scale at all, of course.</p>
<p>So my question is - do you know of an ASP.NET implementation for Comet that works in a different way? Is that even possible with IIS? </p>
|
<p>Comet is challenging to scale with IIS because of comet's persistent connectivity, but there is a team looking at Comet scenarios now. Also look at <a href="http://www.aaronlerch.com/blog/2007/07/08/creating-comet-applications-with-aspnet/" rel="noreferrer">Aaron Lerch's blog</a> as I believe he's done some early Comet work in ASP.NET. </p>
|
<p>I think the Comet approach isn't really scalable unless you are prepared to expand the web farm horizontally (by adding more web servers to the mix). The way it works is that it leaves a TCP connection open per user session, just so the server can push stuff into that connection from time to time to immediately inform the user of a change or activity.</p>
| 9,137
|
<p>I want to run a web application on php and mysql, using the CakePHP framework. And to keep the threshold of using the site at a very low place, I want to not use the standard login with username/password. (And I don't want to hassle my users with something like OpenID either. Goes to user type.)</p>
<p>So I'm thinking that the users shall be able to log in by sending an email to login@domain.com with no subject or content required. And they will get, in reply, an email with a link that will log them in (it will contain a hash). Also I will let the users do some actions without even visiting the site at all, just send an email with command@domain.com and the command will be carried out. I will assume that the users and their email providers takes care of their email account security and as such there is no need for it on my site.</p>
<p>Now, how do I go from an email is sent to an account that is not read by humans to there being fired off some script (basically a "dummy browser client" calls an url( and the cakephp will take care of the rest)?</p>
<hr>
<p>I have never used a cron job before, but I do think I understand their purpose or how they generally work. I can not have the script be called by random people visiting the site, as that solution won't work for several reasons. I think I would like to hear more about the possibility of having the script be run as response to an email coming in, if anyone has any input at all on that. If it's run as a cron job it would only check every X minutes and users would get a lag in their response (if i understand it correctly). </p>
<p>Since there will be different email addresses for different commands, like <strong>login</strong>@domain.com and I know what to do and how to do it to based on the sender email, i dont even need the content, subject or any other headers from the email.</p>
<hr>
<p>There is a lot of worry about security of this application, I understand the issues, but without giving away my concept, I dont think it is a big issue for what I am doing. Also about the usability issue, there really isnt any. It's just gonna be login to provide changes on a users profile if/when they need that and one other command. And this is the main email and is very easy to remember and the outset of this whole concept.</p>
|
<p>I have used the <a href="http://www.phpclasses.org/browse/file/3.html" rel="nofollow noreferrer">pop3 php class</a> with great success (there is also a <a href="http://pear.php.net/package/Net_POP3" rel="nofollow noreferrer">Pear POP3 module</a>).</p>
<p>Using the pop3 class looks something like this:</p>
<pre><code>require ('pop3.php');
$pop3 = new pop3_class();
$pop3->hostname = MAILHOST;
$pop3->Open();
$pop3->Login('myemailaddress@mydomain.com', 'mypassword');
foreach($pop3->ListMessages("","") as $msgidx => $msgsize)
{
$headers = "";
$body = "";
$pop3->RetrieveMessage($msgidx, $headers, $body, -1);
}
</code></pre>
<p>I use it to monitor a POP3 mailbox which feeds into a database. </p>
<p>It gets called by a cronjob which uses wget to call the url to my php script.</p>
<pre><code>*/5 * * * * "wget -q --http-user=me --http-passwd=pass 'http://mydomain.com/mail.php'" >> /dev/null 2>&1
</code></pre>
<p><strong>Edit</strong></p>
<p>I've been thinking about your need to have users send certain site commands by email.</p>
<p>Wouldn't it be easier to have a single address that multiple commands can be sent to rather than having multiple addresses?</p>
<p>I think the security concerns are pretty valid too. Unless the commands are non-destructive or aren't doing anything user-specific, the system will be wide open to anyone who knows how to spoof an email address (which would be everyone :) ).</p>
|
<p>I would seriously reconsider this approach. E-mail hasn't got very high reliability. There's all kinds of spamfilters that might intercept e-mails with links thereby rendering the "command" half-finished, not to mention the security risks.</p>
<p>It's very easy to spoof the sender-address on an e-mail. You are basically opening up your system to anyone.</p>
<p>Also instead of a username/password combination you're suddenly requiring the users to remember a list of commands to put in front of an email-address. It would be better to provide them with a username/password and then giving access to a help page.</p>
<p>In other words the usability and security of this scheme scores very low.</p>
<p>I can't really find any advantages to this approach that even comes close to outweighing the massive disadvantages.</p>
| 6,894
|
<p>Is there a general procedure for programming extensibility capability into your code?</p>
<p>I am wondering what the general procedure is for adding extension-type capability to a system you are writing so that functionality can be extended through some kind of plugin API rather than having to modify the core code of a system.</p>
<p>Do such things tend to be dependent on the language the system was written in, or is there a general method for allowing for this?</p>
|
<p>This is generally something that you'll have to expose yourself, so yes, it will be dependent on the language your system is written in (though often it's possible to write wrappers for other languages as well).</p>
<p>If, for example, you had a program written in C, for Windows, plugins would be written for your program as DLLs. At runtime, you would manually load these DLLs, and expose some interface to them. For example, the DLLs might expose a <code>gimme_the_interface()</code> function which could accept a structure filled with function pointers. These function pointers would allow the DLL to make calls, register callbacks, etc.</p>
<p>If you were in C++, you would use the DLL system, except you would probably pass an object pointer instead of a struct, and the object would implement an interface which provided functionality (accomplishing the same thing as the struct, but less ugly). For Java, you would load class files on-demand instead of DLLs, but the basic idea would be the same.</p>
<p>In all cases, you'll need to define a standard interface between your code and the plugins, so that you can initialize the plugins, and so the plugins can interact with you.</p>
<p>P.S. If you'd like to see a good example of a C++ plugin system, check out the <a href="http://foobar2000.com/SDK.html" rel="nofollow noreferrer">foobar2000 SDK</a>. I haven't used it in quite a while, but it used to be really well done. I assume it still is.</p>
|
<ol>
<li><p>Find out what minimum requrements you want to put on a plugin writer. Then make one or more Interfaces that the writer must implement for your code to know when and where to execute the code. </p></li>
<li><p>Make an API the writer can use to access some of the functionality in your code. </p></li>
</ol>
<p>You could also make a base class the writer must inherit. This will make wiring up the API easier. Then use some kind of reflection to scan a directory, and load the classes you find that matches your requirements. </p>
<p>Some people also make a scripting language for their system, or implements an interpreter for a subset of an existing language. This is also a possible route to go.</p>
<p>Bottom line is: When you get the code to load, only your imagination should be able to stop you.<br>
Good luck.</p>
| 2,961
|
<p>Say a development team includes (or makes use of) graphic artists who create all the images that go into a product. Such things include icons, bitmaps, window backgrounds, button images, animations, etc.</p>
<p>Obviously, everything needed to build a piece of software should be under some form of version control. But most version control systems for developers are designed primarily for text-based information. Should the graphics people use the same version-control system and repository that the coders do? If not, what should they use, and what is the best way to keep everything synchronized?</p>
|
<p>Yes, having art assets in version control is very useful. You get the ability to track history, roll back changes, and you have a single source to do backups with. Keep in mind that art assets are MUCH larger so your server needs to have lots of disk space & network bandwidth.</p>
<p>I've had success with using <a href="http://www.perforce.com/" rel="noreferrer">perforce</a> on very large projects (+100 GB), however we had to wrap access to the version control server with something a little more artist friendly.</p>
<p>I've heard some good things about <a href="http://www.alienbrain.com/" rel="noreferrer">Alienbrain</a> as well, it does seem to have a very slick UI.</p>
|
<p>With respect to diff and merging, I think the version control is more critical for graphics and media elements. If you think about it, most designers are going to be the sole owners of a file -- at least in the case of graphics -- or at least I would think that'd be the case. I'd be curious to hear from a designer.</p>
| 4,894
|
<p>I've just started working on an <code>ASP.NET</code> project which I hope to open source once it gets to a suitable stage. It's basically going to be a library that can be used by existing websites. My preference is to support <code>ASP.NET 2.0</code> through <code>3.5</code>, but I wondered how many people I would be leaving out by not supporting <code>ASP.NET 1.1</code>? More specifically, how many people are there still using <code>ASP.NET 1.1</code> for whom <code>ASP.NET 2.0/3.5</code> is not an option? If upgrading your server is not an option for you, why not?</p>
|
<p>Increasingly I think not.</p>
<p>The kind of large rigid organisation currently still clinging to 1.1 (probably because they're only just upgraded to it) is also the kind that's highly unlikely to look at open source solutions.</p>
<p>If I were starting a new ASP.Net project right now I'd stick with .Net 3.5 and probably the new MVC previews.</p>
|
<p>I think you would be perfectly fine with targeting just 2.0 and above, someone who would use your library would most likely be doing new development and using at least ASP.NET 2.0. I think it would be a very small group of people doing new development in 1.1.</p>
| 3,412
|
<p>Can anyone tell me what exactly does this Java code do?</p>
<pre><code>SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
byte[] bytes = new byte[20];
synchronized (random)
{
random.nextBytes(bytes);
}
return Base64.encode(bytes);
</code></pre>
<hr>
<p>Step by step explanation will be useful so that I can recreate this code in VB. Thanks</p>
|
<p>Using code snippets you can get to something like this</p>
<pre>
Dim randomNumGen As RandomNumberGenerator = RNGCryptoServiceProvider.Create()
Dim randomBytes(20) As Byte
randomNumGen.GetBytes(randomBytes)
return Convert.ToBase64String(randomBytes)
</pre>
|
<p>Basically the code above:</p>
<ol>
<li>Creates a secure random number generator (for VB see link below)</li>
<li>Fills a bytearray of length 20 with random bytes</li>
<li>Base64 encodes the result (you can probably use Convert.ToBase64String(...))</li>
</ol>
<p>You should find some help here:
<a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.rngcryptoserviceprovider.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.security.cryptography.rngcryptoserviceprovider.aspx</a></p>
| 9,808
|
<p>While <kbd>Ctrl</kbd><kbd>X</kbd> works fine in vim under windows, <kbd>Ctrl</kbd><kbd>A</kbd> selects all (duh).</p>
<p>Is there a way to increment a number with a keystroke under windows?</p>
|
<p>Try Ctrl-NumPad + ?</p>
<p>(<a href="https://web.archive.org/web/20080912200928/http://www.vim.org/tips/tip.php?tip_id=305" rel="nofollow noreferrer">from here</a>)</p>
|
<p>I am using cygwin terminal + screen, so <c-a> is captured by the terminal multiplexer. I used this mapping:</p>
<p>:noremap <c-i> <c-a></p>
| 9,248
|
<p>I want to be able to run my Chiron during night-time, but my neighbours tries to sleep at that time of day. I have put a lot of effort into making the printer silent. The controller-fan and power-supply-fan now run slower and only when needed, I have put the printer on those <a href="https://www.thingiverse.com/thing:3225296" rel="nofollow noreferrer">damper feet</a> found on Thingiverse, I have added rods to stabilize the gantry and I have switched to TMC2209 for X, Y and Z. I have made sure the TMCs are tuned for 24V and are using 'stealth chop' below 225 rpm (120 mm/s). The result is impressive compared to how noisy the printer was when I bought it.</p>
<p>One problem was not solved, when Y-axis moves at between 35 and 45 mm/s, the printer starts to loudly vibrate at 220 to 280 Hz. To mitigate that, I first tried to slow down printing, but then print quality was hurt by oozing. Now I have reverted back to my desired print speed, but limited Y-axis feed-rate in Marlin to 32 mm/s using <code>M203 Y 32</code>. It is quiet enough, but many movements are slowed down, affecting quality.</p>
<p>What can I do to stop or mute these vibrations?</p>
<p><strong>ADDED 2021-03-30</strong>
I have no proper accelerometer, so I used a MPU6050 accelerometer and some code in an ESP8266. It samples roughly 400 times per second and gives a vibration-value that can be used to <em>estimate</em> the level of vibrations. It is not frequency-compensated, but gives a hint of what is happening. And it can be used to compare settings.</p>
<p>I also made a program based on an example in TMCStepper so I could run the stepper and see/change all settings. This program also relays the measurements from my accelerometer so I can make graphs.</p>
<p>To do this I removed the stepper from the chassis, as I need to be somewhat quiet when doing these tests. It looks like this:</p>
<p><a href="https://i.stack.imgur.com/MSc3m.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MSc3m.jpg" alt="picture of stepper motor with accelerometer tucked between motor and console" /></a></p>
<p>This graph sums up my findings pretty well:
<a href="https://i.stack.imgur.com/5OYRE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5OYRE.png" alt="graph comparing stealthchop, spreadcycle and the old A4988" /></a>
X-axis shows motor-speed in full steps per second, fsps. fsps corresponds to the frequency of the noises I want to conceal. 200 fsps = 1 revolution per second = 60 rpm. On Chiron Y-axis 60 rpm = 32 mm/s = F1920.</p>
<p>Y-axis is shown with the scale log10(accelerometer values).</p>
<p>Here are the TMC-settings I used during the tests, which are same/or close to what Marlin use for 24V Chiron:
(TPWMTHRS was set to 0 when I tested StealthChop)
<a href="https://i.stack.imgur.com/bclvk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bclvk.png" alt="enter image description here" /></a></p>
<p>What I read from this chart (and my many measurements):
TMC2209 is much quieter below 120 fsps.
StealthChop is fantastic at low speeds.
StealthChop shall ONLY be used at really low speeds in a 3D printer. If at all, since switching mode also is noisy.
SpreadCycle use 256 usteps/fstep. A4988 use 16 usteps/fstep. I think that is the reason for TMC to be more quiet at low speeds.</p>
<p><strong>What I do not understand:</strong>
Why is TMC2209 seems to be more loud at higher speeds. It might make different vibrations that my makeshift accelerometer rates worse, of course. But can I have a defective TMC2209? Or are the BigTreeTech boards bad? Or have I got fake TMC2209 with worse performance?</p>
|
<p>Have you tried a concrete tile for garden with foam below it?</p>
<p>Check <a href="https://www.cnckitchen.com/blog/reduce-your-3d-printing-noise-with-a-concrete-paver" rel="noreferrer">https://www.cnckitchen.com/blog/reduce-your-3d-printing-noise-with-a-concrete-paver</a></p>
<p>The same is on</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/y08v6PY_7ak?start=0"></iframe>
</div></div></p>
<p>Frequencies at 200+ Hz should not get to the neighbours, the walls and floor will absorb them. Lower frequencies are transmitted much more (see the video).</p>
<p>Try that, it's super cheap, and if not enough let us know for further help.</p>
|
<p>I noticed that my TMC drivers make a loud KLANK sound when switching from stealthchop to spreadcycle. The solution is to keep the in stealthchop at all time by butting the threshold really high (I set mine to 1000 mm/s). You may also look for resonance in your frame. If you’re using Klipper, you can use input Shaper with an accelerometer to lower ringing, it will improve your print ans make your printer quieter at the same time.</p>
| 1,885
|
<p>I'm currently trying to read in an XML file, make some minor changes (alter the value of some attributes), and write it back out again.</p>
<p>I have intended to use a StAX parser (<code>javax.xml.stream.XMLStreamReader</code>) to read in each event, see if it was one I wanted to change, and then pass it straight on to the StAX writer (<code>javax.xml.stream.XMLStreamReader</code>) if no changes were required.</p>
<p>Unfortunately, that doesn't look to be so simple - The writer has no way to take an event type and a parser object, only methods like <code>writeAttribute</code> and <code>writeStartElement</code>. Obviously I could write a big switch statement with a case for every possible type of element which can occur in an XML document, and just write it back out again, but it seems like a lot of trouble for something which seems like it should be simple.</p>
<p>Is there something I'm missing that makes it easy to write out a very similar XML document to the one you read in with StAX?</p>
|
<p>StAX works pretty well and is very fast. I used it in a project to parse XML files which are up to 20MB. I don't have a thorough analysis, but it was definitely faster than SAX. </p>
<p>As for your question: The difference between streaming and event-handling, AFAIK is control. With the streaming API you can walk through your document step by step and get the contents you want. Whereas the event-based API you can only handle what you are interested in.</p>
|
<p>After a bit of mucking around, the answer seems to be to use the Event reader/writer versions rather than the Stream versions.</p>
<p>(i.e. javax.xml.stream.XMLEventReader and javax.xml.stream.XMLEventWriter)</p>
<p>See also <a href="http://www.devx.com/tips/Tip/37795" rel="nofollow noreferrer">http://www.devx.com/tips/Tip/37795</a>, which is what finally got me moving.</p>
| 3,177
|
<pre><code>public static void main(String[] args) {
List<? extends Object> mylist = new ArrayList<Object>();
mylist.add("Java"); // compile error
}
</code></pre>
<p>The above code does not allow you to add elements to the list and wild cards can only be used as a signature in methods, again not for adding but only for accessing.
In this case what purpose does the above fulfil ??</p>
|
<p>Let's say you have an interface and two classes:</p>
<pre><code>interface IResult {}
class AResult implements IResult {}
class BResult implements IResult {}
</code></pre>
<p>Then you have classes that return a list as a result:</p>
<pre><code>interface ITest<T extends IResult> {
List<T> getResult();
}
class ATest implements ITest<AResult> {
// look, overridden!
List<AResult> getResult();
}
class BTest implements ITest<BResult> {
// overridden again!
List<BResult> getResult();
}
</code></pre>
<p>It's a good solution, when you need "covariant returns", but you return collections instead of your own objects. The big plus is that you don't have to cast objects when using ATest and BTest independently from the ITest interface. However, when using ITest interface, you cannot add anything to the list that was returned - as you cannot determine, what object types the list really contains! If it would be allowed, you would be able to add BResult to List<AResult> (returned as List<? extends T>), which doesn't make any sense.</p>
<p>So you have to remember this: List<? extends X> defines a list that could be easily overridden, but which is read-only.</p>
|
<p>This works:</p>
<pre><code>List<? super Object> mylist = new ArrayList<Object>();
mylist.add("Java"); // no compile error
</code></pre>
<p>From O'Reilly's <a href="http://oreilly.com/catalog/9780596527754/" rel="nofollow noreferrer">Java Generics</a>:</p>
<blockquote>
<p>The Get and Put Principle: use an extends wildcard when you only get values our of a structure, use a super wildcard when you only put values into a structure, and don't use a wildcard you both get and put.</p>
</blockquote>
| 9,506
|
<p>We are currently working on a new version of our main application. one thing that I really wish to work on is providing support for multiple monitors. Increasingly, our target users are adding second screens to their desktops and I think our product could leverage this extra space to improve user performance.</p>
<p>Our application is a financial package that supports leasing and fleet companies - a very specialised market. That being said, I am sure that many people with multiple monitors have a favourite bit of software that they think would be improved if it supported those extra screens better.</p>
<p>I'm looking for some opinions on those niggles that you have with current software, and how you think they could be improved to support multi-monitor setups. My aim is to then review these and decide how I can implement them and, hopefully, provide an even better environment for my users.</p>
<p>Your help is appreciated.
Thankyou.</p>
|
<p>Few random tips:</p>
<ul>
<li>If multiple windows can be open at one time, allow users to have them on separate screens. Seems obvious, but some very popular apps (e.g. Visual Studio) fail miserably at this.</li>
<li>Remember the position of the last opened window, and open new windows on the same screen as before. However, sometimes users switch between multiple and single-display (e.g. docking a laptop with an external CRT), so watch cover this case as well.</li>
<li>Consider how your particular users work, and how having two maximized windows simultaneously might help. Often, there is a (fairly passive) window for reference (e.g. a web browser/help) and an active window for data entry (e.g. editor/database) that users switch between. </li>
<li>Do <strong>not</strong> put toolboxes/toolbars on a different window than objects they operate on (it's inconvenient to move the mouse so far).</li>
</ul>
|
<p>One thing to keep in mind is that the user may have more than two monitors. My main system has six monitors, and I've run 4+ monitors on Linux, Windows, and Mac OS. Many applications--even multi-monitor utilities--will support 2 monitors but freak out over more than 2.</p>
<p>Applications work best when they know about where their windows are and relate to the locations of those windows. And as someone else mentioned, if you're going to remember where a window was, make sure that geometry still makes sense when the user comes back.</p>
<p>If the OS/window system dispatches an event related to the change of screen geometry, handle it if you're doing anything funky.</p>
<p>I think most applications that are well coded generally work these days.</p>
| 3,429
|
<p>I have a RepRap Prusa i2. I have done the majority of my printing with clear PLA that I got on the cheap from eBay. It works just fine.</p>
<p>I bought a roll of Hatchbox Silver PLA (1.75 mm) from Amazon. I have never had a print go well with it. I have tried various combinations of hotter and cooler extruder and bed (180 - 220°C extruder, 50 - 78°C bed). Prints always either curl up from the bed after 5-20 layers are deposited or delaminate in the middle of the print. I print directly on the heated glass bed, and have also tried various cooling fan settings.</p>
<p>Does anyone have good settings (Slic3r) to use with this stuff? Or any other advice for getting a successful print?</p>
|
<p>I've been using Hatchbox 1.75 mm (but white), and settled on 190°C extruder temp, and 60°C bed. I've had trouble getting some prints to adhere to the bed, but most have been ok; I don't see a clear pattern. I don't know whether it's the fiber or my settings. I'm trying slightly higher temperatures, higher extrusion rates, and other filament brands to see if those help. Will post back if anything clear shows up...</p>
|
<p>I use a Wahao Duplicator I3 with a heated bed. I have only used the orange Hatchbox PLA with great results. I use 210°C for the extruder and 55°C for the bed. Speed is 40 mm/s which works well for me. </p>
| 276
|
<p>I'm sure we've all seen it before...A code base that has been around for a year or two, and as features have been added and bugs fixed, we end up with pieces of code that aren't actually in use anymore. I'm wondering if there is a way (especially in VS.NET with or without a third-party tool) to search the codebase and show me which methods are NEVER used anywhere else in the code?</p>
<p>The one challenge I can think of in regards to this type of utility would be the inability to map back when implicit type conversions are occuring. But assuming that wasn't a problem, what are my options?</p>
|
<p><a href="http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx" rel="noreferrer">FxCop</a> will warn you of methods where nothing calls them.</p>
|
<p>The following tool can find orphan/unused code:</p>
<p><a href="http://www.mztools.com/index.aspx" rel="nofollow noreferrer">MZ-Tools</a></p>
| 3,585
|
<p>What would be the best way to develop a text box that remembers the last x number of entries that were put into it. This is a standalone app written with C#.</p>
|
<p>This is actually fairly easy, especially in terms of showing the "AutoComplete" part of it. In terms of remembering the last x number of entries, you are just going to have to decide on a particular event (or events) that you consider as an entry being completed and write that entry off to a list... an AutoCompleteStringCollection to be precise.</p>
<p>The TextBox class has the 3 following properties that you will need:</p>
<ul>
<li>AutoCompleteCustomSource</li>
<li>AutoCompleteMode </li>
<li>AutoCompleteSource</li>
</ul>
<p>Set AutoCompleteMode to SuggestAppend and AutoCompleteSource to CustomSource.</p>
<p>Then at runtime, every time a new entry is made, use the Add() method of AutoCompleteStringCollection to add that entry to the list (and pop off any old ones if you want). You can actually do this operation directly on the AutoCompleteCustomSource property of the TextBox as long as you've already initialized it.</p>
<p>Now, every time you type in the TextBox it will suggest previous entries :)</p>
<p>See this article for a more complete example: <a href="http://www.c-sharpcorner.com/UploadFile/mahesh/AutoCompletion02012006113508AM/AutoCompletion.aspx" rel="nofollow noreferrer">http://www.c-sharpcorner.com/UploadFile/mahesh/AutoCompletion02012006113508AM/AutoCompletion.aspx</a></p>
<p>AutoComplete also has some built in features like FileSystem and URLs (though it only does stuff that was typed into IE...)</p>
|
<p>I store the completion list in the registry. </p>
<p>The code I use is below. It's reusable, in three steps: </p>
<ol>
<li>replace the namespace and classname in this code with whatever you use.</li>
<li>Call the FillFormFromRegistry() on the Form's <strong>Load</strong> event, and call SaveFormToRegistry on the <strong>Closing</strong> event. </li>
<li>compile this into your project. </li>
</ol>
<p>You need to decorate the assembly with two attributes: <code>[assembly: AssemblyProduct("...")]</code> and <code>[assembly: AssemblyCompany("...")]</code> . (These attributes are normally set automatically in projects created within Visual Studio, so I don't count this as a step.) </p>
<p>Managing state this way is totally automatic and transparent to the user. </p>
<p>You can use the same pattern to store any sort of state for your WPF or WinForms app. Like state of textboxes, checkboxes, dropdowns. Also you can <a href="https://stackoverflow.com/questions/937298/restoring-window-size-position-with-multiple-monitors/937465#937465">store/restore the size of the window</a> - really handy - the next time the user runs the app, it opens in the same place, and with the same size, as when they closed it. You can <a href="https://stackoverflow.com/questions/1233841/how-many-times-program-has-run-c/1233867#1233867">store the number of times an app has been run</a>. Lots of possibilities. </p>
<pre><code>namespace Ionic.ExampleCode
{
public partial class NameOfYourForm
{
private void SaveFormToRegistry()
{
if (AppCuKey != null)
{
// the completion list
var converted = _completions.ToList().ConvertAll(x => x.XmlEscapeIexcl());
string completionString = String.Join("¡", converted.ToArray());
AppCuKey.SetValue(_rvn_Completions, completionString);
}
}
private void FillFormFromRegistry()
{
if (!stateLoaded)
{
if (AppCuKey != null)
{
// get the MRU list of .... whatever
_completions = new System.Windows.Forms.AutoCompleteStringCollection();
string c = (string)AppCuKey.GetValue(_rvn_Completions, "");
if (!String.IsNullOrEmpty(c))
{
string[] items = c.Split('¡');
if (items != null && items.Length > 0)
{
//_completions.AddRange(items);
foreach (string item in items)
_completions.Add(item.XmlUnescapeIexcl());
}
}
// Can also store/retrieve items in the registry for
// - textbox contents
// - checkbox state
// - splitter state
// - and so on
//
stateLoaded = true;
}
}
}
private Microsoft.Win32.RegistryKey AppCuKey
{
get
{
if (_appCuKey == null)
{
_appCuKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(AppRegistryPath, true);
if (_appCuKey == null)
_appCuKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(AppRegistryPath);
}
return _appCuKey;
}
set { _appCuKey = null; }
}
private string _appRegistryPath;
private string AppRegistryPath
{
get
{
if (_appRegistryPath == null)
{
// Use a registry path that depends on the assembly attributes,
// that are presumed to be elsewhere. Example:
//
// [assembly: AssemblyCompany("Dino Chiesa")]
// [assembly: AssemblyProduct("XPathVisualizer")]
var a = System.Reflection.Assembly.GetExecutingAssembly();
object[] attr = a.GetCustomAttributes(typeof(System.Reflection.AssemblyProductAttribute), true);
var p = attr[0] as System.Reflection.AssemblyProductAttribute;
attr = a.GetCustomAttributes(typeof(System.Reflection.AssemblyCompanyAttribute), true);
var c = attr[0] as System.Reflection.AssemblyCompanyAttribute;
_appRegistryPath = String.Format("Software\\{0}\\{1}",
p.Product, c.Company);
}
return _appRegistryPath;
}
}
private Microsoft.Win32.RegistryKey _appCuKey;
private string _rvn_Completions = "Completions";
private readonly int _MaxMruListSize = 14;
private System.Windows.Forms.AutoCompleteStringCollection _completions;
private bool stateLoaded;
}
public static class Extensions
{
public static string XmlEscapeIexcl(this String s)
{
while (s.Contains("¡"))
{
s = s.Replace("¡", "&#161;");
}
return s;
}
public static string XmlUnescapeIexcl(this String s)
{
while (s.Contains("&#161;"))
{
s = s.Replace("&#161;", "¡");
}
return s;
}
public static List<String> ToList(this System.Windows.Forms.AutoCompleteStringCollection coll)
{
var list = new List<String>();
foreach (string item in coll)
{
list.Add(item);
}
return list;
}
}
}
</code></pre>
<p>Some people <a href="http://www.codinghorror.com/blog/archives/000939.html" rel="nofollow noreferrer">shy away from using the Registry for storing state</a>, but I find it's really easy and convenient. If you like, You can very easily build an installer that removes all the registry keys on uninstall. </p>
| 6,458
|
<p>I have a 3D printer built from generic, scrap parts.
It's controlled by a 2+ years old <code>MKS GEN L</code> board running Marlin version <code>1.1.x</code>.</p>
<p>I want to do a complete bed assembly replacement, including:</p>
<ul>
<li>Heated bed</li>
<li>Thermistor</li>
<li>Y-carriage</li>
</ul>
<p>All the hardware bits, including the z-endstop are sorted and ready to be installed.</p>
<p><strong>My question is:</strong></p>
<ul>
<li>Once I replace the assembly, what kind of software / firmware modifications do I need to do to Marlin configuration for my printer to work correctly?</li>
</ul>
<p>I understand that I need to modify dimensions and offsets but I am unsure what else will I need to change within the codebase before flashing Marlin.</p>
|
<h1>The surface won't work</h1>
<p>The only true-metallic surface treatments I know to be actual metal in large enough amounts to conduct electricity would be leafmetal, akin to leaf gold, and electroplating. However, you can't use the procedures for stainless steels, and even then, the thickness is in the tenth of a µm area and lower. Not only would that be far too thin to adhere a magnet to, it also would be super easy to damage with rubbing.</p>
<h1>Filling?</h1>
<p>PLA itself does not block magnetism - I have printed a PLA holder for a magnetic GPS device, into which I inserted a simple 0.5 mm steel plate for a magnetic surface with 0.5 mm of PLA acting as the container and seal against water.</p>
<p>If the prints can be done with one end open and no infill or have a dedicated area that a cheap piece of steel can be inserted into, this method can be used too. The only requirement is that there is a cavity on the inside that at some point is accessible. This also can be during the print.</p>
<p>This cavity could either take a piece of shaped steel sheet or be filled with a different magnetic filler, for example, simple iron powder. The powder could be bound in a non-oxidizing polymer, for example, epoxy resin. This method has been used to <a href="https://www.windstuffnow.com/main/poured_stator.htm" rel="nofollow noreferrer">create cast stators for electro motors</a>. It's <a href="https://www.fieldlines.com/index.php/topic,136931.msg902507.html?PHPSESSID=f201710e153b4520d5b59ec4d1475370#msg902507" rel="nofollow noreferrer">not the most efficient</a>, but might work in your application - if your walls are thin enough.</p>
<p>With the correct mixture, such a material can be used to coat or fill the inside with enough magnetic material to give the magnets something to stick to and not rust away - the shell and the resin together would shield the iron from any air that could rust it. Indeed, a quite stuffed Resin-Iron-mix and a strong magnet have been <a href="https://www.sightunseen.com/2012/04/at-the-2012-milan-furniture-fair/" rel="nofollow noreferrer">used in 2012 to create furniture by the name of "Gravity Stools"</a> or other art pieces like in <a href="https://youtu.be/pxUUTIUOkW0" rel="nofollow noreferrer">this video</a></p>
|
<p>No rust but has magnetic properties? You could try varnishing the iron filled PLA.</p>
| 1,855
|
<p>So far, I've only used Rational Quantify. I've heard great things about Intel's VTune, but have never tried it!</p>
<p>Edit: I'm mostly looking for software that will instrument the code, as I guess that's about the only way to get very fine results.</p>
<hr />
<h3>See also:</h3>
<p><a href="https://stackoverflow.com/questions/153559/what-are-some-good-profilers-for-native-c-on-windows">What are some good profilers for native C++ on Windows?</a></p>
|
<p>For linux development (although some of these tools might work on other platforms). These are the two big names I know of, there's plenty of other smaller ones that haven't seen active development in a while.</p>
<ul>
<li><a href="http://valgrind.org/" rel="noreferrer">Valgrind</a></li>
<li><a href="http://www.cs.uoregon.edu/research/tau/home.php" rel="noreferrer">TAU - Tuning and Analysis Utilities</a></li>
</ul>
|
<p>Let me give a plug for EQATEC... just what I was looking for... simple to learn and use and gives me the info I need to find the hotspots quickly. I much prefer it to the one built in to Visual Studio (though I haven't tried the VS 2010 one yet, to be fair).</p>
<p>The ability to take snapshots is HUGE. I often get an extra analysis and optimization done while waiting for the real target analysis to run... love it.</p>
<p>Oh, and its base version is free!<br>
<a href="http://www.eqatec.com/Profiler/" rel="nofollow">http://www.eqatec.com/Profiler/</a></p>
| 4,620
|
<p>How do you set the Windows time zone on the local machine programmatically in C#? Using an interactive tool is not an option because the remote units have no user interface or users. The remote machine is running .NET 2.0 and Windows XP Embedded and a local app that communicates with a central server (via web service) for automated direction of its tasks. We can deliver a command to synch to a certain time/zone combination, but what code can be put in the local app to accomplish the change? The equipment is not imaged for specific locations before installation, so in order to use any equipment at any location, we have to be able to synch this information.</p>
|
<p><a href="http://msdn.microsoft.com/en-us/library/ms724944.aspx" rel="nofollow noreferrer">SetTimeZoneInformation</a> should do what you need. You'll need to use <a href="http://pinvoke.net/default.aspx/kernel32/SetTimeZoneInformation.html" rel="nofollow noreferrer">P/Invoke</a> to get at it.</p>
<p>Note also that you'll need to possess and enable the SE_TIME_ZONE_NAME privilege.</p>
|
<p>Try this...</p>
<p>First, you need to find, in the registry, the <strong>key</strong> that represents the zone you want ("Central Standard Time" is an example). Those are located here:</p>
<blockquote>
<p>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version\Time Zones</p>
</blockquote>
<p>So, with that in mind, create a batch file, "SetTimeZone.bat" with the following line in it:</p>
<blockquote>
<p>RunDLL32 shell32.dll,Control_RunDLL %SystemRoot%\system32\TIMEDATE.cpl,,/Z %1</p>
</blockquote>
<p>From C#, call:</p>
<blockquote>
<p>System.Diagnostics.Process.Start("SetTimeZone.bat", "The key of the time zone you want to set");</p>
</blockquote>
| 5,272
|
<p>I'm a new one for this community.
This also not directly related with 3D printing.
I searched about this and I couldn't find good answer.</p>
<p>One of my friends told me CNC machining centers (Milling) mostly use servo motors and CNC laser cutter and plasma cutters use stepper motors mostly.</p>
<p>Position controlling is more accurate in servo motors than steppers.</p>
<p>I think position controlling is more important in laser and plasma cutters than CNC machining centers, but laser and plasma cutters use stepper motors.</p>
<p>Why do laser and plasma cutters use steppers without using servo motors?</p>
<p><strong>P.S.</strong>
This question has more area than 3D printing and CNC routing.And also, This question asked for more reason for why use steppers in laser cutters,plasma cutters and CNC router.SO, this is not a duplicate of <a href="https://3dprinting.stackexchange.com/questions/3842/reprap-variants-with-servo-motors-rather-than-stepper-motors">this </a> one.</p>
|
<p>Servos do have several advantages; but, they are more expensive and more difficult to control.</p>
<p>Generally, a servo motor is a DC motor but with an encoder to provide position feedback. A circuit (can be a computer) then compares the actual position (from the encoder) against the commanded position and uses the error to determine how much power to put to the motor (usually by PWM). </p>
<p>Some of the advantages of servos:</p>
<ol>
<li>The encoders on the motor often have thousands of counts per revolution so they are accurate.</li>
<li>They are a great choice for controlling a large mass. When beginning a motion, the control loop can detect that more power is required when the encoder does not respond as fast as expected thus putting more power to the motor. This will them automatically reduce as the motor reaches speed and no longer needs the acceleration torque. Also, the servo loop can also apply reverse torque when trying to slow down the large mass to limit overshot.</li>
</ol>
<p>Some of the disadvantages of servos:</p>
<ol>
<li>The DC Motors used for servos reach peak power at thousands of RPM. That means to use them on a printer you will need to gear them down. This adds to the expense.</li>
<li>You need electronics to PWM the power to the DC Motor and to close the servo loop (usually at least 1 KHz). This can require a lot of the CPU. Probably would be more than a Melzi could do since it is already maxed out.</li>
<li>The servo loop tuning can cause the motor to buzz when it is holding position on an unloaded axis. This could cause print issues.</li>
</ol>
<p>I know you have likely seen cheap servos out there often called "hobby servos". These are often used in RC. These use a creative trick that allows them to use a cheap potentiometer to create an inexpensive control loop. The limit to this "trick" is that it CAN NOT rotate a full 360°; thus, it CAN NOT run a continuous axis. Yes, I know there are hobby servos out there that are called continuous rotation servos; but, they do that by disconnecting the potentiometer. In that case they are no longer servos. This is just a way to use the same control interface to control a standard DC motor and the motors are not accurate.</p>
<p>Stepper motors on the other hand:</p>
<ol>
<li>Are really cheap;</li>
<li>Don't require complicated drive circuits or control loops;</li>
<li>Love to hold position without a load.</li>
</ol>
<p>Their downside is that their rotational accuracy is limited by the physical poles of the motor. This can be improved using micro-stepping; but, there are limits. Also, it is difficult (often impractical) to determine if the motor missed a step. That can usually be handled by just making sure that the load on the motor is always well below the step torque. This often involves managing the motor acceleration.</p>
<p>In summary, servos are great for some applications; but, for low cost situations like 3D printing, steppers are hard to beat. It is likely servos needed for milling CNCs because the cutting head is much more massive than an extruder or laser and the servo control loop is needed to provide accurate motion for the higher mass.</p>
|
<p>Servo for spindle to control rotation speed of cutting bit.
Stepper to control movement and tool position.
All CNC machines.</p>
| 610
|
<p>The rich presentational capabilities of WPF and Silverlight mean developers like me will be working closely with graphic designers more often these days, as is the case in my next project. </p>
<p>Does anyone out there have any tips and experience (from both points of view) on making this go more smoothly? </p>
<p>For example, when I mentioned source control to a designer recently, I was quickly told you can't source control graphics, images etc, so it is a waste of time. So I responded: ok but, what about XAML files in WPF/Silverlight? </p>
<p>Scott Hanselman spoke about this topic in a <a href="http://www.hanselminutes.com/default.aspx?showID=138" rel="noreferrer">podcast</a>, but he focused more on the tools, while I'm more interested in the communication issues/aspects.</p>
|
<p>I have spent 4 months on a project working extremely closely with a designer and he has still not picked up the basic idea of CVS (which is not my choice of source control system). I'm talking template files, JavaScript and CSS here. He's not stupid, it's just one of these things that makes his job harder so he resists fully commiting himself to it.</p>
<p>In my case I had to really hammer home the point that almost all of my JavaScript depended on the mark-up and when he changed his pure CSS, DIV-based layout into a table-based one without telling me then all my JS is going to break.</p>
<p>Often during the course of the project myself and the designer, who I get on with quite well and play soccer with outside of work, had very heated exchanges about our respective responsibilities. If I didn't know him well enough to just get past these exchanges then I think it would have created an unbearable working environment. So I think it's important you establish between you both and with some sort of manager or project supervisor exactly what is expected of both parties during the project. </p>
<p>In my case there have been very few problems lately, because the situation with CVS has been sorted out as well as the idea that he can't just go and change the mark-up whenever he feels like it. Rather than try and create template files and work on them directly, the designer only works on static files and its my responsibility to plug them into my template files.</p>
<p>It's all about communication and a little bit of compromise on both sides.</p>
|
<p>Quite frankly you should tell the designer that images can, should and "will be put in source control mister!" :) </p>
<p>It may be slightly non-conventional and you wont be able to do a merge or anything of that nature, but there will be revisions and a history, etc .. Images can also be embedded in a resource file which goes into source control as well. </p>
<p>XAML can (and should) be put in source control and as its a markup file it will benefit from all of the features. </p>
<p>As far as tips from working with a designer, the one you are working with scares the heck outta me just by that comment alone, so it may all boil down to WHO you are working with. I would explain basic best practices in a nice manner and proceed from there.</p>
| 7,478
|
<p>I have an asp.net url path which is being generated in a web form, and is coming out something like "/foo/bar/../bar/path.aspx", and is coming out in the generated html like this too. It should be shortened to "/foo/bar/path.aspx". </p>
<p>Path.Combine didn't fix it. Is there a function to clean this path up? </p>
|
<p>You could create a helper class which wrapped the UriBuilder class in System.Net</p>
<pre><code>public static class UriHelper
{
public static string NormalizeRelativePath(string path)
{
UriBuilder _builder = new UriBuilder("http://localhost");
builder.Path = path;
return builder.Uri.AbsolutePath;
}
}
</code></pre>
<p>which could then be used like this:</p>
<pre><code>string url = "foo/bar/../bar/path.aspx";
Console.WriteLine(UriHelper.NormalizeRelativePath(url));
</code></pre>
<p>It is a bit hacky but it would work for the specific example you gave.</p>
<p><strong>EDIT: Updated to reflect Andrew's comments.</strong></p>
|
<p>Sarcastic's reply is so much better than mine, but if you were working with filesystem paths, my <strong>ugly hack below</strong> could turn out to be useful too. (Translation: I typed it, so I'll be damned if I don't post it :)</p>
<p>Path.Combine just slaps two strings together, paying attention to leading or trailing slashes. As far as I know, the only Path method that does normalization is Path.GetFullPath. The following will give you the "cleaned up" version.</p>
<pre><code>myPath = System.IO.Path.GetFullPath(myPath);
</code></pre>
<p>Of course, there is the small issue that the resulting path will be rooted and the forward slashes will be converted to back slashes (like "C:\foo\bar\path.aspx"). But if you know the parent root of the original path, stripping out the root should not be a big problem.</p>
| 7,787
|
<p>I'm trying to figure out how big a certain database would be (it hasn't been created yet). I know how many rows and what the tables will be. Is there a feature in Oracle that will tell me the size of such a theoretical database? Is there a known math formula I can use? I know there is a feature to determine the size of an existing database, but I want to know how big it will be before I create it. </p>
|
<p>you can from the size of the data types for the columns in a table. You can then get a rough estimate of the size of a row in that table. then for 1 to n tables, then for 1 row in 1 table for x rows in x tables = estimate of the database for a given rowsize.</p>
<p>Long handed I know but this is how i normally do this.</p>
|
<p>Having an exact size wasn't too important, so I went with littlegeek's method. I figured out what my tables and columns would be, and <a href="http://lbd.epfl.ch/f/teaching/courses/oracle8i/server.815/a68003/01_04blt.htm" rel="nofollow noreferrer">looked up the sizes of the data types</a>, then did some good 'ole multiplying.</p>
| 3,224
|
<p>I'm trying to boil down the concepts of coupling and cohesion to a concise definition. Can someone give me a short and understandable explanation (shorter than the definitions on Wikipedia <a href="http://en.wikipedia.org/wiki/Coupling_%28computer_science%29" rel="noreferrer">here</a> and <a href="http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29" rel="noreferrer">here</a>)? How do they interact?</p>
<p>Thanks.</p>
<p>Anybody have a good, short example?</p>
|
<p><strong>Coupling</strong></p>
<ul>
<li><p>Loose: You and the guy at the convenience store. You communicate through a well-defined protocol to achieve your respective goals - you pay money, he lets you walk out with the bag of Cheetos. Either one of you can be replaced without disrupting the system.</p></li>
<li><p>Tight: You and your wife.</p></li>
</ul>
<p><strong>Cohesion</strong></p>
<ul>
<li><p>Low: The convenience store. You go there for everything from gas to milk to ATM banking. Products and services have little in common, and the convenience of having them all in one place may not be enough to offset the resulting increase in cost and decrease in quality.</p></li>
<li><p>High: The cheese store. They sell cheese. Nothing else. Can't beat 'em when it comes to cheese though. </p></li>
</ul>
|
<p>"Coupling is a measure of interdependencies between modules,
which should be minimized"
"cohesion, a quality to be maximized, focuses on the relationships
between the activities performed by each module."</p>
<p>quoted from this paper: <a href="http://steve.vinoski.net/pdf/IEEE-Old_Measures_for_New_Services.pdf" rel="nofollow noreferrer">http://steve.vinoski.net/pdf/IEEE-Old_Measures_for_New_Services.pdf</a></p>
| 6,114
|
<p>When I've registered an object <strong>foo</strong> to receive KVO notifications from another object <strong>bar</strong> (using addObserver:...), if I then deallocate <strong>foo</strong> do I need to send a <code>removeObserver:forKeyPath:</code> message to <strong>bar</strong> in -dealloc?</p>
|
<p>You need to use <code>-removeObserver:forKeyPath:</code> to remove the observer before <code>-[NSObject dealloc]</code> runs, so yes, doing it in the <code>-dealloc</code> method of your class would work.</p>
<p>Better than that though would be to have a deterministic point where whatever owns the object that's doing the observing could tell it it's done and will (eventually) be deallocated. That way, you can stop observing immediately when the thing doing the observing is no longer needed, regardless of when it's actually deallocated.</p>
<p>This is important to keep in mind because the lifetime of objects in Cocoa isn't as deterministic as some people seem to think it is. The various Mac OS X frameworks themselves <strong>will</strong> send your objects <code>-retain</code> and <code>-autorelease</code>, extending their lifetime beyond what you might otherwise think it would be.</p>
<p>Furthermore, when you make the transition to Objective-C garbage collection, you'll find that <code>-finalize</code> will run at very different times — and in very different contexts — than <code>-dealloc</code> did. For one thing, finalization takes place on a different thread, so you really <strong>can't</strong> safely send <code>-removeObserver:forKeyPath:</code> to another object in a <code>-finalize</code> method.</p>
<p>Stick to memory (and other scarce resource) management in <code>-dealloc</code> and <code>-finalize</code>, and use a separate <code>-invalidate</code> method to have an owner tell an object you're done with it at a deterministic point; do things like removing KVO observations there. The intent of your code will be clearer and you will have fewer subtle bugs to take care of.</p>
|
<p>Definitely agree with Chris on the "Stick to memory (and other scarce resource) management in -dealloc and -finalize..." comment. A lot of times I'll see people try to invalidate NSTimer objects in their dealloc functions. The problem is, NSTimer retains it's targets. So, if the target of that NSTimer is self, dealloc will never get called resulting in some potentially nasty memory leaks. </p>
<p>Invalidate in <code>-invalidate</code> and do other memory cleanup in your <code>dealloc</code> and <code>finalize.</code></p>
| 3,483
|
<p>I'm very new to 3D printing. When my printer was new, I got loads of really good prints, however, now they're all failing.</p>
<p>I suspected that the nozzle was in bad shape, so I replaced it, but even now, the prints are still quite bad.</p>
<p>I suspect that the filament is not coming out properly. (extruding?)</p>
<p>I have a Creality Ender CR6 SE. and I'm using Overture Matte White PLA. I've tried using the default 200 °C nozzle and 60 °C print bed temperatures and I've also tried on the upper end of the recommended temperatures at 230 °C and 70 °C.</p>
<p>I've also tried reducing the print speed to 70 %.</p>
<p>Here is a picture of the first layer of a raft:</p>
<p><a href="https://i.stack.imgur.com/pQdGD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pQdGD.png" alt="enter image description here" /></a></p>
<p>And here's a picture of a few layers in (still of the raft):</p>
<p><a href="https://i.stack.imgur.com/JqnSe.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JqnSe.jpg" alt="enter image description here" /></a></p>
<p>Just before this print I did an auto-level and cleaned the printbed with warm soapy water.</p>
<p>This is the print if I leave it going:</p>
<p><a href="https://i.stack.imgur.com/7TBDn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7TBDn.jpg" alt="enter image description here" /></a></p>
<p>Additional Info: I used the auto-level feature on the CR 6 SE before any of the pictures and used Cura Slicer for slicing.</p>
<p>When using the hairspray method, I managed to get a print out - that print is a 3D Benchy:</p>
<p><a href="https://i.stack.imgur.com/cdXfj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cdXfj.png" alt="enter image description here" /></a></p>
<p>Not looking too good. Also - as you can see, I used a different filament.</p>
<p>Using the hairspray again, I tried printing this:</p>
<p><a href="https://i.stack.imgur.com/vN9i5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vN9i5.png" alt="enter image description here" /></a></p>
<p>But ended up with this:</p>
<p><a href="https://i.stack.imgur.com/PSSmF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PSSmF.png" alt="enter image description here" /></a></p>
<p><strong>UPDATE 3</strong></p>
<p>Ok, So I've found something that's probably not a good thing and I need some advice on it. I think the problem is with the print bed. I found that it can wobble. If I put slight pressure on the front of the bed, the front goes down and the back goes up. Not by much, but there's definite give.</p>
<p>When I print a big circle, the left of the circle is "thinner" than it should be, unless I push down slightly on the print bed. If I do that, then the print thickness on that part of the bed seems to be correct.</p>
<p>However, if I keep that pressure while the nozzle goes around then the print loses adhesion. As soon as I release the pressure and the print bed goes back to what it was, then the print regains adhesion (on that side).</p>
<p>However, if I leave it like that, then the nozzle will be too close to the bed on the other side again.</p>
<p>Now I know. This is a tramming (leveling - are these words completely synonymous?) issue, but when I paid extra for the auto-leveling with the Ender CR6 SE, I paid that extra so that I wouldn't need to mess around with stuff like this. Is this money wasted?</p>
<p>Print nozzle too close on the left, too far on the right:</p>
<p><a href="https://i.stack.imgur.com/rMBag.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rMBag.png" alt="enter image description here" /></a></p>
<p><strong>Should I contact Creality and try to return the printer and get a cheaper one that I'm going to have to manually level/tram anyway?</strong></p>
|
<p>The CR-6 SE uses strain gauge based sensing for the auto leveling. This implies that the nozzle itself is the probe for the leveling procedure. It is important that there is no filament left on the nozzle and no debris is on the bed (of so, this causes incorrect measurement of the bed surface and results in a too large of a gap between the nozzle and the bed).</p>
<p>Normally, when you replace a nozzle, you need to re-assess the distance between the nozzle and bed with the so-called "paper thickness" method.</p>
<p>This video of the CR-6 shows that paper is still required:
<div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/QRyJRGzTGYE?start=0"></iframe>
</div></div></p>
<p>As seen from the first layer of the raft (which by the way is totally unnecessary for PLA) the nozzle is too far from the bed, you see this in balling up of filament and cutting corners where filament is dragged and not deposited. The video does show that it is required to set the Z-offset to the correct value during the printing of the first layer. It is advisable to decrease the Z-offset, alternatively you can set a Z-offset in the slicer, e.g. Ultimaker Cura has a plugin called Z-offset made by Fieldofview to set a different offset directly as slicer option.</p>
<p>You may also have an adhesion problem, probably caused by the incorrect distance, but an adhesive might be beneficial too.</p>
<p>Reprint and post a question on the quality of the print.</p>
|
<p>It almost looks like that nozzle is too far away from the bed. Try releveling your bed.</p>
| 2,193
|
<p>I am currently printing PLA infused with 80% copper powder. So far I mainly used it because it looks and feels really nice and post-processing is almost limitless, however recently I have thought that metal-like filaments might actually be a good idea for gears (in case I don't want to use polycarbonate or carbon fiber PLA).</p>
<p>I have been researching about the material properties of copper-infused PLA and found a few studies about the "strength", however, those seem to have exclusively focussed on how much weight can be suspended on a hook where it showed pretty good results. The only other info I found was an unsourced "it is more brittle", however the objects I printed so far do not feel more brittle.</p>
<p>Does anyone have any experience with spur gears printed from copper-infused PLA? Are there any advantages over regular PLA? Any downsides (I could imagine higher abrasiveness is not really helpful)?</p>
|
<p>With the right material, you could print the gear and then sinter it, resulting in actual metal gears. However, 80 % metal-filled PLA is at the lowest border to achieve this, and a lot of that technology is patented.</p>
<h2>Filamet<sup>TM</sup></h2>
<p>Filamet<sup>TM</sup> is a <a href="https://shop.thevirtualfoundry.com/" rel="nofollow noreferrer">Virtual Foundry</a> product that contains around <strong>80-92 %</strong> metal powder of 100-400 µm particle size, suspended in a carrier. The carrier material is supposedly PLA or at least functionally similar. The resulting filament is highly abrasive, requiring stainless steel<sup>1</sup> to print more than short sections. The high metal content also gives the material a <em>memory</em> of its spooled-up shape. This demands extra special treatment during printing to prevent snapping the filament in the shape of a pre-heater to get it spooled off properly. The same company also offers similar products for ceramics. After printing, the models are burned-out and sintered in an oven at very high temperatures. This sintering is done in a crucible filled with carbon and alumina, burning out the PLA carrier while retaining the shape. Their material-making process is <a href="https://thevirtualfoundry.com/2019/11/21/the-virtual-foundry-wins-a-patent-for-the-process-used-to-produce-its-extrudable-plastic-infused-materials/" rel="nofollow noreferrer">patented</a> <a href="https://www.freepatentsonline.com/y2018/0193912.html" rel="nofollow noreferrer">(patent itself)</a> and covers all their metal, ceramic, and glass materials.</p>
<p><sub>1 - or something even more hardy, like an <a href="https://web.archive.org/web/20210707122849/http://olssonruby.com/" rel="nofollow noreferrer">Olsson Ruby</a> by <a href="https://3dverkstan.se/" rel="nofollow noreferrer">3DVerkstan</a></sub></p>
<h2>MetalX<sup>TM</sup></h2>
<p>The MetalX<sup>TM</sup> system by <a href="https://markforged.com/" rel="nofollow noreferrer">Markforged</a> uses a special printer and proprietary <em>Bound Powder Metal Filament</em> that contains an unknown plastic binder. A lot of this machine and surrounding peripheries are <a href="https://markforged.com/patents" rel="nofollow noreferrer">patented</a> and information spare. Among others, their <a href="https://patents.justia.com/patent/10076875" rel="nofollow noreferrer">method of creating composite filaments</a> and their <a href="https://patents.justia.com/patent/10377083" rel="nofollow noreferrer">binder material, support material & sintering process</a> are only described in patents. From their advertisement I could deduce the following process: The MetalX printer prints the item with unknown print settings, resulting in a raw item containing metal and the binder. After wash-cleaning using a liquid known as Opteon<sup>TM</sup> SF79 <a href="https://www.opteon.de/-/media/files/opteon/opteon-sf79-cleaning-fluid.pdf?rev=082d2f050b3440e8b47f8dd9b58324a9" rel="nofollow noreferrer">(Datasheet)</a> to remove the specialty binder, the sintering happens in a free oven at 1300 °C, leaving behind a metal product. Free oven means here, that the printed part is not embedded in a filled crucible like with Filamet<sup>TM</sup>.</p>
<hr />
<p><sub>Disclaimer: I am not affiliated with either Virtual Foundry, Markforged, 3DVerkstan, any of their products or affiliates.</sub></p>
|
<p>At a guess, copper really isn't that strong so you're likely to see minimal improvements, if any.</p>
<p>The PLA carrier plastic is still PLA, with a low melting point.</p>
<p>The copper won't "fuse" with the PLA, it will still be flakes of metal embedded in a tiny pocket inside of a plastic structure.</p>
<p>However this is all speculation, and your best option for an answer is to print some gears and methodically test them against plain PLA, and perhaps a metal gear if you can. Try and use identical setups/bearings/pressures and times.</p>
<p>Perhaps a high torque and a high-speed test, in both lubricated and unlubed, for PLA, copper-PLA, and a straight metal gear? That would be 12 tests in all and clear out all questions.</p>
| 2,088
|
<p>I am considering buying an Apple MacBook Pro. Are there any pitfalls developing C#/.NET code in a virtual machine running on a Mac?</p>
<p>Also, is it better to run Vista or XP Pro for this purpose?</p>
|
<p>I can't tell you any specific experiences since I don't have a Mac, but I did want to point out that there was an awesome episode of the DeepFriedBytes podcast that discussed this very topic. It made me want to give it a try. They discuss the pros and cons of going this route - well worth the listen IMO if this is something you're considering: </p>
<p><a href="http://deepfriedbytes.com/podcast/episode-5-developing-net-software-on-mac/" rel="noreferrer">Episode 5: Developing .NET Software on a Mac</a></p>
|
<p>Probably better not to run vista in a VM. Especially if you want the Aero UI turned on. VMs aren't very good with advanced graphics, so you'll probably want to run XP, or Vista in classic mode.</p>
| 4,794
|
<p>I've got a peculiar issue today, and was looking for some help with it.</p>
<p>Of the six Ender 3s I manage at my college, one of them seems to be <strong>stretching the Y axis</strong> of all the prints I make with it.</p>
<p>Some points about the issue:</p>
<ul>
<li>It's variable, but is much more pronounced in larger prints:
<ul>
<li>A raspberry pi frame-mounted case I printed came out too long along the Y-Axis by over 2 mm.</li>
<li>To troubleshoot, I printed a calibration cube but the Y-axis was only 0.5 mm longer.</li>
<li>It seems to affect only part of some prints; a bit over half of the pi case was stretched, but a section at the top appeared normal (screw holes were perfect circles, but towards the other end they were ellipse-shaped).</li>
</ul></li>
<li>I tried tensioning the Y-belt, and while I noticed it was loose before tightening it, this didn't make a noticeable improvement.</li>
<li>It doesn't occur in any of the other five Ender 3s, all of which are equal in modifications.</li>
<li>A re-flash of the Marlin firmware didn't fix the issue. It's a preconfigured Marlin version that I pulled off github based on a recommendation. I flashed this version to try and solve the problem, the previous version was installed by the printers' previous caretaker but the new version didn't help (makes me think we might have both grabbed the same version). </li>
<li>It means that I can no longer print any components that require high tolerances, as they simply won't fit together.</li>
</ul>
<p>The most recent print was a 40 mm fan shroud for a "hero me" setup (which I'm working on installing on all six printers).</p>
<ul>
<li>I ran two of them, one on the printer with the issue and one on a perfectly functional printer.</li>
<li>They were run this morning, in identical conditions and started at the same time.</li>
<li>There are no other structural defects aside from the stretching, it simply looks like a normal, print but as if someone used the photoshop transform tool and pulled it.</li>
</ul>
<p>Here is a side by side of the two finished prints, comparing them along both the X and Y axes. As you can see, the X axis is perfect on the problem print, but the Y is consistently stretched (visible in the shape of the round cone and the screwholes).</p>
<p><a href="https://i.stack.imgur.com/75J8V.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/75J8V.jpg" alt="enter image description here"></a></p>
<p>This issue has been consistent and I'm honestly stumped, any help is appreciated! If anyone needs me to obtain more documentation or test something, I'll be back in with the printers in the morning (roughly when this post is 10 hours old) and I'm happy to get any documentation needed.</p>
|
<p>If an axis doesn't print the sizes you command it there are basically 2 options causing this.</p>
<ol>
<li>The printer is incorrectly configured,</li>
<li>The printer has an hardware issue.</li>
</ol>
<p>To find out which of the 2 is applicable, you need to look into your setup and into the firmware settings. E.g. from the printers display you can read the amount of steps the stepper needs to make to move the axis 1 mm. Alternatively, send <a href="https://reprap.org/wiki/G-code#M92:_Set_axis_steps_per_unit" rel="nofollow noreferrer"><code>M92</code></a> through a <a href="/q/10573">terminal</a> and look at the steps per mm. If X and Y are the same, the firmware is correctly configured and you are facing a hardware issue. Note that for the stock Ender 3 the value for X and Y needs to be 80 steps/mm. <strong>Do not alter these values!!!</strong> These values are based on the mechanical layout and the micro-stepping used by the stepper drivers.</p>
<p>Since you have flashed a stock hex firmware file it is highly improbable that the firmware contains the incorrect steps per mm value for the Y axis (unless you accidentally changed this through the interface/display). This leaves you with a hardware issue. Common reasons that could identify the source of the problem are:</p>
<ul>
<li>Loose grub screw of the pulley on the stepper,</li>
<li>Missing steps, e.g. due to too much friction (if dimensions are smaller, in your case this is not the problem, it is added for completeness),</li>
<li>Loose, under tensioned belts,</li>
<li>Stretched belts as a result of over tensioning the belts.</li>
</ul>
<p>Considering the stretched Y dimensions, the most logical explanation would be that your belts are stretched, you cannot fix this by changing the steps/mm value, it requires mechanical attention; i.e. replacing for new belts.</p>
|
<p>It is likely you have PU belt and it is likely it stretched in some area. I had all my PU belts finally stretched with big tension and high speed printing.
Now I am using reinforced rubber belts.</p>
| 1,613
|
<p>I am operating a laser sintering machine, using polyamide 2200 powder (with a grain size of approximately 50 micrometers). During a print, a lot of powder goes unsintered and can theoretically be reused. However, using purely recycled powder degrades print quality to an unacceptable level.</p>
<p>Mixing a little used powder into a larger amount of fresh powder seems to work well though. What is the greatest ratio of used to fresh powder that still gives good results, and is there anything I can do (pre- postprocessing) to allow more powder to be reused?</p>
|
<p>You'll find generally that mixing 40% new polyamide with 60% recycled polyamide will result in a reasonable finish and part. You will obviously want to use all new for parts requiring the best possible finish and mechanical properties, but this mixture will be very difficult to tell apart from a fully new mixture part:</p>
<p><a href="http://www.paramountind.com/pdfs/eos_pa2200_mds.pdf" rel="nofollow">http://www.paramountind.com/pdfs/eos_pa2200_mds.pdf</a></p>
<p>This is more detailed research showing how used powder changes and how that affects print quality here:</p>
<p><a href="http://www.emeraldinsight.com/doi/abs/10.1108/13552540910960299" rel="nofollow">http://www.emeraldinsight.com/doi/abs/10.1108/13552540910960299</a></p>
<p>Searching for the research paper title may find a free source, but the linked resource does require a subscription or payment to that service.</p>
|
<p>You'll find generally that mixing 40% new polyamide with 60% recycled polyamide will result in a reasonable finish and part. You will obviously want to use all new for parts requiring the best possible finish and mechanical properties, but this mixture will be very difficult to tell apart from a fully new mixture part:</p>
<p><a href="http://www.paramountind.com/pdfs/eos_pa2200_mds.pdf" rel="nofollow">http://www.paramountind.com/pdfs/eos_pa2200_mds.pdf</a></p>
<p>This is more detailed research showing how used powder changes and how that affects print quality here:</p>
<p><a href="http://www.emeraldinsight.com/doi/abs/10.1108/13552540910960299" rel="nofollow">http://www.emeraldinsight.com/doi/abs/10.1108/13552540910960299</a></p>
<p>Searching for the research paper title may find a free source, but the linked resource does require a subscription or payment to that service.</p>
| 141
|
<p>I have a PrusaI3(Chinese kit that I assembled myself). my strange problem is that: when I try to leveling the bed, upper-left and bottom-right corners of the bed, are more far than the nozzle, respect to upper-right and bottom-left.</p>
<p>I don't know why, but I can't level them with the screws(because upper-left and bottom-right screws goes to be free sooner than their opposite side screws!!). I thought maybe the heated bed is not flat but I use a glass upon it! and it's not possible both of them are not flat! </p>
<p>EDIT: I can remember the last time I used my printer, there was a knocking sound when Y-AXIS was moving about the half of it's way. I very tried to find the cause of knocking sound but I couldn't. now, I have opened the heating bed and there is no sound when I move Y-Axis by hand.
I hope you can understand me and help me too!</p>
<p>EDIT2: I did measure the rods and bed corners, I found that this corner(pointed by finger) is about 2 millimeters lower than other 3 corners! (It seems the bed part is not flat). </p>
<p><a href="https://i.stack.imgur.com/sGjix.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sGjix.jpg" alt="enter image description here"></a></p>
<p>How can I fix this?</p>
|
<p>The Prusha I3 design uses two rods to guide the Y axis, which moves along the rods on linear bearings. If the rods are not strictly planar, there will be movement of the bed as it moves to and fro. You would not be able to correct this with the leveling screws.</p>
<p>Be sure that the rods are planar, and that there is no torque on the bed from uneven rods. Even if the bed doesn't flex, the frame may flex if the rods are not planar.</p>
|
<p>The Prusha I3 design uses two rods to guide the Y axis, which moves along the rods on linear bearings. If the rods are not strictly planar, there will be movement of the bed as it moves to and fro. You would not be able to correct this with the leveling screws.</p>
<p>Be sure that the rods are planar, and that there is no torque on the bed from uneven rods. Even if the bed doesn't flex, the frame may flex if the rods are not planar.</p>
| 737
|
<p>On their website they say the following</p>
<pre><code>0.25 mm nozzle: 150 to 60 micron
0.40 mm nozzle: 200 to 20 micron
0.60 mm nozzle: 400 to 20 micron
0.80 mm nozzle: 600 to 20 micron
</code></pre>
<p>That confuses me. Why can I go down to 20 micron with the 0.40, 0.60 and 0.80 nozzle but only down to 60 micron with the much smaller 0.25 nozzle? Is that a typo and should say 6 micron?</p>
|
<p>You need a certain minimum flow rate to achieve consistent extrusion. Flow rate is the product of print speed, extrusion width (proportional to nozzle size) and print speed. If you use a very small nozzle and very low layer height, you'd need a very high printing speed to achieve a reasonable flow rate. Therefore, it's quite possible this is not a mistake and intentional.</p>
<p>Keep in mind that Ultimaker uses 2.85mm filament. With a 0.3mm extrusion width, 0.02mm layer height and 60mm/s print speed, you would need a feedrate of 0.06mm/s into your extruder. The extruder might not be able to develop enough force on the filament at such a low speed (which, owing to the small nozzle size, requires a relatively large amount of force).</p>
<p>The ultimaker can not print 6 micron layers since the smallest increment the Z-axis can move in is 5 microns. 6 microns is not a multiple of that.</p>
|
<p>In addition of Tom van der Zanden's answer, when the filament moves too slowly through the heated part of the printhead it is very likeley to clog.</p>
<p>I have had this multiple times on my UM1+, most of the time resulting from a heated printhead with no extrusion (before or after prints). So you need to be sure to have a minimum of filament extrusion happening, wich is most likeley not the case when having 0.25mm * 20 micron instead of 0.60mm * 20micron, for example.</p>
<p>You could of course make the printhead move faster, resulting in a higher extrusion, but that will lower the print quality again.</p>
<p>But let me tell you this: Always look out for high extrusion, removing clogs is a real pain!</p>
| 388
|
<p>I want to use magnets to hold the lid of a box down tight enough to keep it relatively airtight (along with a rubber seal etc.), but I am not sure what strength of magnet to use, that will still allow it to be opened without causing damage either by having to be pried open or by crushing the print layers. I cannot seem to find any guide to how magnets are used for 3d printing at various strengths and I cannot afford to buy too many types that I am not then going to use.</p>
<p>Any help that you can provide will be greatly appreciated.</p>
|
<p>You can vary the “strength” of the magnet by making a membrane of 3D printed plastic in between the magnets. The strength of the attraction is something like a logarithmic relationship to distance- small changes in thickness of material in between the magnets have a large effect on how strong they stick to each other. You could dial in your print by buying strong rare earth magnets and experimenting with attenuating the strength with the membrane. Could even use sheets of paper to get the right feel, then measure the thickness of the stack.</p>
<p>If using an fdm printer, it could be helpful to insert the magnets with a pause in the printing, and print over the top, if there isn’t a good way to otherwise capture them.</p>
|
<p>I had a similar experience using magnets to hold two plates together. Currently also building a device (3d-printed) that clamps together with magnets. For both of these scenarios, I typically start by looking at what size and force you need. I would look into maybe 3 options of different magnets to start with. It could be in the range of 0.6 lbs, 4lbs and 6lbs. Do you know how much the "opening force" would be? As in what would keep it opening? If its substantial, I could see more the 6lbs but this is a very very very rough estimate that honestly would be best supported with trying a few ranges of magnets first. Try McMasterCarr if you're in the US. They have affordable sized magnets that I've worked with, ranging from different sizes, thicknesses and magnetic forces.</p>
| 2,103
|
<p>So I've switched the Trigorilla board in the printer with a SKR 1.3 with TMC2208 drivers and installed the latest Marlin 2.0, with a config based on <a href="https://www.thingiverse.com/thing:3741425/" rel="nofollow noreferrer">this one</a>. You can find the <a href="https://pastebin.com/ij1G5tSw" rel="nofollow noreferrer">Configuration.h here</a>, the only thing I changed in Configuration_adv.h was the pin of the hotend fan. </p>
<p>Now when let the printer autocalibrate the delta settings, it tells me that the height is 141.35 mm, instead of the actual ~300 mm and I had to set the radius to 78 mm, instead of the actual 115 mm so that it doesn't try to probe outside the bed.</p>
<p>What settings could I have set so horribly wrong that I get these results?</p>
|
<p>So the problem was that the TMC2208 were wired for UART mode, yet Marlin was configured for standalone, which apparently makes them work, but with completely wrong step sizes. Changing it in the configuration completely eliminated the problem</p>
|
<p>I would check the "steps per distance" setting. If the motors were moving more than the firmware thinks, the height would measure as shorter than actual (since the number of steps would be less than the firmware expected). Similarly, the radius would scale up.</p>
<p>You replaced the controller and motor drivers, so perhaps the micro-stepping is different.</p>
<p>If the result is inconsistently wrong, it could be a dynamics setting, such as acceleration or max velocity.</p>
| 1,476
|
<p>I am looking to allow users to control of subdomain of an app I am toying with, much like Basecamp where it is <code>customusername.seework.com</code>.</p>
<p>What is required on the <code>DNS</code> end to allow these to be created dynamically and be available instantly. </p>
<p>And how do you recommend dealing with this in the logic of the site? <code>Htaccess</code> rule to lookup the subdomain in the <code>DB</code>?</p>
|
<p>The way we do this is to have a 'catch all' for our domain name registered in DNS so that anything.ourdomain.com will point to our server.</p>
<p>With Apache you can set up a similar catch-all for your vhosts. The ServerName must be a single static name but the ServerAlias directive can contain a pattern.</p>
<pre><code>Servername www.ourdomain.com
ServerAlias *.ourdomain.com
</code></pre>
<p>Now all of the domains will trigger the vhost for our project. The final part is to decode the domain name actually used so that you can work out the username in your code, something like (PHP):</p>
<pre><code>list( $username ) = explode( ".", $_SERVER[ "HTTP_HOST" ] );
</code></pre>
<p>or a RewriteRule as already suggested that silently maps user.ourdomain.com/foo/bar to www.ourdomain.com/foo/bar?user=user or whatever you prefer.</p>
|
<p>I was looking to do something similar (<code>www.mysite.com/SomeUser</code>).</p>
<p>What I did was I edited <code>404.shtml</code> to include this server side include (SSI) code:</p>
<pre><code><!--#include virtual="404.php" -- >
</code></pre>
<p>Then I created the file <code>404.php</code>, where I parsed the URL to check for a user's name and showed their info from the database.</p>
| 2,360
|
<p>I am looking to write some C# code for linux/windows/mac/any other platform, and am looking for best practices for portable code.</p>
<p>Project <a href="http://go-mono.org" rel="noreferrer">mono</a> has some great <a href="http://www.mono-project.com/Category:Porting" rel="noreferrer">porting</a> resources.</p>
<p>What are the best practices for portable C#?</p>
|
<p>I've actually used winforms and it was fine. It was BUTT UGLY, but it worked.</p>
<p>Obviously, don't use P/Invoke, or any win32 stuff like the registry. Also be aware of any third party DLL's. For example, we use a third party SQLite dll which actually contains native code in it which we have to swap out if we want to run on OSX/linux.</p>
|
<p>If you want the code to be portable, you need to closely review the list of completed features on the Mono site. They go into detail on each class in the framework, and the level of completeness. You will have to take these things into consideration during the design process so that you don't go too far down a path and discover that a critical feature has not yet been implemented.</p>
| 6,418
|
<p>Imagine you homebrew a custom gui framework that <em>doesn't</em> use windows handles (compact framework, so please don't argue with "whys"). One of the main disadvantages of developing such a framework is that you lose compatability with the winform designer.</p>
<p>So my question is to all of you who know a lot about VS customisation, would there be a clever mechanism by which one could incorperate the gui framework into the designer and get it to spit out your custom code instead of the standard windows stuff in the <code>InitialiseComponent()</code> method?</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,325
|
<p>One of my favourite tools for linux is <a href="http://en.wikipedia.org/wiki/Lsof" rel="noreferrer" title="Wikipedia">lsof</a> - a real swiss army knife!</p>
<p>Today I found myself wondering which programs on a WinXP system had a specific file open. Is there any equivalent utility to lsof? Additionally, the file in question was over a network share so I'm not sure if that complicates matters.</p>
|
<p>Use <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer" title="Process Explorer">Process Explorer</a> from the Sysinternals Suite, the Find Handle or DLL function will let you search for the process with that file open.</p>
|
<p>If you right-click on your "Computer" (or "My Computer") icon and select "Manage" from the pop-up menu, that'll take you to the Computer Management console.</p>
<p>In there, under System Tools\Shared Folders, you'll find "Open Files". This is probably close to what you want, but if the file is on a network share then you'd need to do the same thing on the server on which the file lives.</p>
| 3,651
|
<p>From C# on a Windows box, is there a way to find out how a process was stopped?
I've had a look at the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx" rel="nofollow noreferrer">Process</a> class, managed to get a nice friendly callback from the Exited event once I set <code>EnableRaisingEvents = true;</code> but I have not managed to find out whether the process was killed or whether it exited naturally?</p>
|
<p>Fire up Process Monitor (from Sysinternals, part of Microsoft), run your process and let it die, then filter the Process Monitor results by your process name -- you will be able to see everything that it did, including exit codes.</p>
|
<p>You can use the return code of the process for that. If your process returns a non-zero value from its Main method, you can then check whether or not the process exited by itself (the return value matches).</p>
| 8,249
|
<p>My website was recently attacked by, what seemed to me as, an innocent code:</p>
<pre><code><?php
if ( isset( $ _GET['page'] ) ) {
include( $ _GET['page'] . ".php" );
} else {
include("home.php");
}
?>
</code></pre>
<p>There where no SQL calls, so I wasn't afraid for SQL Injection. But, apparently, SQL isn't the only kind of injection.</p>
<p>This website has an explanation and a few examples of avoiding code injection: <a href="http://www.theserverpages.com/articles/webmasters/php/security/Code_Injection_Vulnerabilities_Explained.html" rel="noreferrer">http://www.theserverpages.com/articles/webmasters/php/security/Code_Injection_Vulnerabilities_Explained.html</a></p>
<p>How would you protect this code from code injection?</p>
|
<p>Use a whitelist and make sure the page is in the whitelist:</p>
<pre><code> $whitelist = array('home', 'page');
if (in_array($_GET['page'], $whitelist)) {
include($_GET['page'].'.php');
} else {
include('home.php');
}
</code></pre>
|
<p>@pek - That won't work, as your array keys are 0 and 1, not 'home' and 'page'.</p>
<p>This code should do the trick, I believe:</p>
<pre><code><?php
$whitelist = array(
'home',
'page',
);
if(in_array($_GET['page'], $whitelist)) {
include($_GET['page'] . '.php');
} else {
include('home.php');
}
?>
</code></pre>
<p>As you've a whitelist, there shouldn't be a need for <code>file_exists()</code> either.</p>
| 5,987
|
<p><img src="https://i.stack.imgur.com/DibJS.jpg" alt="Visual Studio folder structure"></p>
<p>I need some advice as to how I easily can separate test runs for unit tests and integration test in Visual Studio. Often, or always, I structure the solution as presented in the above picture: separate projects for unit tests and integration tests. The unit tests is run very frequently while the integration tests naturally is run when the context is correctly aligned.</p>
<p>My goal is to somehow be able configure which tests (or test folders) to run when I use a keyboard shortcut. The tests should preferably be run by a graphical test runner (ReSharpers). So for example</p>
<ul>
<li>Alt+1 runs the tests in project BLL.Test, </li>
<li>Alt+2 runs the tests in project DAL.Tests, </li>
<li>Alt+3 runs them both (i.e. all the tests in the [Tests] folder, and</li>
<li>Alt+4 runs the tests in folder [Tests.Integration].</li>
</ul>
<p>TestDriven.net have an option of running just the test in the selected folder or project by right-clicking it and select Run Test(s). Being able to do this, but via a keyboard command and with a graphical test runner would be awesome.</p>
<p><img src="https://i.stack.imgur.com/NYnmJ.jpg" alt="TestDriven.net test run output"></p>
<p>Currently I use VS2008, ReSharper 4 and nUnit. But advice for a setup in the general is of course also appreciated.</p>
|
<p>I actually found kind of a solution for this on my own by using keyboard command bound to a macro. The macro was recorded from the menu Tools>Macros>Record TemporaryMacro. While recording I selected my [Tests] folder and ran ReSharpers UnitTest.ContextRun. This resulted in the following macro, </p>
<pre><code>Sub TemporaryMacro()
DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate
DTE.ActiveWindow.Object.GetItem("TestUnitTest\Tests").Select(vsUISelectionType.vsUISelectionTypeSelect)
DTE.ExecuteCommand("ReSharper.UnitTest_ContextRun")
End Sub
</code></pre>
<p>which was then bound to it's own keyboard command in Tools>Options>Environment>Keyboard.</p>
<p>However, what would be even more awesome is a more general solution where I can configure exactly which projects/folders/classes to run and when. For example by the means of an xml file. This could then easily be checked in to version control and distributed to everyone who works with the project.</p>
|
<p>This is a bit of fiddly solution, but you could configure some <a href="http://blogs.msdn.com/saraford/archive/2008/04/24/did-you-know-you-can-run-external-tools-within-visual-studio-201.aspx" rel="nofollow noreferrer">external tools</a> for each of group of tests you want to run. I'm not sure if you'll be able to launch the ReSharper test runner this way, but you can run the console version of nunit. Once you have of those tools setup, you can assigned keyboard shortcuts to the commands "Tools.ExternalCommand1", "Tools.ExternalCommand2", etc.</p>
<p>This wont really scale very well, and it's awkward to change - but it will give you keyboard shortcuts for running your tests. It does feel like there should be a much simpler way of doing this.</p>
| 3,484
|
<p>I am building a java server that needs to scale. One of the servlets will be serving images stored in Amazon S3.</p>
<p>Recently under load, I ran out of memory in my VM and it was after I added the code to serve the images so I'm pretty sure that streaming larger servlet responses is causing my troubles.</p>
<p>My question is : is there any best practice in how to code a java servlet to stream a large (>200k) response back to a browser when read from a database or other cloud storage?</p>
<p>I've considered writing the file to a local temp drive and then spawning another thread to handle the streaming so that the tomcat servlet thread can be re-used. This seems like it would be io heavy.</p>
<p>Any thoughts would be appreciated. Thanks.</p>
|
<p>When possible, you should not store the entire contents of a file to be served in memory. Instead, aquire an InputStream for the data, and copy the data to the Servlet OutputStream in pieces. For example:</p>
<pre><code>ServletOutputStream out = response.getOutputStream();
InputStream in = [ code to get source input stream ];
String mimeType = [ code to get mimetype of data to be served ];
byte[] bytes = new byte[FILEBUFFERSIZE];
int bytesRead;
response.setContentType(mimeType);
while ((bytesRead = in.read(bytes)) != -1) {
out.write(bytes, 0, bytesRead);
}
// do the following in a finally block:
in.close();
out.close();
</code></pre>
<p>I do agree with toby, you should instead "point them to the S3 url."</p>
<p>As for the OOM exception, are you sure it has to do with serving the image data? Let's say your JVM has 256MB of "extra" memory to use for serving image data. With Google's help, "256MB / 200KB" = 1310. For 2GB "extra" memory (these days a very reasonable amount) over 10,000 simultaneous clients could be supported. Even so, 1300 simultaneous clients is a pretty large number. Is this the type of load you experienced? If not, you may need to look elsewhere for the cause of the OOM exception.</p>
<p>Edit - Regarding:</p>
<blockquote>
<p>In this use case the images can contain sensitive data...</p>
</blockquote>
<p>When I read through the S3 documentation a few weeks ago, I noticed that you can generate time-expiring keys that can be attached to S3 URLs. So, you would not have to open up the files on S3 to the public. My understanding of the technique is:</p>
<ol>
<li>Initial HTML page has download links to your webapp</li>
<li>User clicks on a download link</li>
<li>Your webapp generates an S3 URL that includes a key that expires in, lets say, 5 minutes.</li>
<li>Send an HTTP redirect to the client with the URL from step 3.</li>
<li>The user downloads the file from S3. This works even if the download takes more than 5 minutes - once a download starts it can continue through completion.</li>
</ol>
|
<p>You have to check two things:</p>
<ul>
<li>Are you closing the stream? Very important</li>
<li>Maybe you're giving stream connections "for free". The stream is not large, but many many streams at the same time can steal all your memory. Create a pool so that you cannot have a certain number of streams running at the same time</li>
</ul>
| 7,952
|
<p>Would like to programmically change the connecton string for a database which utilizes the membership provider of asp.net within a windows application. The system.configuration namespace allows changes to the user settings, however, we would like to adjust a application setting? Does one need to write a class with utilizes XML to modify the class? Does one need to delete the current connections (can one select a connection to clear) and add a new one? Can one adjust the existing connection string?</p>
|
<p>You can programatically open the configuration with using the System.configuration namespace: </p>
<p><code>Configuration myConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);</code></p>
<p>Then you can access the connection strings collection at:</p>
<p><code>myConfig.ConnectionStrings.ConnectionStrings</code></p>
<p>You can modify the collection however you want, and when done call <code>.Save()</code> on the configuration object.</p>
|
<p>Use the ConnectionStringsSection class. The documentation even provides an example on how to create a new ConnectionString and have the framework save it to the config file without having to implement the whole XML shebang.</p>
<p>See <a href="http://msdn.microsoft.com/en-us/library/system.configuration.connectionstringssection(VS.80).aspx" rel="nofollow noreferrer">here</a> and browse down for an example.</p>
| 8,898
|
<p>I'm working on a gadget a bit like a jewelry box. I want the lid on a hinge. Are 3d printed hinges robust enough for daily use long term? Perhaps with a metal pin?</p>
<p>I want to incorporate the hinge into the design but my thinking is that it would be a waste of time if the hinge will break as I'd need to reprint the whole gadget.</p>
|
<p>You can make a print-in-place hinge as a horizontal cone with a 45-degree angle. The opposing face will be a similar conical hole with a 0.25 mm gap between the faces (or whatever your printer's tolerance needs to be).</p>
<p>The strength of this (as in the other answers) depends on the diameter of the hinge. The strength you need depends on how heavy the thing it holds up will be.</p>
<p>There are many parts on Thingiverse that use conical hinges like this if you need examples.</p>
<p><a href="https://i.stack.imgur.com/5mEi1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5mEi1.png" alt="disassembled conical hinge" /></a>
The above is a disassembled conical hinge from <a href="https://www.thingiverse.com/thing:5143964" rel="nofollow noreferrer">thing:5143964 (sturdy infinity cube)</a> which I split into parts and then arranged the hinged coupling next to the block it fits in. (Technically I suppose this is a frustrum. But things that come to a zero diameter pointy tip tend to not print well.)</p>
<p>There are 4 holes in the linkage, and the whole assembly is printed at once.</p>
|
<p>Maker's Muse has <a href="https://www.youtube.com/watch?v=7JhjhgjchfM" rel="nofollow noreferrer">a video</a> on how to design hinged objects for printing. It's quite old and might be outdated with regard to materials, slicer functionality, etc. but I think it provides a good background on the topic and a source of ideas. One of the good tips is to look at the abundance of existing hinged designs on Thingiverse and other model sharing sites - that way you can study how they work and test print some before you spend time designing your own thing that might not work.</p>
| 2,119
|
<p>I'm using a Prusa i3 MK3S printer. After ~8 months of printing PLA, PET-G, ABS I decided to buy some HIPS and print something with it. I cannot print >1 filaments at once, so I'm not using it as a support for ABS, <strong>I want to create some high durability working models, like gears, robot parts etc.</strong> </p>
<p>While the quality of my models is perfect, unfortunately their <strong>strength is disappointingly low. They easily undergo plastic deformation or break.</strong> I've tried lots of settings, some yielding better or worse results, but the problem is present regardless.</p>
<p>My settings:</p>
<ul>
<li>Printer: Prusa i3 MK3S</li>
<li>Nozzle: Default 0.4 mm nozzle for Prusa</li>
<li>Layer Height: 0.2-0.3 mm</li>
<li>Temperature: 230-240 °C nozzle, 100-110 °C bed</li>
<li>Slicer: PrusaSlicer 2.0.0</li>
</ul>
<p>I've read lots of tutorials regarding HIPS printing and they did not give me the answer to my question...</p>
<p>Am I doing something wrong or is it normal for High Impact PolyStyrene? At this point, the <em>High Impact</em> Polystyrene seems less <em>High Impact</em> than generic PLA.</p>
|
<p>It might. If HIPS is a single material with consistent properties, it might have a narrower temperature range. Online references suggest up to 240 °C. Try that, then 245 and 250 °C. Maybe higher. </p>
|
<p>I've been using HIPS for nearly 2 years now to print the housings of EDF units for RC planes. They come out light and strong but have poor layer adhesion, especially on thin-wall parts.</p>
<p>Normally I print at with a 260 °C nozzle and 100 °C bed but will try higher temperature when I upgrade my Ender 5 to a 32-bit board. Thin cyanoacrylate painted on the surface solves most issues. Sometimes I use a solution of ASA dissolved in acetone to paint the surface and bind layers together.</p>
<p>The EDF rotors I print from Apollo X which is a modified ASA that is easy to print but not soluble in acetone.</p>
| 1,543
|
<p>So I came across an interesting problem today. We have a WCF web service that returns an IList. Not really a big deal until I wanted to sort it.</p>
<p>Turns out the IList interface doesn't have a sort method built in. </p>
<p>I ended up using the <code>ArrayList.Adapter(list).Sort(new MyComparer())</code> method to solve the problem but it just seemed a bit "ghetto" to me.</p>
<p>I toyed with writing an extension method, also with inheriting from IList and implementing my own Sort() method as well as casting to a List but none of these seemed overly elegant.</p>
<p>So my question is, does anyone have an elegant solution to sorting an IList</p>
|
<p>How about using LINQ To Objects to sort for you?</p>
<p>Say you have a <code>IList<Car></code>, and the car had an <code>Engine</code> property, I believe you could sort as follows:</p>
<pre><code>from c in list
orderby c.Engine
select c;
</code></pre>
<p><em>Edit: You do need to be quick to get answers in here. As I presented a slightly different syntax to the other answers, I will leave my answer - however, the other answers presented are equally valid.</em></p>
|
<p>Convert your <code>IList</code> into <code>List<T></code> or some other generic collection and then you can easily query/sort it using <code>System.Linq</code> namespace (it will supply bunch of extension methods)</p>
| 3,630
|
<p>When is it appropriate to use an unsigned variable over a signed one? What about in a <code>for</code> loop?</p>
<p>I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. </p>
<pre><code>for (unsigned int i = 0; i < someThing.length(); i++) {
SomeThing var = someThing.at(i);
// You get the idea.
}
</code></pre>
<p>I know Java doesn't have unsigned values, and that must have been a concious decision on <a href="https://en.wikipedia.org/wiki/Sun_Microsystems" rel="noreferrer">Sun Microsystems</a>' part. </p>
|
<p>I was glad to find <a href="https://web.archive.org/web/20170323034837/http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2004-02/1382.html" rel="noreferrer">a good conversation</a> on this subject, as I hadn't really given it much thought before.</p>
<p>In summary, signed is a good general choice - even when you're dead sure all the numbers are positive - if you're going to do arithmetic on the variable (like in a typical for loop case).</p>
<p>unsigned starts to make more sense when:</p>
<ul>
<li>You're going to do <strong>bitwise things</strong> like masks, or</li>
<li>You're <strong>desperate</strong> to to take advantage of the sign bit <strong>for that extra positive range</strong> .</li>
</ul>
<p>Personally, I like signed because I don't trust myself to stay consistent and avoid mixing the two types (like the article warns against).</p>
|
<p>In your example above, when 'i' will always be positive and a higher range would be beneficial, unsigned would be useful. Like if you're using 'declare' statements, such as: </p>
<pre><code>#declare BIT1 (unsigned int 1)
#declare BIT32 (unsigned int reallybignumber)
</code></pre>
<p>Especially when these values will never change.</p>
<p>However, if you're doing an accounting program where the people are irresponsible with their money and are constantly in the red, you will most definitely want to use 'signed'.</p>
<p>I do agree with saint though that a good rule of thumb is to use signed, which C actually defaults to, so you're covered.</p>
| 2,283
|
<p>When creating a database structure, what are good guidelines to follow or good ways to determine how far a database should be normalized? Should you create an un-normalized database and split it apart as the project progresses? Should you create it fully normalized and combine tables as needed for performance?</p>
|
<p>You want to start designing a normalized database up to 3rd normal form. As you develop the business logic layer you may decide you have to denormalize a bit but <em>never, never</em> go below the 3rd form. Always, keep 1st and 2nd form compliant. You want to denormalize for simplicity of code, not for performance. Use indexes and stored procedures for that :)</p>
<p>The reason not "normalize as you go" is that you would have to modify the code you already have written most every time you modify the database design.</p>
<p>There are a couple of good articles:</p>
<p><a href="http://www.agiledata.org/essays/dataNormalization.html" rel="nofollow noreferrer">http://www.agiledata.org/essays/dataNormalization.html</a></p>
|
<p>Often if you normalize as far as your other software will let you, you'll be done.</p>
<p>For example, when using Object-Relational mapping technology, you'll have a rich set of semantics for various many-to-one and many-to-many relationships. Under the hood that'll provide join tables with effectively 2 primary keys. While relatively rare, true normalization often gives you relations with 3 or more primary keys. In cases like this, I prefer to stick with the O/R and roll my own code to avoid the various DB anomalies.</p>
| 6,999
|
<p>I would like to extract a reduced collection of "meaningful" tags (10 max) out of an english text of any size. </p>
<p><a href="http://tagcrowd.com/" rel="noreferrer">http://tagcrowd.com/</a> is quite interesting but the algorithm seems very basic (just word counting)</p>
<p>Is there any other existing algorithm to do this?</p>
|
<p>There are existing web services for this. <s>Two</s> Three examples:</p>
<ul>
<li><a href="http://developer.yahoo.com/search/content/V1/termExtraction.html" rel="nofollow noreferrer">Yahoo's Term Extraction API</a></li>
<li>Topicalizer</li>
<li><a href="http://www.opencalais.com/" rel="nofollow noreferrer">OpenCalais</a></li>
</ul>
|
<p>Perhaps "Term Frequency - Inverse Document Frequency" <a href="http://en.wikipedia.org/wiki/Tf-idf" rel="nofollow noreferrer">TF-IDF</a> would be useful...</p>
| 9,328
|
<p>I am modelling a few cut templates to be used on an hexagonal grid (honeycomb) material using OpenSCAD. Basically, from a reference cell, I need to select all cells that are within a given range and given angle.</p>
<p>I implemented this by creating an in memory grid that covers an area larger than what I need (extra range, 360 degrees), and then testing each cell for both the distance and angle requirements, extruding only those that test positive for both conditions.</p>
<p>Everything works as expected...</p>
<p><a href="https://i.stack.imgur.com/vzJD0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vzJD0.png" alt="Range = 15, Angle = 60°"></a></p>
<p>...but now I would also like to add the possibility to have the outer contour of the template without having each individual cell within it (so, a single thin line going around the whole "pizza slice" above).</p>
<p>I'm pretty new to OpenSCAD: what would be the best approach here?
(I'm happy even with a solution that requires to re-implement what done until now).</p>
|
<p>I ended up finding a reasonable solution myself:</p>
<p><a href="https://i.stack.imgur.com/mp3ET.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mp3ET.png" alt="enter image description here"></a></p>
<p>Basically, I diffed two identical, non-hollow geometries, in which the first one had the cells larger than they needed to be (so overlapping with others), and the second one had them exactly of the right dimension:</p>
<pre><code>difference() {
base_geometry(range, angle, infill, extra_padding = 2);
base_geometry(range, angle, infill, extra_padding = 0);
}
</code></pre>
<p>This way the only portion of the solid remaining was the <code>extra_padding</code> on the outer edges of the geometry.</p>
|
<p>Unfortunately, OpenSCAD does not have a 2D hull() transformation, although it has been requested. You might be able to find a pre-written package that implements a 2D hull. However, if all you want is a hexagonal grid with a border of some arbitrary shape, could you not cheat, and get your slicer to generate the grid for you? All you would need to do is generate the envelope, and then slice with a hexagonal grid as in-fill, and request no top or bottom layers. Most slicers will do hexagonal in-fill.</p>
<p>If you want to do it all in OpenSCAD, then I would go about it like this:</p>
<ol>
<li>Create a 2D grid, similar to what you have now.</li>
<li>Create a 2D outline of the shape you want, undersized so that you can add a manifold (as a perimeter).</li>
<li>Duplicate this shape.</li>
<li>Add a manifold to the first copy.</li>
<li>Create an intersection of the second copy and the grid.</li>
<li>Create a union of the two copies.</li>
<li>Extrude the union.</li>
</ol>
| 752
|
<p>I want to parse some HTML in order to find the values of some attributes/tags etc.</p>
<p>What HTML parsers do you recommend? Any pros and cons?</p>
|
<p><a href="http://sourceforge.net/projects/nekohtml/" rel="nofollow noreferrer">NekoHTML</a>, <a href="http://home.ccil.org/~cowan/XML/tagsoup/" rel="nofollow noreferrer">TagSoup</a>, and <a href="http://sourceforge.net/projects/jtidy/" rel="nofollow noreferrer">JTidy</a> will allow you to parse HTML and then process with XML tools, like XPath.</p>
|
<p>Do you need to do a full parse of the HTML? If you're just looking for specific values within the contents (a specific tag/param), then a simple regular expression might be enough, and could very well be faster.</p>
| 4,618
|
<p>Why does C#.Net allow the declaration of the string object to be case-insensitive?</p>
<pre><code>String sHello = "Hello";
string sHello = "Hello";
</code></pre>
<p>Both the lower-case and upper-case S of the word String are acceptable and this seems to be the only object that allows this.</p>
<p>Can anyone explain why?</p>
|
<p><strong><code>string</code></strong> is a language keyword while <code>System.String</code> is the type it aliases.</p>
<p>Both compile to exactly the same thing, similarly:</p>
<ul>
<li><strong><code>int</code></strong> is <code>System.Int32</code></li>
<li><strong><code>long</code></strong> is <code>System.Int64</code></li>
<li><strong><code>float</code></strong> is <code>System.Single</code></li>
<li><strong><code>double</code></strong> is <code>System.Double</code></li>
<li><strong><code>char</code></strong> is <code>System.Char</code></li>
<li><strong><code>byte</code></strong> is <code>System.Byte</code></li>
<li><strong><code>short</code></strong> is <code>System.Int16</code></li>
<li><strong><code>ushort</code></strong> is <code>System.UInt16</code></li>
<li><strong><code>uint</code></strong> is <code>System.UInt32</code></li>
<li><strong><code>ulong</code></strong> is <code>System.UInt64</code></li>
</ul>
<p>I think in most cases this is about code legibility - all the basic system value types have aliases, I think the lower case <code>string</code> might just be for consistency.</p>
|
<p>string is an alias for System.String. They are the same thing.</p>
<p>By convention, though, objects of type (System.String) are generally refered to as the alias - e.g.</p>
<pre><code>string myString = "Hello";
</code></pre>
<p>whereas operations on the class use the uppercase version
e.g.</p>
<pre><code>String.IsNullOrEmpty(myStringVariable);
</code></pre>
| 3,111
|
<p>When spliting a solution in to logical layers, when is it best to use a separate project over just grouping by a folder?</p>
|
<p>By default, <strong>always just create new folder</strong> within the same project</p>
<ul>
<li>You will get single assembly (without additional ILMerge gymnastic)</li>
<li>Easier to obfuscate (because you will have less public types and methods, ideally none at all)</li>
</ul>
<p>Separating your source code into multiple projects makes only sense if you...</p>
<ul>
<li>Have some portions of the source code that are part of the project but not deployable by default or at all (unit tests, extra plugins etc.)</li>
<li>More developers involved and you want to treat their work as consumable black box. (not very recommended)</li>
<li>If you can clearly separate your project into isolated layers/modules and you want to make sure that they can't cross-consume <strong>internal</strong> members. (also not recommended because you will need to decide which aspect is the most important)</li>
</ul>
<p>If you think that some portions of your source code could be reusable, still don't create it as a new project. Just wait until you will really want to reuse it in another solution and isolate it out of original project as needed. Programming is not a lego, reusing is usually very difficult and often won't happen as planned.</p>
|
<blockquote>
<p>Separating your source code into
multiple projects makes only sense if
you...
... More developers involved
and you want to treat their work as
consumable black box. (not very
recommended) ...</p>
</blockquote>
<p>Why isn't this recommended? I've found it a very useful way to manage an application with several devs working on different portions. Makes checkins much easier, mainly by virtually eliminating merges. Very rarely will two devs have to work on the same project at the same time.</p>
| 2,396
|
<p>I am looking for open source or free data collaboration software. Specifically this is for a non-profit organization that wants to teach remote students how a foreign language. The idea is that an instructor would teach a class and there would be up to 10 students in the class at a time. The instructor would be able to post slides or other teaching material and the students would be able to see it on their computers remotely. Video is not required but audio is a must. Any recommendations?</p>
<p>Also if there have been any reviews or feature comparison amongst these products, I would be interested in hearing about them.</p>
|
<p>I know a few of the developers on the Carleton University developed <a href="http://code.google.com/p/blindside/" rel="nofollow noreferrer">Blindside Project</a>. They are actively developing an open-source web conferencing and presentation tool for e-learning, with the intent of eventually offering university courses online.</p>
<p>It's pretty fully featured software, and is meant to be installed as a server that can host many conference rooms at a time. It has voice, video, text, and a whiteboard/slideshow (<strong>Edit:</strong> supports PDF at the moment) capability. One feature I think it neat is that students can 'raise their hands' in the class to ask the instructor a question, where they can take the floor for a moment.</p>
<p>Check out the demo on the site (if it's not working anymore I'll nudge the developers). Another pro is that the clients only need to have flash installed.</p>
<p><strike><em>I just logged onto the online demo and created this preview:</em></strike></p>
<p>This project is now called BigBlueButton : <a href="http://code.google.com/p/bigbluebutton/" rel="nofollow noreferrer">http://code.google.com/p/bigbluebutton/</a></p>
<p>Here is the demo: <a href="http://demo.bigbluebutton.org/" rel="nofollow noreferrer">http://demo.bigbluebutton.org/</a></p>
|
<p>Although it's not what you're looking for, <a href="http://moodle.org/" rel="nofollow noreferrer">Moodle</a> might be of use to you if you're looking into having online courses. </p>
| 4,355
|
<p>I just want to ask if anyone has successfully printed a screw (M3 or M4). Is the printed output usable as a screw? What printer is capable of printing screws? I am using an M3D printer - is there a configuration to successfully print a screw that is usable?</p>
<p>Can anyone share a picture of the best 3D printed screw?</p>
|
<p>well... it's hard to imagine printing M3 or even M4
I haven't try but I haven't because I'm pretty sure it's not possible (on my printer of course)</p>
<p>but some time ago I've tried M8 which is of course way from your needs
it was printed on 0.1mm layer height</p>
<p>it went ok into the nut without any problems but the strength is not very high I suppose</p>
<p>I know the quality is poor but even such bad photo shows issues</p>
<p><a href="https://i.stack.imgur.com/tRoxw.jpg"><img src="https://i.stack.imgur.com/tRoxw.jpg" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/QFKKI.jpg"><img src="https://i.stack.imgur.com/QFKKI.jpg" alt="enter image description here"></a></p>
|
<p>Not very likely unfortunately.</p>
<p>M3D nozzle diameter is too wide to be able to print something that would print reliably, not to mention any FDM machine won't have the precision to build good threads. even 0.05mm layer heights won't run very well. </p>
<p>I've tried on a Form1 (SLA style printer) and even that set at it's max resolution wasn't able to print clean threads. </p>
| 445
|
<p>Tag <a href="https://3dprinting.stackexchange.com/questions/tagged/nylon" class="post-tag" title="show questions tagged 'nylon'" rel="tag">nylon</a> exists already, but I think it would be incredibly useful to have a TPE/TPU tag and a tag for all flexibles as a category.</p>
<p><strong>EDIT:</strong> It has come to my attention that the tag <a href="https://3dprinting.stackexchange.com/questions/tagged/flexible" class="post-tag" title="show questions tagged 'flexible'" rel="tag">flexible</a> already exists. I still would like to see a tag <a href="https://3dprinting.stackexchange.com/questions/tagged/tpu" class="post-tag" title="show questions tagged 'tpu'" rel="tag">tpu</a> though.</p>
|
<p>Let's stay with the classic $.</p>
<p>Example: \$\$\frac{1 \times 2}{2} = 1\$\$</p>
<hr>
<p><em>Now that MathJax is enabled, it renders to:
$$\frac{1 \times 2}{2} = 1$$</em></p>
|
<p>An alternative character could be the Tilde <code>~</code>.</p>
| 60
|
<p>I need to simply go through all the cells in a Excel Spreadsheet and check the values in the cells. The cells may contain text, numbers or be blank. I am not very familiar / comfortable working with the concept of 'Range'. Therefore, any sample codes would be greatly appreciated. (I did try to google it, but the code snippets I found didn't quite do what I needed)</p>
<p>Thank you.</p>
|
<p>If you only need to look at the cells that are in use you can use:</p>
<pre><code>sub IterateCells()
For Each Cell in ActiveSheet.UsedRange.Cells
'do some stuff
Next
End Sub
</code></pre>
<p>that will hit everything in the range from A1 to the last cell with data (the bottom right-most cell)</p>
|
<p>In Excel VBA, this function will give you the content of any cell in any worksheet.</p>
<pre><code>Function getCellContent(Byref ws As Worksheet, ByVal rowindex As Integer, ByVal colindex As Integer) as String
getCellContent = CStr(ws.Cells(rowindex, colindex))
End Function
</code></pre>
<p>So if you want to check the value of cells, just put the function in a loop, give it the reference to the worksheet you want and the row index and column index of the cell. Row index and column index both start from 1, meaning that cell A1 will be ws.Cells(1,1) and so on.</p>
| 9,949
|
<p>Let's assume we've got the following Java code:</p>
<pre><code>public class Maintainer {
private Map<Enum, List<Listener>> map;
public Maintainer() {
this.map = new java.util.ConcurrentHashMap<Enum, List<Listener>>();
}
public void addListener( Listener listener, Enum eventType ) {
List<Listener> listeners;
if( ( listeners = map.get( eventType ) ) == null ) {
listeners = new java.util.concurrent.CopyOnWriteArrayList<Listener>();
map.put( eventType, listeners );
}
listeners.add( listener );
}
}
</code></pre>
<p>This code snippet is nothing but a bit improved listener pattern where each listener is telling what type of event it is interested in, and the provided method maintains a concurrent map of these relationships.</p>
<p>Initially, I wanted this method to be called via my own annotation framework, but bumped into a brick wall of various annotation limitations (e.g. you can't have <em>java.lang.Enum</em> as annotation param, also there's a set of various classloader issues) therefore decided to use Spring.</p>
<p>Could anyone tell me how do I Spring_ify_ this? What I want to achive is:<br>
1. Define <em>Maintainer</em> class as a Spring bean.<br>
2. Make it so that all sorts of listeners would be able to register themselves to <em>Maintainer</em> via XML by using <em>addListener</em> method. Spring doc nor Google are very generous in examples.</p>
<p>Is there a way to achieve this easily?</p>
|
<p>What would be wrong with doing something like the following:</p>
<p>Defining a 'Maintainer' interface with the addListener(Listener, Enum) method.</p>
<p>Create a DefaultMaintainer class (as above) which implements Maintainer.</p>
<p>Then, in each Listener class, 'inject' the Maintainer interface (constructor injection might be a good choice). The listener can then register itself with the Maintainer.</p>
<p>other than that, I'm not 100% clear on exactly what your difficulty is with Spring at the moment! :)</p>
|
<blockquote>
<p>You said "... you can't have java.lang.Enum as"
annotation param ..."</p>
</blockquote>
<p>I think you are wrong on that. I have recently used on a project something like this :</p>
<pre><code>public @interface MyAnnotation {
MyEnum value();
}
</code></pre>
| 9,696
|
<p>I need to enumerate though generic IList<> of objects. The contents of the list may change, as in being added or removed by other threads, and this will kill my enumeration with a "Collection was modified; enumeration operation may not execute."</p>
<p>What is a good way of doing threadsafe foreach on a IList<>? prefferably without cloning the entire list. It is not possible to clone the actual objects referenced by the list.</p>
|
<p>Cloning the list is the easiest and best way, because it ensures your list won't change out from under you. If the list is simply too large to clone, consider putting a lock around it that must be taken before reading/writing to it.</p>
|
<p>Wrap the list in a locking object for reading and writing. You can even iterate with multiple readers at once if you have a suitable lock, that allows multiple concurrent readers but also a single writer (when there are no readers). </p>
| 9,211
|
<p>I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository.</p>
<p>One tool I know of is <a href="http://www.statsvn.org/" rel="noreferrer">statsvn</a> - a Java tool that creates some HTML reports and some code churn metrics. Statsvn reports the number of lines modified (churned) by user over time, some descriptive stats on LOC per file and folder/subfolder, etc.</p>
<p>I would like to know code churn in order to get a better idea of the state of the project. Idea behind this inspired by the MS research: <a href="http://research.microsoft.com/research/pubs/view.aspx?type=Publication&id=1359" rel="noreferrer">Use of Relative Code Churn Measures to Predict System Defect Density</a></p>
<p>In a nutshell, the more that source code is churning (changing, whether adding new lines, deleting, changing,etc) the higher the probability that defects are being introduced into the system. The MS research paper says that the number of defects produced can be predicted based on a number of relative code churn measures.</p>
<p>I wanted to know if there are any others that are maybe open source, extensible, etc.</p>
|
<p>If you are willing to go the commercial route check out <a href="http://www.atlassian.com/software/fisheye/" rel="noreferrer">FishEye</a> from Atlassian (also see their <a href="http://www.cenqua.com/fisheye/demo" rel="noreferrer">demo site</a> ). FishEye also supports adding <a href="http://confluence.atlassian.com/display/FISHEYE/Developing+Fisheye+and+Crucible+Plugins" rel="noreferrer">plugins</a> (though this does not appear to be very well supported at this time). </p>
|
<p>try <a href="http://programeter.edicypages.com/" rel="nofollow noreferrer">programeter</a> which analyses Subversion and many other dev. tools. </p>
| 7,794
|
<p>In Windows XP:</p>
<p>How do you direct traffic to/from a particular site to a specific NIC?</p>
<p>For Instance: How do I say, all connections to stackoverflow.com should use my wireless connection, while all other sites will use my ethernet?</p>
|
<p>I'm not sure if there's an easier way, but one way would be to add a route to the IP(s) of stackoverflow.com that explicitly specifies your wireless connection, using a lower metric (cost) than your default route.</p>
<p>Running nslookup www.stackoverflow.com shows only one IP: 67.199.15.132, so the syntax would be:</p>
<pre>route -p add 67.199.15.132 [your wireless gateway] metric [lower metric than default route] IF [wireless interface]</pre>
<p>See the route command for more info.</p>
|
<p>you should be able to do it using the route command. Route add (ip address) (netmask) (gateway) metric 1</p>
| 9,923
|
<p>As you can see the left side of the edge came out jagged. The right side came out just fine. What happened to the left side?</p>
<p>I am using Ender 3 + BLTouch using Sunlu PLA+ with 200 °C hotend.</p>
<p><a href="https://i.imgur.com/Ki7ZzQ4.jpg" rel="nofollow noreferrer" title="Left side"><img src="https://i.imgur.com/Ki7ZzQ4.jpg" alt="Left side" title="Left side" /></a></p>
<p><a href="https://i.imgur.com/v0X7W3R.jpg" rel="nofollow noreferrer" title="Right side"><img src="https://i.imgur.com/v0X7W3R.jpg" alt="Right side" title="Right side" /></a></p>
<p>Here are my retraction settings (if that matters):</p>
<p><a href="https://i.imgur.com/MCC8wFX.png" rel="nofollow noreferrer" title="Retraction settings"><img src="https://i.imgur.com/MCC8wFX.png" alt="Retraction settings" title="Retraction settings" /></a></p>
|
<p>This may be due to uneven cooling. The part cooling fan only comes from one direction on the Ender 3 series of printers. You may be able to solve the issue by printing the walls from the outside in. If not, I recommend printing a fan shroud that has part cooling ducts on both sides; there are plenty of them on thingiverse.</p>
|
<p>This may be due to uneven cooling. The part cooling fan only comes from one direction on the Ender 3 series of printers. You may be able to solve the issue by printing the walls from the outside in. If not, I recommend printing a fan shroud that has part cooling ducts on both sides; there are plenty of them on thingiverse.</p>
| 1,980
|
<p>When trying to implement an asynchronous API calls / Non-blocking calls, I know a little in a All Plain-C application I have, I read a about APM (Asynchronous Programming Model) by 'Delegates'. Basically what I want to do is call one API <code>f1()</code> to do a functionality(which takes long time 8-10 seconds), So I call that API <code>f1()</code>, forget about it, and continue doing some other work, e.g. I/O for to fetch data for next call of the <code>f1()</code> or some functionality not dependent on result of <code>f1()</code>.</p>
<p>If any one has used that APM model of programming, I am looking at some concise explanation for implementing non-blocking calls. </p>
<p>Is there any other way of implementing asynchronous APIs , any other library/framework which might help in this?</p>
|
<p>You basically need to create a multi-threaded (or multi-process) application. The f1() API needs to spawn a thread (or process) to process the data in a separate execution space. When it completes, the f1() routine needs to signal the main process that the execution is done (signal(), message queues, etc).</p>
|
<p>Replace delegates with pointers to functions in C, everything else is basically same to what you have read.</p>
| 8,770
|
<p>I want to ask how other programmers are producing Dynamic SQL strings for execution as the CommandText of a SQLCommand object.</p>
<p>I am producing parameterized queries containing user-generated WHERE clauses and SELECT fields. Sometimes the queries are complex and I need a lot of control over how the different parts are built. </p>
<p>Currently, I am using many loops and switch statements to produce the necessary SQL code fragments and to create the SQL parameters objects needed. This method is difficult to follow and it makes maintenance a real chore. </p>
<p>Is there a cleaner, more stable way of doing this?</p>
<p>Any Suggestions?</p>
<p>EDIT:
To add detail to my previous post:</p>
<ol>
<li>I cannot really template my query due to the requirements. It just changes too much.</li>
<li>I have to allow for aggregate functions, like Count(). This has consequences for the Group By/Having clause. It also causes nested SELECT statements. This, in turn, effects the column name used by </li>
<li>Some Contact data is stored in an XML column. Users can query this data AS WELL AS and the other relational columns together. Consequences are that xmlcolumns cannot appear in Group By clauses[sql syntax].</li>
<li>I am using an efficient paging technique that uses Row_Number() SQL Function. Consequences are that I have to use a Temp table and then get the @@rowcount, before selecting my subset, to avoid a second query.</li>
</ol>
<p>I will show some code (the horror!) so that you guys have an idea of what I'm dealing with.</p>
<pre><code>sqlCmd.CommandText = "DECLARE @t Table(ContactId int, ROWRANK int" + declare
+ ")INSERT INTO @t(ContactId, ROWRANK" + insertFields + ")"//Insert as few cols a possible
+ "Select ContactID, ROW_NUMBER() OVER (ORDER BY " + sortExpression + " "
+ sortDirection + ") as ROWRANK" // generates a rowrank for each row
+ outerFields
+ " FROM ( SELECT c.id AS ContactID"
+ coreFields
+ from // sometimes different tables are required
+ where + ") T " // user input goes here.
+ groupBy+ " "
+ havingClause //can be empty
+ ";"
+ "select @@rowcount as rCount;" // return 2 recordsets, avoids second query
+ " SELECT " + fields + ",field1,field2" // join onto the other cols n the table
+" FROM @t t INNER JOIN contacts c on t.ContactID = c.id"
+" WHERE ROWRANK BETWEEN " + ((pageIndex * pageSize) + 1) + " AND "
+ ( (pageIndex + 1) * pageSize); // here I select the pages I want
</code></pre>
<p>In this example, I am querying XML data. For purely relational data, the query is much more simple. Each of the section variables are StringBuilders. Where clauses are built like so:</p>
<pre><code>// Add Parameter to SQL Command
AddParamToSQLCmd(sqlCmd, "@p" + z.ToString(), SqlDbType.VarChar, 50, ParameterDirection.Input, qc.FieldValue);
// Create SQL code Fragment
where.AppendFormat(" {0} {1} {2} @p{3}", qc.BooleanOperator, qc.FieldName, qc.ComparisonOperator, z);
</code></pre>
|
<p>I had the need to do this on one of my recent projects. Here is the scheme that I am using for generating the SQL: </p>
<ul>
<li>Each component of the query is represented by an Object (which in my case is a Linq-to-Sql entity that maps to a table in the DB). So I have the following classes: Query, SelectColumn, Join, WhereCondition, Sort, GroupBy. Each of these classes contains all details relating to that component of the query.</li>
<li>The last five classes are all related to a Query object. So the Query object itself has collections of each class.</li>
<li>Each class has a method that can generate the SQL for the part of the query that it represents. So creating the overall query ends up calling Query.GenerateQuery() which in turn enumerates through all of the sub-collections and calls their respective GenerateQuery() methods</li>
</ul>
<p>It is still a bit complicated, but in the end you know where the SQL generation for each individual part of the query originates (and I don't think that there are any big switch statements). And don't forget to use StringBuilder.</p>
|
<p>Out of curiousity, have you considered using an ORM for managing your data access. A lot of the functionality you're trying to implement could already be there. It may be something to look at because its best not to re-invent the wheel.</p>
| 7,503
|
<p>When we create stored procedures in Visual Studio (with the extension .sql) the file encoding is automatically set to 'Unicode (UTF-8 with signature) - Codepage 65001'.</p>
<p>This causes ours DBA's problems as their scripts don't like it.</p>
<p>We have to manually go in and change them to 'Western European (windows) - Codepage 1252'.</p>
<p>This only seems to be happening since we upgraded to VS 2008 from 2005. Can anyone explain whats going on and how to stop it?</p>
|
<p>I think somebody faced a similar problem like yours and had the following workaround which is posted at</p>
<p><a href="http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=319830" rel="nofollow noreferrer">http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=319830</a></p>
|
<p>To summarise the link provided by Codeslayer (in case the page url changes)...</p>
<p><em>Change the sql file templates to ANSI encoding by opening with notepad and then saving it as an ANSI file. You can do the same for files already created.
\Common7\Tools\Templates\Database Project Items</em></p>
<p>You've just made our DBA's very happy!</p>
| 6,731
|
<p>Could someone tell me what the units the <code>SetTimeout(int)</code> method in the <code>ICriteria</code> interface uses?<br>
Is it milliseconds, seconds, minutes or other?</p>
|
<p>A little bit of poking around suggests that it could be seconds:</p>
<p>Assuming that ICriteria is the same as the Criteria interface in Hibernate core, then the JavaDoc for <a href="http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Criteria.html#setTimeout(int)" rel="noreferrer">org.hibernate.Criteria</a> provides a hint - the "see also" link to <a href="http://java.sun.com/j2se/1.3/docs/api/java/sql/Statement.html#setQueryTimeout(int)" rel="noreferrer">java.sql.Statement.setQueryTimeout()</a>. The latter refers to its timeout parameter as seconds.</p>
<p>Assuming that the NHibernate implementation follows the implied contract of that method, then that should be fine. However, for peace of mind's sake, I went and looked for some NHibernate specific stuff. There are various references to CommandTimeout; for example, <a href="http://svn.quanticosoft.com/devage/Eucalypto/Eucalypto1/Eucalypto/Transactions/TransactionScope.cs" rel="noreferrer">here</a>, related to NHibernate. Sure enough, the <a href="http://msdn.microsoft.com/en-us/library/ms678265(VS.85).aspx" rel="noreferrer">documentation for CommandTimeout</a> states that it's seconds.</p>
<p>I almost didn't post the above, because I don't know the answer outright, and can't find any concrete documentation - but since there is so little on the issue, I figured it couldn't hurt to present these findings.</p>
|
<p>I think it's seconds. The NHibernate API closely mirrors Hibernate Core for Java, where the <a href="http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Criteria.html#setTimeout(int)" rel="nofollow noreferrer">Criteria.setTimeout(int)</a> method uses seconds as the units (see also <a href="http://java.sun.com/j2se/1.3/docs/api/java/sql/Statement.html#setQueryTimeout(int)" rel="nofollow noreferrer">Statement.setQueryTimeout(int)</a>).</p>
<p>Also, after looking at some NHibernate source, it appears that it's using that value to set the timeout for the underlying ADO.NET query, which uses seconds.</p>
| 5,409
|
<p>How do I avoid read locks in my database?</p>
<p>Answers for multiple databases welcome!</p>
|
<p>In Oracle the default mode of operation is the <em>Read committed</em> isolation level where a select statement is not blocked by another transaction modifying the data it's reading.
From <a href="http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c21cnsis.htm" rel="nofollow noreferrer">Data Concurrency and Consistency</a>:</p>
<blockquote>
<p>Each query executed by a transaction sees only data that was committed before the query (not the transaction) began. An Oracle query never reads dirty (uncommitted) data.</p>
</blockquote>
|
<p>In SQL Server you can use the with(nolock) keyword in your select statements. For example:</p>
<pre><code>Select table1.columna, table2.columna
from table1 with(nolock), table2 with(nolock)
</code></pre>
<p>Make sure to specify with(nolock) for each table/view in the query.</p>
| 5,778
|
<p>Multiple approaches exist to write your unit tests when using Rhino Mocks:</p>
<ul>
<li>The Standard Syntax</li>
<li>Record/Replay Syntax</li>
<li>The Fluent Syntax</li>
</ul>
<p>What is the ideal and most frictionless way?</p>
|
<p>For .NET 2.0, I recommend the record/playback model. We like this because it separates clearly your expectations from your verifications.</p>
<pre><code>using(mocks.Record())
{
Expect.Call(foo.Bar());
}
using(mocks.Playback())
{
MakeItAllHappen();
}
</code></pre>
<p>If you're using .NET 3.5 and C# 3, then I'd recommend the fluent syntax.</p>
|
<p>Interesting question! My own preference is the for the reflection-based syntax (what I guess you mean by the Standard Syntax). I would argue that this is the most frictionless, as it does not add much extra code: you reference the stubs directly on your interfaces as though they were properly implemented. </p>
<p>I do also quite like the Fluent syntax, although this is quite cumbersome. The Record/Replay syntax is as cumbersome as the Fluent syntax (if not more so, seemingly), but less intuitive (to me at least). I've only used NMock2, so the Record/Replay syntax is a bit alien to me, whilst the Fluent syntax is quite familiar. </p>
<p>However, as <a href="https://yellowduckguy.wordpress.com/2007/10/06/rhino-mocks-v3-2-new-syntax/" rel="nofollow noreferrer">this post</a> suggests, if you prefer separating your expectations from your verifications/assertions, you should opt for the Fluent syntax. It's all a matter of style and personal preference, ultimately :-)</p>
| 7,831
|
<p>I'm writing a C# application which downloads a compressed database backup via FTP. The application then needs to extract the backup and restore it to the default database location.</p>
<p>I will not know which version of SQL Server will be installed on the machine where the application runs. Therefore, I need to find the default location based on the instance name (which is in the config file).</p>
<p>The examples I found all had a registry key which they read, but this will not work, since this assumes that only one instance of SQL is installed.</p>
<p>Another example I found created a database, read that database's file properties, the deleting the database once it was done. That's just cumbersome.</p>
<p>I did find something in the .NET framework which should work, ie:</p>
<p><pre><code>Microsoft.SqlServer.Management.Smo.Server(ServerName).Settings.DefaultFile</code></pre></p>
<p>The problem is that this is returning empty strings, which does not help.</p>
<p>I also need to find out the NT account under which the SQL service is running, so that I can grant read access to that user on the backup file once I have the it extracted.</p>
|
<p>What I discovered is that </p>
<pre><code>Microsoft.SqlServer.Management.Smo.Server(ServerName).Settings.DefaultFile
</code></pre>
<p>only returns non-null when there is no path explicitly defined. As soon as you specify a path which is not the default, then this function returns that path correctly.</p>
<p>So, a simple workaround was to check whether this function returns a string, or null. If it returns a string, then use that, but if it's null, use</p>
<pre><code>Microsoft.SqlServer.Management.Smo.Server(ServerName).Information.RootDirectory + "\\DATA\\"
</code></pre>
|
<p>One option, that may be a simpler solution, is to create a new database on your destination server and then RESTORE over that database with your backup. Your backup will be in the right place and you will not have to fuss with "MOVING" the backup file when you restore it. SQL expects backups to be restored to exactly the same physical path that they were backed up from. If that is not the case you have to use the MOVE option during RESTORE.
This solution also makes it easier to rename the database in the process if, for example, you want to tack a date onto the name.</p>
| 8,854
|
<p>What is Dynamic Code Analysis?</p>
<p>How is it different from <a href="https://stackoverflow.com/questions/49716/what-is-static-code-analysis">Static Code Analysis</a> (ie, what can it catch that can't be caught in static)?</p>
<p>I've heard of bounds checking and memory analysis - what are these?</p>
<p>What other things are checked using dynamic analysis?</p>
<p>-Adam</p>
|
<p>Simply put, static analysis collect information based on <strong>source code</strong> and dynamic analysis is based on the <strong>system execution</strong>, often using instrumentation.</p>
<h2>Advantages of dynamic analysis</h2>
<ul>
<li>Is able to detect dependencies that are not possible to detect in static analysis. Ex.: dynamic dependencies using reflection, dependency injection, polymorphism.</li>
<li>Can collect temporal information.</li>
<li>Deals with real input data. During the static analysis it is difficult to impossible to know what files will be passed as input, what WEB requests will come, what user will click, etc.</li>
</ul>
<h2>Disadvantages of dynamic analysis</h2>
<ul>
<li>May negatively impact the performance of the application.</li>
<li>Cannot guarantee the full coverage of the source code, as it's runs are based on user interaction or automatic tests.</li>
</ul>
<h2>Resources</h2>
<p>There's many dynamic analysis tools in the market, being debuggers the most notorious one. On the other hand, it's still an academic research field. There's many researchers studying how to use dynamic analysis for better understanding of software systems. There's an annual workshop dedicated to <a href="http://www.cs.wisc.edu/woda-2008/" rel="noreferrer">dependency analysis.</a></p>
|
<blockquote>
<p>Bounds checking</p>
</blockquote>
<p>This means runtime checks of array accesses. Contrary to C's laissez-faire approach to memory accesses and pointer arithmetic, other languages like Java or C# actually check whether or not a given array has the element one is trying to access.</p>
| 7,256
|
<p>I have recently installed .net 3.5 SP1. When I deployed a compiled web site that contained a form with its action set:</p>
<pre><code><form id="theForm" runat="server" action="post.aspx">
</code></pre>
<p>I received this error.<br>
Method not found: 'Void System.Web.UI.HtmlControls.HtmlForm.set_Action(System.String)'.<br>
If a fellow developer who has not installed SP1 deploys the compiled site it works fine. Does anyone know of any solutions for this?</p>
|
<p><a href="http://johnsheehan.me/blog/less-code-is-fun-aspnet-35-sp1-removes-need-for-control-adapter-when-using-url-rewriting/" rel="nofollow noreferrer">.NET 3.5 SP1 tries to use the action="" attribute</a> (.NET 3.5 RTM did not). So, when you deploy, your code is attempting to set the HtmlForm.Action property and failing, as the System.Web.dll on the deploy target is RTM and does not have a setter on the property.</p>
|
<p>I just ran into the same problem.
From what I understood it is indeed caused by the fact the my PC has .NET 3.5 SP1 on it, and the server to which I deployed the project doesn't.<br>
From what I understand, one solution is that the server be updated with .NET 3.5 SP1. As I don't want to do that yet, I just removed the "action" attribute from all the forms in the project, and that solved the problem.<br>
<a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361981&wa=wsignin1.0" rel="nofollow noreferrer">Read more</a></p>
| 5,513
|
<p>I've been trying a lot of different things to combat corners curling upward in the first few tens of layers after the bottom skin. To be clear, I'm not talking about corners of the first layer printed on the bed, but rather the points of the outline in layers above the base where direction of print motion changes discontinuously (discrete corner) or abruptly (turn with very tight curvature). Here's an image I found (not mine) that demonstrates:</p>
<p><img src="https://2.bp.blogspot.com/-hxUDhy07rC8/T8k0-UdTcqI/AAAAAAAAAdk/bfGQ9W-4N40/s1600/IMG_9471.JPG" alt="print with curled corners next to one without"></p>
<p>And a pic during print of the type of curling I'm talking about:</p>
<p><img src="https://i.stack.imgur.com/WJHAs.jpg" alt="curling corners during printing"></p>
<p>And some previous worse prints:</p>
<p><img src="https://i.stack.imgur.com/6w6kC.jpg" alt="2 dodecahedra with very warped edges, one with minor distortion to one edge, shown bottom-up"></p>
<p>My go-to worst test case for this now is a 20mm tall hollow dodecahedron with 0.8mm shell (hollow geometry, not just empty infill; 0% infill on a non-hollow model does even worse, shown above). For everything else I've tried, I've mostly been able to sovle the problem with combinations of</p>
<ul>
<li>Improved cooling fan duct</li>
<li>Lowered bed temperature or unheated bed (but this is a tradeoff; it seriously hurts first layer quality and increases risk of non-adhesion)</li>
<li>Disabling Cura's overhang detection mode (non-uniform print speed causes a <strong>huge</strong> increase in the curling due to latency of extrusion rate response)</li>
<li>Increasing motion acceleration limits or decreasing speed limits (also mitigating the latency in extrusion rate response)</li>
</ul>
<p>but I can't get all 5 edges of the worst-case dodecahedron completely warping-free without just heavily slowing down the print; during print it's obvious that the curling at the corners in each layer is the source of the warping. Increasing Cura's <code>cool_min_layer_time</code> to 10 seconds (default is 6, and I usually get by fine with 3-4.5 for most things) mostly but not entirely solved it, and going much slower than that seems likely to introduce other surface artifacts from extremely slow extrusion.</p>
<p>Are there any additional tricks I'm missing for solving this? I'd like something that's easy to leave on all the time or at least to automate, as opposed to hacks like adding in a junk tower off to the side to waste time between layers.</p>
<p>My printer is an Ender 3 with stock gear except for improved fan duct. The problem was worse with the stock fan duct.</p>
|
<p>While I tried a lot of things to solve this, including tuning temperature, fan, speed, etc., ultimately the single biggest factor that causes or prevents it is the state of Cura's <em>Outer Before Inner Walls</em> (<code>outer_inset_first</code>) option. With outer walls first, I don't have the problem at all. With the default (inner walls first), I have it to varying degrees depending on geometry and a lot of other factors.</p>
<p>I don't have a good explanation for why this happens so I'm asking a new question about it.</p>
|
<p>Cura has an additional setting that you can make visible called "Lift Head". My recommendation is that you do the following:</p>
<ol>
<li>Set your minimum print speed to something actually reasonable like 30mm/s or higher. Printing too slowly negates the following two settings and is not beneficial to printing small features.</li>
<li>Set your minimum layer time to something higher, like 15s or so. The slower you print, the higher this number needs to be. Using too small of a minimum print time prevents adequate layer cooling.</li>
<li>Enable "Lift Head". This must be used to allow the small features on your print to properly cool. Without the "Lift Head" setting, your nozzle will remain parked on your print and provide both radiant and convective heat which prevents cooling and causes sagging of small features.</li>
</ol>
<p>The combination of these settings will rapidly deposit the layer, then move the nozzle high and away from the print until the minimum layer time is reached, such that the radiant heat from the nozzle doesn't continue to heat the soft PLA while it's trying to cool. </p>
<p>Enabling all three is how I got perfect tiny features on all of the printers here at my office - a fleabay i3 clone, an Anet A8, and a couple Monoprice printers of various levels. </p>
<p><em>Edit:</em></p>
<p>I forgot to mention, keep your bed temperature at a reasonable setting too. For PLA, normally people may recommend up to 70C, but realistically, for very small prints, you can keep your bed much colder without detrimental effects. For tiny items, my PLA prints used to use a bed temperature of about 30-40 C depending on the specific filament. Very tiny prints are unlikely to warp even with a cold bed.</p>
<p>Basically, the colder the bed is, the less heat is getting conducted up through the print to the top layers that are molten, and the faster those layers cool. Keep the bed temp down and it'll benefit your layer cooling.</p>
| 1,408
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.