instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>I've got a Repeater that lists all the <code>web.sitemap</code> child pages on an ASP.NET page. Its <code>DataSource</code> is a <code>SiteMapNodeCollection</code>. But, I don't want my registration form page to show up there.</p>
<pre><code>Dim Children As SiteMapNodeCollection = SiteMap.CurrentNode.ChildNodes
'remove registration page from collection
For Each n As SiteMapNode In SiteMap.CurrentNode.ChildNodes
If n.Url = "/Registration.aspx" Then
Children.Remove(n)
End If
Next
RepeaterSubordinatePages.DataSource = Children
</code></pre>
<p>The <code>SiteMapNodeCollection.Remove()</code> method throws a </p>
<blockquote>
<p>NotSupportedException: "Collection is read-only".</p>
</blockquote>
<p>How can I remove the node from the collection before DataBinding the Repeater?</p>
|
<p>Your shouldn't need CType</p>
<pre><code>Dim children = _
From n In SiteMap.CurrentNode.ChildNodes.Cast(Of SiteMapNode)() _
Where n.Url <> "/Registration.aspx" _
Select n
</code></pre>
|
<p>I got it to work with code below:</p>
<pre><code>Dim children = From n In SiteMap.CurrentNode.ChildNodes _
Where CType(n, SiteMapNode).Url <> "/Registration.aspx" _
Select n
RepeaterSubordinatePages.DataSource = children
</code></pre>
<p>Is there a better way where I don't have to use the <code>CType()</code>?</p>
<p>Also, this sets children to a <code>System.Collections.Generic.IEnumerable(Of Object)</code>. Is there a good way to get back something more strongly typed like a <code>System.Collections.Generic.IEnumerable(Of System.Web.SiteMapNode)</code> or even better a <code>System.Web.SiteMapNodeCollection</code>?</p>
| 3,334
|
<p>I have 3 Linux machines, and want some way to keep the dotfiles in their home directories in sync. Some files, like .vimrc, are the same across all 3 machines, and some are unique to each machine.</p>
<p>I've used SVN before, but all the buzz about DVCSs makes me think I should try one - is there a particular one that would work best with this? Or should I stick with SVN?</p>
|
<p>I've had the same problem, and built a tool on top of Subversion that adds permission, ownership and secontext tracking, keeps the .svn directories out of the actually versioned trees, and adds a concept of layers so you can for example track all your config related to development, which you then only check out on machines you use for developing.</p>
<p>This has helped me organize my settings much better across the 50+ machines I log into.</p>
<p><a href="https://thomas.apestaart.org/thomas/trac/wiki/projects/savon" rel="nofollow noreferrer">Here's the project page</a>. It's still a little rough around the edges, but we also use it at work to version system configuration for our 60+ servers.</p>
<p>In general, any version control system that uses some sort of metadata files to track stuff is going to cause you pain as is when actually using it.</p>
|
<p>Version control software isn't really great for home directories. Worse, some software doesn't really like the .svn folders or starts to interpret their contents. You could of course try to fix this with some very complex mirroring setup, but that's hard.</p>
| 5,928
|
<p>I'm trying to wrap my head around reflection, so I decided to add plugin capability to a program that I'm writing. The only way to understand a concept is to get your fingers dirty and write the code, so I went the route of creating a simple interface library consisting of the IPlugin and IHost interfaces, a plugin implementation library of classes that implement IPlugin, and a simple console project that instantiates the IHost implementation class that does simple work with the plugin objects. </p>
<p>Using reflection, I wanted to iterate through the types contained inside my plugin implementation dll and create instances of types. I was able to sucessfully instantiate classes with this code, but I could not cast the created object to the interface.</p>
<p>I tried this code but I couldn't cast object o as I expected. I stepped through the process with the debugger and the proper constructor was called. Quickwatching object o showed me that it had the fields and properties that I expected to see in the implementation class. </p>
<pre><code>loop through assemblies
loop through types in assembly
// Filter out unwanted types
if (!type.IsClass || type.IsNotPublic || type.IsAbstract )
continue;
// This successfully created the right object
object o = Activator.CreateInstance(type);
// This threw an Invalid Cast Exception or returned null for an "as" cast
// even though the object implemented IPlugin
IPlugin i = (IPlugin) o;
</code></pre>
<p>I made the code work with this.</p>
<pre><code>using System.Runtime.Remoting;
ObjectHandle oh = Activator.CreateInstance(assembly.FullName, type.FullName);
// This worked as I intended
IPlugin i = (IPlugin) oh.Unwrap();
i.DoStuff();
</code></pre>
<p>Here are my questions:</p>
<ol>
<li>Activator.CreateInstance(Type t) returns an object, but I couldn't cast the object to an interface that the object implemented. Why?</li>
<li>Should I have been using a different overload of CreateInstance()?</li>
<li>What are the reflection related tips and tricks?</li>
<li>Is there some crucial part of reflection that I'm just not getting? </li>
</ol>
|
<p>I'm just guessing here because from your code it's not obvious where do you have definition of IPlugin interface but if you can't cast in your host application then you are probably having IPlugin interface in your host assembly and then at the same time in your plugin assembly. This won't work.</p>
<p>The easiest thing is to make this work is to have IPlugin interface marked as public in your host assembly and then have your Plugin assembly <strong>reference host application assembly</strong>, so both assemblies have access to <strong>the very same interface</strong>.</p>
|
<p>Is your type not public, if so, call the overload that takes in a boolean:</p>
<pre><code>Activator.CreateInstance(type, true);
</code></pre>
<p>Also, in your first example, see if o is null and if not, print out o.GetType().Name to see what it really is.</p>
| 5,152
|
<p>I recently ran out of disk space on a drive on a FreeBSD server. I truncated the file that was causing problems but I'm not seeing the change reflected when running <code>df</code>. When I run <code>du -d0</code> on the partition it shows the correct value. Is there any way to force this information to be updated? What is causing the output here to be different?</p>
|
<p>This probably centres on <em>how</em> you truncated the file. <em>du</em> and <em>df</em> report different things as <a href="http://www.unix.com/unix-dummies-questions-answers/29223-sco-unix-disk-space.html" rel="nofollow noreferrer">this post on unix.com explains</a>. Just because space is not used does not necessarily mean that it's free...</p>
|
<p>Does df --sync work?</p>
| 4,836
|
<p>I have the need to copy the entire contents of a directory on a FTP location onto a shared networked location. FTP Task has you specify the exact file name (not a directory) and File System Task does not allow accessing a FTP location.</p>
<p><strong>EDIT</strong>: I ended up writing a script task.</p>
|
<p>I've had some similar issues with the FTP task before. In my case, the file names changed based on the date and some other criteria. I ended up using a Script Task to perform the FTP operation.</p>
<p>It looks like this is what you ended up doing as well. I'd be curious if anyone else can come up with a better way to use the FTP task. It's nice to have...but VERY limited. </p>
|
<p>When I need to do this sort of thing I use a batch file to call FTP on the command line and use the mget command. Then I call the batch from the DTS/DTSX package.</p>
| 6,358
|
<p>I'm trying to disable a bunch of controls with JavaScript (so that they post back values). All the controls work fine except for my radio buttons as they lose their value. In the below code which is called via a recursive function to disable all child controls the Second else (else if (control is <code>RadioButton</code>)) is never hit and the RadioButton control is identified as a <code>Checkbox</code> control.</p>
<pre><code> private static void DisableControl(WebControl control)
{
if (control is CheckBox)
{
((CheckBox)control).InputAttributes.Add("disabled", "disabled");
}
else if (control is RadioButton)
{
}
else if (control is ImageButton)
{
((ImageButton)control).Enabled = false;
}
else
{
control.Attributes.Add("readonly", "readonly");
}
}
</code></pre>
<p>Two Questions:<br>
1. How do I identify which control is a radiobutton? <br>
2. How do I disable it so that it posts back its value?</p>
|
<p>I found 2 ways to get this to work, the below code correctly distinguishes between the RadioButton and Checkbox controls.</p>
<pre><code> private static void DisableControl(WebControl control)
{
Type controlType = control.GetType();
if (controlType == typeof(CheckBox))
{
((CheckBox)control).InputAttributes.Add("disabled", "disabled");
}
else if (controlType == typeof(RadioButton))
{
((RadioButton)control).InputAttributes.Add("disabled", "true");
}
else if (controlType == typeof(ImageButton))
{
((ImageButton)control).Enabled = false;
}
else
{
control.Attributes.Add("readonly", "readonly");
}
}
</code></pre>
<p>And the solution I used is to set SubmitDisabledControls="True" in the form element which is not ideal as it allows a user to fiddle with the values but is fine in my scenario. The second solution is to mimic the Disabled behavior and details can be found here: https://web.archive.org/web/20210608183803/http://aspnet.4guysfromrolla.com/articles/012506-1.aspx'><a href="https://web.archive.org/web/20210608183803/http://aspnet.4guysfromrolla.com/articles/012506-1.aspx" rel="nofollow noreferrer">https://web.archive.org/web/20210608183803/http://aspnet.4guysfromrolla.com/articles/012506-1.aspx</a>.</p>
|
<p>Off the top of my head, I think you have to check the "type" attribute of the checkbox to determine if it's a radio button.</p>
| 5,211
|
<p>I want to run two stepper motors using Arduino Mega 2560 and RAMPS 1.4. But, somehow I burned the Arduino while I was connecting the motor and plugging the board to the computer.</p>
<p>Can I plug external power supply and USB connection to the computer at the same time?</p>
<h3>Additional info from comments</h3>
<p>I am using RAMPS 1.4 with Polulo red stepper drivers and Arduino Mega R3. I am only using two Nema 17 stepper motors and not using any hotbed or anything else other than the two stepper motors for the x and y axes. I am feeding 11.9 V supply to the RAMPS board. When powered on, can I plug the USB to my computer?</p>
<p>Suppose I have connected two motors on the X and Y outputs of the RAMPS, and the external power supply is on, then can I connect my Arduino to my PC using USB? Will it burn my board or not?</p>
<p>My only trouble is that when the board is on load, connecting the USB to computer motors would take power by Arduino pins instead of the RAMPS external supply.</p>
|
<p>I had a similar issue building my Prusa i3 Mk2s clone. I was constantly hooking & unhooking my Arduino from my PC while the printer was plugged into the mains. At some point it had enough & it released some "magic smoke". Later on I found out this was the power regulator on the Arduino.</p>
<p>You shouldn't <strong>need</strong> to plug in the USB and the external power to the Arduino at the same time, but if you did, it is smart enough to only use one.</p>
<p>That being said, by default the RAMPS passes 12V straight to the Arduino in order to power it (the Vin pin).</p>
|
<p>The answer is, yes you can, but you need to follow guidelines.</p>
<p>Reversing +/- or otherwise incorrectly connecting power can destroy your electronics and cause fire hazard.</p>
<hr />
<p>From <a href="http://reprap.org/wiki/RAMPS_1.4" rel="nofollow noreferrer">RepRap wiki - RAMPS 1.4</a></p>
<blockquote>
<p>Maximum Input Voltage Power Supply without diode There are three
limiting factors to the maximum voltage that you can put into the
RAMPS:</p>
<p>The Arduino Mega maximum input voltage Filtering capacitor maximum
voltages PTC fuse maximum voltages First, the 1N4004 diode connects
the RAMPS input voltage to the Arduino Mega which has a recommended
maximum input voltage of 12 volts. If your board does not have this
diode soldered in (or if you cut it), you will need to power the Mega
through the USB connector or through a separate 5v line, but this
allows a higher RAMPS voltage.</p>
<p>Second, most boards use 25v or 35v aluminum electrolytic capactors
(C2, C3, C4, C6, C7, C9, and C10). To be safe, you should only go to
half of your rated maximum voltage -- thus if your board has 35v
capacitors (code VZA) then you should use a maximum input of 17.5v.
The absolute maximum voltage is determined by the pololu servo
drivers, which themselves are limited to 35V.</p>
<p>Third, the MF-R500 (5A) PTC fuse is rated to 30V and the MF-R1100
(11A) PTC fuse is rated to 16V. They will need to be replaced with
real fuses.</p>
<p>Power Supply with diode If your board has a 1N4004 diode soldered in,
do not apply more than 12 V to it. Original flavor Arduino Mega are
rated to 12 V input. While Arduino Mega 2560 can take 20 V, it is not
recommended.</p>
</blockquote>
| 871
|
<p>Is there a .NET Control Similar to the Access 2007 Split Form?</p>
<p>Or has anyone built such a control?</p>
<p>I upgraded a small personal Name and Address DB to Access 2007 and noticed the Form had a property called “Default View” which can be set to “Split Form”. “Split Form” mode has a GridView and a Form together in one control. When a record is clicked in the GridView, it shows up in the form and it can be edited in either the GridView and/or the Form by setting some properties. Pretty slick.</p>
|
<p>Not that I know of, but pretty much all you need is:</p>
<ul>
<li>a split container</li>
<li>a user control containing your actual form</li>
<li>a grid view</li>
</ul>
<p>Now you just hook up the grid view's item selection events with a controller that loads data into the user control's child controls.</p>
<p>From what I can tell, there Access Split Form doesn't do a lot more.</p>
|
<p>A Flex Grid Control will probably do what you want but you will need to write a bit of VBA code, have a look at my Flex Grid Demo program for some examples.</p>
<p>Go to <a href="http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=180" rel="nofollow noreferrer">http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=180</a></p>
<p>HTH</p>
<p>Peter Hibbs.</p>
| 7,043
|
<p>I've spent a good amount of time coming up with solution to this problem, so in the spirit of <a href="https://stackoverflow.com/questions/21245/questions-vs-conveying-information">this post</a>, I'm posting it here, since I think it might be useful to others. </p>
<p>If anyone has a better script, or anything to add, please post it.</p>
<p>Edit: Yes guys, I know how to do it in Management Studio - but I needed to be able to do it from within another application.</p>
|
<p>I've modified the version above to run for all tables and support new SQL 2005 data types. It also retains the primary key names. Works only on SQL 2005 (using cross apply).</p>
<pre><code>
select 'create table [' + so.name + '] (' + o.list + ')' + CASE WHEN tc.Constraint_Name IS NULL THEN '' ELSE 'ALTER TABLE ' + so.Name + ' ADD CONSTRAINT ' + tc.Constraint_Name + ' PRIMARY KEY ' + ' (' + LEFT(j.List, Len(j.List)-1) + ')' END
from sysobjects so
cross apply
(SELECT
' ['+column_name+'] ' +
data_type + case data_type
when 'sql_variant' then ''
when 'text' then ''
when 'ntext' then ''
when 'xml' then ''
when 'decimal' then '(' + cast(numeric_precision as varchar) + ', ' + cast(numeric_scale as varchar) + ')'
else coalesce('('+case when character_maximum_length = -1 then 'MAX' else cast(character_maximum_length as varchar) end +')','') end + ' ' +
case when exists (
select id from syscolumns
where object_name(id)=so.name
and name=column_name
and columnproperty(id,name,'IsIdentity') = 1
) then
'IDENTITY(' +
cast(ident_seed(so.name) as varchar) + ',' +
cast(ident_incr(so.name) as varchar) + ')'
else ''
end + ' ' +
(case when UPPER(IS_NULLABLE) = 'NO' then 'NOT ' else '' end ) + 'NULL ' +
case when information_schema.columns.COLUMN_DEFAULT IS NOT NULL THEN 'DEFAULT '+ information_schema.columns.COLUMN_DEFAULT ELSE '' END + ', '
from information_schema.columns where table_name = so.name
order by ordinal_position
FOR XML PATH('')) o (list)
left join
information_schema.table_constraints tc
on tc.Table_name = so.Name
AND tc.Constraint_Type = 'PRIMARY KEY'
cross apply
(select '[' + Column_Name + '], '
FROM information_schema.key_column_usage kcu
WHERE kcu.Constraint_Name = tc.Constraint_Name
ORDER BY
ORDINAL_POSITION
FOR XML PATH('')) j (list)
where xtype = 'U'
AND name NOT IN ('dtproperties')
</code></pre>
<p><strong>Update:</strong> Added handling of the XML data type</p>
<p><strong>Update 2:</strong> Fixed cases when 1) there is multiple tables with the same name but with different schemas, 2) there is multiple tables having PK constraint with the same name</p>
|
<p>If you are using management studio and have the query analyzer window open you can drag the table name to the query analyzer window and ... bingo! you get the table script.
I've not tried this in SQL2008</p>
| 4,168
|
<p>I admit it: I don't bother with too much exception handling. I know I should do more but I can never wrap my head around where to start and where to stop. I'm not being lazy. Far from it. It's that I'm overwrought with exception handling ambivalence. It just seems that there is a seemingly infinite number of places in even the smallest app where exception handling can be applied and it can begin to feel like overkill.</p>
<p>I've gotten by with careful testing, validating, and silent prayer but this is a bad programming accident waiting to happen.</p>
<p>So, what are your exception handling best practices? In particular, where are the most obvious/critical places where exception handling should be applied and where are places where it should be considered?</p>
<p>Sorry for the vague the question but I really want to close the book on this once and for all. </p>
|
<p>Microsoft's <a href="http://msdn.microsoft.com/en-us/practices/default.aspx" rel="nofollow noreferrer">Patterns & Practices team</a> did a good job incorporating best practices of exception management into Enterprise Library <a href="http://msdn.microsoft.com/en-us/library/cc511522.aspx" rel="nofollow noreferrer">Exception Handling Application Block</a></p>
<p>Event if wouldn't use Enterprise Library, I <em>highly</em> recommend you to read their documentation. P&P team describes common scenarios and best practices for exceptions handling.</p>
<p>To get you started I recommend read following articles:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ms229005.aspx" rel="nofollow noreferrer">Exception Handling</a> on MSDN</li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms229005.aspx" rel="nofollow noreferrer">Exception Management in .NET</a> on MSDN</li>
<li><a href="http://www.codeproject.com/KB/architecture/exceptionbestpractices.aspx" rel="nofollow noreferrer">Exception Handling Best Practices in .NET</a> on CodeProject</li>
</ul>
<p>ASP.NET specific articles:</p>
<ul>
<li><a href="http://www.codeproject.com/KB/aspnet/ASPNETExceptionHandling.aspx" rel="nofollow noreferrer">User Friendly ASP.NET Exception Handling</a></li>
<li><a href="http://www.developer.com/net/asp/article.php/961301" rel="nofollow noreferrer">Global Exception Handling with
ASP.NET</a></li>
<li><a href="http://www.codersource.net/asp_net_exception_handling.aspx" rel="nofollow noreferrer">Exception handling in C# and ASP
.Net</a></li>
</ul>
|
<p>Well at the very basic level you should be handling the HttpApplication.Error event in the Global.asax file. This should log any exception that occurs to a single place so you can review the stack trace of the exception.</p>
<p>Apart from this basic level you should ideally be handling exceptions where you know you can recover from them - for example if you expect a file might be locked then handling the IOException and reporting the error back to the user would be a good idea.</p>
| 7,981
|
<p>I'm considering buying <a href="http://reprapworld.com/?products_details&products_id/783/cPath/1680">this package</a>, the Kossel, as my first 3D printer. </p>
<p>It's not the cheapest model, but apparently a high resolution and stable, which is what I'm after.</p>
<p>The question is, what is the life expectancy of this printer, given the component list?
Assuming the printer is constructed properly and properly taken care of, but used once or twice a week for several hours.</p>
<p>Is it possible to make an estimate of how many years this particular printer could be used before it starts showing signs of wear? </p>
<p><strong>Parts list:</strong></p>
<p>1x Complete set of platics for Kossel Mini (PLA)<br>
1x Kossel mini Extrusion set<br>
1x traxxas (set of 12)<br>
1x Carbon Tube (kossel printing arms) Set of 6<br>
3x Square slider (40cm)<br>
1x Megatronics v3.0 - Kossel kit<br>
1x Heated Bed glass round 17cm diameter (Borosilicate)<br>
1x Kapton heater mat round 16cm diameter<br>
1x Power supply 12V (240/115V / 20A MAX)<br>
3x Aluminum Pulley GT2<br>
5x Timing belt 1m x 6mm (GT2)<br>
1x E3D v6 - HotEnd Full Kit - 1.75mm<br>
1x Hobbed bolt v1.1<br>
1x Brass drive gear (Wade's compatible)<br>
6x Bearing 623ZZ<br>
125x (1 pcs) Screw M3X8 Philips<br>
125x (1 pcs) Washer M3 normal<br>
125x (1 pcs) Nut M3 normal<br>
6x (1 pcs) Screw M3X16 Philips<br>
12x (1 pcs) Screw M3X25 Philips<br>
6x (1 pcs) Screw M3X20 Philips<br>
10x PTFE tubing, 2inner/4outer diameter (10cm)<br>
1x Bowden setup - J head comp. plug set (1.75mm)<br>
1x E3D v6 - Threaded Bowden Coupling - 1.75mm<br>
2x (1 pcs) Screw M3X40 Philips<br>
6x (1 pcs) Screw M2X16 Philips<br>
1x Power cable 1.8m<br>
6x M4 Threaded rod - Custom length </p>
|
<p>Much like your car, the number of miles, or the number of prints that you can get out of it is entirely up to how well <strong>you</strong> can maintain it.</p>
<p>A 3D Printer is a machine, and a machine needs general maintenance; if you see something starting to break - or get worn out - or anything abnormal, fix it.</p>
<p>I am sure that if you had something like a MakerBot, it would require less maintenance then a fully home built machine, but if you are building it from scratch, I am sure you don't mind.</p>
<p>I am still rocking a 3 year old home built MendalMax, and have both made some improvements, and had to make some repairs along the way - but it is still in damn good condition.</p>
<p>For a $600 investment, I can say you will get a few years out of it if you take proper care of it. By the time the end of its life comes (5+ years), I am sure there will be much better printers available for cheaper, and you will never look back :)</p>
<ul>
<li>Tighten all your nuts and bolts</li>
<li>Keep it calibrated</li>
<li>Keep belts properly tensioned</li>
<li>Oil X, Y, and Z rods</li>
<li>Clean of any dust and scrap plastic (compressed air can?)</li>
<li>Clean hobbed bolt</li>
<li>Clean extruder</li>
<li>Ensure all electronic connections are secure</li>
<li>Check wires at points of movement for wear</li>
</ul>
<p>!remindme 5years</p>
|
<p>I have built a Kossel too. Got lots of tips from the Google Deltaprinter group.
Most important when using the Traxxas rod ends is to have the metal parts go into the freezer and the plastic parts in warm water(not boiling, just 60 degrees celsius or so). Then put the 2 together, due to the fact the metal crimps just a little and the hot water softens the plastic a bit, they will fit easy and will be stiff longer. These mounts tend to wear out causing play in the effector. I have printed 100's of hours on my Kossel mini with traxxas rods and still moves very nice and prints accurately.</p>
| 127
|
<p>I was able to connect my terminal program (Putty) to my 3D Printer (Creality Ender 3 Pro) and was able to send G-code commands to my printer and it obeys.</p>
<p>Now suppose I sent long command like</p>
<pre><code>G29 ; auto bed leveling
</code></pre>
<p>and it is still executing. Printer writes me</p>
<pre><code>echo:busy: processing
</code></pre>
<p>How to interrupt it?</p>
<p>I tried to send <code>M0</code>, but it didn't work.</p>
|
<p>Photo interpretation: I understand that the image on the right presents the actual error: it happens on many layers, following the red "Starting Point" line (so above it on the photo). Interesting issue. Btw. which side of the print is the bottom (zero layer)? - I believe the left side, and the right side is the top of the print.</p>
<p>The problem seems to apeear only in the middle of print. Top and bottom layers are usually printed slower, this could be some hint to find the reason. Also, I guess that the vertical cross section is not just a rectangle, but is wider on the top part? - then print parameters (e.g. speed) may change because of overhangs.</p>
<p>Could you share what type of filament do you print with? For example flexible materials will specifically react to the pressure and should not be forcefully retracted and pushed.
What type</p>
<p>Is there any exccessive material anywhere on the table? Like oozing or stringing? Do you see any material lost before printing the first layer? If not, the retraction is good enough or even too heavy - then try to minimize it: you may go down until you see any oozing, and then check the wall.</p>
<p>Could you share what range of parameters you have tried- especially the speed and retraction values? Jerk and accelleration? Do you use coasting or other pressure affecting techniques?</p>
<p>What is the hotend diameter? - the specs says 0.4 mm and the direct extruder. And (in comparision) what is the wall's line width for extrusion? What is the real width of this wall? (Is it properly sliced and reflected in G-Code? I advice to use G-Code viewer and inspect the details in given area.) What is the infill %, and how many wall lines do you have configured? And the layer height?</p>
<p>I hope this is of some help for diagnosis.</p>
|
<p>Photo interpretation: I understand that the image on the right presents the actual error: it happens on many layers, following the red "Starting Point" line (so above it on the photo). Interesting issue. Btw. which side of the print is the bottom (zero layer)? - I believe the left side, and the right side is the top of the print.</p>
<p>The problem seems to apeear only in the middle of print. Top and bottom layers are usually printed slower, this could be some hint to find the reason. Also, I guess that the vertical cross section is not just a rectangle, but is wider on the top part? - then print parameters (e.g. speed) may change because of overhangs.</p>
<p>Could you share what type of filament do you print with? For example flexible materials will specifically react to the pressure and should not be forcefully retracted and pushed.
What type</p>
<p>Is there any exccessive material anywhere on the table? Like oozing or stringing? Do you see any material lost before printing the first layer? If not, the retraction is good enough or even too heavy - then try to minimize it: you may go down until you see any oozing, and then check the wall.</p>
<p>Could you share what range of parameters you have tried- especially the speed and retraction values? Jerk and accelleration? Do you use coasting or other pressure affecting techniques?</p>
<p>What is the hotend diameter? - the specs says 0.4 mm and the direct extruder. And (in comparision) what is the wall's line width for extrusion? What is the real width of this wall? (Is it properly sliced and reflected in G-Code? I advice to use G-Code viewer and inspect the details in given area.) What is the infill %, and how many wall lines do you have configured? And the layer height?</p>
<p>I hope this is of some help for diagnosis.</p>
| 1,820
|
<p>In my custom printer I have probe and nozzle at same height and configured Marlin this way:</p>
<pre><code>#define NOZZLE_TO_PROBE_OFFSET { 43, -20, 0 }
</code></pre>
<p>On the bed I've a 2 mm glass. How I need to change the configuration? Do I need to act adding a positive Z offset? like this?</p>
<pre><code>#define NOZZLE_TO_PROBE_OFFSET { 43, -20, 2 }
</code></pre>
|
<p>You can define the probe offset (or better the trigger point to bed level distance) in the array definition of <code>NOZZLE_TO_PROBE_OFFSET</code>, but it is not the usual and logical place to do that. Instead you position the probe higher than the nozzle and define the offset later when calibrating the bed level. A positive value is a positive offset, Z+.</p>
<hr>
<p>This answer is intended to be a more generic answer for Z-offset determination. The question is not clear on what kind of Z-probe is used. In case of a touch (or an inductive or a capacitive) probe, a probe trigger point defines how far the probe needs to be from the bed level (the sensor is always placed higher than the nozzle). This trigger point is a measure for the offset and used to determine the distance of the nozzle to the bed print surface (using the offset). Correct installation is trivial, as is the determination of the nozzle to trigger point definition. For a touch sensor, the probing element is either stowed, fully deployed, or pushed in during leveling up to the point that the trigger point is reached and the probe stowes the rest of the pin, see figure:</p>
<p><a href="https://i.stack.imgur.com/wdto7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wdto7.png" alt="BLTouch or 3DTouch sensor Z-offset definition"></a></p>
<p>The <code>M851 Zxx.xx</code> offset is determined by lowering the nozzle beyond the trigger point until the nozzle hits a sheet of paper. If the stowed position to nozzle distance is used, the distance is too large and the nozzle will dive into the bed on printing. A similar sketch for inductive/capacitive proximity probes can be drawn.</p>
<p><a href="https://i.stack.imgur.com/2sGwU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2sGwU.png" alt="Inductive/capacitive proximity sensor Z-offset definition"></a></p>
|
<h1>No.</h1>
<p>You define the Z-Value of the Nozzle to Probe offset mainly to get avoidance of collisions, but it is checked nowhere in the firmware code at all. Usually, the probe is mounted a millimeter or so above the nozzle anyway: you mount it in such a fashion that it triggers when the nozzle has the correct distance to the bed.</p>
<p>If you alter the bed by altering the distance between the nozzle and the metal part of the bed, you might need to alter the physical position of the probe to get the printer to trigger at the correct height, but you don't necessarily need to add a Z-offset.</p>
<p>You might, however, want to include it in the slicer for the case you want to print items in a sequence, which forces most slicers to try to do an error-avoidance pattern.</p>
| 1,609
|
<p>I bought an Ender 3, and after assembling it following the description and some YouTube videos and after correct leveling, I printed the test dog gcode on the micro SD card that comes with the printer. PLA 1.75 mm. Attached the image of the printing result. What went wrong? I didn't change or modify any settings what so ever, I just assembled the printer, and printed the test dog. Please help me, I am a beginner in 3D printing. </p>
<p><a href="https://i.stack.imgur.com/CisP7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CisP7.jpg" alt="enter image description here"></a></p>
|
<p>This is an extreme case of repeated layer shifting in the Y-carriage, which can come from some pieces related to the carriage. Luckily for you, they are easily fixable.</p>
<ul>
<li>The Ender3 Y-carriage has an eccentric nut to adjust the force the wheels press down on the V-slot. Adjust it (most likely loosen them a little) so it moves smoothly when the motors are off, but keep it tight enough so it does not tilt.</li>
<li>The belt in the Y-carriage might be loose. Tighten it till it gives a nice ring when struck.</li>
<li>Check if the gear on the Y-motor is tightened down correctly. If it slips or wriggles, the backlash results in the layers shifting.</li>
<li>The Ender3 has the cables to the gantry and the bed running across each other and quite open. Make sure nothing can be caught in them.</li>
<li>Make sure the gantry is parallel to the bed and stays so in moving upwards - adjust the wheels as needed.
<ul>
<li>To ensure this, make sure the lead screw is orthogonal to the gantry. Level the bed afterwards. You might need to adjust the motor mount, possibly by shimming.</li>
</ul></li>
</ul>
|
<p>Ender 3's have a reputation to be not quite square on the base. Make sure that your X, Y, and X axis' are all perfectly squared.</p>
| 1,238
|
<p>Is the return value of GetHashCode() guaranteed to be consistent assuming the same string value is being used? (C#/ASP.NET)</p>
<p>I uploaded my code to a server today and to my surprise I had to reindex some data because my server (win2008 64-bit) was returning different values compared to my desktop computer.</p>
|
<p>If I'm not mistaken, GetHashCode is consistent given the same value, but it is NOT guaranteed to be consistent across different versions of the framework.</p>
<p>From the MSDN docs on String.GetHashCode():</p>
<blockquote>
<p>The behavior of GetHashCode is dependent on its implementation, which might change from one version of the common language runtime to another. A reason why this might happen is to improve the performance of GetHashCode. </p>
</blockquote>
|
<p>I would have to Say...you cannot rely on it. For example if I run file1 through c#'s md5 hash code and copy nd paste the same file to a new directory...the hash code come out different even tough it is he same file. Obviously its the same .net version, same everything. The only thing that changed was the path.</p>
| 7,651
|
<p>I'm doing some web scraping and sites frequently use HTML entities to represent non ascii characters. Does Python have a utility that takes a string with HTML entities and returns a unicode type?</p>
<p>For example:</p>
<p>I get back:</p>
<pre><code>&#x01ce;
</code></pre>
<p>which represents an "ǎ" with a tone mark. In binary, this is represented as the 16 bit 01ce. I want to convert the html entity into the value <code>u'\u01ce'</code></p>
|
<p>The standard lib’s very own HTMLParser has an undocumented function unescape() which does exactly what you think it does:</p>
<p>up to Python 3.4:
</p>
<pre><code>import HTMLParser
h = HTMLParser.HTMLParser()
h.unescape('&copy; 2010') # u'\xa9 2010'
h.unescape('&#169; 2010') # u'\xa9 2010'
</code></pre>
<p>Python 3.4+:</p>
<pre><code>import html
html.unescape('&copy; 2010') # u'\xa9 2010'
html.unescape('&#169; 2010') # u'\xa9 2010'
</code></pre>
|
<p>Here is the Python 3 version of <a href="https://stackoverflow.com/a/58125/2086547">dF's answer</a>:</p>
<pre><code>import re
import html.entities
def unescape(text):
"""
Removes HTML or XML character references and entities from a text string.
:param text: The HTML (or XML) source text.
:return: The plain text, as a Unicode string, if necessary.
"""
def fixup(m):
text = m.group(0)
if text[:2] == "&#":
# character reference
try:
if text[:3] == "&#x":
return chr(int(text[3:-1], 16))
else:
return chr(int(text[2:-1]))
except ValueError:
pass
else:
# named entity
try:
text = chr(html.entities.name2codepoint[text[1:-1]])
except KeyError:
pass
return text # leave as is
return re.sub("&#?\w+;", fixup, text)
</code></pre>
<p>The main changes concern <code>htmlentitydefs</code> that is now <code>html.entities</code> and <code>unichr</code> that is now <code>chr</code>. See this <a href="http://docs.pythonsprints.com/python3_porting/py-porting.html#reorganization" rel="nofollow noreferrer">Python 3 porting guide</a>.</p>
| 8,205
|
<p>Today I was printing some parts and I got these burn marks at the corners:</p>
<p><a href="https://i.stack.imgur.com/D8b3n.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D8b3n.jpg" alt="1"></a></p>
<p>This is the first time I see this on this printer (Anycubic I3 Mega). I was using more or less the same settings (in Cura) as always, although I was using a new roll of PLA from a brand I haven't used before.</p>
<p>I was printing several parts in one job:</p>
<p><a href="https://i.stack.imgur.com/p56Kp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p56Kp.jpg" alt="2"></a></p>
<p>Most of them are somewhat affected:</p>
<p><a href="https://i.stack.imgur.com/8MqTq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8MqTq.jpg" alt="3"></a></p>
<pre><code>Printing temperature: 200 °C
Build Plate Temperature: 60 °C
Printing Speed: 60 mm/s
Travel speed: 200 mm/s
</code></pre>
|
<p>In addition to <a href="https://3dprinting.stackexchange.com/a/7933/5740">this answer</a> which addresses <strong><em>what</em></strong> is actually the cause (<em>but doesn't explain where the burnt corners come from</em>), I've added some information <strong><em>why</em></strong> this is showing burnt corners.</p>
<p>You are printing PLA at a too high of a temperature and do not have sufficient print part cooling enabled (either in the slicer or limited by the fan duct design). The <strong><em>higher the temperature the larger the shrinkage</em></strong> of the filament is. When printing overhangs like the slanted models you print, the last deposited layer has less surface contact area with the previous layer and therefore the shrink stresses may overcome the adhering stresses (it is also more easily weakened by the heat input of the last layer). This results in curling up, especially in corners as the heat input comes from two sides. When the corners curl up, the change of hitting the sides of the nozzle increases. When the outside of the nozzle is covered in burnt filament, the curling corners may pick that up. This results as if the corners are actually burnt.</p>
|
<p>Could be a dirty nozzle and temperature too high. When the head changes direction on the corner, the nozzle wipes off burnt PLA. This might explain why there are no dark marks on the long runs and only the corners.</p>
<p>Heat nozzle up and clean with acetone and then see if the problem persists.</p>
| 1,175
|
<p>I'm using firmware Marlin 2.0.3 on an Anet A8 printer. I'm using a Roko SN04-N NPN bed leveller. I've managed to set up 3 points bed levelling but I wanted to try the bilinear levelling.</p>
<p>Issue is, the sensor goes out of the aluminum bed ever so slightly during levelling, resulting in the printing head crashing on the bed.</p>
<p>Where can I set the grid for the bilinear levelling in the config file? I didn't find the option in the file and Google wasn't of any help this time.</p>
|
<p>If you have managed to setup 3-point levelling, you should be able to enable bi-linear levelling in the firmware.</p>
<p>From the <a href="https://github.com/MarlinFirmware/Configurations/blob/master/config/default/Configuration.h" rel="nofollow noreferrer">configuration.h</a> file for Marlin firmware you can find the following options:</p>
<pre>
/**
* Choose one of the options below to enable G29 Bed Leveling. The parameters
* and behavior of G29 will change depending on your selection.
*
* If using a Probe for Z Homing, enable Z_SAFE_HOMING also!
*
* - AUTO_BED_LEVELING_3POINT
* Probe 3 arbitrary points on the bed (that aren't collinear)
* You specify the XY coordinates of all 3 points.
* The result is a single tilted plane. Best for a flat bed.
*
* - AUTO_BED_LEVELING_LINEAR
* Probe several points in a grid.
* You specify the rectangle and the density of sample points.
* The result is a single tilted plane. Best for a flat bed.
*
* - AUTO_BED_LEVELING_BILINEAR
* Probe several points in a grid.
* You specify the rectangle and the density of sample points.
* The result is a mesh, best for large or uneven beds.
*
* - AUTO_BED_LEVELING_UBL (Unified Bed Leveling)
* A comprehensive bed leveling system combining the features and benefits
* of other systems. UBL also includes integrated Mesh Generation, Mesh
* Validation and Mesh Editing systems.
*
* - MESH_BED_LEVELING
* Probe a grid manually
* The result is a mesh, suitable for large or uneven beds. (See BILINEAR.)
* For machines without a probe, Mesh Bed Leveling provides a method to perform
* leveling in steps so you can manually adjust the Z height at each grid-point.
* With an LCD controller the process is guided step-by-step.
*/
//#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR
//#define AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING
</pre>
<p>If you are using 3-point levelling you enabled constant <code>AUTO_BED_LEVELING_3POINT</code> by removing the comment characters (<code>//</code>):</p>
<pre><code>#define AUTO_BED_LEVELING_3POINT
</code></pre>
<p>to enable bi-linear levelling, you should remove the comment characters before constant <code>#define AUTO_BED_LEVELING_BILINEAR</code>:</p>
<pre><code>#define AUTO_BED_LEVELING_BILINEAR
</code></pre>
<p>Definition of the grid is done by specifying how many point you want to have using constants <code>GRID_MAX_POINTS_X</code> and <code>GRID_MAX_POINTS_Y</code>:</p>
<pre>
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
// Set the number of grid points per dimension.
#define GRID_MAX_POINTS_X 3
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
</pre>
<p>The code above shows the default definition of a 9 point (3 x 3) grid.</p>
<p>Note that this will only work well if the area for the sensor to reach safely is correctly defined. If the sensor is missing the build plate, you have not correctly defined the limits for the sensor. Question <a href="/q/8153">"How to set Z-probe boundary limits in firmware when using automatic bed leveling?"</a> has an <a href="/a/8154">accepted answer</a> that describes how to define an area on the plate that the sensor may reach (the answer on this question also discusses Marlin 2.x).</p>
<hr>
<h2>In the specific case of the OP (after posting the config files)</h2>
<hr>
<p>From the posted configuration files your probe position can be obtained:</p>
<pre><code>#define NOZZLE_TO_PROBE_OFFSET { 25, 55, 0 }
</code></pre>
<p>So your probe is at the right-back when facing the printer. Also your bed area attempt (commented) and the current active bed area can be obtained:</p>
<pre>
#if PROBE_SELECTED && !IS_KINEMATIC
//#define MIN_PROBE_EDGE_LEFT 5
//#define MIN_PROBE_EDGE_RIGHT 200
//#define MIN_PROBE_EDGE_FRONT 55
//#define MIN_PROBE_EDGE_BACK 200
#define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE
#define MIN_PROBE_EDGE_RIGHT MIN_PROBE_EDGE
#define MIN_PROBE_EDGE_FRONT MIN_PROBE_EDGE
#define MIN_PROBE_EDGE_BACK MIN_PROBE_EDGE
#endif
</pre>
<p>From these excerpts it is clear that the bed limits are incorrectly defined. </p>
<p>Following the theory from <a href="/a/8154/">this answer</a> the probe is only allowed to visit the following (dark red) area:</p>
<p><a href="https://i.stack.imgur.com/gpeCz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gpeCz.png" alt="Probe area for back-right probe Marlin 2.0.x"></a></p>
<p>This area is defined as:</p>
<pre>
#define MIN_PROBE_EDGE_LEFT (PROBE_OFFSET_X_FROM_EXTRUDER + MIN_PROBE_EDGE)
#define MIN_PROBE_EDGE_RIGHT (MIN_PROBE_EDGE)
#define MIN_PROBE_EDGE_FRONT (PROBE_OFFSET_Y_FROM_EXTRUDER + MIN_PROBE_EDGE)
#define MIN_PROBE_EDGE_BACK (MIN_PROBE_EDGE)
</pre>
<p>which translates to:</p>
<pre>
#define MIN_PROBE_EDGE_LEFT (25 + MIN_PROBE_EDGE)
#define MIN_PROBE_EDGE_RIGHT (MIN_PROBE_EDGE)
#define MIN_PROBE_EDGE_FRONT (55 + MIN_PROBE_EDGE)
#define MIN_PROBE_EDGE_BACK (MIN_PROBE_EDGE)
</pre>
<p>As seen in the commented <code>//#define MIN_PROBE_EDGE_LEFT 5</code> and uncommented <code>#define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE</code> (equals 10) left probe limits, you are at least respectively 20 or 15 mm short, hence the sensor is not on the plate on the left.</p>
|
<p>Note for anyone looking at the answer above, but in 2.1.x:
The <code>#define</code> lines have been renamed:</p>
<pre><code>#if PROBE_SELECTED && !IS_KINEMATIC
#define PROBING_MARGIN_LEFT PROBING_MARGIN
#define PROBING_MARGIN_RIGHT PROBING_MARGIN
#define PROBING_MARGIN_FRONT PROBING_MARGIN
#define PROBING_MARGIN_BACK PROBING_MARGIN
#endif
</code></pre>
| 1,586
|
<p>If you're creating a temporary table within a stored procedure and want to add an index or two on it, to improve the performance of any additional statements made against it, what is the best approach? Sybase says <a href="http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc20020_1251/html/databases/databases644.htm" rel="noreferrer">this</a>:</p>
<p><em>"the table must contain data when the index is created. If you create the temporary table and create the index on an empty table, Adaptive Server does not create column statistics such as histograms and densities. If you insert data rows after creating the index, the optimizer has incomplete statistics."</em></p>
<p>but recently a colleague mentioned that if I create the temp table and indices in a different stored procedure to the one which actually uses the temporary table, then Adaptive Server optimiser <em>will</em> be able to make use of them.</p>
<p>On the whole, I'm not a big fan of wrapper procedures that add little value, so I've not actually got around to testing this, but I thought I'd put the question out there, to see if anyone had any other approaches or advice?</p>
|
<p>A few thoughts: </p>
<ul>
<li>If your temporary table is so big that you have to index it, then is there a better way to solve the problem? </li>
<li><p>You can force it to use the index (if you are sure that the index is the correct way to access the table) by giving an optimiser hint, of the form: </p>
<pre><code>SELECT *
FROM #table (index idIndex)
WHERE id = @id
</code></pre></li>
</ul>
<p>If you are interested in performance tips in general, I've answered a couple of other questions about that at some length here: </p>
<ul>
<li><a href="https://stackoverflow.com/questions/18783/sql-what-are-your-favorite-performance-tricks#103176">Favourite performance tuning tricks</a></li>
<li><a href="https://stackoverflow.com/questions/137226/how-do-you-optimize-tables-for-specific-queries#138949">How do you optimize tables for specific queries?</a></li>
</ul>
|
<p>In Sybase if you create a temp table and then use it in one proc the plan for the select is built using an estimate of 100 rows in the table. (The plan is built when the procedure starts before the tables are populated.) This can result in the temp table being table scanned since it is only "100 rows". Calling a another proc causes Sybase to build the plan for the select with the actual number of rows, this allows the optimizer to pick a better index to use. I have seen significant improvedments using this approach but test on your database as sometimes there is no difference. </p>
| 7,728
|
<p>I have a "classic" home built 3D printer, Arduino Mega, RAMPS 1.4 with Marlin 2.0.</p>
<p>It worked, was put in storage, and now I am trying to get it running again.</p>
<p>During all of the testing phases, the PID autotune, etc., the temperature of the hotend is stable.</p>
<p>When printing, for a few layers (4-5), the temperature is OK, despite the part fan coming on and off. However, after 3-4 mm of printing the temperature just rises and rises and rises, and after 275 °C thermal protection kicks in...</p>
<p>MOSFETs have additional cooling and a fan over them.</p>
<p>I'm out of ideas... Help!!!</p>
<p>My config files and G-code are <a href="https://github.com/hergiz/singles" rel="nofollow noreferrer">here</a></p>
<p>Using PrusaSlicer.</p>
<p>Why do I see a temperature rise on the display? Last time I unplugged the printer and left it on USB power then gave it power again. During USB power temperature was steadily going down, as soon I plugged the main cable it resumed printing and the temperature rising again.</p>
<p>I did another test. 20mm above bed started printing, and got same result. I captured on video entire process <a href="https://www.youtube.com/watch?v=5_1puCo07to" rel="nofollow noreferrer">Hot end to orbit</a>. Around 2 min 30 sec the show begins.</p>
|
<p><a href="https://i.stack.imgur.com/1ldX4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1ldX4.png" alt="Left right" /></a></p>
<p><a href="https://i.stack.imgur.com/TtrmF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TtrmF.png" alt="Filament sensors" /></a></p>
<p>The MK3 has 4 pins on the filament sensor, the MK3S has only 3 pins. While you need to take the extruder apart to see that, you can also have a look at the cable instead:</p>
<p><a href="https://i.stack.imgur.com/5C6JE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5C6JE.png" alt="Filament sensor cable" /></a></p>
<p>Matching the sensor, the MK3 has a 4 strand wire including blue and the MK3S has a 3 strand cable without blue.</p>
<p><a href="https://i.stack.imgur.com/nuCqp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nuCqp.png" alt="Bearing clips" /></a></p>
<p>Looking under the heatbed, you'll find the MK3 bearings are fixed with U-bolts while the MK3S has broader bearing clips.</p>
|
<p>On the LCD, the MK3 will show <strong>Original Prusa MK3 OK</strong>, while the MK3S/+ will show <strong>Original Prusa MK3S OK</strong></p>
| 1,986
|
<p>I have a prusa i3 and have been trying to calibrate it. I have been trying to upload the new steps per mm and I get to done uploading. However when I go into Repetier host and type M503 to get the printers settings it still shows the steps as 100 for the y axis, it needs to be 96.1810. I am using ramps 1.4 I think, with Adrunio mega 2560. If I am remembering this correctly isn't there something you have to do when uploading a new sketch like hold the rest button or something?</p>
|
<p><a href="https://www.youtube.com/watch?v=Mbn1ckR86Z8" rel="nofollow">See here</a> for why you <em>shouldn't</em> calibrate your X/Y-steps. The value of 100 is probably better and will give more accurate prints overall than the value you came up with.</p>
<p>When uploading new firmware you generally do not have to press any button. Pressing reset manually is only necessary when your upload method does not provide a reset pulse, but if you upload with USB this is not necessary.</p>
<p>What is probably causing your problem is that the E-steps are stored in EEPROM, and uploading new firmware does not override the EEPROM settings.</p>
<p>You should run a <code>M502</code> to restore the default settings from the firmware you uploaded, then <code>M500</code> to save them to the EEPROM.</p>
|
<p><a href="https://www.youtube.com/watch?v=Mbn1ckR86Z8" rel="nofollow">See here</a> for why you <em>shouldn't</em> calibrate your X/Y-steps. The value of 100 is probably better and will give more accurate prints overall than the value you came up with.</p>
<p>When uploading new firmware you generally do not have to press any button. Pressing reset manually is only necessary when your upload method does not provide a reset pulse, but if you upload with USB this is not necessary.</p>
<p>What is probably causing your problem is that the E-steps are stored in EEPROM, and uploading new firmware does not override the EEPROM settings.</p>
<p>You should run a <code>M502</code> to restore the default settings from the firmware you uploaded, then <code>M500</code> to save them to the EEPROM.</p>
| 351
|
<p>I have had issues with printing on my i3 MK3, especially when it came to the first layer. In March 2020, I have installed the Prusa Mesh Leveling plugin for Octoprint. With that plugin and a Nylock nut modification, I was able to reduce the bed variance from 0.6 mm down to 0.014 mm and prints were great. That took about 25 rounds of calibration and I didn't have any issues with the graphics not updating.</p>
<p><a href="https://i.stack.imgur.com/Fo7Ag.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fo7Ag.png" alt="Mesh bed levelling on March 2020" /></a></p>
<p>Shortly after that, my filament sensor stopped working and I ordered a replacement, which I installed yesterday. But today, my prints are bad again, especially the first layer. So I thought I would simply run through the calibration and mesh bed leveling again.</p>
<p>First, I turned the screws in the wrong direction, so the result became worse and I needed several attempts until the results went into the correct direction. I'm currently at ~1.0 mm bed variance, which is very bad and I need to continue leveling the bed.</p>
<p><a href="https://i.stack.imgur.com/lR588.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lR588.png" alt="Bed variance currently" /></a></p>
<p>Now, the graphics does not update any longer. It always shows the same picture.</p>
<p>I also noticed some different behavior of the mesh bed levelling procedure. Usually, after running the mesh bed levelling, the printer needs some time (~5 secs) before it will react to other commands like a move on the Z axis. I used the following technique to find out when to reload the graphics:</p>
<ul>
<li>run mesh bed levelling</li>
<li>tell the printer to move up 10 mm on the Z axis</li>
<li>as soon as the print head moves up, it was possible to reload the graphics</li>
</ul>
<p>Now, the print head moves up immediately after the mesh bed levelling, without the ~5 secs delay and the graphics does not update.</p>
<p>I have already tried:</p>
<ul>
<li>click the "reload heat map" button</li>
<li>run mesh bed leveling again</li>
<li>restarting Octoprint</li>
<li>resetting the printer using the X button</li>
<li>looking for disk space via SSH</li>
</ul>
<p>.</p>
<pre><code>pi@octopi:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.3G 1.9G 5.1G 27% /
devtmpfs 182M 0 182M 0% /dev
tmpfs 186M 0 186M 0% /dev/shm
tmpfs 186M 2.7M 183M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 186M 0 186M 0% /sys/fs/cgroup
/dev/mmcblk0p1 42M 21M 21M 51% /boot
tmpfs 38M 0 38M 0% /run/user/1000
</code></pre>
<p>In the log file (<code>octoprint.log</code>) with output level set to <code>DEBUG</code>, I could see an entry:</p>
<pre><code>2020-06-06 12:19:52,261 - octoprint.plugins.PrusaMeshMap - INFO - Generating heatmap
2020-06-06 12:19:52,288 - py.warnings - WARNING -
/home/pi/oprint/local/lib/python2.7/site-packages/matplotlib/pyplot.py:522:
RuntimeWarning: More than 20 figures have been opened.
Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are
retained until explicitly closed and may consume too much memory.
(To control this warning, see the rcParam `figure.max_open_warning`).
max_open_warning, RuntimeWarning)
</code></pre>
<p>As you can see, this was at 12:19. The last graphics I saw is from 12:37.</p>
<p>The logs also contain a message on 12:40:</p>
<pre><code>2020-06-06 12:40:39,262 - octoprint.util.comm - ERROR - Error while processing hook PrusaMeshMap:
Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 2849, in _readline
ret = hook(self, ret)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_PrusaMeshMap/__init__.py", line 90, in mesh_level_check
self.mesh_level_generate()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_PrusaMeshMap/__init__.py", line 236, in mesh_level_generate
fig.savefig(self.get_asset_folder() + '/img/heatmap.png', bbox_inches="tight")
[...]
File "/home/pi/oprint/local/lib/python2.7/site-packages/matplotlib/image.py", line 512, in _make_image
output = self.to_rgba(output, bytes=True, norm=False)
File "/home/pi/oprint/local/lib/python2.7/site-packages/matplotlib/cm.py", line 259, in to_rgba
xx = (xx * 255).astype(np.uint8)
MemoryError
</code></pre>
<p>On 12:46 I rebooted the system</p>
<pre><code>2020-06-06 12:46:08,761 - octoprint.server.api.system - INFO - Performing command for core:reboot: sudo shutdown -r now
</code></pre>
<p>but of course that graphics is still missing and the last available graphics is the one from 12:37. So, after the reboot one needs to run the mesh bed leveling again.</p>
<p>Still, no luck...</p>
<p>OctoPrint version is 1.4.0, OctoPi version 0.15.0PE, Prusameshmap Plugin: 0.3.0. As far as I can tell, that's the latest version available.</p>
<p>What can I do to make mesh bed leveling work again?</p>
|
<p>I have formatted the SD card and installed Octoprint from scratch. That's nasty, because I lost all the models I uploaded.</p>
<p>It seems to be a bug in <a href="https://github.com/PrusaOwners/OctoPrint-PrusaMeshMap/blob/master/octoprint_PrusaMeshMap/__init__.py" rel="nofollow noreferrer">__init__.py</a> of OctoPrint-PrusaMeshMap (archived Github repository).</p>
<p>That code saves the heatmap in this line:</p>
<pre><code>fig.savefig(self.get_asset_folder() + '/img/heatmap.png', bbox_inches="tight")
</code></pre>
<p>It uses Pyplot</p>
<pre><code>import matplotlib.pyplot as plt
</code></pre>
<p>and thus the code should probably use (untested!)</p>
<pre><code>plt.close(fig)
del fig
</code></pre>
<p>to free the resources.
Unfortunately it's not possible to file this as an issue because the Github repository is in archived mode and thus readonly.</p>
|
<p>You have found a bug in the OctoPrint plugin. As you noticed, not more than 20 graphs can be created/open at a time. This implies that the developer has not implemented pyplot correctly, this is a common mistake that I have ran into myself once or twice. You should notify the developer.</p>
<p>The problem is that the old graph is not destroyed or not properly updated (I think it is intended to update the graph). The code passes the create plot multiple times and after 20 graphs it will drop the error message.</p>
<p>If you reset the Pi or reload the Octoprint server you are probably good to go for another 20 graphs.</p>
| 1,679
|
<p>I'm having trouble ordering by more than one field in my Linq to NHibernate query. Does anyone either know what might be wrong or if there is a work around?</p>
<p>Code:</p>
<pre><code>IQueryable<AgendaItem> items = _agendaRepository.GetAgendaItems(location)
.Where(item => item.Minutes.Contains(query) || item.Description.Contains(query));
int total = items.Count();
var results = items
.OrderBy(item => item.Agenda.Date)
.ThenBy(item => item.OutcomeType)
.ThenBy(item => item.OutcomeNumber)
.Skip((page - 1)*pageSize)
.Take(pageSize)
.ToArray();
return new SearchResult(query, total, results);
</code></pre>
<p>I've tried replacing ThenBy with multiple OrderBy calls. Same result. The method works great if I comment out the two ThenBy calls.</p>
<p>Error I'm receiving:</p>
<pre>
[SqlException (0x80131904): Invalid column name '__hibernate_sort_expr_0____hibernate_sort_expr_1__'.
Invalid column name '__hibernate_sort_expr_0____hibernate_sort_expr_1__'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1948826
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844747
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
[ADOException: could not execute query
[ SELECT this_.Id as Id5_2_, this_.AgendaId as AgendaId5_2_, this_.Description as Descript3_5_2_, this_.OutcomeType as OutcomeT4_5_2_, this_.OutcomeNumber as OutcomeN5_5_2_, this_.Minutes as Minutes5_2_, agenda1_.Id as Id2_0_, agenda1_.LocationId as LocationId2_0_, agenda1_.Date as Date2_0_, location2_.Id as Id7_1_, location2_.Name as Name7_1_ FROM AgendaItem this_ left outer join Agenda agenda1_ on this_.AgendaId=agenda1_.Id left outer join Location location2_ on agenda1_.LocationId=location2_.Id WHERE location2_.Id = ? and (this_.Minutes like ? or this_.Description like ?) ORDER BY agenda1_.Date asc, this_.OutcomeType asc, this_.OutcomeNumber asc ]
Positional parameters: #0>1 #0>%Core% #0>%Core%
[SQL: SELECT this_.Id as Id5_2_, this_.AgendaId as AgendaId5_2_, this_.Description as Descript3_5_2_, this_.OutcomeType as OutcomeT4_5_2_, this_.OutcomeNumber as OutcomeN5_5_2_, this_.Minutes as Minutes5_2_, agenda1_.Id as Id2_0_, agenda1_.LocationId as LocationId2_0_, agenda1_.Date as Date2_0_, location2_.Id as Id7_1_, location2_.Name as Name7_1_ FROM AgendaItem this_ left outer join Agenda agenda1_ on this_.AgendaId=agenda1_.Id left outer join Location location2_ on agenda1_.LocationId=location2_.Id WHERE location2_.Id = ? and (this_.Minutes like ? or this_.Description like ?) ORDER BY agenda1_.Date asc, this_.OutcomeType asc, this_.OutcomeNumber asc]]
NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +258
NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) +18
NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) +87
NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) +342
NHibernate.Impl.CriteriaImpl.List(IList results) +41
NHibernate.Impl.CriteriaImpl.List() +35
NHibernate.Linq.CriteriaResultReader`1.List() in C:\home\dev\tools\NHibernate\NHibernateContribSrc\src\NHibernate.Linq\src\NHibernate.Linq\CriteriaResultReader.cs:22
NHibernate.Linq.d__0.MoveNext() in C:\home\dev\tools\NHibernate\NHibernateContribSrc\src\NHibernate.Linq\src\NHibernate.Linq\CriteriaResultReader.cs:27
</pre>
|
<p>This looks to me like a bug with Linq to NHybernate. One possible workaround is to convert to an array before sorting. A potentially big downside is that you can't limit the results using Skip() and Take() before enumerating, so this may not be sufficient for you.</p>
<pre><code>var results = items
.ToArray()
.OrderBy(item => item.Agenda.Date)
.ThenBy(item => item.OutcomeType)
.ThenBy(item => item.OutcomeNumber)
.Skip((page - 1)*pageSize)
.Take(pageSize)
</code></pre>
|
<p>although i dont think it'd make a difference, what happens if you do your linq like this:</p>
<p>(from i in items orderby i.prop1, i.prop2, i.prop3).Skip(...).Take(...).ToArray();</p>
| 8,582
|
<p>I'm wondering how the few Delphi users here are doing unit testing, if any? Is there anything that integrates with the IDE that you've found works well? If not, what tools are you using and do you have or know of example mini-projects that demonstrate how it all works?</p>
<h3>Update:</h3>
<p>I forgot to mention that I'm using BDS 2006 Pro, though I occasionally drop into Delphi 7, and of course others may be using other versions.</p>
|
<p><a href="http://dunit.sourceforge.net/" rel="noreferrer">DUnit</a> is a xUnit type of unit testing framework to be used with win32 Delphi. Since Delphi 2005 DUnit is integrated to a certan point into the IDE. Other DUnit integration tools for the Delphi IDE can be found <a href="http://www.elvenware.com/charlie/conferences/2004/talks/UnitTests/dunit/test_tools/index.html" rel="noreferrer">here</a>. DUnit comes with <a href="http://dunit.sourceforge.net/README.html" rel="noreferrer">documentation with examples</a>.</p>
|
<p>We tried to use DUnit with Delphi 5, but it didn't work well. Specially if you are implementing COM interfaces, we found many dependencies to setup all the test infrastructure. I don't know if the test support has improved in newer versions.</p>
| 3,890
|
<p>Is this a leveling problem? or it's because the bed temperature isn't equal in everywhere? </p>
<p>If it's because of leveling, it means the distance between nozzle and bed in this not-sticked corners are lot and should be decrease? </p>
<p>EDIT: material is ABS, and it's recommended temp is 190-230/80-100. But I use Cura high quality ABS default settings with 225/80. (But I had this problem with PLA with 190/60 degrees too)</p>
<p><a href="https://i.stack.imgur.com/8jJkv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8jJkv.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/Pc30D.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pc30D.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/8sh5T.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8sh5T.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/iqWOP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iqWOP.jpg" alt="enter image description here"></a></p>
<p>EDIT2: I have a cooling fan for my Arduino/ramps board. But there was a wire between it's blades and it didn't work. today I saw it and tried to fix but it's plastic duct broke. So I tried to put it by hand as how it's air can cool both the Electronics boars and the bed(you can see my fan in one of the pics in left side). And I got a nice printing results for the same part printing:</p>
<p><a href="https://i.stack.imgur.com/GlRIV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GlRIV.jpg" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/X5ImW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X5ImW.jpg" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/bNbJF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bNbJF.jpg" alt="enter image description here"></a></p>
<p>So the cooling fan for printing part is very important to stick print to bed and I will print a duct for extra fan very soon!</p>
|
<p>You can clearly print but there are also some problems it seems.</p>
<p>To see if you're about okay when it comes to leveling, I recommend to activate the 'skirt' in your slicer soft. Slic3r has it and I think most others too, it just makes the printer do a big one-layer all-around 'perimeter' around what is going to be printed before starting. You'll see quickly if there is not enough or too much space between the bed and the nozzle. You might catch other problems too (I love it because when the hotend drips a bit when leveling it get's smeared out far away from where the print is going to happen). </p>
<p>Your print looks like it is not optimal (overextrusion? no print-cooling? ...) so start with slowing down, first layer 20-25mm/s (Look at it when it's printed, it's very telling!). Then for the following ones, don't go over 40-50mm/s for starters.</p>
<p>Last but not least, you are printing ABS (but you said you had the problem with PLA too, hence my post), I have never printed ABS but for what I have read, you'll need a heatbed and a heated chamber(enclosed printer) to not have this kind of problems.</p>
<p>But for PLA especially; If you have a heat bed, don't put on too much heat when printing, I went from 60°C to 50°C, first layer, 30° then, and my prints now stick like they are melded onto my plate instead of skidding around.</p>
|
<p>For ABS, I use kapton tape, 90 degrees for the bed. You can also try acetone/ABS mixture (can be very thin). If you haven't got acetone, clean or new tape so there is no grease on it.</p>
<p>You can also try a higher nozzle temp for the first layer, sometimes that helps.</p>
<p>You can also try lowerimg the nozzle slightly, but it doesn't look bad. Increase flow rate to 110% probably wont do any harm - basically focus on the details before trying to print complicated parts.</p>
| 743
|
<p>In our current database development evironment we have automated build procceses check all the sql code out of svn create database scripts and apply them to the various development/qa databases.</p>
<p>This is all well and good, and is a tremdous improvement over what we did in the past, but we have a problem with rerunning scripts. Obviously this isn't a problem with some scripts like altering procedures, because you can run them over and over without adversly affecting the system. Right now to add metadata and run statements like create/alter table statements we add code to check and see if the objects exists, and if they do, don't run them.</p>
<p>Our problem is that we really only get one shot to run the script, because once the script has been run, the objects are in the environment and system won't run the script again. If something needs to change once it's been deployed, we have a difficult process of running update scripts agaist the update scripts and hoping that everything falls in the correct order and all of the PKs line up between the environments (the databases are, shall we say, "special").</p>
<p>Short of dropping the database and starting the process from scratch (the last most current release), does anyone have a more elegant solution to this? </p>
|
<p>I'm not sure how best to approach the problem in your specific environment, but I'd suggest reading up on Rail's migrations feature for some inspiration on how to get started. </p>
<p><a href="http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations" rel="nofollow noreferrer">http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations</a></p>
|
<p>if you want to have re-runnability in your scripts, then you can't have them as definitions... what I mean by this is that you need to focus on change scripts rather than here is my Table script.</p>
<p>let's say you have a table Customers:</p>
<pre><code>create table Customers (
id int identity(1,1) primary key,
first_name varchar(255) not null,
last_name varchar(255) not null
)
</code></pre>
<p>and later you want to add a status column. Don't modify your original table script, that one has already run (and can have the if(! exists) syntax to prevent it from causing errors while running again).</p>
<p>Instead, have a new script, called add_customer_status.sql</p>
<p>in this script you'll have something like:</p>
<pre><code>alter table Customers
add column status varchar(50) null
update Customers set status = 'Silver' where status is null
alter table Customers
alter column status varchar(50) not null
</code></pre>
<p>Again you can wrap this with an if(! exists) block to allow re-running, but here we've leveraged the notion that this is a change script, and we adapt the database accordingly. If there is data already in the customers table then we're still okay, since we add the column, seed it with data, then add the not null constraint.</p>
<p>Both of the migration frameworks mentioned above are good, I've also had excellent experience with <a href="http://code.google.com/p/migratordotnet" rel="nofollow noreferrer">MigratorDotNet</a>.</p>
| 7,220
|
<p>What Java library would you say is the best for consuming and parsing feeds? Requirements:</p>
<ul>
<li>Embeddable</li>
<li>Supports Atom & RSS</li>
<li>Has caching architecture</li>
<li>Should be able to deal with any feed format the same way</li>
</ul>
<p>(Please: <em>one</em> suggestion per answer.)</p>
|
<p>Will <a href="https://rome.dev.java.net/" rel="nofollow noreferrer">ROME</a> do?</p>
|
<p>We also use ROME. While the SAX/eventing based <a href="http://commons.apache.org/dormant/feedparser/" rel="nofollow">FeedParser</a> architecture is interesting it is a <code>dormant</code> project at Apache.
The "dormant" at Apache seems to imply NO binary download links and NO active development.</p>
| 8,958
|
<p>We have a set of applications that basically display a bunch of bitmaps and text, then allow user to press "buttons" (certain bitmaps) that cause actions to occur.</p>
<p>We currently have these implemented using DirectX and a bunch of code to place the bitmaps and handle the button-presses. But we'd like to have the following features:</p>
<ul>
<li>portable to Linux</li>
<li>some sort of "editor" that would allow us to lay out screens without hard-coding locations of elements in code</li>
<li>animation</li>
<li>we need to be able to overlay video</li>
<li>not resource intensive (these terminals don't have a lot of memory or CPU)</li>
<li>we're currently using C++, so management would prefer that, but other languages would be considered</li>
<li>We'd prefer a free, open-source solution, but would be willing to buy something if it is not too expensive. (We have a couple dozen developers, and tens of thousands of terminals deployed.)</li>
</ul>
<p>We don't like the common GUI toolkits or widgets. We want something that has more of the look of a game than of a dialog box.</p>
<p>Any suggestions for off-the-shelf stuff we could use?</p>
|
<p>Maybe the way to go is something like <a href="http://clutter-project.org/" rel="nofollow noreferrer">Clutter</a> or <a href="http://www.allegro.cc/" rel="nofollow noreferrer">Allegro</a>. If you check in this <a href="http://arstechnica.com/news.ars/post/20080604-hands-on-with-the-ubuntu-netbook-remix.html" rel="nofollow noreferrer">article</a> at ArsTechnica what they are using Clutter for, you might get an idea how to use it. I don't know for sure if it works on Windows, but I'm pretty sure it does, considering it only depends on libraries that are supported under Windows.</p>
|
<p>You could try <a href="http://www.wxwidgets.org/" rel="nofollow noreferrer">wxWidgets</a> (it has wxBitmapButton) or try to implement your own solution using <a href="http://www.libsdl.org/" rel="nofollow noreferrer">SDL</a> for all of the graphics.</p>
| 4,393
|
<p>How do I concatenate together two strings, of unknown length, in COBOL? So for example:</p>
<pre><code>WORKING-STORAGE.
FIRST-NAME PIC X(15) VALUE SPACES.
LAST-NAME PIC X(15) VALUE SPACES.
FULL-NAME PIC X(31) VALUE SPACES.
</code></pre>
<p>If <code>FIRST-NAME = 'JOHN '</code> and <code>LAST-NAME = 'DOE '</code>, how can I get:</p>
<pre><code>FULL-NAME = 'JOHN DOE '
</code></pre>
<p>as opposed to:</p>
<pre><code>FULL-NAME = 'JOHN DOE '
</code></pre>
|
<p>I believe the following will give you what you desire.</p>
<pre><code>STRING
FIRST-NAME DELIMITED BY " ",
" ",
LAST-NAME DELIMITED BY SIZE
INTO FULL-NAME.
</code></pre>
|
<p>You could try making a loop for to get the real length.</p>
| 6,903
|
<p>I'm interested in using Office 2007 to convert between the pre-2007 binary formats (.doc, .xls, .ppt) and the new Office Open XML formats (.docx, .xlsx, .pptx)</p>
<p>How would I do this? I'd like to write a simple command line app that takes in two filenames (input and output) and perhaps the source and/or destination types, and performs the conversion.</p>
|
<p>Microsoft has a page which gives several examples of writing scripts to "drive" MS Word. <a href="http://gallery.technet.microsoft.com/scriptcenter/3f1802f7-60da-4d5a-841a-12ae8a2f8a4b" rel="nofollow noreferrer">One such example</a> shows how to convert from a Word document to HTML. By changing the last parameter to any values listed <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdsaveformat%28VS.80%29.aspx" rel="nofollow noreferrer">here</a>, you can get the output in different formats.</p>
|
<p>The easiest way would be to use Automation thru the Microsoft.Office.Interop. libraries. You can create an instance of a Word application, for example. There are methods attached to the Application object that will allow you to open and close documents, plus pretty much anything else you can accomplish in VBA by recording a macro.</p>
<p>You could also just write the VBA code in your Office application to do roughly the same thing. Both approaches are equally valid, depending on your comfort in programming in C#, VB.NET or VBA.</p>
| 5,618
|
<p>For writing scripts for process automisation in Linux platform, which scripting language will be better? Shell script, Perl or Python or is there anything else? I am new to all of them. So, am just thinking to which one to go for?</p>
|
<p>The answer is: Whatever best fits the job!</p>
<p>My rule of thumb;</p>
<p><strong>Bash</strong> - for a short script that might need a for loop to do something repetitively.</p>
<p><strong>Perl</strong> - anything to do with some kind of text processing or file processing, especially if it's a one off. Just do a dirty nasty perl script and be done with it</p>
<p><strong>Python</strong> - If it's something you might want to do again or something very like it. Then at least you have a chance of being able to reuse the script. </p>
|
<p>On Linux? Choose your poison, basically. I like Python, others Ruby, still others Perl. Pick one and go for it. :-)</p>
| 9,584
|
<p>In C, what is the most efficient way to convert a string of hex digits into a binary <code>unsigned int</code> or <code>unsigned long</code>?</p>
<p>For example, if I have <code>0xFFFFFFFE</code>, I want an <code>int</code> with the base10 value <code>4294967294</code>.</p>
|
<p>You want <a href="http://www.cplusplus.com/reference/clibrary/cstdlib/strtol.html" rel="noreferrer"><code>strtol</code></a> or <a href="http://en.cppreference.com/w/c/string/byte/strtoul" rel="noreferrer"><code>strtoul</code></a>. See also the <a href="http://man7.org/linux/man-pages/man3/strtoul.3.html" rel="noreferrer">Unix man page</a></p>
|
<p>This currently only works with lower case but its super easy to make it work with both.</p>
<pre><code>cout << "\nEnter a hexadecimal number: ";
cin >> hexNumber;
orighex = hexNumber;
strlength = hexNumber.length();
for (i=0;i<strlength;i++)
{
hexa = hexNumber.substr(i,1);
if ((hexa>="0") && (hexa<="9"))
{
//cout << "This is a numerical value.\n";
}
else
{
//cout << "This is a alpabetical value.\n";
if (hexa=="a"){hexa="10";}
else if (hexa=="b"){hexa="11";}
else if (hexa=="c"){hexa="12";}
else if (hexa=="d"){hexa="13";}
else if (hexa=="e"){hexa="14";}
else if (hexa=="f"){hexa="15";}
else{cout << "INVALID ENTRY! ANSWER WONT BE CORRECT\n";}
}
//convert from string to integer
hx = atoi(hexa.c_str());
finalhex = finalhex + (hx*pow(16.0,strlength-i-1));
}
cout << "The hexadecimal number: " << orighex << " is " << finalhex << " in decimal.\n";
</code></pre>
| 3,157
|
<p>I am writing a unit test to check that a private method will close a stream.</p>
<p>The unit test calls methodB and the variable something is null</p>
<p>The unit test doesn't mock the class on test</p>
<p>The private method is within a public method that I am calling.</p>
<p>Using emma in eclipse (via the eclemma plugin) the method call is displayed as not being covered even though the code within the method is</p>
<p>e.g</p>
<pre><code>public methodA(){
if (something==null) {
methodB(); //Not displayed as covered
}
}
private methodB(){
lineCoveredByTest; //displayed as covered
}
</code></pre>
<p>Why would the method call not be highlighted as being covered?</p>
|
<p>I have found that the eclipse plugin for EMMA is quite buggy, and have had similar experiences to the one you describe. Better to just use EMMA on its own (via ANT if required). Make sure you always regenerate the metadata files produced by EMMA, to avoid merging confusion (which I suspect is the problem with the eclipse plugin).</p>
|
<p>I assume when you say 'the unit test calls <code>methodB()</code>', you mean not directly and via <code>methodA()</code>. </p>
<p>So, is it possible <code>methodB()</code> is being called elsewhere, by another unit test or <code>methodC()</code> maybe?</p>
| 8,029
|
<p>In many places, <code>(1,2,3)</code> (a tuple) and <code>[1,2,3]</code> (a list) can be used interchangeably.</p>
<p>When should I use one or the other, and why?</p>
|
<p>From the <a href="http://www.python.org/doc/faq/general/#why-are-there-separate-tuple-and-list-data-types" rel="noreferrer">Python FAQ</a>:</p>
<blockquote>
<p>Lists and tuples, while similar in many respects, are generally used in fundamentally different ways. Tuples can be thought of as being similar to Pascal records or C structs; they're small collections of related data which may be of different types which are operated on as a group. For example, a Cartesian coordinate is appropriately represented as a tuple of two or three numbers.</p>
<p>Lists, on the other hand, are more like arrays in other languages. They tend to hold a varying number of objects all of which have the same type and which are operated on one-by-one.</p>
</blockquote>
<p>Generally by convention you wouldn't choose a list or a tuple just based on its (im)mutability. You would choose a tuple for small collections of completely different pieces of data in which a full-blown class would be too heavyweight, and a list for collections of any reasonable size where you have a homogeneous set of data.</p>
|
<p><code>(1,2,3)</code> is a tuple while <code>[1,2,3]</code> is a list. A tuple is an immutable object while a list is mutable.</p>
| 2,419
|
<p>We have an application that works with MS Office and uses Microsoft.mshtml.dll. We use ClickOnce to deploy the application. The application deploys without issues on most machines, but sometimes we get errors saying "System Update Required, Microsoft.mshtl.dll should be in the GAC". </p>
<p>We tried installing the PIA for Office without luck. Since Microsoft.mshtml.dll is a system dependent file we cannot include it in the package and re-distribute it. What would be the best way to deploy the application?</p>
|
<p>Do you know which version of MS Office you are targeting? These PIAs are very specific to the version of Office. I remember when we were building a smart client application, we used to have Build VM machines, each one targeting a specific version of Outlook.</p>
<p>Another hurdle was not being able to specify these PIAs as pre-requisites or bundle them with the app. These PIAs needs to be installed on the client using Office CD (<a href="http://msdn.microsoft.com/en-us/library/aa159923.aspx" rel="nofollow noreferrer">at least for 2003 version</a>).</p>
|
<p>You can <a href="http://msdn.microsoft.com/en-us/library/h4k032e1.aspx" rel="nofollow noreferrer">set up prerequisites in a clickonce app</a>, which would check for specific assemblies in the GAC before allowing users to install. You would still need to manually install an app that includes the required office dll outside of ClickOnce, but you would at least avoid throwing errors.</p>
| 7,838
|
<p>I often switch my print material, i.e. ABS / PLA / Wood / Flex,</p>
<p>How can I best clean out my extruder between them to ensure I don't contaminate my next print?</p>
|
<p>If you feel you need to <em>clean</em> the nozzle the best approach is a <em>cold pull</em>. You can perform this procedure with many printers, however, you should seek advice from your printer manufacturer before attempting this process if you have any doubts.</p>
<p>With the previously filament still loaded and the tool head cold:</p>
<ul>
<li><p>Begin to raise the temperature of the tool to the printing temperature of <em>the next filament you intend to load</em></p></li>
<li><p>As it begins to warm up perform any tasks you normally perform during filament unloading (open the idler, for example). <strong>You should not be fighting against the extruder drive gear or any other part of the tool during this process!</strong></p></li>
<li><p>With a fair amount of pressure begin pulling on the filament</p></li>
<li><p>The old filament should eventually release from inside of the tool leaving the end of the filament roughly in a nice molded shape of the inside of the tool. Begin loading the next filament you intend to print and manually feed some filament through as the tool finishes heating</p></li>
</ul>
<p>Anything left over from the previous filament including pigment or other residue should be stuck to the end of the filament.</p>
<p>You can perform <em>cold pulls</em> as many times as you wish by loading new filament, extruding a small amount, letting it completely cool and repeating the steps.</p>
|
<p>Some people use a nylon "cleaning" filament when switching types of filaments. It heats well to a variety of temperatures and seems to stick well to whatever is in there when pulling it back out. Be sure to heat it up to the temperature of the filament being removed to get that to bind with the nylon.</p>
| 136
|
<p>I can display and select a single file in windows explorer like this:</p>
<pre><code>explorer.exe /select, "c:\path\to\file.txt"
</code></pre>
<p>However, I can't work out how to select more than one file. None of the permutations of select I've tried work.</p>
<p>Note: I looked at these pages for docs, neither helped.</p>
<p><a href="https://support.microsoft.com/kb/314853" rel="nofollow noreferrer">https://support.microsoft.com/kb/314853</a><br />
<a href="http://web.archive.org/web/20100716112458/http://www.infocellar.com:80/Win98/explorer-switches.htm" rel="nofollow noreferrer">http://web.archive.org/web/20100716112458/http://www.infocellar.com:80/Win98/explorer-switches.htm</a></p>
|
<p>This should be possible with the shell function <a href="http://msdn.microsoft.com/en-us/library/bb762232(VS.85).aspx" rel="noreferrer"><code>SHOpenFolderAndSelectItems</code></a></p>
<p><strong>EDIT</strong></p>
<p>Here is some sample code showing how to use the function in C/C++, without error checking:</p>
<pre><code>//Directory to open
ITEMIDLIST *dir = ILCreateFromPath(_T("C:\\"));
//Items in directory to select
ITEMIDLIST *item1 = ILCreateFromPath(_T("C:\\Program Files\\"));
ITEMIDLIST *item2 = ILCreateFromPath(_T("C:\\Windows\\"));
const ITEMIDLIST* selection[] = {item1,item2};
UINT count = sizeof(selection) / sizeof(ITEMIDLIST);
//Perform selection
SHOpenFolderAndSelectItems(dir, count, selection, 0);
//Free resources
ILFree(dir);
ILFree(item1);
ILFree(item2);
</code></pre>
|
<p>I suppose you can use <code>FindWindowEx</code> to get the SysListView32 of Windows Explorer, then use <code>SendMessage</code> with <code>LVM_SETITEMSTATE</code> to select the items. The difficulty being to know the position of the items... Perhaps <code>LVM_FINDITEM</code> can be used for this.</p>
| 3,079
|
<p>Starting with 2005, VS started this behavior of when starting debugging session it spawns up a webserver for every project in a solution. I have a solution with 15 projects so it takes a while and is a waste of resources. Is there a way to configure it differently besides just using IIS?</p>
|
<p>Some details here on why it does it and how you can overcome it:</p>
<p><a href="http://vishaljoshi.blogspot.com/2007/12/tips-tricks-start-up-options-and.html" rel="noreferrer">http://vishaljoshi.blogspot.com/2007/12/tips-tricks-start-up-options-and.html</a></p>
<blockquote>
<p>There are instances when you might have many web applications or web sites in the same solution and you may be actually debugging only one of them... In such scenario it might not be desirable to have multiple instances of ASP.NET Development Server running... VS provides an explicit setting in the property grid of web application/site called Development Web Server - "Always Start When Debugging" which is set to True by default... If you set this Property to be False only one web server instance will be created for the start up web project...</p>
</blockquote>
|
<p>I have also been highly annoyed by that behavior. The only solution I have found is to manually change the properties page for each web appllication so it hits a real running instance in IIS.</p>
<p>I prefer this anyway, because debugging with the integrated web server can give you a very false impression of how your application will interact with the IIS security model.</p>
| 3,707
|
<p>I have a generic class that should allow any type, primitive or otherwise. The only problem with this is using <code>default(T)</code>. When you call default on a value type or a string, it initializes it to a reasonable value (such as empty string). When you call <code>default(T)</code> on an object, it returns null. For various reasons we need to ensure that if it is not a primitive type, then we will have a default instance of the type, <strong>not</strong> null. Here is attempt 1:</p>
<pre><code>T createDefault()
{
if(typeof(T).IsValueType)
{
return default(T);
}
else
{
return Activator.CreateInstance<T>();
}
}
</code></pre>
<p>Problem - string is not a value type, but it does not have a parameterless constructor. So, the current solution is:</p>
<pre><code>T createDefault()
{
if(typeof(T).IsValueType || typeof(T).FullName == "System.String")
{
return default(T);
}
else
{
return Activator.CreateInstance<T>();
}
}
</code></pre>
<p>But this feels like a kludge. Is there a nicer way to handle the string case?</p>
|
<p>Keep in mind that default(string) is null, not string.Empty. You may want a special case in your code:</p>
<pre><code>if (typeof(T) == typeof(String)) return (T)(object)String.Empty;
</code></pre>
|
<p>The discussion for String is not working here.</p>
<p>I had to have following code for generics to make it work -</p>
<pre><code> private T createDefault()
{
{
if(typeof(T).IsValueType)
{
return default(T);
}
else if (typeof(T).Name == "String")
{
return (T)Convert.ChangeType(String.Empty,typeof(T));
}
else
{
return Activator.CreateInstance<T>();
}
}
}
</code></pre>
| 5,146
|
<p>Is there a way to get the current xml data when we make our own custom XPath function (see here).</p>
<p>I know you have access to an <code>XPathContext</code> but is this enough?</p>
<p><strong>Example:</strong></p>
<p>Our XML:</p>
<pre><code><foo>
<bar>smang</bar>
<fizz>buzz</fizz>
</foo>
</code></pre>
<p>Our XSL:</p>
<pre><code><xsl:template match="/">
<xsl:value-of select="ourFunction()" />
</xsl:template>
</code></pre>
<p>How do we get the entire XML tree?</p>
<p><strong>Edit:</strong> To clarify: I'm creating a custom function that ends up executing static Java code (it's a Saxon feature). So, in this Java code, I wish to be able to get elements from the XML tree, such as bar and fizz, and their CDATA, such as smang and buzz.</p>
|
<p>There is the classic 'ab' (apachebench) program. More power comes from <a href="http://jakarta.apache.org/jmeter/" rel="nofollow noreferrer">JMmeter</a>. For server health, I recommend Munin, which can painlessly capture data from several systems and aggregate it on one page. </p>
|
<p>Try <a href="http://www.nagios.org/" rel="nofollow noreferrer">Nagios</a>, it's the default tool to monitor servers. You can write plugins to report just about any data. </p>
| 9,486
|
<p>What is the best method for including a CSS or Javascript file for a specific node in Drupal 6.</p>
<p>I want to create a page on my site that has a little javascript application running, so the CSS and javascript is specific to that page and would not want to be included in other page loads at all.</p>
|
<p>I'd advise against using <code>hook_nodeapi</code> for that. Adding CSS and Javascript is related to layout so <code>hook_nodeapi</code> is not the place for it: use themeing. This way, you <em>can</em> override those files when you're going to develop a new theme. Doing that with the nodeapi approach would be a bit harder (you'd have to search the js/css list for the files, remove them and replace them with your own).</p>
<p>Anyway: what you need to do is add a node preprocess function that adds those files for you. You can do this either in a module or in a custom theme. For a module this would be:</p>
<pre><code>function mymodule_preprocess_node(&$variables) {
$node = $variables['node'];
if (!empty($node) && $node->nid == $the_specific_node_id) {
drupal_add_js(drupal_get_path('module', 'mymodule') . "/file.js", "module");
drupal_add_css(drupal_get_path('module', 'mymodule') . "/file.css", "module");
}
}
</code></pre>
<p>or for a theme:</p>
<pre><code>function mytheme_preprocess_node(&$variables) {
$node = $variables['node'];
if (!empty($node) && $node->nid == $the_specific_node_id) {
drupal_add_js(path_to_theme() . "/file.js", "theme");
drupal_add_css(path_to_theme(). "/file.css", "theme");
}
}
</code></pre>
<p>Don't forget to clear the cache, first. </p>
<p>These functions are called before the node is themed. Specifing the js/css there allows for a cascaded approach: you can have the generic/basic stuff in the module and provide enhanced or specific functionality in the theme.</p>
|
<p>You can have a custom template for that node (node-needsjs.tpl.php) which calls the javascript. That's a little cleaner than using PHP right in the node body, and makes changes to content easier in the future.</p>
<p><strong>EDIT:</strong> I don't think I was very clear above. You want to name the template file node-(nodeid).tpl.php. So if it was Node 1, call the file node-1.tpl.php</p>
| 8,702
|
<p>I have a container div with a fixed <code>width</code> and <code>height</code>, with <code>overflow: hidden</code>.</p>
<p>I want a horizontal row of float: left divs within this container. Divs which are floated left will naturally push onto the 'line' below after they read the right bound of their parent. This will happen even if the <code>height</code> of the parent should not allow this. This is how this looks:</p>
<p><img src="https://i.stack.imgur.com/v2x7d.png" alt="Wrong" /></p>
<p>How I would like it to look:</p>
<p>![Right][2] - <em>removed image shack image that had been replaced by an advert</em></p>
<p>Note: the effect I want can be achieved by using inline elements & <code>white-space: no-wrap</code> (that is how I did it in the image shown). This, however, is no good to me (for reasons too lengthy to explain here), as the child divs need to be floated block level elements.</p>
|
<p>You may put an inner div in the container that is enough wide to hold all the floated divs.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>#container {
background-color: red;
overflow: hidden;
width: 200px;
}
#inner {
overflow: hidden;
width: 2000px;
}
.child {
float: left;
background-color: blue;
width: 50px;
height: 50px;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div id="container">
<div id="inner">
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
</div>
</div></code></pre>
</div>
</div>
</p>
|
<p>Float them left. In Chrome, at least, you don't need to have a wrapper, <code>id="container"</code>, in LucaM's example.</p>
| 5,780
|
<p>Is it possible to format certain text in a WinForm Label instead of breaking the text into multiple labels? Please disregard the HTML tags within the label's text; it's only used to get my point out.</p>
<p>For example:</p>
<pre><code>Dim myLabel As New Label
myLabel.Text = "This is <b>bold</b> text. This is <i>italicized</i> text."
</code></pre>
<p>Which would produce the text in the label as:</p>
<blockquote>
<p>This is <strong>bold</strong> text. This is
<em>italicized</em> text.</p>
</blockquote>
|
<p>That's not possible with a WinForms label as it is. The label has to have exactly one font, with exactly one size and one face. You have a couple of options:</p>
<ol>
<li>Use separate labels</li>
<li>Create a new Control-derived class that does its own drawing via GDI+ and use that instead of Label; this is probably your best option, as it gives you complete control over how to instruct the control to format its text</li>
<li>Use a third-party label control that will let you insert HTML snippets (there are a bunch - check CodeProject); this would be someone else's implementation of #2.</li>
</ol>
|
<p>Yeah.
You can implements, using HTML Render.
For you see, click on the link: <a href="https://htmlrenderer.codeplex.com/" rel="nofollow">https://htmlrenderer.codeplex.com/</a>
I hope this is useful.</p>
| 3,246
|
<p>I'm trying to choose a tool for creating UML diagrams of all flavours. Usability is a major criteria for me, but I'd still take more power with a steeper learning curve and be happy. Free (as in beer) would be nice, but I'd be willing to pay if the tool's worth it. What should I be using?</p>
|
<p>Some context: Recently for graduate school I researched UML tools for usability and UML comprehension in general for an independent project. I also model/architect for a living.</p>
<p>The previous posts have too many answers and not enough questions. A common misunderstanding is that UML is about creating diagrams. Sure, diagrams are important, but really you are creating a model. Here are the questions that should be answered as each vendor product/solution does some things better than others. <em>Note: The listed answers are my view as the best even if other products support a given feature or need.</em></p>
<ul>
<li>Are you modeling or drawing? (Drawing - <a href="http://argouml.tigris.org/" rel="noreferrer">ArgoUML</a>, free implementations, and <a href="http://office.microsoft.com/visio/" rel="noreferrer">Visio</a>)<br/></li>
<li>Will you be modeling in the future? (For basic modeling - Community editions of pay products)<br/></li>
<li>Do you want to formalize your modeling through profiles or meta-models? OCL? (<a href="http://www.sparxsystems.com" rel="noreferrer">Sparx</a>, RSM, <a href="http://www.visual-paradigm.com/product/vpuml/" rel="noreferrer">Visual Paradigm</a>)<br/></li>
<li>Are you concerned about model portability, XMI support? (<a href="http://www.genmymodel.com" rel="noreferrer">GenMyModel</a>, <a href="http://www.sparxsystems.com" rel="noreferrer">Sparx</a>, <a href="http://www.visual-paradigm.com/product/vpuml/" rel="noreferrer">Visual Paradigm</a>, <a href="http://www.altova.com/umodel.html" rel="noreferrer">Altova</a>)<br/></li>
<li>Do you have an existing set of documents that you need to work with? (Depends on the documents)<br/></li>
<li>Would you want to generate code stubs or full functioning code?(<a href="http://www.genmymodel.com" rel="noreferrer">GenMyModel</a>, <a href="http://www.visual-paradigm.com/product/vpuml/" rel="noreferrer">Visual Paradigm</a>, <a href="http://www.sparxsystems.com" rel="noreferrer">Sparx</a>, <a href="http://www.altova.com/umodel.html" rel="noreferrer">Altova</a>)<br/></li>
<li>Do you need more mature processes such as use case management, pattern creation, asset creation, RUP integration, etc? (RSA/RSM/IBM Rational Products) <br/></li>
</ul>
<p>Detailed Examples: IBM Rational Software Architect did not implement UML 2.0 all the way when it comes to realizes type relationships when creating a UML profile, but Visual Paradigm and Sparx got it right. <br/>
Ok, that was way too detailed, so a simpler example would be <a href="http://argouml.tigris.org/" rel="noreferrer">ArgoUML</a>, which has no code generation features and focuses on drawing more than the modeling aspect of UML. <br/> <a href="http://www.sparxsystems.com" rel="noreferrer">Sparx</a> and <a href="http://www.visual-paradigm.com/product/vpuml/" rel="noreferrer">Visual Paradigm</a> do UML really well and generate code well, however, hooking into project lifecycles and other process is where RSM/RSA is strong. <br/>
Watch out for closed or product specific code generation processes or frameworks as you could end up stuck with that product.</p>
<p>This is a straight brain dump so a couple details may not be perfect, however, this should provide a general map to the questions and solutions to looking into.</p>
<p>NEW - Found a good list of many UML tools with descriptions. <a href="http://en.wikipedia.org/wiki/List_of_UML_tools" rel="noreferrer">Wiki UML Tool List</a></p>
|
<p>You might want to check out <a href="http://argouml.tigris.org/" rel="nofollow noreferrer">ArgoUML</a>. It's not the best tool I've ever used, but it's one of the better free ones I've seen. It's a little slow because it's written in Java, but it let's you do some basic UML diagrams with relative ease.</p>
| 3,619
|
<p>I have been looking to buy a new extruder. One of the options I have seen comes in "right handed" and "left handed". What does this mean? How can I tell what my current extruder is, so I get the right replacement?</p>
|
<p>The short answer to identify what extruder type you have is the <strong>rotation of the extruder gear</strong>. </p>
<p>CCW rotation to extrude = right-handed extruder</p>
<p>Detailed explanation is below.</p>
<hr>
<p>In addition to the other answers, the right-handed designation comes from math and pysics convention that has become a well known mnemonic in engineering practice:</p>
<p><a href="https://i.stack.imgur.com/a6dsA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a6dsA.png" alt="Right hand mnemonic"></a></p>
<p>or in its physics coat,</p>
<p><a href="https://i.stack.imgur.com/RolFm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RolFm.jpg" alt="right hand rule in physics"></a></p>
<blockquote>
<p><strong>The Right Hand Rule</strong>: Figure (a) shows a disk is rotating counterclockwise when viewed from above. Figure (b) shows the right-hand rule. The direction of angular velocity ω size and angular momentum L are defined to be the direction in which the thumb of your right hand points when you curl your fingers in the direction of the disk’s rotation as shown.
<sub><a href="https://courses.lumenlearning.com/boundless-physics/chapter/vector-nature-of-rotational-kinematics/" rel="nofollow noreferrer">reference</a></sub></p>
</blockquote>
<p>In a right-handed extruder, </p>
<p><a href="https://i.stack.imgur.com/UKSrb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UKSrb.png" alt="Right Handed Extruder Setup"></a></p>
<p>you place your thumb of your right hand in the direction of the shaft (so pointing it towards yourself in the image of the extruder above) to see that rotation in the direction of your curved fingers leads to extrusion of filament (in counterclockwise direction).</p>
<p>For a mirrored extruder they call it left-handed extruder.</p>
|
<p>This is an example of a right handed extruder setup:</p>
<p><a href="https://i.stack.imgur.com/UKSrb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UKSrb.png" alt="Right Handed Extruder Setup"></a></p>
<p>And this is an example of a left handed extruder setup:</p>
<p><a href="https://i.stack.imgur.com/TIdO6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TIdO6.png" alt="Left Handed Extruder Setup"></a></p>
<p>I believe that you can can choose whatever one you favor. With the right handed setup, you will be pushing down the red part with your right hand when inserting filament. With the left handed setup, you will be doing the same thing but then with your left hand. Personally, I favor the right handed setup (my right hand is my dominant and stronger hand). But, you should be able to choose whatever one you like! Be sure to check it will work with your printer though (extruder holder & hotend). </p>
| 1,313
|
<p>Has anyone worked with <a href="http://www.google.com.br/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDomain-specific_programming_language&ei=QyWvSIXcC4foebjSlHs&usg=AFQjCNFsZOnJm-AGmi5sxai8YI-0Al6wfA&sig2=6nX5EkUmNkEwiSKAkUeyZQ" rel="noreferrer">DSLs (Domain Specific Languages)</a> in the finance domain? I am planning to introduce some kind of DSL support in the application that I am working on and would like to share some ideas.</p>
<p>I am in a stage of identifying which are the most stable domain elements and selecting the features which would be better implemented with the DSL. I have not yet defined the syntax for this first feature.</p>
|
<p>Jay Fields and Obie Fernandez have written and talked extensively on the subject.</p>
<ul>
<li>Jay Fields intro on <a href="http://blog.jayfields.com/2008/02/designing-domain-specific-language.html" rel="noreferrer">Domain Specific Languages</a></li>
<li>Jay Fields' series on <a href="http://bnl.jayfields.com/01_introduction.html" rel="noreferrer">Business Natural Language</a></li>
<li>Obie Fernandez <a href="http://www.jroller.com/obie/entry/expressing_contract_terms_in_a" rel="noreferrer">Expressing Contract Terms in a DSL</a></li>
<li>A very good <a href="http://www.infoq.com/presentations/fields-business-natural-languages-ruby" rel="noreferrer">presentation</a> on infoQ by Jay Fields</li>
</ul>
<p>You'll also find general stuff on implementing DSL in Martin Fowler's writings (but not specific to finance).</p>
<ul>
<li><a href="http://martinfowler.com/dslwip/" rel="noreferrer">DSL</a></li>
</ul>
|
<p>We worked on the idea of creating a financial valuation DSL with Fairmat ( <a href="http://www.fairmat.com" rel="nofollow">http://www.fairmat.com</a> )</p>
<p>-it exposes a DSL which can be used to express pay-offs and payment dependencies
-it contains an extension model for creating new types of analytic and implementations of theoretical dynamics using .NET/ C# with our underlying math library (see some open source examples at <a href="https://github.com/fairmat" rel="nofollow">https://github.com/fairmat</a></p>
| 4,343
|
<p>I just switched to the Duet Wifi board (used MKS Gen L 1.0 before) and now small structures look terrible. From my observations the hot end moves correctly, but almost no filament gets extruded. On the other hand larger structures look very good. With the MKS board the exact same G-code worked fine.
After that I gradually disabled many features like coasting, wiping and even retractions altogether, the quality only improved by a tiny margin.</p>
<p>Example print (the two towers should be cylinders):
<a href="https://i.stack.imgur.com/jE94g.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jE94g.jpg" alt="Example print"></a></p>
<p>Additional information:</p>
<ul>
<li>Printer: JGAurora A5</li>
<li>Material: PETG</li>
<li>Slicer: Simplify3D</li>
</ul>
<p>More info (edit):</p>
<ul>
<li>Hot end temperature: 225 °C (for the affected layers)</li>
<li>Bed temperature: 60 °C (I corrected the thermistor data, it's equivalent to 70-75 °C on other JGAurora A5 printers)</li>
<li>Nozzle diameter: 0.4 mm</li>
<li>Part cooling fan: 100% (improved cooler duct by Da Hai Zhu)</li>
<li>Print speed: 50 mm/s (50% for outline)</li>
<li>The cylinder is printed hollow because of my infill settings</li>
<li>Lubricant is fresh, belts are tightened, so there should be no mechanical issues</li>
</ul>
|
<p>The OP found the solution and shared this in comments but has not written a proper answer. The OP found:</p>
<blockquote>
<p>To complete this, the issue was related to the part cooling fan not spinning correctly. After replacing it the problem was gone.</p>
</blockquote>
|
<p>This actually just looks like heating issues. Cura has an option to set a minimum layer time and speed, and any layer that takes less than that amount of time it'll lift the head away from the print to allow the plastic to cool.</p>
<p>Unfortunately, the only things I can find for Simplify3D around head lift and minimum layer times are software feature request posts from 2017, or some features around scaling print speed for small layers, but unfortunately that'll just print the same object much slower and may not properly allow the part to cool as the melting-temperature print head is still sitting directly on top of the part.</p>
<p>I hate to be someone to suggest a software change, but you might try using Cura and seeing if you get better results with features such as this. </p>
| 1,179
|
<p>In Oracle, the number of rows returned in an arbitrary query can be limited by filtering on the "virtual" <code>rownum</code> column. Consider the following example, which will return, at most, 10 rows.</p>
<pre>SELECT * FROM all_tables WHERE rownum <= 10</pre>
<p>Is there a simple, generic way to do something similar in Ingres?</p>
|
<p>Blatantly changing my answer. "Limit 10" works for MySql and others, Ingres uses</p>
<pre><code>Select First 10 * from myTable
</code></pre>
<p><a href="http://docs.ingres.com/sqlref/Selectinteractive" rel="noreferrer">Ref</a></p>
|
<p>Hey Craig. I'm sorry, I made a Ninja Edit.
No, Limit 10 does not work, I was mistaken in thinking it was standard SQL supported by everyone. Ingres uses (according to doc) "First" to solve the issue.</p>
| 7,224
|
<p>I have a basic form with controls that are databound to an object implementing the <em>INotifyPropertyChanged</em> interface. I would like to add some validation to a couple of properties but dont want to go through implementing <em>IDataErrorInfo</em> for the sake of validating a couple of properties.</p>
<p>I have created the functions that perform the validation and return the error message (if applicable) in the object. What I would like to do is call these functions from my form when the relevant properties on the object have changed, and setup the <em>ErrorProvider</em> control in my form with any error messages that have been returned from the validation functions.</p>
<p>I have tried hooking up event handlers to the Validating and LostFocus events, but these seem to fire before my object is updated, and hence they are not validating the correct data. Its only when I leave the textbox, go back in and then leave again that the validation runs against the correct data.</p>
<p>Is there another event that I can hook into so that I can call these validation functions after the property on my object has been updated? Or am I better off just implementing the <em>IDataErrorInfo</em> interface?</p>
|
<p>What kind of printer is that? Regular printers don't print white. Create in-memory image and 'flatten' it (remove alpha channel) and then print the result.</p>
|
<p>Have you tried drawing a white rectangle to initialize the image before you call the DrawImage method?</p>
| 8,818
|
<p>I use emacs to edit my xml files (nxml-mode) and the files were generated by machine don't have any pretty formatting of the tags. </p>
<p>I have searched for pretty printing the entire file with indentation and saving it, but wasn't able to find an automatic way.</p>
<p>Is there a way? Or atleast some editor on linux which can do it. </p>
|
<p>You don't even need to write your own function - sgml-mode (a gnu emacs core module) has a built-in pretty printing function called (sgml-pretty-print ...) which takes region beginning and end arguments.</p>
<p>If you are cutting and pasting xml and you find your terminal is chopping the lines in arbitrary places you can use this <a href="http://curiousprogrammer.wordpress.com/2009/02/27/pretty-printing-xml/" rel="noreferrer">pretty printer</a> which fixes broken lines first.</p>
|
<p>I'm afraid I like Benjamin Ferrari version much better. The internal pretty print always places the end tag in a new line after the value, inserting unwanted CR in the tag values.</p>
| 3,351
|
<p>How do I know what nozzle to get for my Anet A6 printer? I want to get some hardened nozzles because I would love to print with some glow in the dark filament, but I know that eats up brass nozzles fast. But there is so many thread differences so I don't know which one to get, or even what thread the Anet A6 is. Could I have some help finding the thread type and what hardened nozzles would be recommended?</p>
|
<p>The <a href="https://www.creaform3d.com/en/customer-support/legacy-products/exascan-scanner" rel="nofollow noreferrer">Creaform EXAscan</a> is according to the manufacturer a laser based machine. This means that it determines data points and their positions by some triangonometry done with a laser, 32.000 times a second, resulting in very high density point clouds. This demands a powerful program to work with.</p>
<p>At some point, your company used <a href="http://www.directdimensions.com/port_featuredprojects.php?fileName=fp_rapidform" rel="nofollow noreferrer">Rapidform</a>, which costs a wooping 10 to 30 grand for a license. Other software in this niece are - <a href="https://forum.solidworks.com/thread/41681" rel="nofollow noreferrer">according to a solidworks thread</a> - <a href="https://de.3dsystems.com/software" rel="nofollow noreferrer">Geomagic</a> and <a href="https://www.innovmetric.com/en/products/polyworks-inspector" rel="nofollow noreferrer">PolyWorks</a>. The gist of the thread seems to be that these "big 3" were the best ones at the market in 2011. However I have no idea if they work together with the given hardware or what the later two cost.</p>
|
<p>So if the original manufacturer still exists, <a href="https://www.creaform3d.com/en/customer-support/legacy-products/exascan-scanner" rel="nofollow noreferrer">(which they appear to, and even list your scanner under 'legacy' products)</a> your best chance of getting it working is going to be to contact them directly. Using proprietary hardware WITHOUT the associated proprietary software can range from merely tedious but possible, to outright impossible, depending on the specific company. Oftentimes with tech products like this, the business model isn't about the product itself, but about the license fees for the software to use it. That they can charge yearly for. It's possible that the raw data is just a stereo camera file with extensions renamed, and equally possible that the firmware in the scanner will do some sort of check for valid license before it will even start scanning, they don't really have much info on their legacy products on their page</p>
| 869
|
<p>I have a website that I've just uploaded onto the Internet. When I browse to the site using Firefox 3.0.1 on Ubuntu I don't see the favicon; Firefox 3.0.1 on WinXP does display it.</p>
<p><strong>Why</strong> isn't the favicon displaying under Ubuntu? It's a favicon.ico file in the root directory, not referenced in the meta tags; would it work better as a GIF?</p>
|
<p>Previously, there was no favicon. The browser cached the lack of favicon. <a href="http://pcsupport.about.com/od/maintenance/ht/clearcacheff.htm" rel="noreferrer">Clear the Firefox cache</a>, and all is well.</p>
|
<p>Try taking a look at this <a href="https://stackoverflow.com/questions/6642/perfect-way-to-use-favicons">previous Question</a>, which shows you must put two meta tags in your html in order for it to work across all browsers and operating systems.</p>
| 2,846
|
<p><strong>Emacs</strong>: <code>C-U (79) #</code> » a pretty 79 character length divider</p>
<p><strong>VIM</strong>: <code>79-i-#</code> » see above</p>
<p><strong><a href="http://macromates.com/" rel="nofollow noreferrer">Textmate</a></strong>: ????</p>
<p>Or is it just assumed that we'll make a Ruby call or have a snippet somewhere?</p>
|
<p>I would create a bundle command to do this.</p>
<p>You can take editor selection as input to your script, then replace it with the result of execution. This command, for example, will take a selected number and print the character '#' that number of times.</p>
<pre><code>python -c "print '#' * $TM_SELECTED_TEXT"
</code></pre>
<p>Of course this example doesn't allow you to specify the character, but it gives you an idea of what's possible.</p>
|
<p>By taking the</p>
<pre><code>python -c "print '#' * $TM_SELECTED_TEXT"
</code></pre>
<p>a step further, you can duplicate the examples you gave in the question. </p>
<p>Just make a snippet, called divider or something, set the <code>tab trigger</code> field to something appropriate <code>'--'</code> for example, then enter something like:</p>
<pre><code>`python -c "print '_' * $TM_COLUMNS"`
</code></pre>
<p>Then when you type <code>--⇥</code> (dash dash tab), you should get a divider of the correct width. </p>
<p>True, you've lost some of the terseness that you get from vim, but this is far easier to reuse, and you only have to type it once. You can also use whatever language you like.</p>
| 8,990
|
<p>Can anyone recommend some good resources that highlight the differences between Oracle and the AS/400 database?</p>
<p>I am trying to help someone with a lot of AS/400 experience implement an Oracle installation, and they need some guidance.</p>
<p>A book or online resource would be ideal.</p>
|
<p>I've done this a fair few times and the solutions out there really depend on the environment (enterprise / mission critical or development). The BEST way would be the <strong><em>Oracle AS/400 Gateway</em></strong>. Here are some important links in that area:</p>
<p>Allow AS/400 apps to access oracle with the Oracle Access Manager:<br>
<a href="http://download.oracle.com/docs/html/B13951_01/toc.htm" rel="nofollow noreferrer">Installation Guide for the AS/400 Oracle Access Manager</a></p>
<p>Allow your Oracle apps to access AS/400 tables and be queried using Oracle:<br>
<a href="http://download.oracle.com/docs/html/B13983_01/toc.htm" rel="nofollow noreferrer">Oracle Transparent Gateway for DB/2</a></p>
<p>^^^Those products are fairly expensive but super powerful.^^^</p>
<p>Alternately, here are some more academic approaches to the situation:</p>
<p>Here's a technical comparison of the two technologies... It's a little propagandaish*.<br>
<a href="http://www.google.com/url?sa=t&ct=res&cd=3&url=http%3A%2F%2Fwww.cgisecurity.com%2Fdatabase%2Foracle%2Fpdf%2FCWP_9IVSDB_SECURITY.PDF&ei=RSuvSLSRDI6usAPE-Yht&usg=AFQjCNFNFGPT9WjTOibt5AmK7oQwTIq_Cg&sig2=34iBQyH401KRnKGQ8sSlKg" rel="nofollow noreferrer">Technical comparisons of Oracle and DB/2</a></p>
<p>Here's a document written from the opposite point of view - Someone moving from Oracle to DB2. I still find it's useful information:<br>
<a href="http://www.ibm.com/developerworks/db2/library/techarticle/dm-0401gupta/" rel="nofollow noreferrer">Leverage your Oracle 10g skills to learn DB2...</a></p>
<p>And another IBM link that has some really great information all around:<br>
<a href="http://www.ibm.com/developerworks/search/searchResults.jsp?searchType=1&pageLang=&displaySearchScope=dW&searchSite=dW&lastUserQuery1=oracle+db2+differences&lastUserQuery2=&lastUserQuery3=&lastUserQuery4=&qa=oracle%2520db2%2520differences&query=oracle+db2+&searchScope=dW&Go.x=0&Go.y=0" rel="nofollow noreferrer">IBM Developer Network Search Results</a></p>
<p>Hope this helps!</p>
<p>*Yes, I know propagandaish is not a real word.</p>
|
<p>These links are not AS/400 specific, but generally a good place starting with Oracle: </p>
<p><a href="http://tahiti.oracle.com" rel="nofollow noreferrer">http://tahiti.oracle.com</a><br>
<a href="http://asktom.oracle.com" rel="nofollow noreferrer">http://asktom.oracle.com</a></p>
| 4,344
|
<p>Is there another way to render graphics in C# beyond <a href="https://en.wikipedia.org/wiki/Graphics_Device_Interface#Windows_XP" rel="nofollow noreferrer">GDI+</a> and <a href="http://en.wikipedia.org/wiki/Microsoft_XNA" rel="nofollow noreferrer">XNA</a>? </p>
<p>(For the development of a tile map editor.)</p>
|
<p><a href="http://cs-sdl.sourceforge.net/" rel="nofollow noreferrer">SDL.NET</a> is the solution I've come to love. If you need 3D on top of it, you can use Tao.OpenGL to render inside it. It's fast, industry standard (<a href="http://en.wikipedia.org/wiki/Simple_DirectMedia_Layer" rel="nofollow noreferrer">SDL</a>, that is), and cross-platform.</p>
|
<p>You could try looking into WPF, using Visual Studio and/or Expression Blend. I'm not sure how sophisticated you're trying to get, but it should be able to handle a simple editor. Check out this <a href="http://msdn.microsoft.com/en-us/library/ms742562.aspx" rel="nofollow noreferrer">MSDN Article</a> for more info.</p>
| 8,261
|
<p>I recently heard that the 3D printing lab at my college can do fused-deposition with ABS and PLA, but I would like to use TPU, for greater flexibility.</p>
<p>Is it possible to feed a TPU filament into the same machine built for ABS/PLA? Or is there no difference? Assume the diameters of the filaments are the same.</p>
|
<blockquote>
<p>Is it possible to feed a TPU filament into the same machine built for ABS/PLA? Or is there no difference? Assume the diameters of the filaments are the same.</p>
</blockquote>
<p>The question is not what the machine is <em>built for</em> but <em>how</em> it is built. Let's break stuff down some into why some filaments work better than others and the challenges with them.</p>
<h2>Temperature range</h2>
<p>The first obstacle is the temperature range of the printer. For example, if your printer's Extruder can't get over 220 °C, you can't print ABS. You need to make sure your printer can match your intended filament's temperature range.</p>
<p>TPU usually prints around between the same temperatures for PLA and ABS, so it should work from that range.</p>
<h2>Heated Bed</h2>
<p>Most Filaments work better with a heated bed, but some are almost impossible to be printed without. For TPU, a heated bed should be used but is not absolutely mandatory.</p>
<h2>Heated Chamber</h2>
<p>Some filaments can't be printed without a heated chamber, others like ABS highly benefit from it. TPU is ambivalent on this as far as I know.</p>
<h2>Extruder Setup</h2>
<p>There's basically 3 extruder setups. Pellet extruders are super rare, so we don't concern about them. The other two are Direct Drive and Bowden. In a Direct Drive, the extruder motor is right over the hotend, and pushes the filament directly into it. In a Bowden setup, the hotend and the extruder motor are connected via a Bowden tube. Both have benefits and drawbacks:</p>
<p>A Bowden makes for a lighter carriage, leading to faster printing speeds. A Direct Drive has much less trouble with elastic filaments and can do much better with retraction.</p>
<p>TPU is one of the filaments that works much better with Direct Drive.</p>
<h2>Other considerations</h2>
<p>Some Print services do print in machines set up for one filament type and that only, because it prevents cross-contamination of the nozzles, especially when a high-temperature print material remains in it when a low-temperature print comes next. Having for example a little bit of ABS left in a printer that runs PLA next can lead to very very extreme clogging.</p>
|
<p>Most printers can print most filaments. However, some more exotic filaments are not suitable for all printers:</p>
<ul>
<li><p>To print a flexible filament such as TPU, the filament path from the extruder needs to be well-constrained. A bowden extruder is generally less good at handling flexible filaments than a direct extruder. Some direct extruders without a well-constrained filament path may also be unsuitable.</p></li>
<li><p>A printer without a heated bed won't be able to print filaments that tend to warp such as ABS.</p></li>
<li><p>A printer without a (heated) enclosure won't be able to print filaments that tend to warp <em>a lot</em> such as polycarbonate</p></li>
<li><p>A printer with a PTFE-lined hotend won't be able to print filaments that require higher temperatures. PETG is at the upper end of what can be (safely) printed with a PTFE-lined hotend, while filaments such as polycarbonate require temperatures well outside the usable range.</p></li>
<li><p>A printer with a standard brass nozzle won't be able to print (not long, anyways) abrasive filaments such as glow-in-the-dark.</p></li>
</ul>
<p>It is likely the printer at your lab will be able to handle TPU just fine. If it is a bowden printer then you might have some difficulty printing but it might still work depending on exactly how soft the filament is and how well-constrained the filament path.</p>
| 1,680
|
<p>Recently I got IE7 crashed on Vista on jar loading (presumably) with the following error:</p>
<pre><code>Problem signature:
Problem Event Name: BEX
Application Name: iexplore.exe
Application Version: 7.0.6001.18000
Application Timestamp: 47918f11
Fault Module Name: ntdll.dll
Fault Module Version: 6.0.6001.18000
Fault Module Timestamp: 4791a7a6
Exception Offset: 00087ba6
Exception Code: c000000d
Exception Data: 00000000
OS Version: 6.0.6001.2.1.0.768.3
Locale ID: 1037
Additional Information 1: fd00
Additional Information 2: ea6f5fe8924aaa756324d57f87834160
Additional Information 3: fd00
Additional Information 4: ea6f5fe8924aaa756324d57f87834160
</code></pre>
<p>Googling revealed this sort of problems <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1194672&SiteID=1" rel="noreferrer">is</a> <a href="http://support.mozilla.com/tiki-view_forum_thread.php?locale=eu&comments_parentId=101420&forumId=1" rel="noreferrer">common</a> <a href="http://www.eggheadcafe.com/software/aspnet/29930817/bex-problem.aspx" rel="noreferrer">for</a> <a href="http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vc.mfc&tid=d511c635-3c99-431d-8118-526d3e3fff00&cat=&lang=&cr=&sloc=&p=1" rel="noreferrer">Vista</a> and relates to <a href="http://www.gomanuals.com/java_not_working_on_windows_vista.shtml" rel="noreferrer">Java</a> (although SUN <a href="http://weblogs.java.net/blog/chet/archive/2006/10/java_on_vista_y.html" rel="noreferrer">negates</a>). Also I think it has something to do with DEP. I failed to find official Microsoft Kb.</p>
<p>So, the questions are:</p>
<ul>
<li>What BEX stands for?</li>
<li>What is it about?</li>
<li>How to deal with such kind of errors?</li>
</ul>
|
<p>BEX=Buffer overflow exception. See <a href="http://technet.microsoft.com/en-us/library/cc738483.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/cc738483.aspx</a> for details. However, c000000d is STATUS_INVALID_PARAMETER; the technet article talks primarily about status c0000005 or c0000409 (access violation/DEP)</p>
|
<p>Most likely there is an addon that is messing with IE.</p>
<p>You can try this.
1. Open IE
2. Switch to the Advanced tab.
3. Click the Reset Internet Explorer Settings button.
4. Click Reset to confirm the operation.
5. Click Close when the resetting process finished.
6. Uncheck Enable third-party browser extensions option in the Settings box.
7. Click Apply, click OK.</p>
<p>After this, check to see if it works and if it does, enable one addon at a time until you find the culprit. Then uninstall it and reinstall it if you need it.</p>
| 7,491
|
<p>I need a function called <code>SizeOfPipe()</code> which should return the size of a pipe - I only want to know how much data is in the pipe and not actually read data off the pipe itself. </p>
<p>I thought the following code would work:</p>
<pre><code>fseek (pPipe, 0 , SEEK_END);
*pBytes = ftell (pPipe);
rewind (pPipe);
</code></pre>
<p>but <code>fseek()</code> doesn't work on file descriptors. Another option would be to read the pipe then write the data back but would like to avoid this if possible. Any suggestions?</p>
|
<p>Depending on your unix implementation ioctl/FIONREAD might do the trick</p>
<pre>
err = ioctl(pipedesc, FIONREAD, &bytesAvailable);
</pre>
<p>Unless this returns the error code for "invalid argument" (or any other error) bytesAvailable contains the amount of data available for unblocking read operations at that time.</p>
|
<p>On Windows you can always use <code>PeekNamedPipe</code>, but I doubt that's what you want to do anyway.</p>
| 9,738
|
<p>Anet A8 with Cura. First time use. The extrusion temperature is set at 190 °C for PLA but the temperature never quite gets that hot, e.g. 189.2 °C. So the printer never prints.</p>
<p>The bed temperature is fine.</p>
<p>Any suggestions on how to fix?</p>
|
<p>Two common problems to look out for in this situation:</p>
<ul>
<li>Make sure that your <strong>part fan</strong> (the fan that is supposed to cool the filament you just extruded, and that does not start spinning until the print starts) do <em>not</em> blow air on the hot end of your extruder.</li>
<li>Make sure that your <strong>hot end is well insulated</strong>. If available for your printer, silicone sleeves are the best:</li>
</ul>
<p><a href="https://i.stack.imgur.com/7TKQM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7TKQM.jpg" alt="silicone sleeves"></a></p>
<p>otherwise the most common, universal and low-cost solution are cotton pads:</p>
<p><a href="https://i.stack.imgur.com/qcwSc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qcwSc.jpg" alt="enter image description here"></a></p>
|
<p>I had the same problem.</p>
<p><em><strong>If</strong> your mains supply is 110 V</em>, then make sure that the voltage selector switch of your PSU is set to 110 V... it should then print.</p>
<p>If the voltage selector switch is set to the default of 220 V, <em>and the mains supply is only 110 V</em>, then the PSU will not provide enough current.</p>
<hr />
<p>Note: If your mains is 240 V then changing the voltage selector to 110 V will damage your PSU or worse.</p>
| 807
|
<p>I want to use Powershell to write some utilities, leveraging our own .NET components to handle the actual work. This is in place of writing a small console app to tie the calls together. My question is where I would find a good source of documentation or tutorial material to help me fast track this?</p>
|
<p>If you want to load an assembly into your PowerShell session, you can use reflection and load the assembly.</p>
<pre><code>[void][System.Reflection.Assembly]::LoadFrom(PathToYourAssembly)
</code></pre>
<p>After you load your assembly, you can call static methods and create new instances of a class. </p>
<p>A good tutorial can be found <a href="http://stevenmurawski.com/powershell/2009/03/exploring-the-net-framework-with-powershell-constructors-part-3/" rel="nofollow noreferrer">here</a>.</p>
<p>Both books mentioned by EBGreen are excellent. The PowerShell Cookbook is very task oriented and PowerShell in Action is a great description of the language, its focus and useability. PowerShell in Action is one of my favorite books. :)</p>
|
<p>you can use <code>[]</code> or use <code>add-type -AssemblyName "System.example"</code> to use assembly for example use :</p>
<pre><code>[system.drawing]::class ...
</code></pre>
| 4,571
|
<p>I support a third party system that uses COM, classic ASP, and SQL Server. Our company has gone to using TFS as our source control provider - which pushes things through Visual Studio. So, what's the best way to get a classic asp front-end into Visual Studio?</p>
|
<p>When I had to do this, I created a blank solution in VS and then added the folders from the ASP site one at a time, adding "existing items" to each folder as I created it.</p>
<p>In this way I'm able to open the solution which keeps track of what files I had open at last open, plus I get the benefits of intellisense</p>
|
<p>Did any of you heard of Visual Web developer 2008 Express edition?
Work wonders for me.
Most important as soon as you ask to open website in it- it opens each folder of intended website and when you save project it does what you need to do to later open this website in regular visual studio.</p>
<p>It have some limited capability even to convert simple Classic ASP pages into NET code!</p>
| 4,067
|
<p>I am trying to find a way to determine at run-time how much memory a given class is using in .NET. Using <code>Marshal.SizeOf()</code> is out, as it only works on value types. Is there a way to check exactly how much memory a class uses?</p>
|
<p>I've only recently started looking into this type of thing, but i have found that memory profilers can give quite detailed information regarding instances of objects within your application.</p>
<p>Here are a couple that are worth trying:</p>
<ul>
<li><a href="http://www.red-gate.com/Products/ants_profiler/index.htm" rel="noreferrer">ANTS Profiler</a></li>
<li><a href="http://memprofiler.com/" rel="noreferrer">.NET Memory Profiler</a></li>
</ul>
|
<p>I agree that a memory profiler is the easiest way to get the information you are looking for. In addition to the two previously mentioned, I recommend JetBrains <a href="http://www.jetbrains.com/profiler/index.html" rel="nofollow noreferrer">dotTrace</a>, which is both a performance profiler and a memory profiler.</p>
<p>If you want to do it yourself, and are willing to get pretty deep into the guts of the CLR, you can use the <a href="http://msdn.microsoft.com/en-us/library/ms404386.aspx" rel="nofollow noreferrer">.NET Profiling API</a>, which is an unmanaged API that (as Microsoft says): "enables a profiler to monitor a program's execution by the common language runtime (CLR)." It's not exactly intended for casual use, but it does have an enormous amount of functionality.</p>
| 7,464
|
<p>In an Outlook 2003 macro; Is there a way to move a message between folders without changing the ReceivedTime-header?</p>
<p>I currently use the method <code>MailItem.Move</code>. But that automatically sets the <code>ReceivedTime</code> property to the current time, which isn't really what I want.</p>
|
<p>I just tried moving a mailitem from my inbox to the deleted items folder, and it seems to have kept the receivedtime without a problem...</p>
<p>You may want to try using the MailItem.copy function and moving the resulting mailitem object, but like I said I'm not seeing the same problem...</p>
<p>Hope that helps...</p>
|
<p>Do an item.Save() and then do item.Move(), It will stamp current timestamp.</p>
| 8,305
|
<p>I have to admit that I always forgot the syntactical intracacies of the naming patterns for Nant (eg. those used in filesets). The double asterisk/single asterisk stuff seems to be very forgettable in my mind.</p>
<p>Can someone provide a definitive guide to the naming patterns?</p>
|
<p>The rules are:</p>
<ul>
<li>a single star (*) matches zero or more characters <em>within a path name</em></li>
<li>a double star (**) matches zero or more characters <em>across directory levels</em></li>
<li>a question mark (?) matches exactly one character within a path name</li>
</ul>
<p>Another way to think about it is double star (**) matches slash (/) but single star (*) does not.</p>
<p>Let's say you have the files:</p>
<ol>
<li>bar.txt</li>
<li>src/bar.c</li>
<li>src/baz.c</li>
<li>src/test/bartest.c</li>
</ol>
<p>Then the patterns:</p>
<ul>
<li><code>*.c</code> matches nothing (there are no .c files in the current directory)</li>
<li><code>src/*.c</code> matches 2 and 3</li>
<li><code>*/*.c</code> matches 2 and 3 (because * only matches one level)</li>
<li><code>**/*.c</code> matches 2, 3, and 4 (because ** matches any number of levels)</li>
<li><code>bar.*</code> matches 1</li>
<li><code>**/bar.*</code> matches 1 and 2</li>
<li><code>**/bar*.*</code> matches 1, 2, and 4</li>
<li><code>src/ba?.c</code> matches 2 and 3
</li>
</ul>
|
<p>Check out the <a href="http://nant.sourceforge.net/release/latest/help/types/fileset.html" rel="nofollow noreferrer">Nant reference</a>. The fileset patterns are:</p>
<p>'*' matches zero or more characters, e.g. *.cs<br>
'?' matches one character, e.g. ?.cs</p>
<p>And '**' matches a directory tree e.g. src/**/*.cs will find all cs files in any sub-directory of src.</p>
| 9,522
|
<p>I'm already using <a href="http://www.matasano.com/log/958/enough-with-the-rainbow-tables-what-you-need-to-know-about-secure-password-schemes/" rel="nofollow noreferrer">salted hashing</a> to store passwords in my database, which means that I should be immune to <a href="https://en.wikipedia.org/wiki/Rainbow_table" rel="nofollow noreferrer">rainbow table</a> attacks.</p>
<p>I had a thought, though: what if someone does get hold of my database? It contains the users' email addresses. I can't really hash these, because I'll be using them to send notification emails, etc..</p>
<p>Should I encrypt them?</p>
|
<p>Bruce Schneier has a good response to this kind of problem.</p>
<blockquote>
<p>Cryptography is not the solution to your security problems. It might be part of the solution, or it might be part of the problem. In many situations, cryptography starts out by making the problem worse, and it isn't at all clear that using cryptography is an improvement.</p>
</blockquote>
<p>Essentially encrypting your emails in the database 'just in case' is not really making the database more secure. Where are the keys stored for the database? What file permissions are used for these keys? Is the database accesable publically? Why? What kind of account restrictions are in place for these accounts? Where is the machine stored, who has physical access to this box? What about remote login/ssh access etc. etc. etc.</p>
<p>So I guess you can encrypt the emails if you want, but if that is the extent of the security of the system then it really isn't doing much, and would actually make the job of maintaining the database harder.</p>
<p>Of course this could be part of an extensive security policy for your system - if so then great!</p>
<p>I'm not saying that it is a bad idea - But why have a lock on the door from Deadlocks'R'us which cost $5000 when they can cut through the plywood around the door? Or come in through the window which you left open? Or even worse they find the key which was left under the doormat. Security of a system is only as good as the weakest link. If they have root access then they can pretty much do what they want.</p>
<p><a href="https://stackoverflow.com/questions/70450/is-it-worth-encrypting-email-addresses-in-the-database#70484">Steve Morgan</a> makes a good point that even if they cannot understand the email addresses, they can still do a lot of harm (which could be mitigated if they only had SELECT access)</p>
<p>Its also important to know what your reasons are for storing the email address at all. I might have gone a bit overboard with <a href="https://stackoverflow.com/questions/767276/what-is-the-best-and-safest-way-to-store-user-email-addresses-in-the-database">this answer</a>, but my point is do you really need to store an email address for an account? The most secure data is data that doesn't exist.</p>
|
<p>You really have to weigh your worst case senario of someone obtaining those email addresses, the likelihood of someone obtaining them, and your extra effort/time needed to impliement the change.</p>
| 9,583
|
<p>We're seeing some pernicious, but rare, deadlock conditions in the Stack Overflow SQL Server 2005 database.</p>
<p>I attached the profiler, set up a trace profile using <a href="http://www.simple-talk.com/sql/learn-sql-server/how-to-track-down-deadlocks-using-sql-server-2005-profiler/" rel="noreferrer">this excellent article on troubleshooting deadlocks</a>, and captured a bunch of examples. The weird thing is that <strong>the deadlocking write is <em>always</em> the same</strong>:</p>
<pre><code>UPDATE [dbo].[Posts]
SET [AnswerCount] = @p1, [LastActivityDate] = @p2, [LastActivityUserId] = @p3
WHERE [Id] = @p0
</code></pre>
<p>The other deadlocking statement varies, but it's usually some kind of trivial, simple <strong>read</strong> of the posts table. This one always gets killed in the deadlock. Here's an example</p>
<pre><code>SELECT
[t0].[Id], [t0].[PostTypeId], [t0].[Score], [t0].[Views], [t0].[AnswerCount],
[t0].[AcceptedAnswerId], [t0].[IsLocked], [t0].[IsLockedEdit], [t0].[ParentId],
[t0].[CurrentRevisionId], [t0].[FirstRevisionId], [t0].[LockedReason],
[t0].[LastActivityDate], [t0].[LastActivityUserId]
FROM [dbo].[Posts] AS [t0]
WHERE [t0].[ParentId] = @p0
</code></pre>
<p>To be perfectly clear, we are not seeing write / write deadlocks, but read / write.</p>
<p>We have a mixture of LINQ and parameterized SQL queries at the moment. We have added <code>with (nolock)</code> to all the SQL queries. This may have helped some. We also had a single (very) poorly-written badge query that I fixed yesterday, which was taking upwards of 20 seconds to run every time, and was running every minute on top of that. I was hoping this was the source of some of the locking problems!</p>
<p>Unfortunately, I got another deadlock error about 2 hours ago. Same exact symptoms, same exact culprit write.</p>
<p>The truly strange thing is that the locking write SQL statement you see above is part of a very specific code path. It's <em>only</em> executed when a new answer is added to a question -- it updates the parent question with the new answer count and last date/user. This is, obviously, not that common relative to the massive number of reads we are doing! As far as I can tell, we're not doing huge numbers of writes anywhere in the app.</p>
<p>I realize that NOLOCK is sort of a giant hammer, but most of the queries we run here don't need to be that accurate. Will you care if your user profile is a few seconds out of date?</p>
<p>Using NOLOCK with Linq is a bit more difficult as <a href="http://www.hanselman.com/blog/GettingLINQToSQLAndLINQToEntitiesToUseNOLOCK.aspx" rel="noreferrer">Scott Hanselman discusses here</a>.</p>
<p>We are flirting with the idea of using</p>
<pre><code>SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
</code></pre>
<p>on the base database context so that all our LINQ queries have this set. Without that, we'd have to wrap every LINQ call we make (well, the simple reading ones, which is the vast majority of them) in a 3-4 line transaction code block, which is ugly.</p>
<p>I guess I'm a little frustrated that trivial reads in SQL 2005 can deadlock on writes. I could see write/write deadlocks being a huge issue, but <em>reads?</em> We're not running a banking site here, we don't need perfect accuracy every time.</p>
<p>Ideas? Thoughts?</p>
<hr>
<blockquote>
<p>Are you instantiating a new LINQ to SQL DataContext object for every operation or are you perhaps sharing the same static context for all your calls?</p>
</blockquote>
<p>Jeremy, we are sharing one static datacontext in the base Controller for the most part:</p>
<pre><code>private DBContext _db;
/// <summary>
/// Gets the DataContext to be used by a Request's controllers.
/// </summary>
public DBContext DB
{
get
{
if (_db == null)
{
_db = new DBContext() { SessionName = GetType().Name };
//_db.ExecuteCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
}
return _db;
}
}
</code></pre>
<p>Do you recommend we create a new context for every Controller, or per Page, or .. more often?</p>
|
<p>According to MSDN:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms191242.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms191242.aspx</a></p>
<blockquote>
<p>When either the
READ COMMITTED SNAPSHOT or
ALLOW SNAPSHOT ISOLATION database
options are ON, logical copies
(versions) are maintained for all data
modifications performed in the
database. Every time a row is modified
by a specific transaction, the
instance of the Database Engine stores
a version of the previously committed
image of the row in tempdb. Each
version is marked with the transaction
sequence number of the transaction
that made the change. The versions of
modified rows are chained using a link
list. The newest row value is always
stored in the current database and
chained to the versioned rows stored
in tempdb.</p>
<p>For short-running transactions, a
version of a modified row may get
cached in the buffer pool without
getting written into the disk files of
the tempdb database. If the need for
the versioned row is short-lived, it
will simply get dropped from the
buffer pool and may not necessarily
incur I/O overhead.</p>
</blockquote>
<p>There appears to be a slight performance penalty for the extra overhead, but it may be negligible. We should test to make sure.</p>
<p>Try setting this option and REMOVE all NOLOCKs from code queries unless it’s really necessary. NOLOCKs or using global methods in the database context handler to combat database transaction isolation levels are Band-Aids to the problem. NOLOCKS will mask fundamental issues with our data layer and possibly lead to selecting unreliable data, where automatic select / update row versioning appears to be the solution.</p>
<pre><code>ALTER Database [StackOverflow.Beta] SET READ_COMMITTED_SNAPSHOT ON
</code></pre>
|
<p>I would have to agree with Greg so long as setting the isolation level to read uncommitted doesn't have any ill effects on other queries.</p>
<p>I'd be interested to know, Jeff, how setting it at the database level would affect a query such as the following:</p>
<pre><code>Begin Tran
Insert into Table (Columns) Values (Values)
Select Max(ID) From Table
Commit Tran
</code></pre>
| 4,038
|
<p>I have a script that parses the filenames of TV episodes (show.name.s01e02.avi for example), grabs the episode name (from the www.thetvdb.com API) and automatically renames them into something nicer (Show Name - [01x02].avi)</p>
<p>The script works fine, that is until you try and use it on files that have Unicode show-names (something I never really thought about, since all the files I have are English, so mostly pretty-much all fall within <code>[a-zA-Z0-9'\-]</code>)</p>
<p>How can I allow the regular expressions to match accented characters and the likes? Currently the regex's config section looks like..</p>
<pre><code>config['valid_filename_chars'] = """0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@£$%^&*()_+=-[]{}"'.,<>`~? """
config['valid_filename_chars_regex'] = re.escape(config['valid_filename_chars'])
config['name_parse'] = [
# foo_[s01]_[e01]
re.compile('''^([%s]+?)[ \._\-]\[[Ss]([0-9]+?)\]_\[[Ee]([0-9]+?)\]?[^\\/]*$'''% (config['valid_filename_chars_regex'])),
# foo.1x09*
re.compile('''^([%s]+?)[ \._\-]\[?([0-9]+)x([0-9]+)[^\\/]*$''' % (config['valid_filename_chars_regex'])),
# foo.s01.e01, foo.s01_e01
re.compile('''^([%s]+?)[ \._\-][Ss]([0-9]+)[\.\- ]?[Ee]([0-9]+)[^\\/]*$''' % (config['valid_filename_chars_regex'])),
# foo.103*
re.compile('''^([%s]+)[ \._\-]([0-9]{1})([0-9]{2})[\._ -][^\\/]*$''' % (config['valid_filename_chars_regex'])),
# foo.0103*
re.compile('''^([%s]+)[ \._\-]([0-9]{2})([0-9]{2,3})[\._ -][^\\/]*$''' % (config['valid_filename_chars_regex'])),
]
</code></pre>
|
<p>Use a subrange of <code>[\u0000-\uFFFF]</code> for what you want.</p>
<p>You can also use the <code>re.UNICODE</code> compile flag. <a href="http://docs.python.org/lib/re-syntax.html" rel="nofollow noreferrer">The docs</a> say that if <code>UNICODE</code> is set, <code>\w</code> will match the characters <code>[0-9_]</code> plus whatever is classified as alphanumeric in the Unicode character properties database. </p>
<p>See also <a href="http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-05/2560.html" rel="nofollow noreferrer">http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-05/2560.html</a>.</p>
|
<p>\X seems to be available as a generic word-character in some languages, it allows you to match a single character disregarding of how many bytes it takes up. Might be useful.</p>
| 3,517
|
<p>How do I target .NET 3.5 alone after installing SP1 in VS2008? This is because VS 2008 lists only .NET 3.5, .NET 3.0 & .NET 2.0 and does not specifically show .NET 3.5 SP1.</p>
|
<p><a href="http://michael.toren.net/code/tcptraceroute/" rel="nofollow noreferrer">tcptraceroute</a></p>
|
<p>I have lot's of problems with that firewall. Having my server into EEUU doesn't help. If you need tools to test your site hosted outside from china like you were in China, you can try that page:</p>
<p><a href="http://www.websitepulse.com/help/tools.php" rel="nofollow noreferrer">http://www.websitepulse.com/help/tools.php</a></p>
<p>Good luck</p>
| 7,207
|
<p>I've been programming for 10+ years now for the same employer and only source code control we've ever used is VSS. (Sorry - That's what they had when I started). There's only ever been a few of us; two right now and we usually work alone, so VSS has worked ok for us. So, I have two questions: 1) Should we switch to something else like subversion, git, TFS, etc what exactly and why (please)? 2) Am I beyond all hope and destined to eternal damnation because VSS has corrupted me (as Jeff says) ?</p>
<p>Wow - thanks for all the great responses! </p>
<p>It sounds like I should clearify a few things. We are a MS shop (Gold parntner) and we mostly do VB, ASP.NET, SQL Server, sharepoint & Biztalk work. I have CS degree so I've done x86 assembly C, C++ on DEC Unix and Slackware Linux in a "time out of mind" ... </p>
<p>My concern with VSS is that now I'm working over a VPN a lot more and VSS's performance sux and I'm afraid that our 10+ y/o version 5 VSS database is going to get hoosed...
There's the LAN service that's supposed to speed things up, but Ive never used it and I'm not sure it helps with corruption - has anyone used the VSS LAN service? (new with VSS 2005) </p>
|
<p>I'd probably go with Subversion, if I were you. I'm a total Git fanatic at this point, but Subversion certainly has some advantages: </p>
<ul>
<li>simplicity</li>
<li>abundance of interoperable tools</li>
<li>active and supportive community</li>
<li>portable</li>
<li>Has really nice Windows shell integration</li>
<li>integrates with visual studio (I think - but surely through a third party)</li>
</ul>
<p>Git has many, many other advantages, but the above tend to be the ones people care about when asking general questions like the above.</p>
<p><strong>Edit</strong>: the company I now work for is using VisualSVN server, which is free. It makes setting up a Subversion repository on a Windows server stupid simple, and on the client we're using TortoiseSVN (for shell integration) and AnkhSVN for Visual Studio support. It's quite good, and should be fairly easy for even VSS users to pick up.</p>
<p><strong>Latter-day Edit</strong>: So....nearly eight years later, I would never recommend Subversion to anyone for any reason. I don't really recant, <em>per se</em>, because I think my advice was valid at the time. However, in 2016, Subversion retains almost none of the advantages it used to have over Git. The tooling for Git is superior to (and much more diverse) what it once was, and in particular, there's GitHub and other good Git hosting providers (BitBucket, Beanstalk, Visual Studio Online, just off the top of my head). Visual Studio now has Git support out-of-the-box, and it's actually pretty good. There are even PowerShell modules to give a more native Windows experience to denizens of the console. Git is even easier to set up and use than Subversion and doesn't require a server component. Git has become as ubiquitous as any single tool can be, and you really would only be cheating yourself to not use it (unless you just really want to use something not-Git). Don't misunderstand - this isn't me hating on Subversion, but rather me recognizing that it's a tool from another time, rather like a straight razor for shaving. </p>
|
<p>I'd say stick with what works for you. Unless you are having issues with VSS, why switch? Subversion is swell, though a little sticky to begin using it. TFS is far better than VSS, though it is fairly expensive for such a small team. I have not used git so I can't really speak to it.</p>
| 5,158
|
<p>Although the <a href="http://www.adobe.com/devnet/pdf/pdf_reference.html" rel="noreferrer">PDF specification</a> is available from Adobe, it's not exactly the simplest document to read through. PDF allows documents to be encrypted so that either a user password and/or an owner password is required to do various things with the document (display, print, etc). A common use is to lock a PDF so that end users can read it without entering any password, but a password is required to do anything else.</p>
<p>I'm trying to parse PDFs that are locked in this way (to get the same privileges as you would get opening them in any reader). Using an empty string as the user password doesn't work, but it seems (section 3.5.2 of the spec) that there has to be a user password to create the hash for the admin password.</p>
<p>What I would like is either an explanation of how to do this, or any code that I can read (ideally Python, C, or C++, but anything readable will do) that does this so that I can understand what I'm meant to be doing. Standalone code, rather than reading through (e.g.) the gsview source, would be best.</p>
|
<p>A plugin for GSview for viewing encrypted PDFs is <a href="http://www.cs.cmu.edu/~dst/Adobe/Gallery/Keating/" rel="nofollow noreferrer">here</a>.</p>
<p>If this works for you, you may be able to look at the source.</p>
|
<p>xpdf is probably a good reference implementation for this sort of problem. I have successfully used them to open encrypted pdfs before.</p>
| 7,202
|
<p><em>Disclaimer: This is not actually a programming question, but I feel the audience on stackoverflow is more likely to have an answer than most question/answer sites out there.</em></p>
<p>Please forgive me, Joel, for stealing your question. Joel asked this question on a podcast a while back but I don't think it ever got resolved. I'm in the same situation, so I'm also looking for the answer. </p>
<p>I have multiple devices that all sync with MS-Outlook. PCs, Laptops, Smartphones, PDAs, etc. all have the capability to synchronize their data (calendars, emails, contacts, etc.) with the Exchange server. I like to use the Outlook meeting notice or appointment reminders to remind me of an upcoming meeting or doctors appointment or whatever. The problem lies in the fact that all the devices pop up the same reminder and I have to go to every single device individually in order to snooze or dismiss all of the identical the reminder popups. </p>
<p>Since this is a sync'ing technology, why doesn't the fact that I snooze or dismiss on one device sync up the other devices automatically. I've even tried to force a sync after dismissing a reminder and it still shows up on my other devices after a forced sync. This is utterly annoying to me. </p>
<p>Is there a setting that I'm overlooking or is there a 3rd party reminder utility that I should be using instead of the built-in stuff?</p>
<p>Thanks,
Kurt</p>
|
<p>At least for PCs, the fact that you dismiss an item does get sync'd, and fairly quickly for me. I'm not sure why phones don't seem to do it, though. Maybe the ActiveSync protocol doesn't offer that option.</p>
|
<p>Thanks from me, too :)</p>
<p>Maybe it's because all your devices clocks are synchronized to a time server, so they all have the exactly correct atomic-clock time, and all the devices notify you within a couple of seconds of each other, so the "dismiss" synchronization just doesn't happen fast enough.</p>
| 3,443
|
<p>To grab the inode of a file in PHP, you can use this:</p>
<pre><code>$fs = stat($file);
echo $fs['ino'];
</code></pre>
<p>The problem with this is EVERYWHERE says it's slow and you should avoid it. So the question becomes what's the fast(er) way to do it?</p>
|
<p>You could use <a href="http://php.net/fileinode" rel="nofollow noreferrer"><code>fileinode()</code></a> but you should run benchmarks if you think it is slow.</p>
|
<p>I think you should benchmark and take a look at what you are doing to determine if stat() is the slowest part of your code. Stating 1 file on each request on a server that gets about 100 hits/day is not a problem. Stating every file could be a problem when you have to eek out a few more requests a second.</p>
<p>You can avoid stating the same file repeatedly by caching the results via memcached, apc or some other in-memory caching system.</p>
<p>Premature optimization is the root of all evil. - Donald Knuth</p>
| 4,008
|
<p>In our place we're split between using mysqli and PDO for stuff like prepared statements and transaction support. Some projects use one, some the other. There is little realistic likelihood of us ever moving to another RDBMS.</p>
<p>I prefer PDO for the single reason that it allows named parameters for prepared statements, and as far as I am aware mysqli does not.</p>
<p>Are there any other pros and cons to choosing one over the other as a standard as we consolidate our projects to use just one approach?</p>
|
<p>Well, you could argue with the object oriented aspect, the prepared statements, the fact that it becomes a standard, etc. But I know that most of the time, convincing somebody works better with a killer feature. So there it is:</p>
<p>A really nice thing with PDO is you can fetch the data, injecting it automatically in an object. If you don't want to use an <a href="http://en.wikipedia.org/wiki/Object-relational_mapping" rel="noreferrer">ORM</a> (cause it's a just a quick script) but you do like object mapping, it's REALLY cool :</p>
<pre><code>class Student {
public $id;
public $first_name;
public $last_name
public function getFullName() {
return $this->first_name.' '.$this->last_name
}
}
try
{
$dbh = new PDO("mysql:host=$hostname;dbname=school", $username, $password)
$stmt = $dbh->query("SELECT * FROM students");
/* MAGIC HAPPENS HERE */
$stmt->setFetchMode(PDO::FETCH_INTO, new Student);
foreach($stmt as $student)
{
echo $student->getFullName().'<br />';
}
$dbh = null;
}
catch(PDOException $e)
{
echo $e->getMessage();
}
</code></pre>
|
<p>There's one thing to keep in mind.</p>
<p>Mysqli does not support fetch_assoc() function which would return the columns with keys representing column names. Of course it's possible to write your own function to do that, it's not even very long, but I had <strong>really</strong> hard time writing it (for non-believers: if it seems easy to you, try it on your own some time and don't cheat :) )</p>
| 3,450
|
<p>Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression?</p>
|
<p>From <a href="http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx" rel="noreferrer">MSDN</a> about System.IO.Compression.GZipStream:</p>
<blockquote>
<p>This class represents the gzip data format, which uses an industry standard algorithm for lossless file compression and decompression.</p>
</blockquote>
<p>From the <a href="http://www.gzip.org/zlib/zlib_faq.html" rel="noreferrer">zlib FAQ</a>:</p>
<blockquote>
<p>The gz* functions in zlib on the other hand use the gzip format.</p>
</blockquote>
<p>So zlib and GZipStream should be interoperable, but only if you use the zlib functions for handling the gzip-format.</p>
<p>System.IO.Compression.Deflate and zlib are reportedly not interoperable.</p>
<p>If you need to handle zip files (you probably don't, but someone else might need this) you need to use <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx" rel="noreferrer">SharpZipLib</a> or another third-party library.</p>
|
<p>I agree with andreas. You probably won't be able to open the file in an external tool, but if that tool expects a stream you might be able to use it. You would also be able to deflate the file back using the same compression class.</p>
| 9,570
|
<p>I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a side-by-side diff of two HTML pages. The idea would be that the diff would show the differences of the <em>rendered</em> HTML.</p>
<p>To clarify, I want to be able to see the side-by-side diffs <em>as</em> rendered output. So if I delete a paragraph, the side by side view would know to space things correctly.</p>
<hr>
<p>@Josh exactly. Though maybe it would show the deleted text in red or something. The idea is that if I use a WYSIWYG editor for my HTML content, I don't want to have to switch to HTML to do diffs. I want to do it with two WYSIWYG editors side by side maybe. Or at least display diffs side-by-side in an end-user friendly matter.</p>
|
<p>There's another nice trick you can use to significantly improve the look of a rendered HTML diff. Although this doesn't fully solve the initial problem, it will make a significant difference in the appearance of your rendered HTML diffs.</p>
<p>Side-by-side rendered HTML will make it very difficult for your diff to line up vertically. Vertical alignment is crucial for comparing side-by-side diffs. In order to improve the vertical alignment of a side-by-side diff, you can insert invisible HTML elements in each version of the diff at "checkpoints" where the diff should be vertically aligned. Then you can use a bit of client-side JavaScript to add vertical spacing around checkpoint until the sides line up vertically.</p>
<p>Explained in a little more detail:</p>
<p>If you want to use this technique, run your diff algorithm and insert a bunch of <code>visibility:hidden</code> <code><span></code>s or tiny <code><div></code>s wherever your side-by-side versions should match up, according to the diff. Then run JavaScript that finds each checkpoint (and its side-by-side neighbor) and adds vertical spacing to the checkpoint that is higher-up (shallower) on the page. Now your rendered HTML diff will be vertically aligned up to that checkpoint, and you can continue repairing vertical alignment down the rest of your side-by-side page.</p>
|
<p>I believe a good way to do this is to <a href="http://weblogs.mozillazine.org/roc/archives/2005/05/rendering_web_p.html" rel="nofollow noreferrer">render the HTML to an image</a> and then use some <a href="http://www.scootersoftware.com/" rel="nofollow noreferrer">diff tool that can compare images</a> to spot the differences. </p>
| 5,165
|
<p>For my day job, I live in Emacs. Utterly. I also have become pretty dependent on CScope to help me find things in the code.</p>
<p>Normally, I have 2 windows in a split (C-x 3):
<a href="http://bitthicket.com/files/emacs-2split.JPG">alt text http://bitthicket.com/files/emacs-2split.JPG</a></p>
<p>And I use the right window for code buffers and the left window for the CScope search buffer. When you do a CScope search and select a result, it automatically updates the right-side window to show the buffer referred to by the result. This is all well and good, except that it causes me to lose my place in some other buffer that I was studying. Sometimes this is no biggie, because [C-s u] gets me back to where I was.</p>
<p>What would be better, though, is to have 3 split windows like this ([C-x 2] in the left window):
<a href="http://bitthicket.com/files/emacs-3split.jpg">alt text http://bitthicket.com/files/emacs-3split.jpg</a></p>
<p>And have the bottom left window contain the CScope search buffer, and the top left window be the only buffer that CScope ever updates. That way, I can see my CScope searches and navigate around the code without losing the buffer I'm focused on.</p>
<p>Anyone know how I can do that?</p>
|
<p>Put this in your .emacs file:</p>
<pre><code>;; Toggle window dedication
(defun toggle-window-dedicated ()
"Toggle whether the current active window is dedicated or not"
(interactive)
(message
(if (let (window (get-buffer-window (current-buffer)))
(set-window-dedicated-p window
(not (window-dedicated-p window))))
"Window '%s' is dedicated"
"Window '%s' is normal")
(current-buffer)))
</code></pre>
<p>Then bind it to some key - I use the Pause key:</p>
<pre><code>(global-set-key [pause] 'toggle-window-dedicated)
</code></pre>
<p>And then use it to "dedicate" the window you want locked. then cscope can only open files from its result window in some OTHER window. Works a charm. I specifically use it for exactly this purpose - keeping one source file always on screen, while using cscope in a second buffer/window, and looking at cscope results in a third.</p>
|
<p>Well, I decided to not be a reputation-whore and find the answer myself. I looked in cscope.el as shown on the Emacs wiki, as well as the xcscope.el that comes with the cscope RPM package on RHEL.</p>
<p>Neither appear to give a way to do what I'm wanting. The way is probably to edit the ELisp by adding a package variable like <code>*browse-buffer*</code> or something and just initialize that variable if not already initialized the first time the user does <code>[C-c C-s g]</code> or whatever, and always have the resulting code shown in <code>*browse-buffer*</code>. Then the user can put the <code>*browse-buffer*</code> wherever he wants it.</p>
| 6,533
|
<p>Is it possible to use BackGroundWorker thread in <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> 2.0 for the following scenario, so that the user at the browser's end does not have to wait for long time?</p>
<h2>Scenario</h2>
<ol>
<li>The browser requests a page, say SendEmails.aspx</li>
<li>SendEmails.aspx page creates a BackgroundWorker thread, and supplies the thread with enough context to create and send emails.</li>
<li>The browser receives the response from the ComposeAndSendEmails.aspx, saying that emails are being sent.</li>
<li>Meanwhile, the background thread is engaged in a process of creating and sending emails which could take some considerable time to complete.</li>
</ol>
<p>My main concern is about keeping the BackgroundWorker thread running, trying to send, say 50 emails while the ASP.NET workerprocess threadpool thread is long gone.</p>
|
<p>If you don't want to use the AJAX libraries, or the e-mail processing is REALLY long and would timeout a standard AJAX request, you can use an AsynchronousPostBack method that was the "old hack" in the .net 1.1 days. </p>
<p>Essentially what you do is have your submit button begin the e-mail processing in an asynchronous state, while the user is taken to an intermediate page. The benefit to this is that you can have your intermediate page refresh as much as needed, without worrying about hitting the standard timeouts. </p>
<p>When your background process is complete, it will put a little "done" flag in the database/application variable/whatever. When your intermediate page does a refresh of itself, it detects this flag and automatically redirects the user to the "done" page.</p>
<p>Again, AJAX makes all of this moot, but if for some reason you have a very intensive or timely process that has to be done over the web, this solution will work for you. I found a nice tutorial on it <a href="http://www.simple-talk.com/dotnet/asp.net/asynchronous-client-script-callbacks/" rel="noreferrer">here</a> and there are plenty more out there. </p>
<p>I had to use a process like this when we were working on a "web check-in" type application that was interfacing with a third party application and their import API was hideously slow.</p>
<p>EDIT: GAH! Curse you Guzlar and your god-like typing abilities 8^D.</p>
|
<p>It is possible. Once you start a new thread asynchronously from page, page request will proceed and send the page back to the user. The async thread will continue to run on the server but will no longer have access to the session.</p>
<p>If you have to show task progress, consider some Ajax techniques.</p>
| 8,225
|
<p>Is there any way to check whether a file is locked without using a try/catch block? </p>
<p>Right now, the only way I know of is to just open the file and catch any <code>System.IO.IOException</code>.</p>
|
<p>No, unfortunately, and if you think about it, that information would be worthless anyway since the file could become locked the very next second (read: short timespan).</p>
<p>Why specifically do you need to know if the file is locked anyway? Knowing that might give us some other way of giving you good advice.</p>
<p>If your code would look like this:</p>
<pre><code>if not locked then
open and update file
</code></pre>
<p>Then between the two lines, another process could easily lock the file, giving you the same problem you were trying to avoid to begin with: exceptions.</p>
|
<p>What I ended up doing is:</p>
<pre><code>internal void LoadExternalData() {
FileStream file;
if (TryOpenRead("filepath/filename", 5, out file)) {
using (file)
using (StreamReader reader = new StreamReader(file)) {
// do something
}
}
}
internal bool TryOpenRead(string path, int timeout, out FileStream file) {
bool isLocked = true;
bool condition = true;
do {
try {
file = File.OpenRead(path);
return true;
}
catch (IOException e) {
var errorCode = Marshal.GetHRForException(e) & ((1 << 16) - 1);
isLocked = errorCode == 32 || errorCode == 33;
condition = (isLocked && timeout > 0);
if (condition) {
// we only wait if the file is locked. If the exception is of any other type, there's no point on keep trying. just return false and null;
timeout--;
new System.Threading.ManualResetEvent(false).WaitOne(1000);
}
}
}
while (condition);
file = null;
return false;
}
</code></pre>
| 2,370
|
<p>Can anyone explain this behavior?
Running:</p>
<pre><code>#!/bin/sh
echo "hello world" | read var1 var2
echo $var1
echo $var2
</code></pre>
<p>results in nothing being ouput, while:</p>
<pre><code>#!/bin/sh
echo "hello world" > test.file
read var1 var2 < test.file
echo $var1
echo $var2
</code></pre>
<p>produces the expected output:</p>
<pre><code>hello
world
</code></pre>
<p>Shouldn't the pipe do in one step what the redirection to test.file did in the second example? I tried the same code with both the dash and bash shells and got the same behavior from both of them.</p>
|
<p>A recent addition to <code>bash</code> is the <code>lastpipe</code> option, which allows the last command in a pipeline to run in the current shell, not a subshell, when job control is deactivated.</p>
<pre><code>#!/bin/bash
set +m # Deactiveate job control
shopt -s lastpipe
echo "hello world" | read var1 var2
echo $var1
echo $var2
</code></pre>
<p>will indeed output</p>
<pre><code>hello
world
</code></pre>
|
<p>Try:</p>
<pre><code>echo "hello world" | (read var1 var2 ; echo $var1 ; echo $var2 )
</code></pre>
<p>The problem, as multiple people have stated, is that var1 and var2 are created in a subshell environment that is destroyed when that subshell exits. The above avoids destroying the subshell until the result has been echo'd. Another solution is:</p>
<pre><code>result=`echo "hello world"`
read var1 var2 <<EOF
$result
EOF
echo $var1
echo $var2
</code></pre>
| 2,483
|
<p>I am building my CoreXY 3D printer with 350x350 mm heated bed at about 4 mm thickness. I just found out that borosilicate glass is unavailable at the local glazier. He offered tempered or ceramic glass instead. Which one should I go for? I read that both are a more expensive option to borosilicate glass, but I worry about the temperature stability, warping of the glass (in case of the tempered one), and parts (not) sticking to it. Any experience is appreciated.</p>
<p>PS. The ceramic glass of this size would cost me about 45 USD. The glazier did not tell me the price of the tempered option, but I reckon it will be around 30 USD, which is much more acceptable if it does the same job.</p>
|
<p>The primary advantage of borosilicate isn't that it's resistant to thermal shock -- as someone already noted, there's not much in the way of rapid heating or cooling in FDM printing (yes, the filament is hot, but its mass is low enough the glass it touches won't pick up much heat). Rather, it's the low expansion. Common soda-lime glass (window glass, mirror glass) expands several times as much as borosilicate, which means it will also shrink several times as much when it cools back down.</p>
<p>If you're holding constant temp throughout the print, and give adequate preheat time, that won't matter, but if (for instance) you heat the bed 10 °C hotter for the first layer, then cool it, plain glass will shrink enough to potentially cause the print to come loose, while borosilicate won't.</p>
<p>Ceramic glass is like borosilicate only more so (akin to Corningware) -- but again, not worth paying for unless you expect to change your bed temperature during the print.</p>
<p>For any kind of glass, my own preference is to use glue stick. I apply a "squiggle" (a precise metric volume), use 91% isopropyl to spread it evenly over the build area, and my prints stay stuck, but pop right off when the glass cools a little.</p>
|
<p>People choose borosilicate because of its thermal properties.</p>
<p>Between ceramic and tempered, I would suggest tempered glass, it's not good as borosilicate when comes to adapting to rapid temperatures but better than ceramic. The other option I would suggest will be "Aluminium", which is much better.</p>
| 2,015
|
<p>I have looked in vain for a good example or starting point to write a java based facebook application... I was hoping that someone here would know of one. As well, I hear that facebook will no longer support their java API is this true and if yes does that mean that we should no longer use java to write facebook apps??</p>
|
<p>Facebook stopped supporting the official Java API on 5 May 2008 according to their <a href="http://developers.facebook.com/blog/post/106" rel="nofollow noreferrer">developer wiki</a>.</p>
<p>In no way does that mean you shouldn't use Java any more to write FB apps. There are several alternative Java approaches outlined on the wiki.</p>
<p>You might also want to check <a href="http://code.google.com/p/facebook-java-webapp/" rel="nofollow noreferrer">this project</a> out; however, it only came out a few days ago so YMMV.</p>
|
<p>You might want to try <a href="http://www.springsource.org/spring-social" rel="nofollow">Spring Social</a>. It might be limited in terms of Facebook features, but lets you also connect to Twitter, LinkedIn, TripIt, GitHub, and Gowalla. </p>
<p>The other side of things is that as Facebook adds features some of the old API's might break, so using a simpler pure FB api (that you can update when things don't work) might be a good idea.</p>
| 8,785
|
<p>When creating scrollable user controls with .NET and WinForms I have repeatedly encountered situations where, for example, a vertical scrollbar pops up, overlapping the control's content, causing a horizontal scrollbar to also be needed. Ideally the content would shrink just a bit to make room for the vertical scrollbar.</p>
<p>My current solution has been to just keep my controls out of the far right 40 pixels or so that the vertical scroll-bar will be taking up. Since this is still effectively client space for the control, the horizontal scroll-bar still comes up when it gets covered by the vertical scroll-bar, even though no controls are being hidden at all. But then at least the user doesn't actually need to <strong>use</strong> the horizontal scrollbar that comes up.</p>
<p>Is there a better way to make this all work? Some way to keep the unneeded and unwanted scrollbars from showing up at all?</p>
|
<p>You will need your controls to resize slightly to accommodate the width of the vertical scroll bar. One way to achieve this achieved through docking. Rather than just dropping controls on the form, you'll have to play a bit with panels, padding, min/max sizing and docking.</p>
<p>Here is example code you can place behind a blank new Form1. Resize the form, in designer or runtime and you'll see that the horizontal scrollbar is not shown and the fields are not overlapped. I've also given the fields a max width for good measure : </p>
<pre><code>#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.textBox1.Location = new System.Drawing.Point(32, 0);
this.textBox1.MaximumSize = new System.Drawing.Size(250, 0);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(250, 20);
this.textBox1.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(0, 3, 0, 0);
this.label1.Size = new System.Drawing.Size(32, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Field:";
//
// panel1
//
this.panel1.Controls.Add(this.textBox1);
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(392, 37);
this.panel1.TabIndex = 2;
//
// panel2
//
this.panel2.Controls.Add(this.textBox2);
this.panel2.Controls.Add(this.label2);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 37);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(392, 37);
this.panel2.TabIndex = 3;
//
// textBox2
//
this.textBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.textBox2.Location = new System.Drawing.Point(32, 0);
this.textBox2.MaximumSize = new System.Drawing.Size(250, 0);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(250, 20);
this.textBox2.TabIndex = 0;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Dock = System.Windows.Forms.DockStyle.Left;
this.label2.Location = new System.Drawing.Point(0, 0);
this.label2.Name = "label2";
this.label2.Padding = new System.Windows.Forms.Padding(0, 3, 0, 0);
this.label2.Size = new System.Drawing.Size(32, 16);
this.label2.TabIndex = 0;
this.label2.Text = "Field:";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(392, 116);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label2;
</code></pre>
|
<p>If your controls are inside a panel, try setting the AutoScroll property of the Panel to False. This will hide the scrollbars. I hope this points you in the right direction.</p>
<pre><code>myPanel.AutoScroll = False
</code></pre>
| 4,628
|
<p>I have just got a MacBook Pro and have been using it (+Fusion) to develop on for about a month now. The purpose of this question is similar to <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c#35342">Hidden Features of C#</a>; to become a how-to of tips and trick for windows development on a mac.</p>
<p>I should clarify that I am aware of boot camp but do not use it (nor do I have any interest to), hence my use of steady state to make sure nothing happens to my OS partition without my knowledge. However; as Sara pointed out, Apple makes great hardware and I absolutely <strong>LOVE</strong> the form factor of my MBP so for someone who is looking for a windows only laptop a mac with boot camp should not be overlooked as the hardware is amazing.</p>
<p>My environment is as follows<br>
* MacBook Pro 15" 2.4Ghz 2GB RAM (Going to upgrade to 4GB soon)<br>
* VMWare Fusion 2.0 Beta<br>
* Windows XP Pro SP3 (Slipstreamed BEFORE install)</p>
<p>Tips:<br>
* Use Windows Steady State to keep OS consistent<br>
* Use svn+ssh to connect to the mac for small repositories then use time machine to backup.<br>
* Use spaces.</p>
|
<p>@Andrew - I'm exactly in your situation. I use a MBP while my company work is purely Microsoft based: i.e., .NET, COM etc. While nothing can beat running Vista natively in Boot Camp (I've never seen Vista run so fast), the niceties of having your Mac OS be the "main" OS, for internet, mail etc. has gotten me to the following configuration. Works like a charm:</p>
<h2>Hardware</h2>
<ul>
<li>Load up your MBP with the max possible - 4GB. It's really worth every $.</li>
<li>Upgrade your hard drive (if not already) to 7200RPM. Major performance boost here.</li>
</ul>
<h2>Software</h2>
<ul>
<li><a href="http://www.parallels.com/en/products/desktop/" rel="noreferrer">Parallels Desktop for Mac</a> for virtualization. You can either have multiple VM, or use a boot camp partition. The latter is supposed to be faster, but I haven't really measured it (I use it for having the option to boot natively if I really need speed). The former allows you to have multiple OS. I gave my VM 1GB memory. I can do more if you want it more snappy.</li>
<li>Micorsoft Visual Studio 2005/8 for .NET and C++. I have yet to see any IDE for .NET which beats this one. The <a href="http://en.wikipedia.org/wiki/IntelliSense" rel="noreferrer">intellisense</a> is really amazing.</li>
<li>Code Gear (yes we have some Delphi)</li>
</ul>
<p>For non development occasional need I also keep Microsoft Office 2007 installed. They do have MAC ports, but those don't always cut it. </p>
|
<p>I use a Mac Book Pro as well but I run Vista. I set aside a little space so I could also run Leopard and just use Boot Camp. You can use Boot Camp to just boot from windows so you never have to deal with Leopard unless you want to. </p>
<p>I would highly reccomend it because Apple makes great hardware while Microsoft makes great tools (and also great OSs, I love Vista) </p>
<p>go ahead and downmod me for being a fangirl, but I've found what works for me. </p>
| 6,637
|
<p>Is it possible to use both JScript and VBScript in the same HTA? Can I call VBScript functions from JScript and vice-versa? Are there any "gotchas," like the JScript running first and the VBScript running second (classic ASP pages have this issue).</p>
|
<p>Yeah, just separate them into different script tags:</p>
<pre><code><script language="javascript">
// javascript code
</script>
<script language="vbscript">
' vbscript code
</script>
</code></pre>
<p>Edit: And, yeah, you can cross call between Javascript and VBScript with no extra work.</p>
<p>Edit: This is also true of ANY Windows Scripting technology. It works in WSF files and can include scripts written in any supported ActiveScript language such as Perl as long as the engine is installed.</p>
<p>Edit: The specific "gotcha" of all JScript being executed first, then VBScript is related to how ASP processes scripts. The MSHTA host (which uses IE's engine) does not have this problem. I'm not much into HTAs though, so I can't address any other possible "gotchas".</p>
|
<p>Also you can give references between them. For example:
at the background some function on vbscript handle with database and FSO issues, and let javascript create user interfaces and dialogs etc. with DOM in frontline.
Whenever you need you can call both functions from each script sides.
In js you can call vbs function, and also in vbscript you can call js functions. Then you can use their returns where you call them.
Regards</p>
| 9,019
|
<p>Is it necessary or advantageous to write custom connection pooling code when developing applications in .NET with an SQL Server database? I know that ADO.NET gives you the option to enable/disable connection pooling -- does that mean that it's built into the framework and I don't need to worry about it? Why do people talk about writing their own connection pooling software and how is this different than what's built into ADO.NET?</p>
|
<p>The connection pooling built-in to ADO.Net is robust and mature. I would recommend against attempting to write your own version.</p>
|
<p>Well, it is going to go away as the answer to all these questions will be LINQ. Incidentally, we have never needed custom connection pooling for any of our applications, so I am not sure what all the noise is about.</p>
| 2,969
|
<p>I got my Ender 3 a couple weeks ago. Within a couple days of test prints, I was able to get it working pretty well. Prints looked great. However, I installed <a href="https://www.thingiverse.com/thing:2959991" rel="noreferrer">a more permanent solution to my X-Gantry binding issues</a> and now print quality is down again.</p>
<p><a href="https://i.stack.imgur.com/P5yjv.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/P5yjv.jpg" alt="Layer separation issues"></a></p>
<p>The bottom .25" of the calibration part looks absolutely terrible, with hideous layer separation issues, while the upper .75" looks flawless. I have little idea what could be causing this issue.</p>
<p><a href="https://i.stack.imgur.com/G5lab.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/G5lab.jpg" alt="Macro closeup on layer separation"></a></p>
<p>The only possible failure mode I can think of is that the bed isn't the right distance from the print head, but even fiddling with the knobs doesn't yield any better print quality than the print on the right of the first image. What can I do?</p>
<p>I slice with Cura and can make my profile available if it would be useful.</p>
|
<p>The answer now seems brain-dead obvious now. <em>Hindsight is 20/20, amirite?</em></p>
<p>I had a decent filament clog in the extruder past the end of the Bowden tube. This was resolved by sticking a <a href="https://smile.amazon.com/dp/B078HXTLX8" rel="nofollow noreferrer">nozzle cleaner rod</a> up and down the filament path from the top of the extruder block several times and clearing the filament jam from the bottom of the Bowden tube. The printer works flawlessly now.</p>
|
<p>I had a real problem with what I was poor bed adhesion and layer separation on my 6month old Ender 3 pro. this problem started all at once, I checked the bed height several times and layer height, temperatures etc still the problem was there.
Then I noticed the filament guide pinch roller was at a slight angle and on further inspection the plastic arm on removal was fractured so instead of holding the filament against the toothed drive it was metal to metal causing a slip on the nozzle feed.
I ordered a replacement aluminium feed roller kit at £6.99 the machine is working as it did when I first got it.
So it’s worth removing the pinch arm and inspecting.</p>
| 1,005
|
<p>My group is developing a service-based (.NET WCF) application and we're trying to decide how to handle exceptions in our internal services. Should we throw exceptions? Return exceptions serialized as XML? Just return an error code?</p>
<p>Keep in mind that the user will never see these exceptions, it's only for other parts of the application.</p>
|
<p>WCF uses <code>SoapFaults</code> as its native way of transmitting exceptions from either the service to the client, or the client to the service.</p>
<p>You can declare a custom SOAP fault using the <code>FaultContract</code> attribute in your contract interface:</p>
<p>For example:</p>
<pre><code>[ServiceContract(Namespace="foobar")]
interface IContract
{
[OperationContract]
[FaultContract(typeof(CustomFault))]
void DoSomething();
}
[DataContract(Namespace="Foobar")]
class CustomFault
{
[DataMember]
public string error;
public CustomFault(string err)
{
error = err;
}
}
class myService : IContract
{
public void DoSomething()
{
throw new FaultException<CustomFault>( new CustomFault("Custom Exception!"));
}
}
</code></pre>
|
<p>Phil, different parts of the application call each other using WCF. By "return exceptions serialized as XML," I meant that the return value of the function wold be an exception object. Success would be indicated by null. </p>
<p>I don't think that's the right option.</p>
<p>WCF fault contracts sound good, but I don't know anything about them. Checking google right now.</p>
| 6,133
|
<p>I've just heard the term covered index in some database discussion - what does it mean?</p>
|
<p>A <em>covering index</em> is an index that contains all of, and possibly more, the columns you need for your query.</p>
<p>For instance, this:</p>
<pre><code>SELECT *
FROM tablename
WHERE criteria
</code></pre>
<p>will typically use indexes to speed up the resolution of which rows to retrieve using <em>criteria</em>, but then it will go to the full table to retrieve the rows.</p>
<p>However, if the index contained the columns <em>column1, column2</em> and <em>column3</em>, then this sql:</p>
<pre><code>SELECT column1, column2
FROM tablename
WHERE criteria
</code></pre>
<p>and, provided that particular index could be used to speed up the resolution of which rows to retrieve, the index already contains the values of the columns you're interested in, so it won't have to go to the table to retrieve the rows, but can produce the results directly from the index.</p>
<p>This can also be used if you see that a typical query uses 1-2 columns to resolve which rows, and then typically adds another 1-2 columns, it could be beneficial to append those extra columns (if they're the same all over) to the index, so that the query processor can get everything from the index itself.</p>
<p>Here's an <a href="http://www.devx.com/dbzone/Article/29530" rel="noreferrer">article: Index Covering Boosts SQL Server Query Performance</a> on the subject.</p>
|
<p>Covering indexes are indexes which "cover" all columns needed from a specific table, removing the need to access the physical table at all for a given query/ operation.</p>
<p>Since the index contains the desired columns (or a superset of them), table access can be replaced with an index lookup or scan -- which is generally much faster.</p>
<p>Columns to cover:</p>
<ul>
<li>parameterized or static conditions; columns restricted by a parameterized or constant condition.</li>
<li>join columns; columns dynamically used for joining</li>
<li>selected columns; to answer selected values.</li>
</ul>
<p>While covering indexes can often provide good benefit for retrieval, they do add somewhat to insert/ update overhead; due to the need to write extra or larger index rows on every update. </p>
<h2>Covering indexes for Joined Queries</h2>
<p>Covering indexes are probably most valuable as a performance technique for joined queries. This is because joined queries are more costly & more likely then single-table retrievals to suffer high cost performance problems. </p>
<ul>
<li>in a joined query, covering indexes should be considered per-table.</li>
<li>each 'covering index' removes a physical table access from the plan & replaces it with index-only access.</li>
<li>investigate the plan costs & experiment with which tables are most worthwhile to replace by a covering index. </li>
<li>by this means, the multiplicative cost of large join plans can be significantly reduced. </li>
</ul>
<p>For example:</p>
<pre><code>select oi.title, c.name, c.address
from porderitem poi
join porder po on po.id = poi.fk_order
join customer c on c.id = po.fk_customer
where po.orderdate > ? and po.status = 'SHIPPING';
create index porder_custitem on porder (orderdate, id, status, fk_customer);
</code></pre>
<p>See:</p>
<ul>
<li><a href="http://literatejava.com/sql/covering-indexes-query-optimization/" rel="nofollow">http://literatejava.com/sql/covering-indexes-query-optimization/</a></li>
</ul>
| 8,749
|
<p>I've been looking for a way to convert an mp3 to aac programmatically or via the command line with no luck. Ideally, I'd have a snippet of code that I could call from my rails app that converts an mp3 to an aac. I installed ffmpeg and libfaac and was able to create an aac file with the following command:</p>
<p><code>ffmpeg -i test.mp3 -acodec libfaac -ab 163840 dest.aac</code></p>
<p>When i change the output file's name to dest.m4a, it doesn't play in iTunes. </p>
<p>Thanks! </p>
|
<p><a href="http://en.wikipedia.org/wiki/Ffmpeg" rel="noreferrer">FFmpeg</a> provides AAC encoding facilities if you've compiled them in. If you are using Windows you can grab full binaries from <a href="http://arrozcru.no-ip.org/ffmpeg_builds/" rel="noreferrer">here</a></p>
<pre><code>ffmpeg -i source.mp3 -acodec libfaac -ab 128k dest.aac
</code></pre>
<p>I'm not sure how you would call this from ruby.</p>
<p>Also, be sure to set the bitrate appropriately.</p>
|
<p>I've had good luck using mplayer (which I believe uses ffmpeg...) and lame. To the point that I've wrapped it up in a script:</p>
<pre><code>#!/bin/sh
TARGET=$1
BASE=`basename "${TARGET}"`
echo TARGET: "${TARGET}"
echo BASE: "${BASE}" .m4a
# Warning! Race condition vulnerability here! Should use a mktemp
# variant or something...
mkfifo encode
mplayer -quiet -ao pcm -aofile encode "${TARGET}" &
lame --silent encode "${BASE}".mp3
rm encode
</code></pre>
<p>Sorry for the security issues, I banged this out on the train one day...</p>
<p>My mplayer and lame come from <a href="http://www.finkproject.org/" rel="nofollow noreferrer">fink</a></p>
| 9,549
|
<p>In a .net system I'm building, there is a need for automated e-mail notifications. These should be editable by an admin. What's the easiest way to do this? SQL table and WYSIWIG for editing?</p>
<hr>
<p>The queue is a great idea. I've been throwing around that type of process for awhile with my old company.</p>
|
<p>From a high level, yes. :D The main thing is some place to store the templates. A database is a great option unless you're not already using one, then file systems work fine.</p>
<p>WSIWIG editors (such as fckeditor) work well and give you some good options regarding the features that you allow.</p>
<p>Some sort of token replacement system is also a good idea if you need it. For example, if someone puts %FIRSTNAME% in the email template, the code that generates the email can do some simple pattern matching to replace known tokens with other known values that may be dynamic based on user or other circumstances.</p>
|
<p>Are you just talking about the interface and storage, or the implementation of sending the emails as well?</p>
<p>Yes, a SQL table with FROM, TO, Subject, Body should work for storage and, heck, a textbox or even maybe a RichText box should work for editing.</p>
<p>Or is this a web interface?</p>
<p>For actually sending it, check out the System.Web.Mail namespace, it's pretty self explanatory and easy to use :)</p>
| 2,803
|
<p>I can't seem to find details on how to unsubscribe from ubiquity commands. The command list page only seems to have information about the installed commands and there are no links to deleting them. Am I missing something?</p>
|
<p>Go to about:ubiquity in Firefox. Under the section "subscribed feeds" there should be an option to unsubscribe to command feeds you no longer desire.</p>
<p>Also, if you clear your entire browser history, it will delete all command feeds (this will be fixed by 0.2)</p>
|
<p>Check this out:
<a href="http://getsatisfaction.com/mozilla/topics/how_do_you_edit_delete_the_default_ubiquity_commands_verbs" rel="nofollow noreferrer">http://getsatisfaction.com/mozilla/topics/how_do_you_edit_delete_the_default_ubiquity_commands_verbs</a></p>
<p>Also, you can find a utility to reset your ubiquity to default in \extensions\ubiquity@labs.mozilla.com\chrome\content\reset.html
EDIT1: The above file does nothing, please ignore.</p>
<p>EDIT2 (answer?): You can use the ffx addon SQLite Manager to open the \ubiquity_ann.sqlite database and remove all rows for the command you want to delete (there will be several rows, but they are identified by the url the script came from and so easy to identify). When you restart firefox, the command will be gone.
(The code that populates the Commands page uses javascript to create an instance of UbiquitySetup object, and executes the method .createServices().commandSource which reads that SQLite database directly for a list of commands (returning an object or array of objects/commands to iterate through). This seems to delete the command itself, since it will no longer be found in ubiquity or the command list.)</p>
<p>Good luck.</p>
| 5,685
|
<p><strong>Original Question</strong></p>
<p>I want to be able to generate a new (fully valid) MP3 file from an existing MP3 file to be used as a preview -- try-before-you-buy style. The new file should only contain the first <em>n</em> seconds of the track.</p>
<p>Now, I know I could just "chop the stream" at <em>n</em> seconds (calculating from the bitrate and header size) when delivering the file, but this is a bit dirty and a real PITA on a VBR track. I'd like to be able to generate a proper MP3 file.</p>
<p>Anyone any ideas?</p>
<p><strong>Answers</strong></p>
<p>Both <code>mp3split</code> and <code>ffmpeg</code> are both good solutions. I chose ffmpeg as it is commonly installed on linux servers and is also <a href="http://sourceforge.net/project/showfiles.php?group_id=205275&package_id=248632" rel="noreferrer">easily available for windows</a>. Here's some more good command line parameters for generating previews with ffmpeg</p>
<ul>
<li><strong><code>-t <seconds></code></strong> chop after specified number of seconds</li>
<li><strong><code>-y</code></strong> force file overwrite</li>
<li><strong><code>-ab <bitrate></code></strong> set bitrate e.g. <em>-ab 96k</em></li>
<li><strong><code>-ar <rate Hz></code></strong> set sampling rate e.g. <em>-ar 22050</em> for 22.05kHz</li>
<li><strong><code>-map_meta_data <outfile>:<infile></code></strong> copy track metadata from infile to outfile</li>
</ul>
<p>instead of setting -ab and -ar, you can copy the original track settings, as Tim Farley suggests, with:</p>
<ul>
<li><strong><code>-acodec copy</code></strong></li>
</ul>
|
<p>I also recommend ffmpeg, but the command line suggested by John Boker has an unintended side effect: it re-encodes the file to the default bitrate (which is 64 kb/s in the version I have here at least). This might give your customers a false impression of the quality of your sound files, and it also takes longer to do.</p>
<p>Here's a command line that will slice to 30 seconds without transcoding:</p>
<pre><code>ffmpeg -t 30 -i inputfile.mp3 -acodec copy outputfile.mp3
</code></pre>
<p>The -acodec switch tells ffmpeg to use the special "copy" codec which does not transcode. It is lightning fast.</p>
<p>NOTE: the command was updated based on comment from Oben Sonne</p>
|
<p>My package <strong>medipack</strong> is a very simple command-line app as a wrapper over <code>ffmpeg</code>.</p>
<p>you can achieve trimming your video using these commands:</p>
<pre><code>medipack trim input.mp3 -s 00:00 -e 00:30 -o output.mp3
medipack trim input.mp3 -s 00:00 -t 00:30 -o output.mp3
</code></pre>
<p>you can view options of trim subcommand as:</p>
<pre><code>srb@srb-pc:$ medipack trim -h
usage: medipack trim [-h] [-s START] [-e END | -t TIME] [-o OUTPUT] [inp]
positional arguments:
inp input video file ex: input.mp4
optional arguments:
-h, --help show this help message and exit
-s START, --start START
start time for cuting in format hh:mm:ss or mm:ss
-e END, --end END end time for cuting in format hh:mm:ss or mm:ss
-t TIME, --time TIME clip duration in format hh:mm:ss or mm:ss
-o OUTPUT, --output OUTPUT
</code></pre>
<p>you could also explore other options using <code>medipack -h</code></p>
<pre><code>srb@srb-pc:$ medipack --help
usage: medipack.py [-h] [-v] {trim,crop,resize,extract} ...
positional arguments:
{trim,crop,resize,extract}
optional arguments:
-h, --help show this help message and exit
-v, --version Display version number
</code></pre>
<p>you may visit my repo <a href="https://github.com/srbcheema1/medipack" rel="nofollow noreferrer">https://github.com/srbcheema1/medipack</a> and checkout examples in README.</p>
| 6,552
|
<p>I am creating an installer in IzPack. It is quite large, and I have broken up my XML files appropriately using <xinclude> and <xfragment> tags. Unfortunately, IzPack does not combine them together when you build your installer. This requires you to package the files with the installer, which just won't work. </p>
<p>I was about to start writing a tool in Java to load the XML files and combine them, but I don't want to go reinventing the wheel. </p>
<p>Do the Java XML libraries provide native handling of xinclude? A google didn't seem to turn up much. </p>
<p>Not a big deal if I have to write this myself, just wanted to check with you guys. Thanks.</p>
<p>Format of XML for example purposes:
File1.xml</p>
<pre><code><?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<installation version="1.0">
<packs>
<pack name="Transaction Service" id="Transaction Service" required="no" >
<xinclude href="example/File2.xml" />
</pack>
</packs>
</code></pre>
<p>File2.xml</p>
<pre><code><xfragment>
<file src="..." />
</xfragment>
</code></pre>
<p>File2 does not need the standard XML header. The xml file is parsed at build time, because the resources it specifies are included in the installer. What isn't included is the actual XML information (order to write the files, where to put them etc.)</p>
<p>What I am looking to have produced:</p>
<pre><code><?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<installation version="1.0">
<packs>
<pack name="Transaction Service" id="Transaction Service" required="no" >
<file src="..." />
</pack>
</packs>
</code></pre>
<p>Thanks, I am going to start whipping it together in Java now, but hopefully someone has a simple answer. </p>
<p>Tim Reynolds</p>
|
<p>If you can't get xinclude to work and you're using Ant, I'd recommend <a href="http://www.oopsconsultancy.com/software/xmltask" rel="nofollow noreferrer">XMLTask</a>, which is a plugin task for Ant. It'll do lots of clever stuff, including the one thing you're interested in - constructing a XML file out of fragments.</p>
<p>e.g.</p>
<pre><code><xmltask source="templatefile.xml" dest="finalfile.xml">
<insert path="/packs/pack[1]" position="under" file="pack1.xml"/>
</xmltask>
</code></pre>
<p>(warning- the above is done from memory so please consult the documentation!).</p>
<p>Note that in the above, the file <em>pack1.xm</em>l doesn't have to have a root node.</p>
|
<p>I'm not sure if java supports automatic xinclude. But you will have to use namespaces to make it work. So don't use <code><xinclude ....></code>, but use: </p>
<pre><code><xi:xinclude xmlns:xi="http://www.w3.org/2001/XInclude" href="example/File2.xml" />
</code></pre>
<p>Normally the included file should still contain the xml header as well. There is no requirement for it to e.g. have the same encoding.</p>
| 9,861
|
<p>I have a semi-diy hotend setup on my MOOZ-2 (an obscure chinese printer). It requires that the total nozzle length (including threading) is longer than 15 mm. So far, I've been using Volcano nozzles because they're the only ones I can find that meet this requirement. However I believe this negatively impacts performance because they stick out way beyond the heater block (see picture below). Unfortunately, the next size I can find are MK8 or V6 nozzles which are 13 mm - too short! Are there any nozzle sizes in between that I could use?</p>
<p><a href="https://i.stack.imgur.com/IN5df.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IN5df.jpg" alt="Nozzle setup" /></a></p>
|
<p><strong>I think this is just an overcomplicated lost-PLA (investment) casting.</strong></p>
<p>What you're asking for is to create an object, create a mold around it, and then burn out the object and replace it with metal. Traditionally this is done with wax, <a href="https://en.wikipedia.org/wiki/Lost-wax_casting" rel="nofollow noreferrer">and called lost-wax casting</a>, but the same can be done with anything that melts/burns away, including PLA.</p>
<p>Rather than worrying about burning hairs and pressure and compaction of metal powder, print a model, and use the correct kind of plaster (a search for "investment casting plaster" will get you going down the right path) to make your mold. Heat the metal powder in a crucible, instead of the mold itself, and pour it through the expansion/extra material tube you were talking about.</p>
|
<p>I don't see why it wouldn't work. It doesn't seem to be the optimal way but I haven't tried it.</p>
<p>Only thing that might be an issue is that PLA doesn't burn away clean (not for me anyway) which can leave defects in the product. But there are filaments specifically made for casting which apparently burn away with no residue.</p>
<p>This is assuming you can actually successfully print a complex object with walls that thin.</p>
| 2,135
|
<p>I'm looking to introduce a unit testing framework into the mix at my job. We're using Visual Studio 2005 (though we may be moving to 2008 within the next six months) and work primarily in C#. If the framework has some kind of IDE integration that would be best, but I'm open to frameworks that don't have integration but are still relatively simple to get set up. I'm going to get resistance to it one way or another, so if I can make sure what I'm pushing isn't a pain in the neck, that would help my case.</p>
<p>The obvious choice from the research I've done so far points to NUnit, but I'd like to get the impressions of someone who's actually used it before recommending it to my team.</p>
<p>Has anyone out there used <a href="https://en.wikipedia.org/wiki/NUnit" rel="nofollow noreferrer">NUnit</a>? If so, are there any pitfalls or limitations of which I should be aware? Are there other good options out there? If so, if you've used both NUnit at that, I'd greatly appreciate an idea of the strengths and weaknesses of them.</p>
|
<p>I think <a href="https://en.wikipedia.org/wiki/NUnit" rel="nofollow noreferrer">NUnit</a> <strong>is</strong> your best bet. With <a href="https://testdriven.net/" rel="nofollow noreferrer">TestDriven.NET</a>, you get great integration within Visual Studio. (ReSharper also has a unit test runner if you're using it). NUnit is simple to use and follows an established paradigm. You'll also find plenty of projects, tutorials, and guides using it which always helps.</p>
<p>Your other main choice is probably <a href="https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#.NET_programming_languages" rel="nofollow noreferrer">MbUnit</a>, which is more and more positioning itself as the <a href="https://en.wikipedia.org/wiki/Behavior-driven_development" rel="nofollow noreferrer">BDD</a> framework of choice (in conjunction with <a href="http://www.gallio.org" rel="nofollow noreferrer">Gallio</a>).</p>
|
<p><a href="https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#.NET_programming_languages" rel="nofollow noreferrer">MbUnit</a> is worth a look. It has a set of features comparable to NUnit. It has its own GUI, or can be integrated into Visual Studio if you have <a href="https://en.wikipedia.org/wiki/JetBrains#ReSharper_Ultimate" rel="nofollow noreferrer">ReSharper</a>. I would also recommend <em>Rhino Mocks</em> if you are doing any sort of <a href="https://en.wikipedia.org/wiki/Test-driven_development" rel="nofollow noreferrer">TDD</a>.</p>
| 2,313
|
<p>I have had a 3d printer for a while now, and I have a lot of the quality settings dialed in pretty well, but one thing that constantly bugs me is removing the raft from my finished prints. I am using Repetier and I have set the air gap to 0.2 mm. That led to much better results than the default 0, which were impossible to remove at all, but it is still not great. Are there any settings I should look at changing to get easier to remove rafts? Does the filament affect this? I am printing in Hatchbox PLA at high temps. I have a heated bed, and reducing the temp on that did seem to help. Maybe it keeps the layers on the raft from fusing with the layers on the part? Any help is greatly appreciated. Thanks.</p>
|
<p>I have been able to get rafts that peel off by editing the g-code after the raft has finished and adding an M104 set temperature command telling my printer to cool the nozzle down to about 40 degrees and then another M104 command to tell the nozzle to heat back up again. This gives the raft enough time to cool and then the raft doesn't weld to the rest of the print. If you are using a heated bed I would suggest trying the M190 command and turning that off after the raft and then back on after the first layer as well. </p>
|
<p>I use raft almost always for ABS and PLA. My favorite setting for gap is somewhere between 0.11-0.13 mm both for 0.1 and 0.2 mm layer height.</p>
<p>By using 3-4 layers of raft I always get predictably good quality of a lower layer and not have any issues with removing prints from the surface which I had without using raft (especially with large or weak prints)</p>
| 692
|
<p>I'm just about wrapped up on a project where I was using a commercial SVN provider to store the source code. The web host the customer ultimately picked includes a repository as part of the hosting package, so, now that the project is over, I'd like to relocate the repository to their web host and discontinue the commercial account.</p>
<p>How would I go about doing this?</p>
|
<p>If you want to move the repository and keep history, you'll probably need filesystem access on both hosts. The simplest solution, if your backend is FSFS (the default on recent versions), is to make a filesystem copy of the entire repository folder.</p>
<p>If you have a Berkley DB backend, if you're not sure of what your backend is, or if you're changing SVN version numbers, you're going to want to use svnadmin to dump your old repository and load it into your new repository. Using <code>svnadmin dump</code> will give you a single file backup that you can copy to the new system. Then you can create the new (empty) repository and use <code>svnadmin load</code>, which will essentially replay all the commits along with its metadata (author, timestamp, etc).</p>
<p>You can read more about the dump/load process here:</p>
<p><a href="http://svnbook.red-bean.com/en/1.8/svn.reposadmin.maint.html#svn.reposadmin.maint.migrate" rel="noreferrer">http://svnbook.red-bean.com/en/1.8/svn.reposadmin.maint.html#svn.reposadmin.maint.migrate</a></p>
<p>Also, if you do <code>svnadmin load</code>, make sure you use the <code>--force-uuid</code> option, or otherwise people are going to have problems switching to the new repository. Subversion uses a UUID to identify the repository internally, and it won't let you switch a working copy to a different repository.</p>
<p>If you don't have filesystem access, there may be other third party options out there (or you can write something) to help you migrate: essentially you'd have to use the svn log to replay each revision on the new repository, and then fix up the metadata afterwards. You'll need the pre-revprop-change and post-revprop-change hook scripts in place to do this, which sort of assumes filesystem access, so YMMV. Or, if you don't want to keep the history, you can use your working copy to import into the new repository. But hopefully this isn't the case.</p>
|
<p>Assuming you have the necessary privileges to run svnadmin, you need to use the <a href="http://svnbook.red-bean.com/en/1.4/svn.ref.svnadmin.c.dump.html" rel="nofollow noreferrer">dump</a> and <a href="http://svnbook.red-bean.com/en/1.4/svn.ref.svnadmin.c.load.html" rel="nofollow noreferrer">load</a> commands.</p>
| 7,201
|
<p>Why are unsigned integers not CLS compliant?</p>
<p>I am starting to think the type specification is just for performance and not for correctness.</p>
|
<p>Not all languages have the concept of unsigned ints. For example VB 6 had no concept of unsigned ints which I suspect drove the decision of the designers of VB7/7.1 not to implement as well (it's implemented now in VB8).</p>
<p>To quote:</p>
<blockquote>
<p><a href="http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx</a></p>
<p>The CLS was designed to be large enough to include the language
constructs that are commonly needed by developers, yet small enough
that most languages are able to support it. In addition, any language
construct that makes it impossible to rapidly verify the type safety
of code was excluded from the CLS so that all CLS-compliant languages
can produce verifiable code if they choose to do so.</p>
</blockquote>
<p>Update: I did wonder about this some years back, and whilst I can't see why a UInt wouldn't be type safety verifiable, I guess the CLS guys had to have a cut off point somewhere as to what would be the baseline minimum number of value types supported. Also when you think about the longer term where more and more languages are being ported to the CLR why force them to implement unsigned ints to gain CLS compliance if there is absolutely no concept, ever?</p>
|
<p>Unsigned integers are not CLS compliant because they're not interoperable between certain languages.</p>
| 2,807
|
<p>What are the common algorithms being used to measure the processor frequency?</p>
|
<p>Intel CPUs after Core Duo support two Model-Specific registers called IA32_MPERF and IA32_APERF.<br>
MPERF counts at the maximum frequency the CPU supports, while APERF counts at the actual current frequency.</p>
<p>The actual frequency is given by:</p>
<p><img src="https://chart.apis.google.com/chart?cht=tx&chl=%5CLARGE%5C%21freq%20%3D%20%5Cfrac%7Bmax%20frequency%20%5Ccdot%20APERF%7D%7BMPERF%7D" alt="freq = max_frequency * APERF / MPERF"></p>
<p>You can read them with this flow</p>
<pre><code>; read MPERF
mov ecx, 0xe7
rdmsr
mov mperf_var_lo, eax
mov mperf_var_hi, edx
; read APERF
mov ecx, 0xe8
rdmsr
mov aperf_var_lo, eax
mov aperf_var_hi, edx
</code></pre>
<p>but note that rdmsr is a privileged instruction and can run only in ring 0.</p>
<p>I don't know if the OS provides an interface to read these, though their main usage is for power management, so it might not provide such an interface.</p>
|
<p>I'm not sure why you need assembly for this. If you're on a machine that has the /proc filesystem, then running:</p>
<pre><code>> cat /proc/cpuinfo
</code></pre>
<p>might give you what you need.</p>
| 9,085
|
<p>I was surprised to learn that, AFAICT, neither Protolabs, Xometry, or Shapeways* can supply 3D printed parts from acrylic. Is anyone aware of a commercial source of 3D printed parts made from acrylic [polymethylmethacrylate (PMMA)]?</p>
<p>*Shapeways does 3D print their "Fine Detail Plastic" which is an acrylic. However, during the printing process, the material is UV cured so, AFAIK, it is no longer a thermoplastic (as PMMA is). I need the thermoplastic property for my application.</p>
|
<p>You can definitely use glue - however you can also brush some of the liquid resin along the edges of the two pieces, push them together and cure them, this will fuse them together.</p>
<p>You don't need much, and you need to watch for drip out while curing (don't your fingers in it)</p>
|
<p>You can definitely use glue - however you can also brush some of the liquid resin along the edges of the two pieces, push them together and cure them, this will fuse them together.</p>
<p>You don't need much, and you need to watch for drip out while curing (don't your fingers in it)</p>
| 1,730
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.