instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>Is it possible to use .htaccess to process all six digit URLs by sending them to a script, but handle every other invalid URL as an error 404?</p>
<p>For example:</p>
<pre><code>http://mywebsite.com/132483
</code></pre>
<p>would be sent to:</p>
<pre><code>http://mywebsite.com/scriptname.php?no=132483
</code></pre>
<p>but</p>
<pre><code>http://mywebsite.com/132483a or
http://mywebsite.com/asdf
</code></pre>
<p>would be handled as a 404 error.</p>
<p>I presently have this working via a custom PHP 404 script but it's kind of kludgy. Seems to me that .htaccess might be a more elegant solution, but I haven't been able to figure out if it's even possible.</p>
|
<p>In your htaccess file, put the following</p>
<pre><code>RewriteEngine On
RewriteRule ^([0-9]{6})$ /scriptname.php?no=$1 [L]
</code></pre>
<p>The first line turns the mod_rewrite engine on. The () brackets put the contents into $1 - successive () would populate $2, $3... and so on. The [0-9]{6} says look for a string precisely 6 characters long containing only characters 0-9.</p>
<p>The [L] at the end makes this the last rule - if it applies, rule processing will stop.</p>
<p>Oh, the ^ and $ mark the start and end of the incoming uri.</p>
<p>Hope that helps!</p>
|
<p>Yes it's possible with mod_rewrite. There are tons of good mod_rewrite tutorials online a quick Google search should turn up your answer in no time. </p>
<p>Basically what you're going to want to do is ensure that the regular expression you use is just looking for digits and no other characters and to ensure the length is 6. Then you'll redirect to scriptname.?no= with the number you captured. </p>
<p>Hope this helps!</p>
| 9,881
|
<p>I have a few issues with the blue tape, which I'm trying out for the first time.</p>
<p>The tape seems to warp, bubble and lift from the aluminum plate when it heats and cools and during printing.
I put some clips on it, but not sure if this is standard.</p>
<p>It also seems the print is lifting off the tape itself (bottom left corner). I applied some magigoo glue to it. Maybe I shouldn't have done that.</p>
<p>I feel like this print isn't going to make it...</p>
<p><a href="https://i.stack.imgur.com/iM8A2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iM8A2.jpg" alt="Print and tape adhesion problems"></a></p>
<p>I'm printing with a Monoprice Select V2, with AmazonBasics ABS with 100 °C bed and 250 °C extruder temperature, at 15 mm/s initial layer speed and 60 mm/s print speed sliced with Ultimaker Cura.</p>
|
<p>My Dad uses prittstick on the bed before the print and the bed keeps the prittstick just abbout the right temp for it to stick.</p>
<p><a href="https://i.stack.imgur.com/23Uem.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/23Uem.jpg" alt="Me Gluing his print bed (No Need FOr tape)"></a></p>
|
<p>The absolute best way to solve sticking problem is Overture build surface. I could not get anything to stick. Got a free build sheet when I bought some filament from them. What a difference, everything sticks now, just clean with alcohol between uses.</p>
| 1,158
|
<p>Where can I find some good pointers on best practices for running ASP.NET MVC on IIS6?</p>
<p>I haven't seen any realistic options for web-hosts who provide IIS7-hosting yet. Mostly because I don't live in the U.S.</p>
<p>So I was wondering on how you best build applications in ASP.NET MVC and make it easily available to deploy on both IIS6 and IIS7. Keep in mind that this is for standard web-hosts, so there is no access to ISAPI-filters or special settings inside IIS6.</p>
<p>Are there anything else one should think about when developing ASP.NET MVC-applications to target IIS6? Any functions that doesn't work?</p>
<p>UPDATE: One of the bigger issues is the thing with routes. The pattern {controller}/{action} will work on IIS7, but not IIS6 which needs {controller}.mvc/{action}. So how do I make this transparent? Again, <strong>no ISAPI</strong> and <strong>no IIS-settings</strong>, please.</p>
|
<p>It took me a bit, but I figured out how to make the extensions work with IIS 6. First, you need to rework the base routing to include .aspx so that they will be routed through the ASP.NET ISAPI filter.</p>
<pre><code>routes.MapRoute(
"Default", // Route name
"{controller}.aspx/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
</code></pre>
<p>If you navigate to Home.aspx, for example, your site should be working fine. But Default.aspx and the default page address of <a href="http://[website]/" rel="nofollow noreferrer">http://[website]/</a> stop working correctly. So how is that fixed?</p>
<p>Well, you need to define a second route. Unfortunately, using Default.aspx as the route does not work properly:</p>
<pre><code>routes.MapRoute(
"Default2", // Route name
"Default.aspx", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
</code></pre>
<p>So how do you get this to work? Well, this is where you need the original routing code:</p>
<pre><code>routes.MapRoute(
"Default2", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
</code></pre>
<p>When you do this, Default.aspx and <a href="http://[website]/" rel="nofollow noreferrer">http://[website]/</a> both start working again, I think because they become successfully mapped back to the Home controller. So the complete solution is:</p>
<pre><code>public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}.aspx/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
routes.MapRoute(
"Default2", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
}
</code></pre>
<p>And your site should start working just fine under IIS 6. (At least it does on my PC.)</p>
<p>And as a bonus, if you are using Html.ActionLink() in your pages, you should not have to change any other line of code throughout the entire site. This method takes care of properly tagging on the .aspx extension to the controller.</p>
|
<p>I have a detailed step by step guide, but it requires that you use isapi_rewrite. View it at: <a href="http://biasecurities.com/blog/2008/how-to-enable-pretty-urls-with-asp-net-mvc-and-iis6/" rel="nofollow noreferrer">http://biasecurities.com/blog/2008/how-to-enable-pretty-urls-with-asp-net-mvc-and-iis6/</a></p>
| 5,438
|
<p>The MSDN documentation on <a href="http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx" rel="noreferrer">Object.GetHashCode()</a> describes 3 contradicting rules for how the method should work. </p>
<ol>
<li>If two objects of the same type represent the same value, the hash function must return the same constant value for either object.</li>
<li>For the best performance, a hash function must generate a random distribution for all input.</li>
<li>The hash function must return exactly the same value regardless of any changes that are made to the object.</li>
</ol>
<p>Rules 1 & 3 are contradictory to me.</p>
<p>Does Object.GetHashCode() return a unique number based on the <strong>value</strong> of an object, or the <strong>reference</strong> to the object. If I override the method I can choose what to use, but I'd like to know what is used internally if anyone knows.</p>
|
<blockquote>
<p>Rules 1 & 3 are contradictory to me.</p>
</blockquote>
<p>To a certain extent, they are. The reason is simple: if an object is stored in a hash table and, by changing its value, you change its hash then the hash table has lost the value and you can't find it again by querying the hash table. It is important that while objects are stored in a hash table, they retain their hash value.</p>
<p>To realize this it is often simplest to make hashable objects immutable, thus evading the whole problem. It is however sufficient to make only those fields immutable that determine the hash value.</p>
<p>Consider the following example:</p>
<pre><code>struct Person {
public readonly string FirstName;
public readonly string Name;
public readonly DateTime Birthday;
public int ShoeSize;
}
</code></pre>
<p>People rarely change their birthday and most people never change their name (except when marrying). However, their shoe size may grow arbitrarily, or even shrink. It is therefore reasonable to identify people using their birthday and name but not their shoe size. The hash value should reflect this:</p>
<pre><code>public int GetHashCode() {
return FirstName.GetHashCode() ^ Name.GetHashCode() ^ Birthday.GetHashCode();
}
</code></pre>
|
<p>By default it does it based on the reference to the object, but that means that it's the exact same object, so both would return the same hash. But a hash should be based on the value, like in the case of the string class. "a" and "b" would have a different hash, but "a" and "a" would return the same hash.</p>
| 5,475
|
<p>I have a solution with several projects, where the startup project has a post-build event that does all the copying of "plugin" projects and other organizing tasks. After upgrading the solution from VS 2005 to VS 2008, it appears as though the post-build event only fires if I modify the startup project, which means my updated plugins don't get plugged in to the current debugging session. This makes sense, but it seems like a change in behavior. Is anyone else noticing a change in behavior with regard to which projects get built?</p>
<p>Does anyone know of a workaround that I can use to force the startup project to rebuild whenever I hit F5? Perhaps I configured VS 2005 to work this way so long ago that I've forgotten all about it ...</p>
|
<p>Why not just add a dependency to the "startup" project for each of the plugins? This will force the project to be rebuilt if any of the others change, and you won't have to mess with any other pre/post-build events.</p>
|
<p>Starting from @lomaxx suggestion, I got a very similar setup working by adding the following line at the <em>end</em> of the <em>post-build</em> event of the startup project:</p>
<pre><code>"$(DevEnvDir)devenv.exe" "$(ProjectPath)" /clean
</code></pre>
<p>Note that this makes the startup project build the <em>next</em> time you need to debug, so you should make sure the project gets built at least once.</p>
<p>PS. I initially tried the pre-build as suggested, but that didn't work (and I think it makes sense - if VS thinks a project doesn't need building, it won't execute any events for that project).</p>
| 3,644
|
<p>I was thinking about <a href="https://lifehacks.stackexchange.com/questions/24627/how-to-paint-a-circle-pattern-on-a-big-piece-of-paper">this question</a> and thought of maybe printing a pattern-drawing roller painter.</p>
<p>The question is: is it possible to print with an ink absorbing material that could make a paint roller possible?</p>
<p>P.S: I don't own a 3D printer, nor have I any deep knowledge in this matter. I simply want to know if this is feasible, so I can start looking for someone to 3D print this for me. If it's not, knowing beforehand could spare me a lot of time.</p>
|
<p>While printing a <em>roller stamp</em> or rubber-roll from a flexible material such as <a href="https://all3dp.com/2/tpe-vs-tpu-flexible-filament-the-differences/" rel="nofollow noreferrer">[hard]TPU, [softer] TPE</a>, or even a [super soft] foaming flexible filament is certainly possible. In any case, this would create soft, somewhat squishy prints. These prints will work quite easily as a stamp or woodblock printing stock, transferring ink from a pad to paper. The print pattern will depend a lot on how soft the stamp is: the harder, the sharper it will print. A massive roll of this material can behave akin to a rubber roll as one uses it in linoleum printing.</p>
<p>A foaming filament might be able to take <em>a little</em> paint in its airgaps, but it will never be as soft and contain as much paint as a foam lacquer roll - making it at best an improvised tool, or one that is chosen for a specific artistic purpose. It behaves more akin to closed-cell foam, while foam brushes and rolls from artist supply are typically open-cell ones. So if you go for a roller-stamp, you'll need to have an ink reservoir in the shape of a soaky-roller that isn't printed.</p>
<p>To top it off, it is nearly impossible to print a hairy wall painting roller: the hairs used in them can't be achieved with common print materials and slicers at the time. Even if stringing creates hair of <em>similar</em> dimensions, they are not affixed well enough to not get lost in the paint and can't be reliably created on demand.</p>
<p>Notes on pricing: One of the few options for foaming print materials is colorFabb, who was the first to offer such. Most of their foaming filaments cost around <a href="https://colorfabb.com/filaments/lightweight-foaming-filaments" rel="nofollow noreferrer">50 €/kg</a>, their flexible NinjaFlex costs about <a href="https://colorfabb.com/filaments/ninjatek-filaments" rel="nofollow noreferrer">80 €/kg</a>.</p>
|
<p>I'm relatively new to 3D printing, but I know some stuff. If you really wanted to print a paint roller with a pattern, I would actually go with nylon or TPR. TPE is okay, but I find that it is less cushy. I would highly suggest buying your own printer for this project. It would be much more cost effective in not only the long run, but for testing different materials. 3D printing services get pricey, so choose your printer wisely. If you do decide to buy your own printer, I would go with an Ender 3 pro. Mine is very smooth, and has an easy-to-use interface.</p>
| 1,907
|
<p>Is this even a valid question? I have a .NET Windows app that is using MSTDC and it is throwing an exception:</p>
<blockquote>
<p>System.Transactions.TransactionManagerCommunicationException: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for
network access in the security configuration for MSDTC using the Component Services Administrative tool ---> System.Runtime.InteropServices.COMException (0x8004D024): The transaction manager has disabled its support for remote/network
transactions. (Exception from HRESULT: 0x8004D024) at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32
propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier,
Guid& transactionIdentifier, OletxTransactionIsolationLevel&
isolationLevel, ITransactionShim& transactionShim)....</p>
</blockquote>
<p>I followed <a href="https://support.microsoft.com/en-us/kb/883960" rel="noreferrer">the Kbalertz guide to enable MSDTC</a> on the PC on which the app is installed, but the error still occurs. </p>
<p>I was wondering if this was a database issue? If so, how can I resolve it?</p>
|
<p>Use this for windows Server 2008 r2 and Windows Server 2012 R2</p>
<ol>
<li><p>Click <strong>Start</strong>, click <strong>Run</strong>, type <strong>dcomcnfg</strong> and then click <strong>OK</strong> to open <strong>Component Services</strong>.</p></li>
<li><p>In the console tree, click to expand <strong>Component Services</strong>, click to expand <strong>Computers</strong>, click to expand <strong>My Computer</strong>, click to expand <strong>Distributed Transaction Coordinator</strong> and then click <strong>Local DTC</strong>.</p></li>
<li><p>Right click <strong>Local DTC</strong> and click <strong>Properties</strong> to display the <strong>Local DTC Properties</strong> dialog box.</p></li>
<li><p>Click the <strong>Security</strong> tab.</p></li>
<li><p>Check mark <strong>"Network DTC Access"</strong> checkbox.</p></li>
<li><p>Finally check mark <strong>"Allow Inbound"</strong> and <strong>"Allow Outbound"</strong> checkboxes.</p></li>
<li><p>Click <strong>Apply</strong>, <strong>OK</strong>.</p></li>
<li><p>A message will pop up about <strong>restarting</strong> the service.</p></li>
<li><p>Click <strong>OK</strong> and That's all.</p></li>
</ol>
<p>Reference : <a href="https://msdn.microsoft.com/en-us/library/dd327979.aspx" rel="noreferrer">https://msdn.microsoft.com/en-us/library/dd327979.aspx</a></p>
<p><strong>Note:</strong> Sometimes the network firewall on the Local Computer or the Server could interrupt your connection so make sure you create rules to <strong>"Allow Inbound"</strong> and <strong>"Allow Outbound"</strong> connection for <code>C:\Windows\System32\msdtc.exe</code></p>
|
<p>MSDTC can be configured with MsDtc PowerShell module, e.g.:</p>
<pre><code># Import the module
Import-Module -Name MsDtc
# Set the DTC config
$dtcNetworkSetting = @{
DtcName = 'Local'
AuthenticationLevel = 'NoAuth'
InboundTransactionsEnabled = $true
OutboundTransactionsEnabled = $true
RemoteClientAccessEnabled = $true
RemoteAdministrationAccessEnabled = $true
XATransactionsEnabled = $false
LUTransactionsEnabled = $true
}
Set-DtcNetworkSetting @dtcNetworkSetting
# Restart the MsDtc service
Get-Service -Name MsDtc | Restart-Service
</code></pre>
<p>Run on each of the machines that will be supporting the distributed transactions (i.e. where the MSDTC service is running).</p>
| 2,930
|
<p>Are all of these equal? Under what circumstances should I choose each over the others?</p>
<ul>
<li><p>var.ToString()</p></li>
<li><p>CStr(var)</p></li>
<li><p>CType(var, String)</p></li>
<li><p>DirectCast(var, String)</p></li>
</ul>
<hr>
<p><em>EDIT: Suggestion from <strong><a href="https://stackoverflow.com/users/303/notmyself">NotMyself</a></strong>…</em></p>
<ul>
<li>TryCast(var, String)</li>
</ul>
|
<p>Those are all slightly different, and generally have an acceptable usage.</p>
<ul>
<li><code>var.</code><a href="http://msdn.microsoft.com/en-us/library/system.object.tostring.aspx" rel="noreferrer"><code>ToString</code></a><code>()</code> is going to give you the string representation of an object, regardless of what type it is. Use this if <code>var</code> is not a string already.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/0zk841e9.aspx" rel="noreferrer"><code>CStr</code></a><code>(var)</code> is the VB string cast operator. I'm not a VB guy, so I would suggest avoiding it, but it's not really going to hurt anything. I think it is basically the same as <code>CType</code>.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/4x2877xb.aspx" rel="noreferrer"><code>CType</code></a><code>(var, String)</code> will convert the given type into a string, using any provided conversion operators.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/7k6y2h6x.aspx" rel="noreferrer"><code>DirectCast</code></a><code>(var, String)</code> is used to up-cast an object into a string. If you know that an object variable is, in fact, a string, use this. This is the same as <code>(string)var</code> in C#.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/zyy863x8.aspx" rel="noreferrer"><code>TryCast</code></a> (as mentioned by @<a href="https://stackoverflow.com/questions/40764/how-should-i-cast-in-vbnet#40771">NotMyself</a>) is like <code>DirectCast</code>, but it will return <code>Nothing</code> if the variable can't be converted into a string, rather than throwing an exception. This is the same as <code>var as string</code> in C#. The <code>TryCast</code> page on MSDN has a good comparison, too.</li>
</ul>
|
<p>At one time, I remember seeing the MSDN library state to use CStr() because it was faster. I do not know if this is true though.</p>
| 6,203
|
<p>If you've used Oracle, you've probably gotten the helpful message "ORA-00942: Table or view does not exist". Is there a legitimate technical reason the message doesn't include the name of the missing object? </p>
<p>Arguments about this being due to security sound like they were crafted by the TSA. If I'm an attacker, I'd know what table I just attempted to exploit, and be able to interpret this unhelpful message easily. If I'm a developer working with a complex join through several layers of application code, it's often very difficult to tell.</p>
<p>My guess is that when this error was originally implemented, someone neglected to add the object name, and now, people are afraid it will break compatibility to fix it. (Code doing silly things like parsing the error message will be confused if it changes.)</p>
<p>Is there a developer-friendly (as opposed to recruiting your DBA) way to determine the name of the missing table?</p>
<hr>
<p>Although I've accepted an answer which is relevant to the topic, it doesn't really answer my question: <em>Why isn't the name part of the error message?</em> If anyone can come up with the real answer, I'll be happy to change my vote.</p>
|
<p>You can set an EVENT in your parameter file (plain text or spfile) to force Oracle to dump a detailed trace file in the user_dump_dest, the object name might be in there, if not the SQL should be.</p>
<p>EVENT="942 trace name errorstack level 12"</p>
<p>If you are using a plain text file you need to keep all your EVENT settings on consecutive lines. Not sure how that applied to spfile.</p>
|
<p>@Matthew</p>
<p>Your query's a start, but it might not work when you have multiple schemas. For example, if I log into our instance as myself, I have read access to all our tables. But if I don't qualify the table name with the schema I'll get an ORA-00942 for tables without synonyms:</p>
<pre>
SQL> select * from tools;
select * from tools
*
ERROR at line 1:
ORA-00942: table or view does not exist
</pre>
<p>The table still shows up in all_tables though:</p>
<pre>
SQL> select owner, table_name from all_tables where table_name = 'TOOLS';
OWNER TABLE_NAME
------------------------------ ------------------------------
APPLICATION TOOLS
</pre>
<p>@erikson
Sorry that doesn't help much. I'm with Mark - I used TOAD.</p>
| 6,850
|
<p>I managed to tear my build plate trying to get some very stubborn plastic off it.</p>
<p><a href="https://i.stack.imgur.com/fDqad.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fDqad.jpg" alt="Torn build plate"></a></p>
<p>I'll need to buy a new one, what characteristics are important for me to ensure it's compatable with my printer?</p>
<p>I can think of:</p>
<ol>
<li>Dimensions</li>
<li>Power requirements</li>
<li>Connector types</li>
<li>That my printer moves the plate in the z axis (?)</li>
</ol>
<hr>
<p><em>NB</em> I'm so new at this I didn't realise that this was just a sticker on the plate, so I just need to replace this sticker. However, as a question, I'm still curious as there's a good chance I will break it at some point.</p>
|
<p>If your printer's heated bed still works, but the sticker has been ripped in some places:</p>
<ul>
<li>You can try and remove the rest of the sticker, clean the metal plate under the sticker (perhaps with isopropyl alcohol) and then apply a new sticker once there is no adhesive remaining on the heated bed.</li>
<li>You can remove the sticker with the method above, but instead of replacing it with a new sticker, you can buy a PEI sheet and cut it to size if required (read more about PEI <a href="https://all3dp.com/2/pei-sheet-as-a-3d-printer-print-bed-sheet-a-guide/" rel="nofollow noreferrer">here</a>) and then stick it to the metal plate.</li>
</ul>
<p>Personally, I would recommend the latter option, since PEI is low maintenance and the prints automatically pop off the sheet once it cools down, however just make sure not to print PETG on it, since it sticks too much.</p>
<p>On the other hand, if your entire heated bed is broken, the best-case scenario is to look for a heated bed that was designed specifically for your printer. Especially since your printer's heated bed has 3 mounting screws instead of 4. </p>
<p>If you somehow have a solution for mounting a heated bed with 4 mounting screws on a printer that uses 3, the things you need to watch out for are the heated bed's operating voltage (it should be 24v) and the dimensions must be the same. If the wires are not provided with the heated bed, make sure to get wires that have high enough gauge so that it is able to handle the high currents that the heated bed will need. </p>
|
<p>I would say put a glass bed on it and you won't have to worry about tearing it ever again. Many places which sell picture frames can cut out a piece of 3 mm glass for very little (like 1-2 dollars). I've had a normal 3 mm glass bed (no expensive "heat glass" or anything) that's worked fine for 2 years of printing. You can use simple metal clips to hold the glass in place.</p>
<p>As an added bonus the prints pop off by themselves when the glass cools down. I'm usually impatient and remove the glass from my printer and cool it down under water. I wouldn't recommend doing that tho, since you risk cracking the glass due to the heat shock.</p>
<p>Only down side is that it might be a tiny bit tricker to get the print to stick, but I don't really have anything to compare to so I don't know for sure. I only have problems getting prints to stick when my initial layer height is wrong or when printing very small things.</p>
| 1,162
|
<p>Many frameworks seek to abstract away from HTML (custom tags, JSFs component system) in an effort to make dealing with that particular kettle of fish easier.</p>
<p>Is there anything you folks have used that has a similar concept applied to CSS? Something that does a bunch of cross-browser magic for you, supports like variables (why do I have to type #3c5c8d every time I want that colour), supports calculated fields (which are 'compiled' into CSS and JS), etc.</p>
<p>Alternatively, am I even thinking about this correctly? Am I trying to push a very square block through a very round hole? </p>
|
<p>What I found works best is to really learn CSS. I mean <strong>really</strong> learn CSS.</p>
<p>It can be a confusing language to learn, but if you read enough about it and practice, eventually you'll learn the best way to do things.</p>
<p>The key is to do it enough that it comes natural. CSS can be very elegant if you know what you want to do before you start and you have enough experience to do it.</p>
<p>Granted, it is also a major PITA to do sometimes, but even cross-browser issues aren't so bad if you <strong>really</strong> practice at it and learn what works and what doesn't, and how to get around problems.</p>
<p>All it takes is practice and in time you can become good at it.</p>
|
<p>CSS takes a bit of time to learn, but the thing I initially found most discouraging was the fact that so many hacks were needed to get all browsers to behave the same way. Learning a system which doesn't adhere to logic seems dumb... but I've clung to the vague belief that there is logic behind each browser's idiosyncrasy, in the form of the W3 spec. It seems that the new generation browsers are slowly coming into line - but IE6 still makes my life hell on a daily basis.</p>
<p>Maybe creating an abstraction layer between compliant/valid CSS code and the browsers' shoddy implementations wouldn't be a bad thing. But if such a thing was created - would it need to be powered by JS (or jQuery)? (and would that create an unreasonably burden, in terms of processing cost?)</p>
<p>I've found that it useful to 'level the ground' when scripting with CSS. There are probably loads of different flavours of reset script out there - but using YUI resets has helped me to reduce the number of quirks I'd otherwise encounter - and YUI grids make life a little easier sometimes. </p>
| 4,507
|
<p>I have an ASP.Net 2.0 application in which the Session_Start event is not firing in my Global.asax file. Can anyone tell why this is happening and how I can get it working?</p>
<p>The application worked fine on my Windows XP development machine, but stopped working when deployed to the server (Win Server 2003/IIS 6/ASP.Net 2.0). </p>
<p>I'm not sure if this is relevant, but the server also hosts a SharePoint installation (WSS 3.0) which I know does change some settings at the default web site level.</p>
|
<p>Is the site precompiled before adding global.asax? Try compiling it again.</p>
|
<p>Are you sure the website in IIS is set to use ASP.NET 2.0 rather than 1.1?</p>
| 9,719
|
<p>I want to scrape some information off a football (soccer) web page using simple python regexp's. The problem is that players such as the first chap, ÄÄRITALO, comes out as &#196;&#196;RITALO!<br>
That is, html uses escaped markup for the special characters, such as &#196;</p>
<p>Is there a simple way of reading the html into the correct python string? If it was XML/XHTML it would be easy, the parser would do it.</p>
|
<p>I would recommend <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow noreferrer">BeautifulSoup</a> for HTML scraping. You also need to tell it to convert HTML entities to the corresponding Unicode characters, like so:</p>
<pre><code>>>> from BeautifulSoup import BeautifulSoup
>>> html = "<html>&#196;&#196;RITALO!</html>"
>>> soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
>>> print soup.contents[0].string
ÄÄRITALO!
</code></pre>
<p>(It would be nice if the standard <a href="http://docs.python.org/lib/module-codecs.html" rel="nofollow noreferrer">codecs</a> module included a codec for this, such that you could do <code>"some_string".decode('html_entities')</code> but unfortunately it doesn't!)</p>
<p><strong>EDIT:</strong>
Another solution:
Python developer Fredrik Lundh (author of elementtree, among other things) has <a href="http://docs.python.org/lib/module-codecs.html" rel="nofollow noreferrer">a function to unsecape HTML entities</a> on his website, which works with decimal, hex and named entities (BeautifulSoup will not work with the hex ones).</p>
|
<p>I haven't tried it myself, but have you tried</p>
<p><a href="http://zesty.ca/python/scrape.html" rel="nofollow noreferrer">http://zesty.ca/python/scrape.html</a> ?</p>
<p>It seems to have a method htmldecode(text) which would do what you want.</p>
| 7,665
|
<p>Last year, Scott Guthrie <a href="http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx" rel="noreferrer">stated</a> “You can actually override the raw SQL that LINQ to SQL uses if you want absolute control over the SQL executed”, but I can’t find documentation describing an extensibility method.</p>
<p>I would like to modify the following LINQ to SQL query:</p>
<pre>using (NorthwindContext northwind = new NorthwindContext ()) {
var q = from row in northwind.Customers
let orderCount = row.Orders.Count ()
select new {
row.ContactName,
orderCount
};
}</pre>
<p>Which results in the following TSQL:</p>
<pre>SELECT [t0].[ContactName], (
SELECT COUNT(*)
FROM [dbo].[Orders] AS [t1]
WHERE [t1].[CustomerID] = [t0].[CustomerID]
) AS [orderCount]
FROM [dbo].[Customers] AS [t0]</pre>
<p>To:</p>
<pre>using (NorthwindContext northwind = new NorthwindContext ()) {
var q = from row in northwind.Customers.With (
TableHint.NoLock, TableHint.Index (0))
let orderCount = row.Orders.With (
TableHint.HoldLock).Count ()
select new {
row.ContactName,
orderCount
};
}</pre>
<p>Which <em>would</em> result in the following TSQL:</p>
<pre>SELECT [t0].[ContactName], (
SELECT COUNT(*)
FROM [dbo].[Orders] AS [t1] WITH (HOLDLOCK)
WHERE [t1].[CustomerID] = [t0].[CustomerID]
) AS [orderCount]
FROM [dbo].[Customers] AS [t0] WITH (NOLOCK, INDEX(0))</pre>
<p>Using:</p>
<pre>public static Table<TEntity> With<TEntity> (
this Table<TEntity> table,
params TableHint[] args) where TEntity : class {
//TODO: implement
return table;
}
public static EntitySet<TEntity> With<TEntity> (
this EntitySet<TEntity> entitySet,
params TableHint[] args) where TEntity : class {
//TODO: implement
return entitySet;
}</pre>
<p>And</p>
<pre>
public class TableHint {
//TODO: implement
public static TableHint NoLock;
public static TableHint HoldLock;
public static TableHint Index (int id) {
return null;
}
public static TableHint Index (string name) {
return null;
}
}</pre>
<p>Using some type of LINQ to SQL extensibility, other than <a href="http://blogs.msdn.com/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx" rel="noreferrer">this one</a>. Any ideas?</p>
|
<p>The ability to change the underlying provider and thus modify the SQL did not make the final cut in LINQ to SQL.</p>
|
<p><code>DataContext x = new DataContext</code></p>
<p>Something like this perhaps?</p>
<p><code>var a = x.Where().with()</code>...etc </p>
<p>It lets you have a much finer control over the SQL.</p>
| 8,849
|
<p>Here is a sample code to retrieve data from a database using the yield keyword that I found in a few place while googling around :</p>
<pre><code>public IEnumerable<object> ExecuteSelect(string commandText)
{
using (IDbConnection connection = CreateConnection())
{
using (IDbCommand cmd = CreateCommand(commandText, connection))
{
connection.Open();
using (IDbDataReader reader = cmd.ExecuteReader())
{
while(reader.Read())
{
yield return reader["SomeField"];
}
}
connection.Close();
}
}
}
</code></pre>
<p>Am I correct in thinking that in this sample code, the connection would not be closed if we do not iterate over the whole datareader ? </p>
<p>Here is an example that would not close the connection, if I understand yield correctly..</p>
<pre><code>foreach(object obj in ExecuteSelect(commandText))
{
break;
}
</code></pre>
<p>For a db connection that might not be catastrophic, I suppose the GC would clean it up eventually, but what if instead of a connection it was a more critical resource?</p>
|
<p>The Iterator that the compiler synthesises implements <code>IDisposable</code>, which <code>foreach</code> calls when the <code>foreach</code> loop is exited.</p>
<p>The Iterator's <code>Dispose()</code> method will clean up the <code>using</code> statements on early exit.</p>
<p>As long as you use the iterator in a <code>foreach</code> loop, <code>using()</code> block, or call the <code>Dispose()</code> method in some other way, the cleanup of the Iterator will happen.</p>
|
<p>Judging from <a href="http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx" rel="nofollow noreferrer">this technical explanation</a>, your code will not work as expected, but abort on the second item, because the connection was already closed when returning the first item.</p>
<p>@Joel Gauvreau : Yes, I should have read on. <a href="http://blogs.msdn.com/oldnewthing/archive/2008/08/14/8862242.aspx" rel="nofollow noreferrer">Part 3</a> of this series explains that the compiler adds special handling for finally blocks to trigger only at the <em>real</em> end.</p>
| 6,978
|
<p>Taken from the <a href="https://3dprinting.stackexchange.com/a/60/47">answer provided by @EricJohnson</a>,</p>
<p>When should I use a raft, and when should I use a brim? What advantages does each have over the other?</p>
<p>Raft
<a href="https://i.stack.imgur.com/rOghM.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/rOghM.jpg" alt="enter image description here"></a></p>
<p>Brim
<a href="https://i.stack.imgur.com/9MnlZ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/9MnlZ.jpg" alt="enter image description here"></a></p>
|
<p>A raft will allow for better adhesion for the whole print as the raft attaches to the printing surface and the print attaches to the raft. Rafts go all the way under the print and consist of multiple layers, whereas a brim is only 1 layer and on the outside of the print. Rafts are normally harder to remove than brims because of the increased contact with the print.</p>
<p>From my own experiences, the brim does not help a lot with layer adhesion as it is only 1 layer. I normally use a raft when I need a nice looking 1st layer that is not on the bed or when there are not enough contact points.</p>
|
<p>I have been favoring brims recently; I am tired of the rafts becoming an integral part of my print, impossible to remove.</p>
| 103
|
<p>I want to build a bot that asks someone a few simple questions and branches based on the answer. I realize parsing meaning from the human responses will be challenging, but how do you setup the program to deal with the "state" of the conversation?</p>
<p>It will be a one-to-one conversation between a human and the bot.</p>
|
<p>You probably want to look into <a href="http://en.wikipedia.org/wiki/Markov_chain" rel="noreferrer">Markov Chains</a> as the basics for the bot AI. I wrote something a long time ago (the code to which I'm not proud of at all, and needs some mods to run on Python > 1.5) that may be a useful starting place for you: <a href="http://sourceforge.net/projects/benzo/" rel="noreferrer"><a href="http://sourceforge.net/projects/benzo/" rel="noreferrer">http://sourceforge.net/projects/benzo/</a></a></p>
<p>EDIT: Here's a minimal example in Python of a Markov Chain that accepts input from stdin and outputs text based on the probabilities of words succeeding one another in the input. It's optimized for IRC-style chat logs, but running any decent-sized text through it should demonstrate the concepts:</p>
<pre><code>import random, sys
NONWORD = "\n"
STARTKEY = NONWORD, NONWORD
MAXGEN=1000
class MarkovChainer(object):
def __init__(self):
self.state = dict()
def input(self, input):
word1, word2 = STARTKEY
for word3 in input.split():
self.state.setdefault((word1, word2), list()).append(word3)
word1, word2 = word2, word3
self.state.setdefault((word1, word2), list()).append(NONWORD)
def output(self):
output = list()
word1, word2 = STARTKEY
for i in range(MAXGEN):
word3 = random.choice(self.state[(word1,word2)])
if word3 == NONWORD: break
output.append(word3)
word1, word2 = word2, word3
return " ".join(output)
if __name__ == "__main__":
c = MarkovChainer()
c.input(sys.stdin.read())
print c.output()
</code></pre>
<p>It's pretty easy from here to plug in persistence and an IRC library and have the basis of the type of bot you're talking about.</p>
|
<p>I would suggest looking at Bayesian probabilities. Then just monitor the chat room for a period of time to create your probability tree.</p>
| 7,874
|
<p>I'll soon be posting an article on <a href="http://theschmitzer.blogspot.com" rel="nofollow noreferrer">my blog</a>, but I'd like to verify I haven't missed anything first.</p>
<p>Find an example I've missed, and I'll cite you on my post.</p>
<p>The topic is failed Singleton implementations: In what cases can you <em>accidentally</em> get multiple instances of a singleton?</p>
<p>So far, I've come up with:</p>
<ul>
<li>Race Condition on first call to <code>instance()</code></li>
<li>Incorporation into multiple DLLs or DLL and executable </li>
<li>Template definition of a singleton - actually separate classes</li>
</ul>
<p>Any other ways I'm missing - perhaps with inheritance?</p>
|
<p>If you use a static instance field that you initialize in your cpp file, you can get multiple instances (and even worse behavior) if the initialization of some static/global tries to get an instance of your singleton. This is because the order of static initialization across compilation units is undefined.</p>
|
<p>Inheritance shouldn't be an issue as long as the ctor is private.</p>
<p>However, if you don't disallow the copy constructor, users may [un]intentionally copy the singleton instance. Privately inheriting from <a href="http://www.boost.org/doc/libs/1_36_0/libs/utility/utility.htm" rel="nofollow noreferrer">boost::noncopyable</a> is the easiest way to prevent this.</p>
| 8,520
|
<p>I'm trying to setup CruiseControl.net webdashboard at the moment. So far it works nice, but I have a problem with the NAnt Build Timing Report.</p>
<p>Firstly, my current <code>ccnet.config</code> file looks something like this:</p>
<pre><code><project name="bla">
...
<prebuild>
<nant .../>
</prebuild>
<tasks>
<nant .../>
</tasks>
<publishers>
<nant .../>
</publishers>
...
</project>
</code></pre>
<p>As the build completes, NAnt timing report displays three duplicate summaries. Is there a way to fix this without changing the project structure?
</p>
|
<p>Apparently this can be solved by selecting only the first <code><buildresults></code> node in webdashboard's NAntTiming.xsl. Because each duplicate summary contains the same info this change in <code><div id="NAntTimingReport"></code> section seems to be sufficient:</p>
<pre><code><xsl:variable name="buildresults" select="//build/buildresults[1]" />
</code></pre>
|
<p>Not a direct answer to your question, but you might want to check out Hudson. It has the benefit of being much easier to configure than CruiseControl. There's a bit about using it for NAnt <a href="http://hudson.gotdns.com/wiki/display/HUDSON/NAnt+Plugin" rel="nofollow noreferrer">here</a>.</p>
| 4,548
|
<p>What is the difference between the following types of endianness?</p>
<ul>
<li>byte (8b) invariant big and little endianness</li>
<li>half-word (16b) invariant big and little endianness</li>
<li>word (32b) invariant big and little endianness</li>
<li>double-word (64b) invariant big and little endianness</li>
</ul>
<p>Are there other types/variations?</p>
|
<p>There are two approaches to endian mapping: <em>address invariance</em> and <em>data invariance</em>.</p>
<h2>Address Invariance</h2>
<p>In this type of mapping, the address of bytes is always preserved between big and little. This has the side effect of reversing the order of significance (most significant to least significant) of a particular datum (e.g. 2 or 4 byte word) and therefore the interpretation of data. Specifically, in little-endian, the interpretation of data is least-significant to most-significant bytes whilst in big-endian, the interpretation is most-significant to least-significant. In both cases, the set of bytes accessed remains the same.</p>
<p><strong>Example</strong></p>
<p>Address invariance (also known as <em>byte invariance</em>): the byte address is constant but byte significance is reversed.</p>
<pre><code>Addr Memory
7 0
| | (LE) (BE)
|----|
+0 | aa | lsb msb
|----|
+1 | bb | : :
|----|
+2 | cc | : :
|----|
+3 | dd | msb lsb
|----|
| |
At Addr=0: Little-endian Big-endian
Read 1 byte: 0xaa 0xaa (preserved)
Read 2 bytes: 0xbbaa 0xaabb
Read 4 bytes: 0xddccbbaa 0xaabbccdd
</code></pre>
<h2>Data Invariance</h2>
<p>In this type of mapping, the relative byte significance is preserved for datum of a particular size. There are therefore different types of data invariant endian mappings for different datum sizes. For example, a 32-bit word invariant endian mapping would be used for a datum size of 32. The effect of preserving the value of particular sized datum, is that the byte addresses of bytes within the datum are reversed between big and little endian mappings.</p>
<p><strong>Example</strong></p>
<p>32-bit data invariance (also known as <em>word invariance</em>): The datum is a 32-bit word which always has the value <code>0xddccbbaa</code>, independent of endianness. However, for accesses smaller than a word, the address of the bytes are reversed between big and little endian mappings.</p>
<pre><code>Addr Memory
| +3 +2 +1 +0 | <- LE
|-------------------|
+0 msb | dd | cc | bb | aa | lsb
|-------------------|
+4 msb | 99 | 88 | 77 | 66 | lsb
|-------------------|
BE -> | +0 +1 +2 +3 |
At Addr=0: Little-endian Big-endian
Read 1 byte: 0xaa 0xdd
Read 2 bytes: 0xbbaa 0xddcc
Read 4 bytes: 0xddccbbaa 0xddccbbaa (preserved)
Read 8 bytes: 0x99887766ddccbbaa 0x99887766ddccbbaa (preserved)
</code></pre>
<p><strong>Example</strong></p>
<p>16-bit data invariance (also known as <em>half-word invariance</em>): The datum is a 16-bit
which always has the value <code>0xbbaa</code>, independent of endianness. However, for accesses smaller than a half-word, the address of the bytes are reversed between big and little endian mappings.</p>
<pre><code>Addr Memory
| +1 +0 | <- LE
|---------|
+0 msb | bb | aa | lsb
|---------|
+2 msb | dd | cc | lsb
|---------|
+4 msb | 77 | 66 | lsb
|---------|
+6 msb | 99 | 88 | lsb
|---------|
BE -> | +0 +1 |
At Addr=0: Little-endian Big-endian
Read 1 byte: 0xaa 0xbb
Read 2 bytes: 0xbbaa 0xbbaa (preserved)
Read 4 bytes: 0xddccbbaa 0xddccbbaa (preserved)
Read 8 bytes: 0x99887766ddccbbaa 0x99887766ddccbbaa (preserved)
</code></pre>
<p><strong>Example</strong></p>
<p>64-bit data invariance (also known as <em>double-word invariance</em>): The datum is a 64-bit
word which always has the value <code>0x99887766ddccbbaa</code>, independent of endianness. However, for accesses smaller than a double-word, the address of the bytes are reversed between big and little endian mappings.</p>
<pre><code>Addr Memory
| +7 +6 +5 +4 +3 +2 +1 +0 | <- LE
|---------------------------------------|
+0 msb | 99 | 88 | 77 | 66 | dd | cc | bb | aa | lsb
|---------------------------------------|
BE -> | +0 +1 +2 +3 +4 +5 +6 +7 |
At Addr=0: Little-endian Big-endian
Read 1 byte: 0xaa 0x99
Read 2 bytes: 0xbbaa 0x9988
Read 4 bytes: 0xddccbbaa 0x99887766
Read 8 bytes: 0x99887766ddccbbaa 0x99887766ddccbbaa (preserved)
</code></pre>
|
<p>the basic concept is the ordering of bits:</p>
<pre><code>1010 0011
</code></pre>
<p>in little-endian is the same as</p>
<pre><code>0011 1010
</code></pre>
<p>in big-endian (and vice-versa).</p>
<p>You'll notice the order changes by grouping, not by individual bit. I don't know of a system, for example, where</p>
<pre><code>1100 0101
</code></pre>
<p>would be the "other-endian" version of the first version.</p>
| 4,161
|
<p>A Visual Studio 2008 project in one solution needs to reference a WCF service in another VS 2008 solution on the same development machine. Does anybody have any suggestions on how best to accomplish this?</p>
|
<p>You could do a redirect to buy.php after saving to the session object, which then does a server redirect to check.php, it would mean when the user clicks back, they're going back to the GET request not the POST request</p>
|
<p>Yes - I agree with above. I ALWAYS do a <code>redir</code> away from the last post, so clicking back bounces them back without that error OR re-submissions. it also avoids complications. u can always tag the <code>redir</code> link page with a <code>?m</code> or <code>&m</code> (i.e.: <code>page.php?m</code>) and have this at top of page: (use <code>elseif</code> there after) </p>
<pre><code>if (isset($_GET['m'])) {
echo 'order placed.';
}
else {
//...
}
</code></pre>
<p>You can have it all on one page too. Just name the submit buttons <code>submit1</code>, <code>submit2</code>, like: (bear in mind if you use an image for submits, it becomes <code>$_POST['submit1_x']</code> :)</p>
<pre><code>if (isset($_POST[submit1]) {
//validate + save session data from form1
//display form 2
} else if(isset($_POST[submit2])) {
//validate + save session data from form2
//display form 3
} else {
//display first form
//<input type="submit" name="submit1" value="Continue">
}
</code></pre>
| 7,963
|
<p>How can I use .NET DataSet.Select method to search records that match a DateTime?
What format should I use to enter my dates in?</p>
|
<p>The best method is dd MMM yyyy (ie 15 Sep 2008). This means there is no possiblity of getting it wrong for different Locals.</p>
<pre><code>ds.select(DBDate = '15 Sep 2008')
</code></pre>
<p>You can use the DateFormat function to convert to long date format as well and this will work fine too.</p>
|
<p>I use the following for the SQL Select:</p>
<pre><code> public string BuildSQL()
{
// Format: CAST('2000-05-08 12:35:29' AS datetime)
StringBuilder sb = new StringBuilder("CAST('");
sb.Append(_dateTime.ToString("yyyy-MM-dd HH:mm:ss"));
sb.Append("' AS datetime)");
return sb.ToString();
}
</code></pre>
| 9,322
|
<p>Looking for feedback on :</p>
<p><a href="http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools" rel="nofollow noreferrer">http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools</a></p>
|
<p>There's a <a href="http://web.archive.org/web/20090227051320/http://xtalk.msk.su:80/%7Eott/en/writings/prog-checking/GooglePT.html" rel="nofollow noreferrer">pretty good post</a> that I read a while back that outlines some testing and analysis of GPT in a variety of scenarios</p>
|
<p>I use GPT at work since 2007, and I totally satisfied. I use it to monitor and optimize a Linux network library, and I have obtained a significant results.</p>
<p>The main flaw of GPT is the lack of precision. Due to the design, you only got the main time consuming functions, but this is often what you need when you want to optimize a program. </p>
<p>To be more precise I advise to use other tools like gprof or IBM Quantify.</p>
| 2,864
|
<p>Let's take a web development environment, where developers checkout a project onto their local machines, work on it, and check in changes to development.<br>
These changes are further tested on development and moved live on a regular schedule (eg weekly, monthly, etc.).<br>
Is it possible to have an auto-moveup of the latest tagged version (and not the latest checkin, as that might not be 100% stable), for example 8AM on Monday mornings, either using a script or a built-in feature of the VCS?</p>
|
<p>Certainly, but the exact product may be dependent upon the VCS you are using.</p>
<p>What you might want to do, is have a a few different branches, and migrate up as you progress. E.g., Development -> Stable-Dev -> Beta -> Production. You can then simply auto-update to the latest version of Stable-Dev and Beta for your testers, and always be able to deploy a new Production version at the drop of a hat.</p>
|
<p>I doubt many VCSs provide this ability directly, however it should be very simple to script. Either a date or branch based checkout.</p>
| 3,544
|
<p>Are there any good programs for dealing with reading large CSV files? Some of the datafiles I deal with are in the 1 GB range. They have too many lines for Excel to even deal with. Using Access can be a little slow, as you have to actually import them into a database to work with them directly. Is there a program that can open large CSV files and give you a simple spreadsheet layout to help you easily and quickly scan through the data?</p>
|
<p>MySQL can import CSV files very quickly onto tables using the <a href="http://dev.mysql.com/doc/refman/5.0/en/load-data.html" rel="noreferrer"><code>LOAD DATA INFILE</code></a> command. It can also read from CSV files directly, bypassing any import procedures, by using the <a href="http://dev.mysql.com/doc/refman/5.0/en/csv-storage-engine.html" rel="noreferrer">CSV storage engine</a>.</p>
<p>Importing it onto native tables with <code>LOAD DATA INFILE</code> has a start up cost, but after that you can <code>INSERT/UPDATE</code> much faster, as well as index fields. Using the CSV storage engine is almost instantaneous at first, but only sequential scan will be fast.</p>
<p><strong>Update</strong>: <a href="http://dev.mysql.com/tech-resources/articles/csv-storage-engine.html" rel="noreferrer">This article</a> (scroll down to the section titled <em>Instant Data Loads</em>) talks about using both approaches to loading CSV data onto MySQL, and gives examples.</p>
|
<p>vEdit is great but don't forget you can always go back to "basics" check out <a href="http://www.cygwin.com/" rel="nofollow noreferrer">Cygwin</a> and start greping.</p>
<p>Helpfull commands</p>
<ul>
<li>grep </li>
<li>head</li>
<li>tail</li>
<li>of course perl!</li>
</ul>
| 6,602
|
<p>I have been experimenting with <a href="http://www.woopra.com/" rel="nofollow noreferrer">woopra.com</a> A web analytics tool. Which requires a piece of javascript code to be added to each page to function. This is easy enough with more dynamic sites with universal headers or footers but not for totally static html pages.</p>
<p>I attempted to work round it by using a combination of Apache rewrites and SSI's to "Wrap" the static html with the required code. For example...</p>
<p>I made the following changes to my apache config</p>
<pre><code> RewriteEngine On
RewriteCond %{REQUEST_URI} !=test.shtml
RewriteCond %{IS_SUBREQ} false
RewriteRule (.*)\.html test.shtml?$1.html
</code></pre>
<p>The test.shtml file contains...</p>
<pre><code> <script type="text/javascript">
var XXXXid = 'xxxxxxx';
</script>
<script src="http://xxxx.woopra.com/xx/xxx.js"></script>
<!--#set var="page" value="$QUERY_STRING" -->
<!--#include virtual= $page -->
</code></pre>
<p>The idea was that a request coming in for</p>
<pre><code> /abc.html
</code></pre>
<p>would be redirected to</p>
<pre><code> /test.shtml?abc.html
</code></pre>
<p>the shtml would then include the original file into the response page.</p>
<p>Unfortunately it doesn't quite work as planed :) can anyone see what I am doing wrong or perhaps suggest an alternative approach. Is there any apache modules that could do the same thing. Preferably that can be configured on a per site basis.</p>
<p>Thanks</p>
<p>Peter</p>
|
<p>I think that <a href="http://httpd.apache.org/docs/2.2/mod/mod_ext_filter.html" rel="nofollow noreferrer">mod_filter_ext</a> is the module you are looking for. You can write a short Perl script for example to insert the JS code in the pages and register it to process HTML pages:</p>
<pre><code>while (<>) {
s/<html>/\Q<script>....\E/;
print $_;
}
</code></pre>
<p>You could even use something like <code>sed</code> to perform the substitution.</p>
|
<p>ok the method above's biggest problem is it would break your html validity by placing a script tag outside the <code><html></code> tags</p>
<p>i'd agree with the others on a pre-process run over your html files such as a sed/awk script</p>
<p>heres a quick example {assuming the script part can be added before the <code></head></code>
and that the <code></head></code> is at the start of a newline</p>
<pre><code>#!/bin/bash
cd /var/webserver/whatever/
grep -r '<\/head>' */*|grep "^.*\.html*:" >/var/tmp/tempfile.txt
((lines = $(wc -l /var/tmp/dom-tempfile.txt | awk '{print $1}')))
if [ $lines -gt 0 ]
then
while read line; do
sed 's/<script type="text\/javascript"> var XXXXid = "xxxxxxx"; <\/script><script src="http:\/\/xxxx\.woopra\.com\/xx\/xxx\.js"><\/script><\/head>/^<\/head>/g' $line>/var/tmp/tempfile.htm
mv /var/tmp/tempfile.htm $line
done < <(sed 's/\(^.*\.html*\):.*$/\1/' /var/tmp/tempfile.txt)
fi
exit 0
</code></pre>
| 6,136
|
<p>Looking for a way to display a PDF in Flex. I'm sure there are several ways. Looking for the easiest to maintain / integrate / most user friendly. I'm guessing it's possible to display a browser window in the app and render it, but if it goes off of IE / FireFox it's not acceptable for this project.</p>
<p>Thanks...</p>
|
<p>This looks like a nice PDF viewer for flex <a href="http://www.devaldi.com/?p=212" rel="nofollow noreferrer">http://www.devaldi.com/?p=212</a></p>
|
<p>Oh sweet, this is an air app. I'll go with the HTML view. I can't convert them to SWF because the client will be uploading the files.</p>
| 5,096
|
<p>I am currently in the process of creating my own blog and I have got to marking up the comments, but what is the best way to mark it up?</p>
<p>The information I need to present is:</p>
<ol>
<li>Persons Name</li>
<li>Gravatar Icon</li>
<li>Comment Date</li>
<li>The Comment</li>
</ol>
<p><em>PS: I'm only interested in semantic HTML markup.</em></p>
|
<p>I think that your version with the cite, blockquote, etc. would definitely work, but if semantics is your main concern then I personally wouldn't use cite and blockquote as they have specific things that they are supposed to represent.</p>
<p>The blockquote tag is meant to represent a quotation taken from another source and the cite tag is meant to represent a source of information (like a magazine, newspaper, etc.).</p>
<p>I think an argument can certainly made that you can use semantic HTML with class names, provided they are meaningful. This article on Plain Old Semantic HTML makes a reference to using class names - <a href="http://www.fooclass.com/plain_old_semantic_html" rel="nofollow noreferrer">http://www.fooclass.com/plain_old_semantic_html</a></p>
|
<p>I don't know that there's markup that would necessarily represent the comment structure well without using <em>divs</em> or classes as well, but you could use definition lists. You can use multiple <em>dt</em> and <em>dd</em> tags in the context of a definition list - see <em><a href="http://www.w3.org/TR/html401/struct/lists.html#edef-DL" rel="nofollow noreferrer">10.3 Definition lists: the DL, DT, and DD elements</a></em>.</p>
<pre><code><dl>
<dt>By [Name] at 2008-01-01<dt>
<dd><img src='...' alt=''/></dd>
<dd><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed mauris. Morbi quis tellus sit amet eros ullamcorper ultrices. Proin a tortor. Praesent et odio. Duis mi odio, consequat ut, euismod sed, commodo vitae, nulla. Suspendisse potenti. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam pede.</p>
<p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas rhoncus accumsan velit. Donec varius magna a est. </p>
</dd>
</dl>
</code></pre>
<p>The concern I'd have with an approach like this is that it could be difficult to uniquely identify the elements with CSS for styling purposes. You could use JavaScript (jQuery would be great here) to find and apply styles. Without full CSS selector support across browsers (<a href="https://en.wikipedia.org/wiki/Internet_Explorer" rel="nofollow noreferrer">Internet Explorer</a>), it would be tougher to style.</p>
| 2,720
|
<p>It seems like drag and drop upload widgets disappeared from the face of Web 2.0. The last one of these I remember using was an activex widget, and inability of using it in anything other than IE doomed it. Have you used or seen one of these recently?</p>
|
<p>The <a href="http://dojotoolkit.org/" rel="nofollow noreferrer">Dojo Toolkit</a> JavaScript library supports some drag & drop functionality that I've seen work in IE6+ and FF2+. The nice thing about Dojo and other JS libraries is that they abstract away all of the browser detection stuff.</p>
<p>I'm sure other JS libraries support this functionality.</p>
|
<p><a href="http://widgets.yahoo.com/widgets/ftp-drop" rel="nofollow noreferrer">FTP Drop</a> for Yahoo Widgets allows you to drag files over the widget and the file will be sent to the defined ftp server.</p>
| 2,772
|
<p>I am fairly new to Emacs and I have been trying to figure out how to change the default folder for <kbd>C-x C-f</kbd> on start-up. For instance when I first load Emacs and hit <kbd>C-x C-f</kbd> its default folder is <code>C:\emacs\emacs-21.3\bin</code>, but I would rather it be the desktop. I believe there is some way to customize the <code>.emacs</code> file to do this, but I am still unsure what that is.</p>
<p>Update: There are three solutions to the problem that I found to work, however I believe solution 3 is Windows only.</p>
<ul>
<li><p>Solution 1: Add <code>(cd "C:/Users/Name/Desktop")</code> to the <code>.emacs</code> file</p></li>
<li><p>Solution 2: Add <code>(setq default-directory "C:/Documents and Settings/USER_NAME/Desktop/")</code> to the <code>.emacs</code> file</p></li>
<li><p>Solution 3: Right click the Emacs short cut, hit properties and change the start in field to the desired directory.</p></li>
</ul>
|
<p>You didn't say so, but it sounds like you're starting Emacs from a Windows shortcut.</p>
<p>The directory that you see with c-x c-f is the cwd, in Emacs terms, the <code>default-directory</code> (a variable).</p>
<p>When you start Emacs using an MS Windows shortcut, the <code>default-directory</code> is initially the folder (directory) specified in the "Start In" field of the shortcut properties. Right click the shortcut, select <code>Properties</code>, and type the path to your desktop in the <code>Start In</code> field.</p>
<p>If you're using Emacs from the command line, <code>default-directory</code> starts as the directory where you started Emacs (the cwd).</p>
<p>This approach is better than editing your .emacs file, since it will allow you to have more than one shortcuts with more than one starting directory, and it lets you have the normal command line behavior of Emacs if you need it.</p>
<p><strong>CWD</strong> = <a href="http://linux.die.net/man/3/cwd" rel="noreferrer">current working directory</a> = <strong>PWD</strong> = <a href="http://en.wikipedia.org/wiki/Pwd" rel="noreferrer">present working directory</a>. It makes a lot more sense at the command line than in a GUI.</p>
|
<p>In Windows 8, it works to create a shortcut in the Desktop and change the property 'Start In:' for the shortcut. </p>
<p>Now, I ran the program emacs-23.3\bin\addpm.exe as recommended, and the Windows-8 screen (that horrendous invention from Microsoft) it appeared an icon-link to Emacs. But there you have to change again the property 'Start In'. (It is different from the one in the desktop).
Just right-click, choose in the bottom bar 'Open the file location' (or similar, I did it in my language), and you are taken to the folder with a new shortcut, in which you can (must) also change the property 'Start In:'.</p>
<p>A little involved, but in fact very easy.</p>
| 8,535
|
<p>I have a WebChartControl on my web page. When the chart was generated, an image is being produced and it was shown on the page. </p>
<p>Is there a way to get and save this chart as an image output on runtime? </p>
|
<p>Sure. Ultimately the image comes from a URL of some sort. Do a view-source on the web page and see what that URL looks like. With a certain amount of reverse-engineering, usage of System.Web.UI.HtmlTextWriter, perhaps an HttpHandler, etc. you should be able to get what you want.</p>
|
<p>Use the ExportToImage method of the ChartControl object .. This is WinForm code, but the same concept should hold true for WebChartControl:</p>
<pre><code> Dim chart As ChartControl = ChartControl1.Clone()
chart.Size = New Size(800, 600)
chart.ExportToImage("file.png", System.Drawing.Imaging.ImageFormat.Png)
</code></pre>
| 6,867
|
<p>I'm currently designing a RepRap 3D printer that will not have a heated bed. I have heard that it is possible to use a power brick with commercial printers lacking heatbeds. Is this possible with a RepRap printer using a RAMPS board?</p>
<p>I'm referring specifically to the TronXY X1 power brick. I was wondering if it we're possible to use the same TronXY X1 power brick with a standard RAMPS 1.4 board - rather than the special board the TronXY X1 uses.</p>
|
<p><strong>Printing speed is dependent by the firmware and physical properties of your printer</strong>.</p>
<p>Slicers typically compute the expected time by assuming the printer will execute <em>exactly</em> what it is instructed to do, but a printer is a real object, with mass and momentum, and stepper motors that have an upper limit for their power output and rotation speed.</p>
<p>So for example, the GCODE may say "extrude 200mm at 100mm/s" and the slicer will compute that operation as taking 2 seconds. However the printer will need to accelerate and decelerate at the extremes of the movement, and it may even be incapable of reaching speeds over 70mm/s, so the <em>actual</em> operation will likely take 3 seconds or more.</p>
<p>Accelerations and decelerations account for most of the difference between ideal time and real one, and since the number and intensity of those is totally dependent by the GCODE/model being printed, <strong>it is not possible to simply multiply the computed time for a given factor</strong> (for example <code>1.15</code>, as your question seems to imply). A large cylinder printed in vase mode will have a printing time much more similar to the computed one that an intricate model with a very complex surface, for example.</p>
<p>In recent years, slicers that are maintained by a printer manufacturer (cura, slic3r PE) have become better at estimating printing times for their own printers, as the settings of the firmware are accounted for in the actual estimating algorithm.</p>
<p>If you use Octoprint, you may have noticed that the time estimate octoprint gives improves over time, as <strong>octoprint will analyse the GCODE and measure the elapsed time, and will be able to guesstimate the real time with an increasingly degree of accuracy</strong>.</p>
|
<p>I use a Anet A8 which has a system acceleration and jerk of 400 and 20
When i slice with Cura, then I use a gcode without acceleration control, because the printer does this by its own and a combination with the gcode acceleration/jerk control gets me some strange behavior (e.g. sometimes some ultra slow movement in fine detail sections, or random nearly stopped movement)
But to get a realistic approximation for the print time, i enable the acceleration/jerk control in cura and then I get a really good result, that is really close to the real values. </p>
<p>And to be more specific to your question: It is e.g. 50mm/s >>maximum<< speed you can set, not a exactly and absolut speed.
If you know your printer you can also experiment with the following approach: Set the max speed really high, so that the max material volume per time is the limiting factor and set the acceleration and jerk as low as needed for good results. So that your printer will accelerate on long lines as long as it can up to the point it has to deaccelerate for the next corner. </p>
| 875
|
<p>Can anyone suggest some good browser add-on tools/extensions to help with development?
I have firebug installed in Firefox which is great for dealing with CSS, HTML and javascript; any other suggestions?</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/1843" rel="nofollow noreferrer">Firebug</a></p>
|
<p>Firefox:</p>
<ul>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1913" rel="nofollow noreferrer">Inspect This</a> if you use the DOM Inspector at all</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/539" rel="nofollow noreferrer">Measure It</a> for telling you pixel distances (if you need that)</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/35" rel="nofollow noreferrer">IE View</a> or <a href="https://addons.mozilla.org/en-US/firefox/addon/4641" rel="nofollow noreferrer">Safari View</a> for ease of testing in other browsers</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/249" rel="nofollow noreferrer">HTML Validator</a> if you care about validation</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1815" rel="nofollow noreferrer">Console<sup>2</sup></a> to improve your js error console</li>
<li>The <a href="https://www.squarefree.com/bookmarklets/webdevel.html" rel="nofollow noreferrer">Javascript Shell</a> bookmarklet is also handy (and look at the others there as well)</li>
</ul>
<p>Edit: This is in addition to the <a href="https://addons.mozilla.org/en-US/firefox/addon/60" rel="nofollow noreferrer">Web Development Toolbar</a> mentioned by others</p>
|
<p>Other than the excellent tools already mentioned, I find <a href="http://www.charlesproxy.com/" rel="nofollow noreferrer">Charles</a> to be extremely useful. Especially since I do alot of work with Flash Remoting which it handles excellently.</p>
<blockquote>
<p>Charles is an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP traffic between their machine and the Internet. This includes requests, responses and the HTTP headers (which contain the cookies and caching information).</p>
<p>Charles can act as a man-in-the-middle for HTTP/SSL communication, enabling you to debug the content of your HTTPS sessions.</p>
</blockquote>
<p>It's crossplatform, costs $50, but there's a "30 minute per session"-evaluation you can download.</p>
| 3,817
|
<p>What are some standard practices for managing a medium-large JavaScript application? My concerns are both speed for browser download and ease and maintainability of development.</p>
<p>Our JavaScript code is roughly "namespaced" as:</p>
<pre><code>var Client = {
var1: '',
var2: '',
accounts: {
/* 100's of functions and variables */
},
orders: {
/* 100's of functions and variables and subsections */
}
/* etc, etc for a couple hundred kb */
}
</code></pre>
<p>At the moment, we have one (unpacked, unstripped, highly readable) JavaScript file to handle all the business logic on the web application. In addition, there is jQuery and several jQuery extensions. The problem we face is that it takes <em>forever</em> to find anything in the JavaScript code and the browser still has a dozen files to download.</p>
<p>Is it common to have a handful of "source" JavaScript files that gets "compiled" into one final, compressed JavaScript file? Any other handy hints or best practices?</p>
|
<p>The approach that I've found works for me is having seperate JS files for each class (just as you would in Java, C# and others). Alternatively you can group your JS into application functional areas if that's easier for you to navigate.</p>
<p>If you put all your JS files into one directory, you can have your server-side environment (PHP for instance) loop through each file in that directory and output a <code><script src='/path/to/js/$file.js' type='text/javascript'></code> in some header file that is included by all your UI pages. You'll find this auto-loading especially handy if you're regularly creating and removing JS files.</p>
<p>When deploying to production, you should have a script that combines them all into one JS file and "minifies" it to keep the size down.</p>
|
<p>Read the code of other (good) javascript apps and see how they handle things. But I start out with a file per class. But once its ready for production, I would combine the files into one large file and minify.</p>
<p>The only reason, I would not combine the files, is if I didn't need all the files on all the pages.</p>
| 3,620
|
<p>I need to figure out what div is visible out of four possible divs using jQuery. Only one of those div's will be visible at any given time.</p>
<p>This is what I have that works so far:</p>
<pre><code>$("#FeatureImage1:visible, #FeatureImage2:visible, #FeatureImage3:visible, #FeatureImage4:visible").attr("id");
</code></pre>
<p>Is there a way to refactor this? Is there an easier way to figure this out?</p>
|
<p>Assign the same class to each div then:</p>
<pre><code>$("div.myClass:visible").attr("id");
</code></pre>
|
<p>When applicable, it's better to use contextual selectors rather than add spurious classes. For instance, if the <code><div></code> elements are the only children of an element with <code>id="foo"</code>, then using <code>$("#foo > div:visible").attr("id")</code> would better reflect the purpose of the code.</p>
| 8,673
|
<p>The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&7 and it even works in Chrome??</p>
<p>It's a simple asp:LinkButton with an OnClick event</p>
<pre><code><asp:LinkButton ID="DeleteAllPicturesLinkButton" Enabled="False" OnClientClick="javascript:return confirm('Are you sure you want to delete all pictures? \n This action cannot be undone.');" OnClick="DeletePictureLinkButton_Click" CommandName="DeleteAll" CssClass="button" runat="server">
</code></pre>
<p>The javascript confirm is firing so I know the javascript is working, it's specirically the __doPostBack event. There is a lot more going on on the page, just didn't know if it's work it to post the entire page.</p>
<p>I enable the control on the page load event.</p>
<p>Any ideas?</p>
<hr>
<p>I hope this is the correct way to do this, but I found the answer. I figured I'd put it up here rather then in a stackoverflow "answer"</p>
<p>Seems it had something to do with nesting ajax toolkit UpdatePanel. When I removed the top level panel it was fixed.</p>
<p>Hope this helps if anyone else has the same problem. I still don't know what specifically was causing the problem, but that was the solution for me.</p>
|
<p>Check your User Agent string. This same thing happened to me one time and I realized it was because I was testing out some pages as "googlebot". The JavaScript that is generated depends on knowing what the user agent is.</p>
<p>From <a href="http://support.mozilla.com/tiki-view_forum_thread.php?locale=tr&comments_parentId=160492&forumId=1" rel="noreferrer">http://support.mozilla.com/tiki-view_forum_thread.php?locale=tr&comments_parentId=160492&forumId=1</a>:</p>
<blockquote>
<p>To reset your user agent string type about:config into the location bar and press enter. This brings up a list of preferences. Enter general.useragent into the filter box, this should show a few preferences (probably 4 of them). If any have the status user set, right-click on the preference and choose Reset</p>
</blockquote>
|
<p>With or without the OnClientClick event it still doesn't work.</p>
<p>The _doPostBack event is the auto generated javascript that .NET produces.</p>
<pre><code>function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
</code></pre>
<p>*The &95; are underscores, seems to be a problem with the stackoverflow code block format.</p>
| 7,909
|
<p>I'm thinking of learning the <code>ASP.NET MVC</code> framework for an upcoming project. Can I use the advanced routing to create long URLs based on the sitemap hierarchy?</p>
<p>Example navigation path:</p>
<p><strong>Home > Shop > Products > Household > Kitchen > Cookware > Cooksets > Nonstick</strong></p>
<p>Typical (I think) MVC URL:<br/>
<a href="http://example.com/products/category/NonstickCooksets" rel="nofollow noreferrer">http://example.com/products/category/NonstickCooksets</a></p>
<p>Desired URL:<br/>
<a href="http://example.com/shop/products/household/kitchen/cookware/cooksets/nonstick" rel="nofollow noreferrer">http://example.com/shop/products/household/kitchen/cookware/cooksets/nonstick</a></p>
<p>Can I do this?</p>
|
<p>Zack, if I understand right you want unlimited depth of the subcategories. No biggie, since MVC Preview 3 (I think 3 or 4) this has been solved.</p>
<p>Just define a route like</p>
<p>"{controller}/{action}/{*categoryPath}"</p>
<p>for an url such as :</p>
<p><a href="http://example.com/shop/products/household/kitchen/cookware/cooksets/nonstick" rel="noreferrer">http://example.com/shop/products/household/kitchen/cookware/cooksets/nonstick</a></p>
<p>you should have a ShopController with a Products action :</p>
<pre><code>public class ShopController : Controller
{
...
public ActionResult Products(string categoryPath)
{
// the categoryPath value would be
// "household/kitchen/cookware/cooksets/nonstick". Process it (for ex. split it)
// and then decide what you do..
return View();
}
</code></pre>
|
<p>The MVC routing lets you define pretty much any structure you want, you just need to define what each of the pieces mean semantically. You can have bits that are "hard-coded", like "shop/products", and then define the rest as variable, "{category}/{subcategory}/{speciality}", etc.</p>
<p>You can also define several routes that all map to the same end point if you like. Basically, when a URL comes into your MVC app, it goes through the routing table until it finds a pattern that matches, fills in the variables and passes the request off to the appropriate controller for processing.</p>
<p>While the default route is a simple Controller, Action, Id kind of setup, that's certainly not the extent of what you can do.</p>
| 3,571
|
<p>What is the best way to get hosting of an ASP.NET MVC application to work on IIS 5 (6 or 7). When I tried to publish my ASP.NET MVC application, all I seemed to get is 404 errors. I've done a bit of googleing and have found a couple of solutions, but neither seem super elegant, and I worry if they will be unusable once I come to use a shared hosting environment for the application.</p>
<p><a href="http://blogs.microsoft.co.il/blogs/dorony/archive/2007/12/15/using-asp-net-mvc-on-iis-5.aspx" rel="nofollow noreferrer">Solution 1</a></p>
<blockquote>
<ol>
<li>Right-click your application virtual directory on inetmgr.exe.</li>
<li>Properties->Virtual Directory Tab-> Configuration.</li>
<li>Add a new mapping extension. The extension should be .*, which will be
mapped to the Executable
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,
or the appropriate location on your
computer (you can simply copy this
from the mapping for .aspx files). On
the mapping uncheck "check that file
exists".</li>
<li>3 X OK and you're good to go.</li>
<li>If you want, you can apply this setting to all your web sites. In
step1, click on the "Default Web Site"
node instead of your own virtual
directory, and in step 2 go to the
"Home Directory" tab. The rest is the
same.</li>
</ol>
</blockquote>
<p>It seems a tad hacky to route everything through ASP.NET.</p>
<p><a href="http://blog.pagedesigners.co.nz/?p=29" rel="nofollow noreferrer">Solutions 2</a></p>
<p>Edit the MVC routing to contain .mvc in the URL and then follow the steps in solution 1 based around this extension. <em>Edit: The original image link was lost, but here it is from Google's Cache:</em></p>
<p><img src="https://i.stack.imgur.com/TDp4F.png" alt="alt text"></p>
|
<p>Answer is <a href="http://forums.asp.net/p/1239943/2294813.aspx" rel="nofollow noreferrer">here</a></p>
<blockquote>
<p>If *.mvc extension is not registered
to the hosting , it will give 404
exception. The working way of hosting
MVC apps in that case is to modify
global.asax routing caluse in the
following way.</p>
<p>routes.Add(new
Route("{controller}.mvc.aspx/{action}",
new MvcRouteHandler()) {
Defaults = new RouteValueDictionary (new{ controller
= "YourController"} ) });</p>
<p>In this way all your controller
request will end up in *.mvc.aspx,
which is recognized by your hosting.
And as the MVC dlls are copied into
your local bin , no special setttings
need to be done for it.</p>
</blockquote>
|
<p>Have you tried adding .aspx to the end of the controller name?</p>
<p>It worked for Stack Overflow question <em><a href="https://stackoverflow.com/questions/32757/where-can-i-get-asp-mvc-hosting">Where can I get ASP.NET MVC hosting?</a></em>.</p>
| 8,206
|
<p>I am using an M3D printer and loaded an STL design with holes in the middle:</p>
<p><a href="https://i.stack.imgur.com/UMD0V.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UMD0V.jpg" alt="Screenshot of STL design with holes in the middle"></a></p>
<p>However, the output is an object without holes (so I stopped the printing): </p>
<p><a href="https://i.stack.imgur.com/RrlBC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RrlBC.jpg" alt="Photo of the first few layers of actual print, without holes"></a></p>
<p>What can be done to be able to print with holes?</p>
|
<p>Have you tried letting it print a few more layers? It is very common that printers use the first few layers to create a <strong>raft</strong>, which will make the model adhere better to the bed.</p>
<p>I believe this illustration from Simplify3D <a href="https://www.simplify3d.com/support/articles/rafts-skirts-and-brims/" rel="noreferrer">displays this well</a>:</p>
<p><a href="https://i.stack.imgur.com/4xaFS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4xaFS.png" alt="raft vs skirt vs brim"></a></p>
|
<p><strong>Case 1:</strong></p>
<p>There may be an issue with the precision of the print nozzle, not being able to fully articulate the hole. That is to say, the printer is trying to print it with holes, but the material is filling in that area.</p>
<p>Try increasing the size of the hole. Granted, it is not an exact process but there may be an inner hole diameter that winds up mimicking the diameter you're looking for after the material extrudes. </p>
<p>This case could be rejected by nature of the printer depositing straight lines through the center diameter of the cylinder's base.</p>
<p><strong>Case 2:</strong></p>
<p>There may be some discrepancy between the file's appearance and the file's information.</p>
<p>If you downloaded the file from somewhere like ThingiVerse, try designing the part yourself if possible. If you designed it yourself, overwrite the file with a second version. </p>
<p><strong>Case 3:</strong></p>
<p>If downloaded, verify that the center hole is extruded though the entire thickness of the part. It may be that it's extruded most of the way through and there is a sealed bottom layer. </p>
| 443
|
<p>It strikes me that Properties in C# should be use when trying to manipulate a field in the class. But when there's complex calculations or database involved, we should use a getter/setter.</p>
<p>Is this correct?</p>
<p>When do you use s/getter over properties?</p>
|
<p>The .NET design guidelines provide some answers to this question in the <a href="http://msdn.microsoft.com/en-us/library/bzwdh01d(VS.71).aspx#cpconpropertyusageguidelinesanchor1" rel="noreferrer">Properties vs. Methods</a> section.</p>
<p>Basically, properties have the same semantics as a field. You shouldn't let a property throw exceptions, properties shouldn't have side effects, order shouldn't matter, and properties should return relatively quickly. If any of those things could happen, it's better to use a method. The guidelines also recommend using methods for returning arrays.</p>
<p>When deciding whether to use a property or method, it helps if I think of it like a field. I think about the behavior of the property and ask myself, "If this were a field on the class, would I be surprised if it behaved the way it does?" Consider, for example, the <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.getstream.aspx" rel="noreferrer">TcpClient.GetStream method</a>. It can throw several exceptions based on if the connection is made, and it's important that the TcpClient is configured before you try to get the stream. Because of this, it is a Get method rather than a property.</p>
<p>If you take a good look at the design guidelines, you'll see that it's usually <em>not</em> a matter of preference; there's good reasons to use methods instead of properties in certain cases.</p>
|
<p>Forget the Getter and Setter methods. Just use Properties. </p>
<p>An interesting thing to mention is that Properties are ending up as Setter and/or Getter method(s) in the assembly. Setter and/or Getter become a Property just by a little bit of metadata. So in fact, properties = setter/getter methods.</p>
| 9,264
|
<p>A database that stores a lot of credit card information is an inevitable part of the system we have just completed. What I want though is ultimate security of the card numbers whereby we setup a mechanism to encrypt and decrypt but of ourselves cannot decrypt any given number. </p>
<p>What I am after is a way to secure this information even down at the database level so no one can go in and produce a file of card numbers. How have others overcome this issue? What is the 'Standard' approach to this?</p>
<p>As for usage of the data well the links are all private and secure and no transmission of the card number is performed except when a record is created and that is encrypted so I am not worried about the front end just the back end.</p>
<hr>
<p>Well the database is ORACLE so I have PL/SQL and Java to play with.</p>
|
<p>Unless you are a payment processor you don't really need to store any kind of CC information.</p>
<p>Review your requirements, there really is not many cases where you need to store CC information</p>
|
<p>It would be helpful to know the DB server and language/platform types so we could get more specific, but I would be looking into <a href="http://en.wikipedia.org/wiki/SHA" rel="nofollow noreferrer">SHA</a>.</p>
| 8,374
|
<p>What is Windows' best I/O event notification facility? </p>
<p>By best I mean something that ...</p>
<ol>
<li>doesn't have a limit on number of input file descriptors</li>
<li>works on all file descriptors (disk files, sockets, ...)</li>
<li>provides various notification modes (edge triggered, limit triggered)</li>
</ol>
|
<p>In Windows, async operations are done by file operation, not by descriptor. There are several ways to wait on file operations to complete asynchronously.</p>
<p>For example, if you want to know when data is available on a network socket, issue an async read request on the socket and when it completes, the data was available and was retrieved.</p>
<p>In Win32, async operations use the <a href="http://msdn.microsoft.com/en-us/library/ms684342(VS.85).aspx" rel="noreferrer"><code>OVERLAPPED</code></a> structure to contain state about an outstanding IO operation.</p>
<ol>
<li>Associate the files with an <a href="http://msdn.microsoft.com/en-us/library/aa365198(VS.85).aspx" rel="noreferrer">IO Completion Port</a> and dispatch async IO requests. When an operation completes, it will put a completion message on the queue which your worker thread(s) can wait on and retrieve as they arrive. You can also put user defined messages into the queue. There is no limit to how many files or queued messages can be used with a completion port</li>
<li>Dispatch each IO operation with an event. The event associated with an operation will become signaled (satisfy a wait) when it completes. Use <a href="http://msdn.microsoft.com/en-us/library/ms687025(VS.85).aspx" rel="noreferrer"><code>WaitForMultipleObjects</code></a> to wait on all the events at once. This has the disadvantage of only being able to wait on <code>MAXIMUM_WAIT_OBJECTS</code> objects at once (64). You can also wait on other types of events at the same time (process/thread termination, mutexes, events, semaphores)</li>
<li>Use a <a href="http://msdn.microsoft.com/en-us/library/ms686760(VS.85).aspx" rel="noreferrer">thread pool</a>. The thread pool can take an unlimited number of objects and file operations to wait on and execute a <a href="http://msdn.microsoft.com/en-us/library/ms684124(VS.85).aspx" rel="noreferrer">user defined function</a> upon completion each.</li>
<li>Use <code><a href="http://msdn.microsoft.com/en-us/library/aa365468(VS.85).aspx" rel="noreferrer">ReadFileEx</a></code> and <a href="http://msdn.microsoft.com/en-us/library/aa365748(VS.85).aspx" rel="noreferrer"><code>WriteFileEx</code></a> to queue <a href="http://msdn.microsoft.com/en-us/library/ms681951(VS.85).aspx" rel="noreferrer">Asynchronous Procedure Calls</a> (APCs) to the calling thread and <a href="http://msdn.microsoft.com/en-us/library/ms686307(VS.85).aspx" rel="noreferrer"><code>SleepEx</code></a> (or <code>WaitFor{Single|Multiple}ObjectsEx</code>) with <code>Alertable TRUE</code> to receive a notification message for each operation when it completes. This method is similar to an IO completion port, but only works for one thread.
</ol>
<p>The Windows NT kernel makes no distinction between socket, disk file, pipe, etc. file operations internally: all of these options will work with all the file types.</p>
|
<p>select() function is POSIX and usable on windows including "winsock.h" or "winsock2.h". </p>
| 9,266
|
<p>Despite the documentation, NetworkStream.Write does not appear to wait until the data has been sent. Instead, it waits until the data has been copied to a buffer and then returns. That buffer is transmitted in the background.</p>
<p>This is the code I have at the moment. Whether I use ns.Write or ns.BeginWrite doesn't matter - both return immediately. The EndWrite also returns immediately (which makes sense since it is writing to the send buffer, not writing to the network).</p>
<pre><code> bool done;
void SendData(TcpClient tcp, byte[] data)
{
NetworkStream ns = tcp.GetStream();
done = false;
ns.BeginWrite(bytWriteBuffer, 0, data.Length, myWriteCallBack, ns);
while (done == false) Thread.Sleep(10);
}
public void myWriteCallBack(IAsyncResult ar)
{
NetworkStream ns = (NetworkStream)ar.AsyncState;
ns.EndWrite(ar);
done = true;
}
</code></pre>
<p>How can I tell when the data has actually been sent to the client?</p>
<p>I want to wait for 10 seconds(for example) for a response from the server after sending my data otherwise I'll assume something was wrong. If it takes 15 seconds to send my data, then it will always timeout since I can only start counting from when NetworkStream.Write returns - which is before the data has been sent. I want to start counting 10 seconds from when the data has left my network card.</p>
<p>The amount of data and the time to send it could vary - it could take 1 second to send it, it could take 10 seconds to send it, it could take a minute to send it. The server does send an response when it has received the data (it's a smtp server), but I don't want to wait forever if my data was malformed and the response will never come, which is why I need to know if I'm waiting for the data to be sent, or if I'm waiting for the server to respond.</p>
<p>I might want to show the status to the user - I'd like to show "sending data to server", and "waiting for response from server" - how could I do that?</p>
|
<p>I'm not a C# programmer, but the way you've asked this question is slightly misleading. The only way to know when your data has been "received", for any useful definition of "received", is to have a specific acknowledgment message in your protocol which indicates the data has been fully processed.</p>
<p>The data does not "leave" your network card, exactly. The best way to think of your program's relationship to the network is:</p>
<blockquote>
<p>your program -> lots of confusing stuff -> the peer program</p>
</blockquote>
<p>A list of things that might be in the "lots of confusing stuff":</p>
<ul>
<li>the CLR</li>
<li>the operating system kernel</li>
<li>a virtualized network interface</li>
<li>a switch</li>
<li>a software firewall</li>
<li>a hardware firewall</li>
<li>a router performing network address translation</li>
<li>a router on the peer's end performing network address translation</li>
</ul>
<p>So, if you are on a virtual machine, which is hosted under a different operating system, that has a software firewall which is controlling the virtual machine's network behavior - when has the data "really" left your network card? Even in the best case scenario, many of these components may drop a packet, which your network card will need to re-transmit. Has it "left" your network card when the first (unsuccessful) attempt has been made? Most networking APIs would say no, it hasn't been "sent" until the other end has sent a TCP acknowledgement.</p>
<p>That said, <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.networkstream.write.aspx" rel="noreferrer">the documentation for NetworkStream.Write</a> seems to indicate that it will not return until it has at least initiated the 'send' operation:</p>
<blockquote>
<p>The Write method blocks until the requested number of bytes is sent or a SocketException is thrown.</p>
</blockquote>
<p>Of course, "is sent" is somewhat vague for the reasons I gave above. There's also the possibility that the data will be "really" sent by your program and received by the peer program, but the peer will crash or otherwise not actually process the data. So you should do a <code>Write</code> followed by a <code>Read</code> of a message that will only be emitted by your peer when it has actually processed the message.</p>
|
<p>Perhaps try setting
<code>tcp.NoDelay = true</code></p>
| 9,332
|
<p>Rehsarper 4.0 - Renaming a class does not rename the file…<br>
I probably set something on accident in the options, but I can't find it. Any ideas?</p>
|
<p>When I do a rename in Resharper there's a checkbox below the textbox where you type the new name that says "Synchronise file name with class name". Check that and the file is renamed too.</p>
<p>Be sure you're using Resharper's rename (right-click/Refactor/Rename) rather than Visual Studio's (right-click/Rename), as the latter definitely doesn't rename the file.</p>
|
<ol>
<li>Go to the class name and click Ctrl+R+R</li>
<li>Set the new name</li>
<li>select the check box "Also rename files to reflect this change."</li>
</ol>
| 7,873
|
<p>I was surprised to find today that I couldn't track down any simple way to write the contents of an <code>InputStream</code> to an <code>OutputStream</code> in Java. Obviously, the byte buffer code isn't difficult to write, but I suspect I'm just missing something which would make my life easier (and the code clearer).</p>
<p>So, given an <code>InputStream</code> <code>in</code> and an <code>OutputStream</code> <code>out</code>, is there a simpler way to write the following?</p>
<pre><code>byte[] buffer = new byte[1024];
int len = in.read(buffer);
while (len != -1) {
out.write(buffer, 0, len);
len = in.read(buffer);
}
</code></pre>
|
<p>As WMR mentioned, <code>org.apache.commons.io.IOUtils</code> from Apache has a method called <a href="http://commons.apache.org/proper/commons-io/javadocs/api-2.4/org/apache/commons/io/IOUtils.html#copy(java.io.InputStream,%20java.io.OutputStream)" rel="noreferrer"><code>copy(InputStream,OutputStream)</code></a> which does exactly what you're looking for.</p>
<p>So, you have:</p>
<pre><code>InputStream in;
OutputStream out;
IOUtils.copy(in,out);
in.close();
out.close();
</code></pre>
<p>...in your code.</p>
<p>Is there a reason you're avoiding <code>IOUtils</code>? </p>
|
<p>you can use this method</p>
<pre><code>public static void copyStream(InputStream is, OutputStream os)
{
final int buffer_size=1024;
try
{
byte[] bytes=new byte[buffer_size];
for(;;)
{
int count=is.read(bytes, 0, buffer_size);
if(count==-1)
break;
os.write(bytes, 0, count);
}
}
catch(Exception ex){}
}
</code></pre>
| 6,474
|
<p>When a controller renders a view based on a model you can get the properties from the ViewData collection using the indexer (ie. ViewData["Property"]). However, I have a shared user control that I tried to call using the following:</p>
<pre><code>return View("Message", new { DisplayMessage = "This is a test" });
</code></pre>
<p>and on my Message control I had this:</p>
<pre><code><%= ViewData["DisplayMessage"] %>
</code></pre>
<p>I would think this would render the DisplayMessage correctly, however, null is being returned. After a heavy dose of tinkering around, I finally created a "MessageData" class in order to strongly type my user control:</p>
<pre><code>public class MessageControl : ViewUserControl<MessageData>
</code></pre>
<p>and now this call works:</p>
<pre><code>return View("Message", new MessageData() { DisplayMessage = "This is a test" });
</code></pre>
<p>and can be displayed like this:</p>
<pre><code><%= ViewData.Model.DisplayMessage %>
</code></pre>
<p>Why wouldn't the DisplayMessage property be added to the ViewData (ie. ViewData["DisplayMessage"]) collection without strong typing the user control? Is this by design? Wouldn't it make sense that ViewData would contain a key for "DisplayMessage"?</p>
|
<p>The method </p>
<pre><code>ViewData.Eval("DisplayMessage")
</code></pre>
<p>should work for you.</p>
|
<p>Of course after I create this question I immediately find the answer after a few more searches on Google</p>
<p><a href="http://forums.asp.net/t/1197059.aspx" rel="nofollow noreferrer">http://forums.asp.net/t/1197059.aspx</a></p>
<p>Apparently this happens because of the wrapper class. Even so, it seems like any property passed should get added to the ViewData collection by default.</p>
<p>I really need to stop answering my own questions :(</p>
| 3,934
|
<p>I recently got a KP3S Kingroon 3D printer and have been trying to set it up.</p>
<p>After a couple of test prints, the Y-axis seems to only move in one direction. At first, I thought it was a motor issue, but when I go into the manual move directions for the Y-axis it seems that both inputs lead to the motor spinning in the same direction.</p>
<p>We have ruled out endstops as a possible issue. I think it might be a hardware issue but lack the skills to confirm the exact issue.</p>
<pre><code>Send:17:40:57.724: @moveRel Y10.00
Send:17:40:57.724: N31 G1 Y10.00 F6000
Send:17:40:57.728: @updatePrinterState
Send:17:41:00.824: @moveRel Y-10.00
Send:17:41:00.824: N35 G1 Y0.00 F6000
Send:17:41:00.828: @updatePrinterState
Send:17:41:07.445: @moveRel Y10.00
Send:17:41:07.445: N43 G1 Y10.00 F6000
Send:17:41:07.449: @updatePrinterState
Send:17:41:09.482: @moveRel Y-10.00
Send:17:41:09.482: N46 G1 Y0.00 F6000
Send:17:41:09.486: @updatePrinterState
</code></pre>
<p>Even though it states that it is increasing and decreasing by 10 it only decreases by 10.</p>
<p>I have updated the firmware to Marlin. I tested switching X and Y inputs and believe the breakdown occurs at the Y input signal.</p>
<p>attached is a picture of the mother board.</p>
<p><a href="https://i.stack.imgur.com/nhmP2.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nhmP2.gif" alt="picture of mother board" /></a></p>
<p>I am unsure of how to best fix this?</p>
|
<p>The answer might just be replace the mother board.</p>
<p>If I understood everything correctly there are 5 things to check to break down the problem:</p>
<ul>
<li>the motor,</li>
<li>the cable,</li>
<li>the stepper connection,</li>
<li>the software input, and</li>
<li>the firmware.</li>
</ul>
<p>Using Repetier I disproved that the software was broken. By switching the X stepper and Y stepper cables, the motor and connection cable were proven to work. By flashing new firmware it was shown that it was without question that the firmware was the issue.</p>
<p>The backup extractor (E1) is not operational on this board. So it is either the stepper of the mother board.</p>
|
<p>The question body has changed to rule out broken endstops. As a generic answer for steppers only going into a single direction, if an axis of a 3D printer only moves in one direction it usually implies that the end stop of that axis is triggered. If triggered, the firmware doesn’t allow the stepper to move to the direction of the end stop.</p>
<p>Check the end stop lever and cables. Optionally connect a USB cable and send the G-code <a href="https://reprap.org/wiki/G-code#M119:_Get_Endstop_Status" rel="nofollow noreferrer"><code>M119</code></a> over a <a href="https://3dprinting.stackexchange.com/questions/10573/what-is-a-printer-console-terminal">terminal</a>.</p>
<p>If the endstops are functioning correctly (reporting “open” or “triggered” corresponding to the state of the endstop), a Google search on the World Wide Web shows that people that had these exact problems had issues with the controller board, replacing the board helped their issue. If this is a recent purchase it is advised to contact the seller for support rather than fiddling with the board or the firmware.</p>
<p>In case the board has a spare unused stepper driver (not very unlikely if you have <a href="https://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwiX5PGlv4b1AhURDuwKHU5JBuQQFnoECBMQAQ&url=https%3A%2F%2Fnl.aliexpress.com%2Fitem%2F1005001621822311.html&usg=AOvVaw1uT5ZgSK04dlnQvoBgHSKF" rel="nofollow noreferrer">this controller board</a>), the firmware could be altered to use the spare for Y movement. <a href="https://3dprinting.stackexchange.com/a/5786/">E.g. <code>E1</code> could be used for <code>Y</code>.</a></p>
| 2,083
|
<p>We are changing our remote log-in security process at my workplace, and we are concerned that the new system does not use <a href="http://en.wikipedia.org/wiki/Two-factor_authentication" rel="nofollow noreferrer">multi-factor authentication</a> as the old one did. (We had been using RSA key-fobs, but they are being replaced due to cost.) The new system is an anti-phishing image system which has been misunderstood to be a two-factor authentication system. We are now exploring ways to continue providing multi-factor security without issuing hardware devices to the users.</p>
<p>Is it possible to write a software-based token system to be installed on the user's PCs that would constitute a true second factor in a multi-factor authentication system? Would this be considered "something the user has", or would it simply be another form of "something the user knows"?</p>
<p>Edit: <em>phreakre</em> makes a good point about cookies. For the sake of this question, assume that cookies have been ruled out as they are not secure enough.</p>
|
<p>I would say "no". I don't think you can really get the "something you have" part of multi-factor authentication without issuing something the end user can carry with them. If you "have" something, it implies it can be lost - not many users lose their entire desktop machines. The security of "something you have", after all, comes from the following:</p>
<ul>
<li>you would notice when you don't have it - a clear indication security has been compromised</li>
<li>only 1 person can have it. So if you do, someone else doesn't</li>
</ul>
<p>Software tokens do not offer the same guarantees, and I would not in good conscience class it as something the user "has". </p>
|
<p>I agree with @freespace that the the image is not part of the multi-factor authentication for the user. As you state the image is part of the anti-phishing scheme. I think that the image is actually a weak authentication of the system to the user. The image provides authentication to the user that the website is valid and not a fake phishing site.</p>
<blockquote>
<p>Is it possible to write a software-based token system to be installed on the user's PCs that would constitute a true second factor in a multi-factor authentication system? </p>
</blockquote>
<p>The software based token system sounds like you may want to investigate the Kerberos protocol, <a href="http://en.wikipedia.org/wiki/Kerberos_(protocol)" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Kerberos_(protocol)</a>. I am not sure if this would count as a multi-factor authentication, though.</p>
| 9,813
|
<p>I've always wanted to be able to get a reasonably elegant way of getting vimdiff to work with a CVS controlled file. I've found numerous (somewhat hacky) scripts around the internet (best example <a href="http://www.vim.org/tips/tip.php?tip_id=390" rel="noreferrer">here</a>) that basically check out the file you are editing from CVS to a temp file, and vimdiff the two. None of these take into account branches, and always assume you're working from MAIN, which for me is completely useless. </p>
<p>So, my question is this: has anyone out there found a decent solution for this that does more than this script?</p>
<p>Or failing that, does anyone have any ideas of how they would implement this, or suggestions for what features you would consider vital for something that does this? My intention is that, if no one can suggest an already built solution to either use or build from, we start building one from here. </p>
|
<p>I've been working on a similar script here: <a href="http://github.com/ghewgill/vim-scmdiff" rel="nofollow noreferrer">http://github.com/ghewgill/vim-scmdiff</a> (in fact, they may have the same ancestry). I haven't used scmdiff with cvs, but it should do a diff against the branch you have checked out. You can also specify that you want to diff against a particular revision (with :D <em>revision</em>). Hopefully this helps, and feel free to contribute if you've got improvements!</p>
|
<p>You could change the call to <code>cvs</code> to take branches into account. That shouldn't be to hard. It bit harder would to change the whole function and make the branch your working a variable (argument, session, global or otherwise).</p>
| 4,580
|
<p>The DOM method <code>getChildNodes()</code> returns a <code>NodeList</code> of the children of the current <code>Node</code>. Whilst a <code>NodeList</code> is ordered, is the list guaranteed to be in document order?</p>
<p>For example, given <code><a><b/><c/><d/></a></code> is <code>a.getChildNodes()</code> guaranteed to return a <code>NodeList</code> with <code>b</code>, <code>c</code> and <code>d</code> <em>in that order</em>?</p>
<p>The <a href="http://java.sun.com/javase/6/docs/api/org/w3c/dom/Node.html#getChildNodes()" rel="noreferrer">javadoc</a> isn't clear on this.</p>
|
<p>In my experience, yes. The <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1451460987" rel="nofollow noreferrer">DOM spec</a> isn't any clearer. If you're paranoid, try something like</p>
<pre><code>current = node.firstChild;
while(null != current) {
...
current = current.nextSibling;
}
</code></pre>
|
<p>I'd love to tell you that this is guaranteed (as I believe it is) but the <a href="http://www.w3.org/DOM/" rel="nofollow noreferrer">Document Object Model specification</a> itself seems ambiguous in this case. I'm pretty sure that it's always document-order, though.</p>
| 9,171
|
<p>As I develop more with vim, I find myself wanting to copy in blocks of useful code, similar to "templates" in Eclipse. </p>
<p>I was thinking of making a separate file for each code chunk and just reading them in with</p>
<pre><code>:r code-fornext
</code></pre>
<p>but that just seems kind of primitive. Googling around I find vim macros mentioned and something about "maps" but nothing that seems straightforward.</p>
<p>What I am looking for are e.g. something like Eclipse's "Templates" so I pop in a code chunk with the cursor sitting in the middle of it.
Or JEdit's "Macros" which I can record doing complicated deletes and renaming on one line, then I can play it again on 10 other lines so it does the same to them.</p>
<p>Does vim have anything like these two functionalities?</p>
|
<p>To record macros in Vim, in the command mode, hit the <code>q</code> key and another key you want to assign the macro to. For quick throw away macros I usually just hit <code>qq</code> and assign the macro to the <code>q</code> key. Once you are in recording mode, run through your key strokes. When you are done make sure you are back in command mode and hit <code>q</code> again to stop recording. Then to replay the macro manually, you can type <code>@q</code>. To replay the previously run macro you can type <code>@@</code> or to run it 10 times you could type <code>10@q</code> or <code>20@q</code>, etc..</p>
<p>In summary:</p>
<pre><code>+----------------------------------+-------------------------------------+
| start recording a macro | qX (X = key to assign macro to) |
+----------------------------------+-------------------------------------+
| stop recording a macro | q |
+----------------------------------+-------------------------------------+
| playback macro | @X (X = key macro was assigned to) |
+----------------------------------+-------------------------------------+
| replay previously played macro | @@ |
+----------------------------------+-------------------------------------+
</code></pre>
<p>In regards to code chunks, I have found and started using a Vim plug-in called snipMate, which mimics TextMate's snippets feature. You can get the plug-in here:</p>
<p><a href="http://www.vim.org/scripts/script.php?script_id=2540" rel="nofollow noreferrer">http://www.vim.org/scripts/script.php?script_id=2540</a></p>
<p>And a short article on using snipMate (along with a short screencast showing it in use):</p>
<p><a href="http://www.catonmat.net/blog/vim-plugins-snipmate-vim/" rel="nofollow noreferrer">http://www.catonmat.net/blog/vim-plugins-snipmate-vim/</a></p>
<p>Hope you find this helpful! </p>
|
<p>On vim.wikia, you will find a <a href="http://vim.wikia.com/wiki/Category:Automated_Text_Insertion" rel="nofollow noreferrer" title="Automated Text Insertion category">category of tips</a> dedicated to snippets and abbreviations expansion. You will also see a list of plugins that ease the definition of complex snippets/templates-files.</p>
<p>HTH,</p>
| 7,801
|
<p>I have an STL file and I would like to know how many grams would this print consume. Is there a software so I can get it or an online link that can say me that?</p>
|
<p>You can not tell this by looking at the STL file alone, because how much material will be used depends on the print settings (obviously, printing at 100% infill will consume much more material than 10%).</p>
<p>The best way to check the material usage is to load the model into a slicer and slice it using your preferred settings. Most slicers will report the projected material usage, often in grams but sometimes in meters of filament (but the two figures are easily converted between each other if you know the density and diameter of your material).</p>
<p>Here is an example in the Cura slicer:</p>
<p><a href="https://i.stack.imgur.com/e23iM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e23iM.png" alt="Cura print statistics"></a></p>
<p>Simplify3D (after you click "prepare to print!") also shows you the projected print time and material usage and even the cost of the material (if you have previously entered the material cost per kilogram):</p>
<p><a href="https://i.stack.imgur.com/pjcxO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pjcxO.png" alt="Simplify3D print statistics"></a></p>
|
<p>This is a link I found that analyzes your G-code ( filament usage, time, etc.): <a href="http://gcode.ws/" rel="nofollow noreferrer">gCodeViewer</a></p>
<p>From the description (emphasis is mine):</p>
<blockquote>
<ul>
<li>Analyze GCode
<ul>
<li>Print time, <strong><em>amount of plastic used</em></strong>, layer height, etc. for whole file and for single layer</li>
</ul></li>
</ul>
</blockquote>
<p>Here is a screenshot:</p>
<blockquote>
<p><a href="https://i.stack.imgur.com/pDsuL.png" rel="nofollow noreferrer" title="Screenshot"><img src="https://i.stack.imgur.com/pDsuL.png" alt="Screenshot" title="Screenshot"></a></p>
</blockquote>
| 548
|
<p>Using 3D printing I'd like to create a text oversized keycap that uses several strong LEDs to make the text light as red or green, depending on status. It's quite similar to what are called annunciators on aircraft:</p>
<p><a href="https://i.stack.imgur.com/6B1lY.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/6B1lY.jpg" alt="Annunciator Panel example without the panels being turned into MX switch keycaps" /></a></p>
<p><a href="https://i.stack.imgur.com/Jce1q.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Jce1q.jpg" alt="Annunciator removed from a panel where it is separated" /></a></p>
<p>I'd like to create an MX keycap with this ability and size with the backlighting changing from green to red to indicate something is on or off. I understand including the MX connector in the center, but how would I print a black panel and leave the text transparent, or at least transluscent?</p>
|
<p>There are a few possible ways you could go about this:</p>
<ol>
<li>If you have a multi-material printer, you may be able to print with both a transparent or translucent material for the internal structure of the print and an opaque material for the external parts of the print. PET(G) may be suitable for this purpose but is harder to print compared to standard PLA.</li>
<li>You can print the entire print in a translucent material, mask off the lettering at the front and spray paint the rest of the print.</li>
<li>You can create a multi-part print, where one outer 'shell' is printed in opaque filament, and another piece in translucent material, which will mate together after printing.</li>
<li>You can deboss the lettering of your print, and with the letters face down to the bed, print the first layers in an opaque material, and then swap filaments to a translucent material for the rest of the print, spray painting the upper parts of the print to match a uniform color, while leaving the bottom untouched.</li>
</ol>
<p>There are several advantages and disadvantages to each method:</p>
<ol>
<li>Requires that you have a (typically) expensive upgrade installed onto your machine, but would be the most straightforward way to go about this.</li>
<li>Requires precise masking of your letters to make them come out looking nice, but will give you sharper, more defined edges on the lettering.</li>
<li>Will require you to design for tolerances for the two parts, or add glue in the post-processing steps, But could be produced en masse with two printers, one for each material.</li>
<li>Can be a bit fiddly, and will possibly result in an undesired look, with the lettering being debossed into the part, But would be less complex than the other options.</li>
</ol>
<p>Pick whichever method you wish, or try all of them to see which gives you the best results.</p>
|
<p>Cut the letters out of the key, so they print as holes all the way to the light source. Print in black.</p>
<p>fill the holes with clear silicon caulk or leave empty.</p>
| 2,007
|
<p>Like the Delicious submission bookmark-let, I'd like to have some standard JavaScript I can use to submit any visited URL to a 3rd party site when that's possible by URL. Suggestions?</p>
<p>For example, I've been using </p>
<pre><code>javascript:void(location.href="http://www.yacktrack.com/home?query="+encodeURI(location.href))
</code></pre>
<p>so far but wonder if there's something more sophisticated I could use or better practice.</p>
|
<p>Do you want something exactly like the Delicious bookmarklet (as in, something the user actively clicks on to submit the URL)? If so, you could probably just copy their code and replace the target URL:</p>
<pre><code>javascript:(function(){
location.href='http://example.com/your-script.php?url='+
encodeURIComponent(window.location.href)+
'&title='+encodeURIComponent(document.title)
})()
</code></pre>
<p>You may need to change the query string names, etc., to match what your script expects.</p>
<p>If you want to track a user through your website automatically, this probably won't be possible. You'd need to request the URL with AJAX, but the web browser won't allow Javascript to make a request outside of the originating domain. Maybe it's possible with <code>iframe</code> trickery.</p>
<p><strong>Edit:</strong> John beat me to it.</p>
|
<p>Another option would be to something like this:</p>
<pre><code><form action="http://www.yacktrack.com/home" method="get" name="f">
<input type="hidden" name="query" />
</form>
</code></pre>
<p>then your javascript would be:</p>
<pre><code>f.query.value=location.href; f.submit();
</code></pre>
<p>or you could combine the [save link] with the submit like this:</p>
<pre><code><form action="http://www.yacktrack.com/home" method="get" name="f" onsubmit="f.query.value=location.href;">
<input type="hidden" name="query" />
<input type="submit" name="Save Link" />
</form>
</code></pre>
<p>and if you're running server-side code, you can plug in the location so you can be JavaScript-free:</p>
<pre><code><form action="http://www.yacktrack.com/home" method="get" name="f">
<input type="hidden" name="query" value="<%=Response.Url%>" />
<input type="submit" name="Save Link" />
</form>
</code></pre>
| 7,805
|
<p>The <a href="http://en.wikipedia.org/wiki/Law_Of_Demeter" rel="noreferrer">wikipedia article</a> about <a href="http://c2.com/cgi/wiki?LawOfDemeter" rel="noreferrer">Law of Demeter</a> says:</p>
<blockquote>
<p>The law can be stated simply as "use only one dot".</p>
</blockquote>
<p>However a <a href="http://weblogs.asp.net/jgalloway/archive/2006/12/06/a-simple-example-of-a-fluent-interface.aspx" rel="noreferrer">simple example</a> of a <a href="http://en.wikipedia.org/wiki/Fluent_interface" rel="noreferrer">fluent interface</a> may look like this:</p>
<pre><code>static void Main(string[] args)
{
new ZRLabs.Yael.Pipeline("cat.jpg")
.Rotate(90)
.Watermark("Monkey")
.RoundCorners(100, Color.Bisque)
.Save("test.png");
}
</code></pre>
<p>So does this goes together?</p>
|
<p>Well, the short definition of the law shortens it too much. The real "law" (in reality advice on good API design) basically says: Only access objects you created yourself, or were passed to you as an argument. Do not access objects indirectly through other objects. Methods of fluent interfaces often return the object itself, so they don't violate the law, if you use the object again. Other methods create objects for you, so there's no violation either.</p>
<p>Also note that the "law" is only a best practices advice for "classical" APIs. Fluent interfaces are a completely different approach to API design and can't be evaluated with the Law of Demeter.</p>
|
<p>There's no problem with your example. After all, you're rotating, watermarking, etc... always the same image. I believe you're talking to a Pipeline object all the while, so as long as your code only depends on the class of the Pipeline, you're not violating LoD.</p>
| 9,312
|
<p>I've tried two different methods of reusing code. I have a solution full of just class library projects with generic code that I reuse in almost every project I work on. When I get to work on a new project, I will reuse code from this code library in one of two ways:</p>
<ol>
<li>I have tried bringing the projects I need from this code library into my project.</li>
<li>I have also tried compiling down to a .dll and referencing the .dll from a folder in the root of my current solution.</li>
</ol>
<p>While the second method seems easier and lighter to implement, I always find myself making small tweaks to the original code to fit it into the context of my current project.</p>
<p>I know this is a bit of a vague question, but has anyone had success with other methods of reusing class libraries on new solutions?</p>
|
<p>In short, what you are doing is right, you want to move the common code into a class library (DLL) and then reference that in any projects that require its logic.</p>
<p>Where you are going wrong is that you are not <em>maintaining</em> it. If you need to make little "tweaks", <a href="http://en.wikipedia.org/wiki/Subclass_(computer_science)" rel="nofollow noreferrer"><em>subclass</em></a> your existing code and extend it, dont change it.. If there are major changes needed, then re-think the design.</p>
|
<p>I like to write all of my generic classes as just that: generics. I keep them as application independent as possible, and try to keep them even type unaware. If I make a fancy Tree class, I'll use generics to create it as Tree<T> so that I can use any type I want with the class. If I need to use the Tree to hold GameCharacter objects, I can instantiate Tree<GameCharacter> but if I'm writing a business application I can use it as Tree<Spreadsheet>.</p>
<p>If you find yourself changing your Reuse Libary to match your projects, try making them less specific and instead deriving from your Library base classes in your actual projects. Put all of the common logic in the library classes, and for the application specific parts, create a derived class and implement their logic in that derived class.</p>
<p>As far as solution organization goes, I keep the Reuse Library as a separate project in a common folder and include the project in any solution that I create, which lets me reference easily into it, but also make any changes from any of my applications' solutions.</p>
| 5,511
|
<p>I've searched for this a little but I have not gotten a particularly straight answer. In C (and I guess C++), how do you determine what comes after the % when using <code>printf</code>?. For example:</p>
<pre><code>double radius = 1.0;
double area = 0.0;
area = calculateArea( radius );
printf( "%10.1f %10.2\n", radius, area );
</code></pre>
<p>I took this example straight from a book that I have on the C language. This does not make sense to me at all. Where do you come up with <code>10.1f</code> and <code>10.2f</code>? Could someone please explain this?</p>
|
<p><a href="http://en.wikipedia.org/wiki/Printf#printf_format_placeholders" rel="noreferrer">http://en.wikipedia.org/wiki/Printf#printf_format_placeholders</a> is Wikipedia's reference for format placeholders in printf. <a href="http://www.cplusplus.com/reference/clibrary/cstdio/printf.html" rel="noreferrer">http://www.cplusplus.com/reference/clibrary/cstdio/printf.html</a> is also helpful</p>
<p>Basically in a simple form it's %[width].[precision][type]. Width allows you to make sure that the variable which is being printed is at least a certain length (useful for tables etc). Precision allows you to specify the precision a number is printed to (eg. decimal places etc) and the informs C/C++ what the variable you've given it is (character, integer, double etc).</p>
<p>Hope this helps</p>
<p><strong>UPDATE:</strong></p>
<p>To clarify using your examples:</p>
<pre><code>printf( "%10.1f %10.2\n", radius, area );
</code></pre>
<p>%10.1f (referring to the first argument: radius) means make it 10 characters long (ie. pad with spaces), and print it as a float with one decimal place.</p>
<p>%10.2 (referring to the second argument: area) means make it 10 character long (as above) and print with two decimal places.</p>
|
<p>One issue that hasn't been raised by others is whether <strong>double</strong> is the same as a <strong>float</strong>. On some systems a different format specifier was needed for a double compared to a float. Not least because the parameters passed could be of different sizes.
<PRE>
%f - float
%lf - double
%g - double
</PRE></p>
| 3,860
|
<p>Over the last few months/years, I have shared a folder or two with numerous people on my domain. How do I easily revoke those shares to keep access to my system nice and tidy?</p>
|
<p>Using computer management (an MMC snap-in. See Control Panel Administrative tools) you can see a list of all folders that are shared. You could delete the shares or change the permissions on the share to only allow access for certain people or groups.</p>
|
<p>On Windows XP, go to:</p>
<pre><code>Administrative Tools > Computer Management > System Tools > Shared Folders > Shares
</code></pre>
<p>This page lists all shares and lets you remove them easily, in one place.</p>
| 4,583
|
<p>In my limited experience with them executable requirements (i.e. specifying all requirements as broken automated tests) have proven to be amazingly successful. I've worked on one project in which we placed a heavy emphasis on creating high-level automated tests which exercised all the functionality of a given use case/user story. It was really amazing to me how much easier development became after we began this practice. Implementing features became so much easier after writing a test and we were able to make major architectural changes to the system with all the confidence in the world that everything still worked the same as it did yesterday.</p>
<p>The biggest problem we ran into was that the tools for managing these types of tests aren't very good. We used Fitnesse quite a bit and as a result I now hate the Fit framework.</p>
<p>I'd like to know 1) if anyone else has experience developing using this type of test-driven requirement definition and 2) what tools you all used to facilitate this.</p>
|
<p>The primary tool I've also used was FitNesse. I've used it at several companies, with very good results. We did have test cases numbering in the many thousands, and we had to be very disciplined in how we organized and used them.</p>
<p>I've tried some other tools, including writing my own DSL (domain-specific language) and using things like RSpec. I really like RSpec, but it is certainly more of a developer tool than a business one. </p>
<p>I know Rick Mugridge has been working on a tool called ZiBreve (<a href="http://www.zibreve.com/visit.php?page=index" rel="nofollow noreferrer"><a href="http://www.zibreve.com/visit.php?page=index" rel="nofollow noreferrer">http://www.zibreve.com/visit.php?page=index</a></a>) which is supposed to have stronger refactoring support. I haven't used it myself, but I know Rick and have talked to him several times. I know there was discussion at Agile 2008 on some different ways to deal with the Fitnesse tests in general.</p>
<p>Other than that, I haven't seen a lot of good tools out there. Even tools like WinRunner are fine for QA type tests, but for exploratory testing of requirements by the business, FitNesse or a custom DSL seem to be the ways to go right now.</p>
|
<p>My experience is limited to personal projects and found much the same advantages you mentioned. I recommend <a href="http://metacpan.org/pod/Test::Simple::Tutorial" rel="nofollow noreferrer">http://metacpan.org/pod/Test::Simple::Tutorial</a> which was my inspiration for trying out testing-based development. The perl testing modules seem pretty useful and flexible, though I have nothing to compare them to.</p>
<p>I also believe tests are vital for the maintenance period of a project. If you have good tests to begin with, it saves a lot of time and mistakes later on. I wish I had put more work into tests on my current project. </p>
| 3,388
|
<p>I'm introducing Subversion into our web shop. I want to want the checked in files to be uploaded into the server via FTP (and as they get use to Subversion, via SFTP). The files are sent to a release candidate page for testing purposes. A script can be called to move the files into production.</p>
<p>My question is this: How do you transfer the files to the server via Subversion? Is there a script I can add that will do the transfer when the files are checked in?</p>
|
<p>If you have shell access to your sever, and SVN installed on it (or the ability to install SVN), then your best bet may be just to bypass FTP entirely.</p>
<p>How we deploy our apps is (simplified)</p>
<ul>
<li>Developers write code and check it into trunk</li>
<li>Periodically, when trunk is stable, we will take a snapshot of it as a tag</li>
<li>On the server, svn checkout the tag</li>
</ul>
<p>If any changes need to be made to the server (or directly on the live server itself) it is trivial to use subversion to sync the code</p>
|
<p>I second Orion's idea. If you've got shell access to the server, it's actually extremely easy to use Subversion itself as the deployment tool. Just make sure you have some web server rules set up so that you don't accidentally expose the .svn directories.</p>
| 3,496
|
<p>I recently rebuilt my A8 printer to have a metal frame and replaced the board with a GT2560 reva+. I'm having problems with the temp readings from both my hotend and hotbed. Using marlin 1.1x and Its possible I have something configured incorrectly. I can get successful prints with good quality but sometimes I get thermal runaway during a print.</p>
<p>Both cold and at temp (200c) have fairly large temp spikes. I didn't have this problem with my old board. I had much smoother temp curves. I'm using the default PID values for Ultimaker Kp 22.2, Ki 1.08, Kd 144.</p>
<p>I have tried to use PID autotune but get drastically different values every time I run it and using the results gave worse results (sometimes giving a heating error during the autotune). I checked all the wiring and nothing looks frayed or damaged. </p>
<p>First pic is cold temps. Second is trying to do a PID tune. Third and fourth are during a print.</p>
<p><a href="https://i.stack.imgur.com/7H8KC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7H8KC.png" alt="Temps cold"></a></p>
<p><a href="https://i.stack.imgur.com/EpW8E.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EpW8E.png" alt="PID tune"></a></p>
<p><a href="https://i.stack.imgur.com/A9bU0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/A9bU0.png" alt="During a print"></a></p>
<p><a href="https://i.stack.imgur.com/GwyP4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GwyP4.png" alt="During a print 2"></a></p>
|
<p>I had a similar problem and there could be three reasons(if the connections are ok):</p>
<ul>
<li>thin wires to the hotend</li>
<li>one of the MOSFETs was fried </li>
<li>the termal sensor wasn't good enough insert into the hotend</li>
</ul>
<p>Try to measure the hotend heating element voltage while printing.</p>
|
<p>This really looks like a bad connection, so try with your old board to see if the broken connection is on the board, or it's the temp sensor or the wires.</p>
<p>I had exactly this problem with a bad connection from the temp sensor.</p>
<p>If you didn't break anything, it's the board that's fried / badly connected.</p>
| 823
|
<p>I'd like to add a method to my existing server's CORBA interface. Will that require recompiling all clients?</p>
<p>I'm using TAO.</p>
|
<p>Recompilation of clients is not required (and should not be, regardless of the ORB that you use). As Adam indicated, lookups are done by operation name (a straight text comparison).</p>
<p>I've done what you're describing with our ACE/TAO-based system, and encountered no issues (servers were in ACE/TAO C++, clients were ACE/TAO C++, C# using Borland's Janeva, and OmniORBPy).</p>
|
<p>It depends on usage of new idl method.
If Corba invocation is static(SII), meaning your client is linked with stub, you have to recompile a stub if you want to use your new added method interface. </p>
<p>If corba invocation is dynamic(DII), there is no stub required for client. None of recompilation is required. In this case, your client code should be like: </p>
<pre><code> remoteObjRef->invoke("methodname", args); // send("methodname", args)
</code></pre>
<p>I did CORBA DII invocation four years ago and it works with TAO client&TAO/Jacorb/IONA corba service. </p>
| 5,750
|
<p>Ok, so I demo'd Refactor Pro and Resharper, I'm more comfortable with Resharper so that's what I bought. When I uninstalled Refactor Pro I thought everything was breezy. However, now when I open Visual Studio I get </p>
<p>The Add-in 'DevExpress Tools' failed to load or caused and exception, woudl you like to remove this Add in? </p>
<p>If you choose yes, the file it was loaded from, </p>
<blockquote>
<p>'C:\ProgramData\Application Data\Microsoft\MSEnvShared\Addins\DevExpressToolsOrcas.Addin' will be renamed. </p>
</blockquote>
<p>I hit yes, then get:</p>
<blockquote>
<p>"Could Not rename Add-in file "C:\ProgramData\Application Data\Microsoft\MSEnvShared\Addins\DevExpressToolsOrcas.Addin"</p>
</blockquote>
<p>This happens every time, I went to that location and there is not folder by that name. I searched for that file and nothing. </p>
<p>Anyone experience a clingy add-in?</p>
|
<p>I had the same issue with the VS.NET 2005 version and I'm not sure it is related. It was a registry problem and when i contacted the people from devexpress they send me a clean up tool. </p>
<p>You can try to see if there is another clean up tool for 2008 or search in the registry for the file name and remove it manually.</p>
|
<p>This page has instructions on how to manually remove a Visual Studio add-in:</p>
<p><a href="http://www.mztools.com/articles/2006/mz2006018.aspx" rel="nofollow noreferrer">http://www.mztools.com/articles/2006/mz2006018.aspx</a></p>
| 6,768
|
<p>How do you shade alternating rows in a SQL Server Reporting Services report?</p>
<hr>
<p><strong>Edit:</strong> There are a bunch of good answers listed below--from <a href="https://stackoverflow.com/questions/44376/add-alternating-row-color-to-sql-server-reporting-services-report#44378">quick</a> and <a href="https://stackoverflow.com/questions/44376/add-alternating-row-color-to-sql-server-reporting-services-report#345935">simple</a> to <a href="https://stackoverflow.com/questions/44376/add-alternating-row-color-to-sql-server-reporting-services-report#83832">complex and comprehensive</a>. Alas, I can choose only one...</p>
|
<p>Go to the table row's BackgroundColor property and choose "Expression..."</p>
<p>Use this expression: </p>
<pre><code>= IIf(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")
</code></pre>
<p>This trick can be applied to many areas of the report.</p>
<p>And in .NET 3.5+ You could use:</p>
<pre><code>= If(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")
</code></pre>
<p>Not looking for rep--I just researched this question myself and thought I'd share.</p>
|
<p>Just because none of the answers above seemed to work in my matrix, I'm posting this here:</p>
<p><a href="http://reportingservicestnt.blogspot.com/2011/09/alternate-colors-in-matrixpivot-table.html" rel="nofollow">http://reportingservicestnt.blogspot.com/2011/09/alternate-colors-in-matrixpivot-table.html</a></p>
| 6,613
|
<p>I've been raised to believe that if multiple threads can access a variable, then all reads from and writes to that variable must be protected by synchronization code, such as a "lock" statement, because the processor might switch to another thread halfway through a write.</p>
<p>However, I was looking through System.Web.Security.Membership using Reflector and found code like this:</p>
<pre><code>public static class Membership
{
private static bool s_Initialized = false;
private static object s_lock = new object();
private static MembershipProvider s_Provider;
public static MembershipProvider Provider
{
get
{
Initialize();
return s_Provider;
}
}
private static void Initialize()
{
if (s_Initialized)
return;
lock(s_lock)
{
if (s_Initialized)
return;
// Perform initialization...
s_Initialized = true;
}
}
}
</code></pre>
<p>Why is the s_Initialized field read outside of the lock? Couldn't another thread be trying to write to it at the same time? <strong>Are reads and writes of variables atomic?</strong> </p>
|
<p>For the definitive answer go to the spec. :)</p>
<p>Partition I, Section 12.6.6 of the CLI spec states: "A conforming CLI shall guarantee that read and write access to properly aligned memory locations no larger than the native word size is atomic when all the write accesses to a location are the same size."</p>
<p>So that confirms that s_Initialized will never be unstable, and that read and writes to primitve types smaller than 32 bits are atomic.</p>
<p>In particular, <code>double</code> and <code>long</code> (<code>Int64</code> and <code>UInt64</code>) are <strong>not</strong> guaranteed to be atomic on a 32-bit platform. You can use the methods on the <code>Interlocked</code> class to protect these.</p>
<p>Additionally, while reads and writes are atomic, there is a race condition with addition, subtraction, and incrementing and decrementing primitive types, since they must be read, operated on, and rewritten. The interlocked class allows you to protect these using the <code>CompareExchange</code> and <code>Increment</code> methods.</p>
<p>Interlocking creates a memory barrier to prevent the processor from reordering reads and writes. The lock creates the only required barrier in this example.</p>
|
<p>Ack, nevermind... as pointed out, this is indeed incorrect. It doesn't prevent a second thread from entering the "initialize" code section. Bah.</p>
<blockquote>
<p>You could also decorate s_Initialized with the volatile keyword and forego the use of lock entirely.</p>
</blockquote>
| 3,104
|
<p>In all the bigger prints I print on my Ender 5 with PETG I have problems with warping and raft detachment during printing. I have a glass bed and I'm using Ultimaker Cura 4.6.1 standard printing settings for PETG (Recently I had some success using 245 °C nozzle temperature and 80 °C build plate).</p>
<p>Any ideas how to reduce those problems?</p>
|
<p>Every print is somewhat affected by chamber temperature. On small prints, or prints with lower-temperature materials, the improvement is minor.</p>
<p>However, large prints with higher-temperature materials (like PETG) really benefit from a heated chamber. This helps by keeping the entire build close to the glass transition temperature until it's all done, and then letting it all cool together, more uniformly. Uniform cooling reduces the stresses of having different layers cool at different times and rates.</p>
|
<p>This sounds like a bed leveling issue. As reported by others, I get much less warping with PETG than with ABS or even PLA, and deal with too much adhesion with PETG rather than too little. With a Reprap x400, I printed a faceplate for the extruder to hold a electronic drop indicator. This gives me much higher precision leveling. Of course, I remove the drop indicator after leveling.</p>
<p>If leveling isn't the issue, then you may be printing too fast. The recommendations I've seen are to print PETG at 50 mm/s or less. I print a a lower speed than that.</p>
| 1,732
|
<p>Can someome provide code or pseudo-code for how the paging links on StackOverflow are generated?</p>
<p>I keep racking my brain but can't think of a decent way to build the dynamic links that always show the 2 pages around the current, plus the first and last.</p>
<p>Example: <code>1 ... 5 6 7 ... 593</code></p>
|
<p>There are several other answers already, but I'd like to show you the approach I took to solve it:
First, let's check out how Stack Overflow handles normal cases and edge cases. Each of my pages displays 10 results, so to find out what it does for 1 page, find a tag that has less than 11 entries: <a href="https://stackoverflow.com/questions/tagged/usability">usability</a> works today. We can see nothing is displayed, which makes sense.</p>
<p>How about 2 pages? Find a tag that has between 11 and 20 entries (<a href="https://stackoverflow.com/questions/tagged/emacs">emacs</a> works today). We see: "<strong>1</strong> 2 Next" or "Prev 1 <strong>2</strong>", depending on which page we're on.</p>
<p>3 pages? "<strong>1</strong> 2 3 ... 3 Next", "Prev 1 <strong>2</strong> 3 Next", and "Prev 1 ... 2 <strong>3</strong>". Interestingly, we can see that Stack Overflow itself doesn't handle this edge case very well: it should display "<strong>1</strong> 2 ... 3 Next"</p>
<p>4 pages? "<strong>1</strong> 2 3 ... 4 Next", "Prev 1 <strong>2</strong> 3 ... 4 Next", "Prev 1 ... 2 <strong>3</strong> 4 Next" and "Prev 1 ... 3 <strong>4</strong>"</p>
<p>Finally let's look at the general case, N pages: "<strong>1</strong> 2 3 ... N Next", "Prev 1 <strong>2</strong> 3 ... N Next", "Prev 1 ... 2 <strong>3</strong> 4 ... N Next", "Prev 1 ... 3 <strong>4</strong> 5 ... N Next", etc.</p>
<p>Let's generalize based on what we've seen:
The algorithm seems to have these traits in common:</p>
<ul>
<li>If we're not on the first page, display link to Prev</li>
<li>Always display the first page number</li>
<li>Always display the current page number</li>
<li>Always display the page before this page, and the page after this page.</li>
<li>Always display the last page number</li>
<li>If we're not on the last page, display link to Next</li>
</ul>
<p>Let's ignore the edge case of a single page and make a good first attempt at the algorithm: (As has been mentioned, the code to actually print out the links would be more complicated. Imagine each place we place a page number, Prev or Next as a function call that will return the correct URL.)</p>
<pre><code>function printPageLinksFirstTry(num totalPages, num currentPage)
if ( currentPage > 1 )
print "Prev"
print "1"
print "..."
print currentPage - 1
print currentPage
print currentPage + 1
print "..."
print totalPages
if ( currentPage < totalPages )
print "Next"
endFunction
</code></pre>
<p>This function works ok, but it doesn't take into account whether we're near the first or last page. Looking at the above examples, we only want to display the ... if the current page is two or more away.</p>
<pre><code>function printPageLinksHandleCloseToEnds(num totalPages, num currentPage)
if ( currentPage > 1 )
print "Prev"
print "1"
if ( currentPage > 2 )
print "..."
if ( currentPage > 2 )
print currentPage - 1
print currentPage
if ( currentPage < totalPages - 1 )
print currentPage + 1
if ( currentPage < totalPages - 1 )
print "..."
print totalPages
if ( currentPage < totalPages )
print "Next"
endFunction
</code></pre>
<p>As you can see, we have some duplication here. We can go ahead and clean that up for readibility:</p>
<pre><code>function printPageLinksCleanedUp(num totalPages, num currentPage)
if ( currentPage > 1 )
print "Prev"
print "1"
if ( currentPage > 2 )
print "..."
print currentPage - 1
print currentPage
if ( currentPage < totalPages - 1 )
print currentPage + 1
print "..."
print totalPages
if ( currentPage < totalPages )
print "Next"
endFunction
</code></pre>
<p>There are only two problems left. First, we don't print out correctly for one page, and secondly, we'll print out "1" twice if we're on the first or last page. Let's clean those both up in one go:</p>
<pre><code>function printPageLinksFinal(num totalPages, num currentPage)
if ( totalPages == 1 )
return
if ( currentPage > 1 )
print "Prev"
print "1"
if ( currentPage > 2 )
print "..."
print currentPage - 1
if ( currentPage != 1 and currentPage != totalPages )
print currentPage
if ( currentPage < totalPages - 1 )
print currentPage + 1
print "..."
print totalPages
if ( currentPage < totalPages )
print "Next"
endFunction
</code></pre>
<p>Actually, I lied: We have one remaining issue. When you have at least 4 pages and are on the first or last page, you get an extra page in your display. Instead of "<strong>1</strong> 2 ... 10 Next" you get "<strong>1</strong> 2 3 ... 10 Next". To match what's going on at Stack Overflow exactly, you'll have to check for this situation:</p>
<pre><code>function printPageLinksFinalReally(num totalPages, num currentPage)
if ( totalPages == 1 )
return
if ( currentPage > 1 )
print "Prev"
print "1"
if ( currentPage > 2 )
print "..."
if ( currentPage == totalPages and totalPages > 3 )
print currentPage - 2
print currentPage - 1
if ( currentPage != 1 and currentPage != totalPages )
print currentPage
if ( currentPage < totalPages - 1 )
print currentPage + 1
if ( currentPage == 1 and totalPages > 3 )
print currentPage + 2
print "..."
print totalPages
if ( currentPage < totalPages )
print "Next"
endFunction
</code></pre>
<p>I hope this helps!</p>
|
<p>This is my approach to make a paging link. The following <strong><em>java code</em></strong> is just a pseudo.</p>
<pre><code>package com.edde;
/**
* @author Yang Shuai
*/
public class Pager {
/**
* This is a method used to display the paging links(pagination or sometimes called pager).
* The totalPages are the total page you need to display. You can get this value using the
* formula:
*
* total_pages = total_records / items_per_page
*
* This methods is just a pseudo-code.
*
*
* @param totalPages how many pages you need to display
* @param currentPage you are in which page now
*/
public static void printPageLinks(int totalPages, int currentPage) {
// how many pages to display before and after the current page
int x = 2;
// if we just have one page, show nothing
if (totalPages == 1) {
return;
}
// if we are not at the first page, show the "Prev" button
if (currentPage > 1) {
System.out.print("Prev");
}
// always display the first page
if (currentPage == 1) {
System.out.print(" [1]");
} else {
System.out.print(" 1");
}
// besides the first and last page, how many pages do we need to display?
int how_many_times = 2 * x + 1;
// we use the left and right to restrict the range that we need to display
int left = Math.max(2, currentPage - 2 * x - 1);
int right = Math.min(totalPages - 1, currentPage + 2 * x + 1);
// the upper range restricted by left and right are more loosely than we need,
// so we further restrict this range we need to display
while (right - left > 2 * x) {
if (currentPage - left < right - currentPage) {
right--;
right = right < currentPage ? currentPage : right;
} else {
left++;
left = left > currentPage ? currentPage : left;
}
}
// do we need display the left "..."
if (left >= 3) {
System.out.print(" ...");
}
// now display the middle pages, we display how_many_times pages from page left
for (int i = 1, out = left; i <= how_many_times; i++, out++) {
// there are some pages we need not to display
if (out > right) {
continue;
}
// display the actual page
if (out == currentPage) {
System.out.print(" [" + out + "]");
} else {
System.out.print(" " + out);
}
}
// do we need the right "..."
if (totalPages - right >= 2) {
System.out.print(" ...");
}
// always display the last page
if (currentPage == totalPages) {
System.out.print(" [" + totalPages + "]");
} else {
System.out.print(" " + totalPages);
}
// if we are not at the last page, then display the "Next" button
if (currentPage < totalPages) {
System.out.print(" Next");
}
System.out.println();
}
public static void main(String[] args) {
// printPageLinks(50, 3);
help(500);
}
public static void test(int n) {
for (int i = 1; i <= n; i++) {
printPageLinks(n, i);
}
System.out.println("------------------------------");
}
public static void help(int n) {
for (int i = 1; i <= n; i++) {
test(i);
}
}
public static void help(int from, int to) {
for (int i = from; i <= to; i++) {
test(i);
}
}
}
</code></pre>
| 6,632
|
<p>I have a problem most likely very similar to some reported by other users: extruder stepper is visually skipping a step from time to time. It rapidly rotates in the direction opposite to the one it is supposed to rotate.</p>
<p>I noticed the following:</p>
<ul>
<li>The extruder stepper jumps totally randomly - there is nothing specific in the pattern printed, position etc.</li>
<li>Stepper jumps more often on the infill, rarely on the walls.</li>
</ul>
<p>Details about print:</p>
<ul>
<li>PLA (Devil Design - various colors, they doesn't matter)</li>
<li>Filament guide installed on top, but not yet before the extruder (it is printing right now, I'm waiting for the ball bearings too)</li>
<li>Filament mounted on the top - in the place defined by Creality</li>
<li>Extruder is already replaced with the aluminium one</li>
<li>The mainboard is SKR E3 mini V2 (replaced recently)</li>
<li>95% flow set in Cura</li>
<li>Printing on glass, leveled bed (the jumping occurs on all layers, not only first)</li>
<li>215 °C hotend temperature, 60 °C bed temperature</li>
<li>Stepper motor current settings (from Marlin menu): 580 for X, Y & Z, 650 for E1</li>
</ul>
<p>Other observations:</p>
<ul>
<li>What's interesting is that extruder motor jumps even if I manually unwind some filament, so that the only force that it has to overcome is only pushing filament into the head.</li>
<li>I did a quick DIY wooden spool holder, so that the filament was fed almost horizontally. This actually seemed to make things worse - stepper jumped more often. I moved spool to the top again and it reduced jumping a little.</li>
<li>Prints are done beatifully (after changing the motherboard, that is) - no lost lines or layers, walls connected with infill, perfect first layer etc.</li>
</ul>
<p>What may be the cause of stepper motor jumping? How can I solve it? Does it pose a threat to the motor or stepper? I need to print filament guide and spool holder with ball bearings, so that I can minimize force required by the extruder motor, but then the stepper will probably jump during the prints. I already damaged the original mainboard because of stuck filament, I don't want to destroy another one.</p>
<hr />
<p>This is how regular extruder retraction looks:</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/h0c7APCTKLM?start=0"></iframe>
</div></div> (10 seconds)</p>
<p>This is how stepper skipping looks:</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/KCmNs9ixzPQ?start=0"></iframe>
</div></div> (13 seconds)</p>
<hr />
<p>Today I replaced the whole heat block (radiator, heater, thermistor and nozzle) to a new one (original, for now) and motor stopped skipping - at least on the calibration cube. I will see, how will it perform on more complex prints.</p>
<p>However, even having the prior one in hands, I couldn't find the reason, why motor was skipping - other than the fact, that I couldn't extract the bowden tube from the radiator (so maybe some filament indeed was dripping inside?)</p>
|
<p>In agreement with what Akriss said, pretty much all "super" glue is CA (cyanoacrylate) glue, which is soluble in acetone. PLA itself is does not dissolve in or react with acetone, but the pigments, additives, etc. likely do, so you should wipe with a paper towel or cloth (the latter might be better to avoid getting fibers stuck on the glue) soaked in acetone rather than pouring it over the piece or submerging it, to limit the effects. Also, test first on a scrap piece printed with the same filament to ensure the results aren't unacceptably bad.</p>
|
<p>I've used Acetone before. However that said I've not had the need to remove it from PLA. Not sure how PLA reacts to Acetone.</p>
<p>A link that may be of use.
<a href="https://www.art-us.com/how-to-get-super-glue-off-almost-anything/" rel="nofollow noreferrer">https://www.art-us.com/how-to-get-super-glue-off-almost-anything/</a></p>
| 1,800
|
<p>Can a LINQ enabled app run on a machine that only has the .NET 2.0 runtime installed?</p>
<p>In theory, LINQ is nothing more than syntactic sugar, and the resulting IL code should look the same as it would have in .NET 2.0.</p>
<p>How can I write LINQ without using the .NET 3.5 libraries? Will it run on .NET 2.0?</p>
|
<p>There are some "Hacks" that involve using a System.Core.dll from the 3.5 Framework to make it run with .net 2.0, but personally I would not want use such a somewhat shaky foundation.</p>
<p>See here: <a href="http://weblogs.asp.net/fmarguerie/archive/2007/09/05/linq-support-on-net-2-0.aspx" rel="noreferrer">LINQ support on .NET 2.0</a></p>
<blockquote>
<ol>
<li>Create a new console application</li>
<li>Keep only System and System.Core as referenced assemblies</li>
<li>Set Copy Local to true for System.Core, because it does not exist in .NET 2.0</li>
<li>Use a LINQ query in the Main method. For example the one below.</li>
<li>Build</li>
<li>Copy all the bin output to a machine where only .NET 2.0 is installed</li>
<li>Run</li>
</ol>
</blockquote>
<p>(Requires .net 2.0 SP1 and I have no idea if bundling the System.Core.dll violates the EULA)</p>
|
<p>No, because while you thought LINQ is really just syntactic sugar, it actually heavily used expression trees -- a feature absent in .NET 2.0.</p>
<p>That being said .NET 3.5 only builds up on top of .NET 2.0, and that's the reason why the IL doesn't look "different" or "special".</p>
<p>I do not see a reason why you shouldn't just install the .NET 3.5 Framework. Everything .NET 2.0 will work fine on it, promise :)</p>
| 2,433
|
<p>I need to add DVD writing functionality to an application I'm working on. However it needs to be able to write out files that are being grabbed "live" from a camera, over a long period of time. I can't wait until all the files are captured before I start writing them to the DVD, I need to write them out in chunks as I go along.</p>
<p>I've looked at <a href="http://msdn.microsoft.com/en-us/library/aa364806(VS.85).aspx" rel="nofollow noreferrer">IMAPI v2</a>, but the main problems seems to be that you need to point it to all the files you plan to write out to disk before you start the burning process. I know it has to concept of "sessions", which means you can write to the DVD in several parts, before you finally "close" it.</p>
<p>But I was wondering if there were any other DVD writing SDK's that allow you to be constantly writing files to a DVD and in particular files that are only in memory. It would be more efficient if I didn't have to write the captured images out to hard before they are burned to DVD.</p>
<p>The solution needs to work under .NET on Windows XP and vista</p>
|
<p>The <a href="http://www.primoburner.com/" rel="nofollow noreferrer">Primo burning engine</a> for .Net works nicely. </p>
|
<p>Format your optical media to a <a href="http://en.wikipedia.org/wiki/Live_File_System" rel="nofollow">Live File System</a> (<a href="http://en.wikipedia.org/wiki/Packet_writing" rel="nofollow">Incremental Packet Writing</a> instead of using a mastered disc format with IMAPIv2) and then you will be able to add any file just using i.e. <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363851%28v=vs.85%29.aspx" rel="nofollow">CopyFile</a> without creating new sessions.</p>
<p>This way you will not waste lead-in/lead-out space each time you want to add a new file in a new session...</p>
<p>Notice that to ensure compatibility of disks created on Windows Vista, UDF 2.01 or lower should be selected.</p>
| 8,322
|
<p>Will a 3D scanner capture internal details within an enclosure?</p>
<p>I'm contemplating buying a 3D scanner, but they're pretty expensive so I'm looking for advice on whether they will actually be useful for the projects I have in mind. So with the picture below as an example, could I expect to generate a usable STL file by scanning this?</p>
<p><a href="https://i.stack.imgur.com/iYiDz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iYiDz.jpg" alt="Object" /></a></p>
|
<p>Yes these exist. 3D printers using pellets is not uncommon for industry, but for the user at home this might be a different question. Pellets are the pre-fabricate before it is extruded into filament (small balls/cylinders of plastic).</p>
<p><a href="https://i.stack.imgur.com/0RIoy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0RIoy.png" alt="enter image description here" /></a><br>
<em>Random image showing a variety of pellets in different colors</em></p>
<p>There are even processes to turn used plastic into pellets, so if you combine it all this should be very doable. The problem is to get a consistent type of waste plastic to feed your machine. The size of the nozzle doesn't matter, as long as your shredding, compressing and heating process can keep up with the flow you need. It would be an excellent idea to get rid of plastic waste and turning these into building bricks e.g. for insulation of heat.</p>
<hr />
<p><em>I've seen prototype printers printing PEEK from pallets having a nozzle (slot) diameter of several millimeters.</em></p>
|
<p>You can certainly get large nozzles, but the material for extrusion still needs to be consistent. So any chunked plastic would have to be melted and that will produce an erratic flow at the extruder.</p>
<p>By reforming your shredded plastic into a consistent string of filament, then the printer has a steady supply of material to use. There are already filament extruders for the small shop, but they're still expensive for the home user. The main problems are getting consistent thickness of filament, and minimising contaminants. Also colours tend to be lost and muddied. These might be economical if you have a print farm and are consuming a spool a day on average.</p>
<p>On a large scale, there are "3d printers" that can place a special quick-drying concrete and produce small buildings as homes in a matter of days. However they're fed a special mixture of smooth cement and accelerators to set the concrete ready for the next layer.</p>
<p><a href="https://i.stack.imgur.com/y1vWs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y1vWs.jpg" alt="Tecla 3d printed house" /></a></p>
| 2,055
|
<p>I've run into a few gotchas when doing C# XML serialization
that I thought I'd share:</p>
<ul>
<li>You can't serialize items that are read-only (like KeyValuePairs)</li>
<li>You can't serialize a generic dictionary. Instead, try this wrapper class (from <a href="http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx" rel="noreferrer">http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx</a>):</li>
</ul>
<hr/>
<pre><code>using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
[XmlRoot("dictionary")]
public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, IXmlSerializable
{
public System.Xml.Schema.XmlSchema GetSchema()
{
return null;
}
public void ReadXml(System.Xml.XmlReader reader)
{
XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));
XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));
bool wasEmpty = reader.IsEmptyElement;
reader.Read();
if (wasEmpty)
return;
while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
{
reader.ReadStartElement("item");
reader.ReadStartElement("key");
TKey key = (TKey)keySerializer.Deserialize(reader);
reader.ReadEndElement();
reader.ReadStartElement("value");
TValue value = (TValue)valueSerializer.Deserialize(reader);
reader.ReadEndElement();
this.Add(key, value);
reader.ReadEndElement();
reader.MoveToContent();
}
reader.ReadEndElement();
}
public void WriteXml(System.Xml.XmlWriter writer)
{
XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));
XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));
foreach (TKey key in this.Keys)
{
writer.WriteStartElement("item");
writer.WriteStartElement("key");
keySerializer.Serialize(writer, key);
writer.WriteEndElement();
writer.WriteStartElement("value");
TValue value = this[key];
valueSerializer.Serialize(writer, value);
writer.WriteEndElement();
writer.WriteEndElement();
}
}
}
</code></pre>
<p>Any other XML Serialization gotchas out there?</p>
|
<p>I can't make comments yet, so I will comment on Dr8k's post and make another observation. Private variables that are exposed as public getter/setter properties, and do get serialized/deserialized as such through those properties. We did it at my old job al the time.</p>
<p>One thing to note though is that if you have any logic in those properties, the logic is run, so sometimes, the order of serialization actually matters. The members are <em>implicitly</em> ordered by how they are ordered in the code, but there are no guarantees, especially when you are inheriting another object. Explicitly ordering them is a pain in the rear.</p>
<p>I've been burnt by this in the past.</p>
|
<blockquote>
<p>Private variables/properties are not
serialized in XML serialization, but
are in binary serialization.</p>
</blockquote>
<p>I believe this also gets you if you are exposing the private members through public properties - the private members don't get serialised so the public members are all referencing null values.</p>
| 9,349
|
<p>I have a custom action in a workflow and would like to report an error to the user when something goes wrong. What's the best way of doing that?</p>
<p><strong>UPD:</strong> Ideally I would like to put the workflow in the error state and log a message to the workflow log. That doesn't seem possible. What's the closest I can get to it? I want to a reusable solution,something that's easy for users to set up when using my custom action in SharePoint Designer.</p>
<hr>
<p>Added more details to the question.</p>
<p>@mauro that takes care of storing the error, but how do I display the error to the user in a way which makes sense?</p>
<p>@AdamSane That's seems like a rather fragile solution. It's not a matter of setting this up once on a single site. I need something others can add using SPD.</p>
|
<p>when you throw the error your error handler can then email the user, or better if the list is massive, add the error state to the workflow item - i think this is default functionality though as the error would be mentioned there.</p>
<p><a href="http://www.sharepointsecurity.com/blog/sharepoint/sharepoint-2007-development/fault-handling-in-sharepoint-workflows/" rel="nofollow noreferrer">http://www.sharepointsecurity.com/blog/sharepoint/sharepoint-2007-development/fault-handling-in-sharepoint-workflows/</a></p>
|
<p>Add the error to a hidden list with that users name. Set the visibility on the list (for users) to only read/write their own values. Then use a custom web part or FlexListViewer to view the contents of that list and display it to the user. Once they acknowledge that error, remove it from the list.</p>
<p>If necessary, you can add a different workflow action on that message list, that says pause for 2 days and then email. Whatever, depending on your requirements.</p>
<p>Otherwise you can have a custom db table that you use for pretty much the same thing, this way sharepoint does most of the work for you.</p>
<p><strong>Update</strong> This can be packaged up as a feature and deployed to each site as needed. The strengths of this approach (adding a list item to a list, querying, alerting a user, and emailing a user) are all built into the sharepoint itself. In this case you can focus on your custom logic only, while letting sharepoint focus on the implementation details.</p>
| 3,688
|
<p><a href="http://www.nevrona.com/" rel="nofollow noreferrer">Nevrona Designs'</a> <a href="http://www.nevrona.com/Products/RaveReports/StandardEdition/tabid/66/Default.aspx" rel="nofollow noreferrer">Rave Reports</a> is a Report Engine for use by <a href="http://www.embarcadero.com/" rel="nofollow noreferrer">Embarcadero's</a> <a href="http://www.codegear.com/products/delphi/win32" rel="nofollow noreferrer">Delphi</a> IDE.</p>
<p>This is what I call the Rave Endless Loop bug. In Rave Reports
version 6.5.0 (VCL10) that comes bundled with Delphi 2006, there is a
nortorious bug that plagues many Rave report developers. If you have a
non-empty dataset, and the data rows for this dataset fit exactly into a
page (that is to say there are zero widow rows), then upon PrintPreview,
Rave will get stuck in an infinite loop generating pages.</p>
<p>This problem has been previously reported in this newsgroup under the
following headings:</p>
<ol>
<li>"error: generating infinite pages"; Hugo Hiram 20/9/2006 8:44PM</li>
<li>"Rave loop bug. Please help"; Tomas Lazar 11/07/2006 7:35PM</li>
<li>"Loop on full page of data?"; Tony Chistiansen 23/12/2004 3:41PM</li>
<li>reply to (3) by another complainant; Oliver Piche</li>
<li>"Endless lopp print bug"; Richso 9/11/2004 4:44PM</li>
</ol>
<p>In each of these postings, there was no response from Nevrona, and no
solution was reported.</p>
<p>Possibly, the problem has also been reported on an allied newsgroup
(nevrona.public.rave.reports.general), to wit:
6. "Continuously generating report"; Jobard 20/11/2005
Although it is not clear to me if (6) is the Rave Endless loop bug or
another problem. This posting did get a reply from Nevrona, but it was
more in relation to multiple regions ("There is a problem when using
multiple regions that go over a page-break.") than the problem of zero
widows.</p>
|
<p>This is more of a work-around than a true solution. I first posted this work-around on the Nevrona newsgroup (Group=nevrona.public.rave.developer.delphi.rave; Subject="Are you suffering from the Rave Endless Loop bug?: Work-around announced."; Date=13/11/2006 7:06 PM)</p>
<p>So here is my solution. It is more of a work-around than a good
long-term solution, and I hope that Nevrona will give this issue some
serious attention in the near future.</p>
<ol>
<li>Given your particular report layout, count the maximum number of rows
per page. Let us say that this is 40.</li>
<li>Set up a counter to count the rows within the page (as opposed to rows within the whole report). You could do this either by event script or by a CalcTotal component.</li>
<li>Define an OnBeforePrint scripted event handler for the main data band.</li>
<li>In this event handler set the FinishNewPage property of the main data band to be True when the row-per-page count is one or two below the max (in our example, this would be 38). And set it to False in all other cases. The effect of this is to give every page a non-zero number of widows (in this case 1..38), thus avoiding the condition that gives rise to the Rave Endless loop problem.</li>
</ol>
|
<p>thank's a lot, this thread helps me out from my problem with endless printing loop in Nevrona Rave...., I set MinHeightLeft to 0,500, this setting is work but i'm not sure that it will work for anothers result set of my query report.</p>
| 9,439
|
<p>I am working at a client site where there is a proxy server (<code>HTTP</code>) in place. If I do a hard reset of the emulator it forgets network connection settings for the emulator and settings in the hosted Windows Mobile OS. If I 'save state and exit' it will lose all of these settings. I need to do hard resets regularly which means that I lose this information and spend a lot of time setting:</p>
<ul>
<li>The emulators associated network card</li>
<li>DNS servers for network card in the WM OS.</li>
<li>Proxy servers in connection settings of WM OS.</li>
</ul>
<p>How can I make my life easier? Can I save this as defaults in the emulator, or create an installer easily?</p>
|
<p>This is explained in the Perl <a href="http://perldoc.perl.org/perlop.html#Conditional-Operator" rel="noreferrer">documentation</a>.</p>
<p>Because of Perl operator precedence the statement is being parsed as</p>
<pre><code>($condition ? $a= 2 : $a ) = 3 ;
</code></pre>
<p>Because the ?: operator produces an assignable result, 3 is assigned to the result of the condition.</p>
<p>When $condition is true this means ($a=2)=3 giving $a=3</p>
<p>When $condition is false this means ($a)=3 giving $a=3</p>
<p>The correct way to write this is</p>
<pre><code>$a = ( $condition ? 2 : 3 );
print $a;
</code></pre>
<p>We got bitten by this at work, so I am posting here hoping others will find it useful.</p>
|
<p>One suggestion to Tithonium's answer above:</p>
<p>If you are want to assign different values to the same variable, this might be better (the copy-book way): </p>
<p>$a = ($condition) ? 2 : 3;</p>
| 3,048
|
<p>As far as I can tell, in spite of the countless millions or billions spent on OOP education, languages, and tools, OOP has not improved developer productivity or software reliability, nor has it reduced development costs. Few people use OOP in any rigorous sense (few people adhere to or understand principles such as LSP); there seems to be little uniformity or consistency to the approaches that people take to modelling problem domains. All too often, the class is used simply for its syntactic sugar; it puts the functions for a record type into their own little namespace.</p>
<p>I've written a large amount of code for a wide variety of applications. Although there have been places where true substitutable subtyping played a valuable role in the application, these have been pretty exceptional. In general, though much lip service is given to talk of "re-use" the reality is that unless a piece of code does <em>exactly</em> what you want it to do, there's very little cost-effective "re-use". It's extremely hard to design classes to be extensible <em>in the right way</em>, and so the cost of extension is normally so great that "re-use" simply isn't worthwhile.</p>
<p>In many regards, this doesn't surprise me. The real world isn't "OO", and the idea implicit in OO--that we can model things with some class taxonomy--seems to me very fundamentally flawed (I can sit on a table, a tree stump, a car bonnet, someone's lap--but not one of those is-a chair). Even if we move to more abstract domains, OO modelling is often difficult, counterintuitive, and ultimately unhelpful (consider the classic examples of circles/ellipses or squares/rectangles).</p>
<p>So what am I missing here? Where's the value of OOP, and why has all the time and money failed to make software any better?</p>
|
<blockquote>
<p>The real world isn't "OO", and the idea implicit in OO--that we can model things with some class taxonomy--seems to me very fundamentally flawed</p>
</blockquote>
<p>While this is true and has been observed by other people (take Stepanov, inventor of the STL), the rest is nonsense. OOP may be flawed and it certainly is no silver bullet but it makes large-scale applications much simpler because it's a great way to reduce dependencies. Of course, this is only true for “good” OOP design. Sloppy design won't give any advantage. But good, decoupled design can be modelled very well using OOP and not well using other techniques.</p>
<p>There are much better, more universal models (<a href="https://stackoverflow.com/questions/16770/haskells-algebraic-data-types">Haskell's type model</a> comes to mind) but these are also often more complicated and/or difficult to implement efficiently. OOP is a good trade-off between extremes.</p>
|
<p>OOP <em>has</em> reduced costs, and increased efficiency.</p>
<p>When I made the jump from classic ASP/VBScript to C# I noticed a HUGE increase in productivity thanks to OOP.</p>
| 4,400
|
<p>After you've let the VS.NET (2008 in this case) wizard upgrade your solution, do you perform any manual steps to upgrade specific properties of your solution and projects? For instance, you have to go to each project and target a new version of the framework (from 2.0 to 3.5 in this case). Even after targeting a new version of the framework, I find assembly references still point to the assemblies from the old version (2.0 rather than 3.5 even after changing the target). Does this mean I lose out on the performance benefits of assemblies in the new version of the framework?</p>
|
<p>All versions of the .Net Framework from 2.0 onwards (i.e. 3.0 and 3.5) use exactly the same core framework files (i.e. the CLR, you'll notice there are no directories relating to 3.0 or 3.5 in the C:\Windows\Microsoft.Net\Framework directory) therefore you shouldn't worry too much about any performance issues.</p>
<p>The Core parts are referred to in Microsoft Speak as the 'Red Bits' and the rest as the 'Green Bits'.</p>
|
<p>the target framework feature, you'll need to manually add a reference to System.Core.dll to utilise some of the latest features like Linq.</p>
| 5,001
|
<p>We have a SQL Server 2005 SP2 machine running a large number of databases, all of which contain full-text catalogs. Whenever we try to drop one of these databases or rebuild a full-text index, the drop or rebuild process hangs indefinitely with a MSSEARCH wait type. The process can’t be killed, and a server reboot is required to get things running again. Based on a Microsoft forums post<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2681739&SiteID=1" rel="noreferrer">1</a>, it appears that the problem might be an improperly removed full-text catalog. Can anyone recommend a way to determine which catalog is causing the problem, without having to remove all of them?</p>
<p><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2681739&SiteID=1" rel="noreferrer">1</a> [<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2681739&SiteID=1]" rel="noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2681739&SiteID=1]</a>
“Yes we did have full text catalogues in the database, but since I had disabled full text search for the database, and disabled msftesql, I didn't suspect them. I got however an article from Microsoft support, showing me how I could test for catalogues not properly removed. So I discovered that there still existed an old catalogue, which I ,after and only after re-enabling full text search, were able to delete, since then my backup has worked”</p>
|
<p>Here's a suggestion. I don't have any corrupted databases but you can try this:</p>
<pre><code>declare @t table (name nvarchar(128))
insert into @t select name from sys.databases --where is_fulltext_enabled
while exists(SELECT * FROM @t)
begin
declare @name nvarchar(128)
select @name = name from @t
declare @SQL nvarchar(4000)
set @SQL = 'IF EXISTS(SELECT * FROM '+@name+'.sys.fulltext_catalogs) AND NOT EXISTS(SELECT * FROM sys.databases where is_fulltext_enabled=1 AND name='''+@name+''') PRINT ''' +@Name + ' Could be the culprit'''
print @sql
exec sp_sqlexec @SQL
delete from @t where name = @name
end
</code></pre>
<p>If it doesn't work, remove the filter checking <code>sys.databases</code>.</p>
|
<p>Have you tried running process monitor and when it hangs and see what the underlying error is? Using process moniter you should be able to tell whick file/resource it waiting for/erroring on. </p>
| 6,847
|
<p>I have to use a third-party component without source code. I have the release DLL and release PDB file. Let's call it 'CorporateComponent.dll'. My own code creates objects from this DLL and calls methods on these objects.</p>
<pre><code>CorpObject o = new CorpObject();
Int32 result = o.DoSomethingLousy();
</code></pre>
<p>While debugging, the method 'DoSomethingLousy' throws an exception. What does the PDB file do for me? If it does something nice, how can I be sure I'm making use of it?</p>
|
<p>To confirm if you're using the provided PDB, CorporateComponent.pdb, during debugging within the Visual Studio IDE review the output window and locate the line indicating that the CorporateComponent.dll is loaded and followed by the string <code>Symbols loaded</code>.</p>
<p>To illustrate from a project of mine:</p>
<pre><code>The thread 0x6a0 has exited with code 0 (0x0).
The thread 0x1f78 has exited with code 0 (0x0).
'AvayaConfigurationService.vshost.exe' (Managed): Loaded 'C:\Development\Src\trunk\ntity\AvayaConfigurationService\AvayaConfigurationService\bin\Debug \AvayaConfigurationService.exe', Symbols loaded.
'AvayaConfigurationService.vshost.exe' (Managed): Loaded 'C:\Development\Src\trunk\ntity\AvayaConfigurationService\AvayaConfigurationService\bin\Debug\IPOConfigService.dll', No symbols loaded.
</code></pre>
<blockquote>
<p><code>Loaded 'C:\Development\src...\bin\Debug\AvayaConfigurationService.exe', Symbols loaded.</code></p>
</blockquote>
<p>This indicates that the PDB was found and loaded by the IDE debugger.</p>
<p>As indicated by others When examining stack frames within your application you should be able to see the symbols from the CorporateComponent.pdb. If you don't then perhaps the third-party did not include symbol information in the release PDB build.</p>
|
<p>The main I get from the pdb is line numbers and real method names for stack traces.</p>
| 7,584
|
<p>I'm using an older version of ASP.NET AJAX due to runtime limitations, Placing a ASP.NET Validator inside of an update panel does not work. Is there a trick to make these work, or do I need to use the ValidatorCallOut control that comes with the AJAX toolkit?</p>
|
<p>I suspect you are running the original release (RTM) of .NET 2.0.</p>
<p>Until early 2007 validator controls were not compatible with UpdatePanels. This was resolved with the SP1 of the .NET Framework.</p>
<p>The source of the problem is that UpdatePanel can detect markup changes in your page, but it has no way to track scripts correctly. Validators rely heavily on scripts. During a partial postback, the scripts are either blown away, not updated, or not run when they are meant to.</p>
<p>In early betas, MS had the UpdatePanel try to <em>guess</em> what scripts needed to be re-rendered or run. It didn't work very well, and they had to take it out.</p>
<p>To get around the immediate problem, Microsoft released a patched version of the validator classes in a new DLL called Validators.DLL, and gave instructions on how to tell ASP.NET to use those classes instead of the real ones. If you Google for that DLL name, you should find more information. See also <a href="http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx" rel="noreferrer">This blog post</a>.</p>
<p>This was a stop-gag measure and you should <strike>not use it</strike> <em>avoid it if possible</em>.</p>
<p>The real solution to the problem came shortly after, in .NET 2.0 SP1. Microsoft introduced a new mechanism to register scripts in SP1, and changed the real validator classes to use that mechanism instead of the older one.</p>
<p>Let me give you some details on the changes:</p>
<p>Traditionally, you were supposed to register scripts via Page methods such as Page.RegisterStartupScript() and Page.RegisterClientScriptBlock(). The problem is that these methods were not designed for extensibility and UpdatePanel had no way to monitor those calls.</p>
<p>In SP1 there is a new property object on the page called Page.ClientScripts. This object has methods to register scripts that are equivalent (and in some ways better) to the original ones. Also, UpdatePanel can monitor these calls, so that it rerenders or calls the methods when appropriate. The older RegisterStartupScript(), etc. methods have been deprecated. They still work, but not inside an UpdatePanel.</p>
<p>There is no reason (other than politics, I suppose) to not update your installations to .NET 2.0 SP1. Service Packs carry important fixes.</p>
<p>Good luck.</p>
|
<p>If for what ever reason you are unable to use the udpated version of the ASP.NET validator controls is actually very easy to validate a validation group yourself, all you need to do is call </p>
<pre><code>Page_ClientValidate("validationGroupName");
</code></pre>
<p>Then you can use the PageRequestManager execute the validation as you need.</p>
<p>Definately using the updated validation controls is the way to go, but I'm quite partial to JavaScript ;)</p>
| 5,281
|
<p>Is there a simple way to drop a group of interrelated tables in SQL Server? Ideally I'd like to avoid having to worry about what order they're being dropped in since I know the entire group will be gone by the end of the process.</p>
|
<p>At the risk of sounding stupid, I don't believe SQL Server supports the delete / cascade syntax. I think you can configure a delete rule to do cascading deletes (<a href="http://msdn.microsoft.com/en-us/library/ms152507.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms152507.aspx</a>), but as far as I know the trick with SQL Server is to just to run your drop query once for each table you're dropping, then check it worked.</p>
|
<p>I don't have access to SQL Server to test this, but how about:</p>
<pre><code>DROP TABLE IF EXISTS table1, table2, table3 CASCADE;
</code></pre>
| 2,905
|
<p>Have just started using Visual Studio Professional's built-in unit testing features, which as I understand, uses MS Test to run the tests.</p>
<p>The .trx file that the tests produce is xml, but was wondering if there was an easy way to convert this file into a more "manager-friendly" format?</p>
<p>My ultimate goal is to be able to automate the unit-testing and be able to produce a nice looking document that shows the tests run and how 100% of them passed :)</p>
|
<p>Since this file is XML you could and should use xsl to transform it to another format. The <em>IAmUnkown</em> - blog has an entry about <a href="http://preetsangha.blogspot.com/2008/05/decoding-ms-test-trx-file.html" rel="noreferrer">decoding/transforming the trx file into html</a>. </p>
<p>You can also use <a href="http://boss.bekk.no/display/BOSS/.NetSpecExporter" rel="noreferrer">.NetSpecExporter from Bekk</a> to create nice reports. Their product also uses XSL, so you could probably <em>steal</em> it from the downloaded file and apply it with whatever xsl-application you want.</p>
|
<p>Recently I wrote one trx to html convertor which is python based, have a look
<a href="https://github.com/avinash8526/Murgi" rel="nofollow">https://github.com/avinash8526/Murgi</a></p>
| 4,342
|
<p>A mutex is a programming concept that is frequently used to solve multi-threading problems. My question to the community: </p>
<p>What is a mutex and how do you use it?</p>
|
<p>When I am having a big heated discussion at work, I use a rubber chicken which I keep in my desk for just such occasions. The person holding the chicken is the only person who is allowed to talk. If you don't hold the chicken you cannot speak. You can only indicate that you want the chicken and wait until you get it before you speak. Once you have finished speaking, you can hand the chicken back to the moderator who will hand it to the next person to speak. This ensures that people do not speak over each other, and also have their own space to talk.</p>
<p>Replace Chicken with Mutex and person with thread and you basically have the concept of a mutex.</p>
<p>Of course, there is no such thing as a rubber mutex. Only rubber chicken. My cats once had a rubber mouse, but they ate it.</p>
<p>Of course, before you use the rubber chicken, you need to ask yourself whether you actually need 5 people in one room and would it not just be easier with one person in the room on their own doing all the work. Actually, this is just extending the analogy, but you get the idea.</p>
|
<p>Mutex: Mutex stands for <strong>Mut</strong>ual <strong>Ex</strong>clusion. It means only one process/thread can enter into critical section at a given time. In concurrent programming multiple threads/process updating the shared resource (any variable, shared memory etc.) may lead to some unexpected result. ( As the result depends upon the which thread/process gets the first access).</p>
<p>In order to avoid such an unexpected result we need some synchronization mechanism, which ensures that only one thread/process gets access to such a resource at a time.</p>
<p>pthread library provides support for Mutex.</p>
<pre class="lang-cpp prettyprint-override"><code>typedef union
{
struct __pthread_mutex_s
{
***int __lock;***
unsigned int __count;
int __owner;
#ifdef __x86_64__
unsigned int __nusers;
#endif
int __kind;
#ifdef __x86_64__
short __spins;
short __elision;
__pthread_list_t __list;
# define __PTHREAD_MUTEX_HAVE_PREV 1
# define __PTHREAD_SPINS 0, 0
#else
unsigned int __nusers;
__extension__ union
{
struct
{
short __espins;
short __elision;
# define __spins __elision_data.__espins
# define __elision __elision_data.__elision
# define __PTHREAD_SPINS { 0, 0 }
} __elision_data;
__pthread_slist_t __list;
};
#endif
</code></pre>
<p>This is the structure for mutex data type i.e pthread_mutex_t.
When mutex is locked, __lock set to 1. When it is unlocked __lock set to 0.</p>
<p>This ensure that no two processes/threads can access the critical section at same time.</p>
| 5,483
|
<p>I've been making a concerted effort to improve my javascript skills lately by reading as much javascript code as I can. In doing this I've sometimes seen the <code>javascript:</code> prefix appended to the front of event handler attributes in HTML element tags. What's the purpose of this prefix? Basically, is there any appreciable difference between:</p>
<pre><code>onchange="javascript: myFunction(this)"
</code></pre>
<p>and</p>
<pre><code>onchange="myFunction(this)"
</code></pre>
<p>?</p>
|
<p>Probably nothing in your example. My understanding is that <code>javascript:</code> is for anchor tags (in place of an actual <code>href</code>). You'd use it so that your script can execute when the user clicks the link, but without initiating a navigation back to the page (which a blank <code>href</code> coupled with an <code>onclick</code> will do).</p>
<p>For example:</p>
<pre><code><a href="javascript:someFunction();">Blah</a>
</code></pre>
<p>Rather than:</p>
<pre><code><a href="" onclick="someFunction();">Blah</a>
</code></pre>
|
<p>I don't know if the <code>javascript:</code> prefix means anything within the <code>onevent</code> attributes but I know they are annoying in anchor tags when trying to open the link in a new tab. The <code>href</code> should be used as a fall back and <strong>never</strong> to attach javascript to links.</p>
| 4,323
|
<p>I’m using a RepRap printer, PLA (Hatchbox 1.75 mm), SketchUp, and Slic3r. The heated bed is covered with a blue polyester sticker. When I print small holes (1 to 1.5 mm radius), slicer software considers the holes outside edges for the first layer and prints them before the internal first layer. The problem is, unlike the actual outer edges, the holes have no brim and the small first layer circles stick to the extruder rather than the bed. The rest of the first layer print sticks and the print eventually recovers with slight defects depending on where the lifted circles end up. If I could print the first layer circles after the surrounding first layer was printed, this wouldn’t be an issue. I’ve tried different bed and extrusion temperatures. All four holes in different locations do the same. First layer is 0.3 mm thick. Second layer is 0.2 mm thick. </p>
|
<p>are you using hairspray or tape to help with bed adhesion? If not that might help.</p>
<p>Also try printing the first layer slower or try adjusting the bed level offset so you are squishing the first layer down a bit more.</p>
|
<p>You didn't say what type of bed you have, but I'm guessing glass. Do you have a BuildTak or comparable generic surface you could clip on and use? I've never had adhesion problems like this with my Ender 3, which came with a BuildTak clone; PLA just sticks, with no brim, no glue, no hairspray, etc.</p>
| 1,282
|
<p>In a discussion about motors with a friend who used to work in the robotics industry, he told me that he despised stepper motor systems, as every stepper based system he had worked on required a bunch of hacky software fixes to make the system perform to the required level.</p>
<p>He said that servo motor based systems had their own foibles, but at least they could generally be tuned out and you always knew that if the encoder said you were in a given place then you would be (to within the constraints of the backlash compensation).</p>
<p>Because of this, I was wondering if there were any options for using brushless DC motors + encoders + drive electronics instead of steppers + drive electronics. </p>
|
<p>You can get "stepper replacement" servo drives that supposedly put all the needed control in the drive, and accept ordinary stepper inputs. Those should make the servo-drive a "drop-in" option on anything that uses stepper drives.</p>
<p>That said, I've seen an affordable CNC router system based on steppers turned into a much more expensive system based on servos, and I still have the "obsolete" stepper version, as the servo based system is MUCH more expensive and I could not keep up with the "upgrades" and never would have bought it at the price it now goes for. I'm in fact considering changing that to a reprap control system (still as a router, not as a printer, as I currently think.)</p>
<p>Given some practical limits to printhead speed in additive 3D printing based on the material solidifying, there may not be a lot of benefit in the considerable added expense of servos. They can move faster, but how much of that will translate to actually printing faster? How fast can you melt and pump plastic and have it stay where you put it?</p>
|
<p>I think using these technologies is possible, and may be better than stepper motors, but by using these you loose the main advantages of the steppers : the simplicity and the cost.</p>
<p>When you use steppers, you assume your motors are strong enough to don't loose any step, and you "just" command them. Steppers are not so expensive and are compacts, so your 3D printer is "simple".</p>
<p>If you use separated motors and encoders, you can do better job, but your 3D printer will be a lot more expensive, harder to tune, and harder to program.</p>
| 564
|
<p>Is there a way to make a TSQL variable constant?</p>
|
<p>No, but you can create a function and hardcode it in there and use that.</p>
<p>Here is an example:</p>
<pre><code>CREATE FUNCTION fnConstant()
RETURNS INT
AS
BEGIN
RETURN 2
END
GO
SELECT dbo.fnConstant()
</code></pre>
|
<p>The best answer is from SQLMenace according to the requirement if that is to create a temporary constant for use within scripts, i.e. across multiple GO statements/batches.</p>
<p>Just create the procedure in the tempdb then you have no impact on the target database.</p>
<p>One practical example of this is a database create script which writes a control value at the end of the script containing the logical schema version. At the top of the file are some comments with change history etc... But in practice most developers will forget to scroll down and update the schema version at the bottom of the file.</p>
<p>Using the above code allows a visible schema version constant to be defined at the top before the database script (copied from the generate scripts feature of SSMS) creates the database but used at the end. This is right in the face of the developer next to the change history and other comments, so they are very likely to update it.</p>
<p>For example:</p>
<pre><code>use tempdb
go
create function dbo.MySchemaVersion()
returns int
as
begin
return 123
end
go
use master
go
-- Big long database create script with multiple batches...
print 'Creating database schema version ' + CAST(tempdb.dbo.MySchemaVersion() as NVARCHAR) + '...'
go
-- ...
go
-- ...
go
use MyDatabase
go
-- Update schema version with constant at end (not normally possible as GO puts
-- local @variables out of scope)
insert MyConfigTable values ('SchemaVersion', tempdb.dbo.MySchemaVersion())
go
-- Clean-up
use tempdb
drop function MySchemaVersion
go
</code></pre>
| 4,619
|
<p>I am using <strong>Flashforge Creator Pro</strong> and a <strong>Flashforge Finder</strong></p>
<p><a href="https://i.stack.imgur.com/CE1Aa.jpg" rel="noreferrer" title="Flashforge 3D printers"><img src="https://i.stack.imgur.com/CE1Aa.jpg" alt="Flashforge 3D printers" title="Flashforge 3D printers"></a></p>
<p>I want to know which NEMA stepper model is used in each of these two printers, or is it NEMA 17 for both? </p>
<p>Their model numbers are:</p>
<ul>
<li><code>42HB40F08AB-04 [W-42MM, L-40MM]</code>, and;</li>
<li><code>42HD4027-01[W-42MM, L-40MM]</code></li>
</ul>
|
<p>Nema 17 is about the physical size of the motor, ie screw hole placement. It doesn't specify anything about the power of the motor. If you are looking to replace the motor, you need quite a bit more info than that it is Nema 17, such as the steps/rotation and the holding torque.</p>
|
<p>It most likely uses a nema 17 stepper motor. These are the most commonly used stepper motors. Since it is also the same company there is good reason to believe it uses the same steppers. Why must you know, anyways?</p>
| 755
|
<p>I am building a public website using ASP.NET, as part of the deliverable I need to do an Admin Site for data entry of the stuff shown in the public site, I was wondering what techniques or procedures are people using to validate entries using ASP.NET MVC.</p>
|
<p>Take a look at the <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="noreferrer">JQuery Validation plugin</a> this plugin is amazing,it's clean to implement and has all the features you could ever need, including remote validation via AJAX.</p>
<p>Also a sample MVC controller method can be found <a href="http://httpcode.com/blogs/PermaLink,guid,f8970f20-90d1-4af6-b2da-0285f1963b14.aspx" rel="noreferrer">here</a> which basically uses the JsonResult action type like:</p>
<pre><code>public JsonResult CheckUserName(string username)
{
return Json(CheckValidUsername(username));
}
</code></pre>
|
<p>My favorite way it perform both client and server validation using model-based attributes. I wrote a short post about this and released the source code as well, that will basically allow you to create a class like this</p>
<pre><code>
class User {
[Required]
public string Name{get;set;}
[Email][Required]
public string Email {get;set;}
}
</code></pre>
<p>And the appropriate javascript code will be generated to perform client validation as well as server-side validation runner will be validate your submitted form.</p>
<p>Read the post over <a href="http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/" rel="nofollow noreferrer">here</a></p>
| 3,743
|
<p>How do I enable external access to MySQL Server? I can connect locally but I cannot connect from another box on the network.</p>
<p>I just tried</p>
<pre><code>grant all privileges on *.* to root@'%' identified by '*****' with grant option;
</code></pre>
<p>And restarted MySQL Server with no success.</p>
|
<p>You probably have to edit the configuration file (usually my.cnf) to listen in the external interface instead of on localhost only.</p>
<p>Change the <code>bind-address</code> parameter to your machine's IP address.</p>
<p>If this is an old MySQL installation, you should comment out the skip-networking parameter.</p>
<p>Afterwards, restart MySQL and you'll be set</p>
|
<p>Command and syntax looks fine. Have you checked the server is listening on an interface other than 127.0.0.1? By default Im pretty sure it only listens on the localhost address (127.0.0.1)</p>
| 7,697
|
<p>I've got some Java code using a servlet and Apache Commons FileUpload to upload a file to a set directory. It's working fine for character data (e.g. text files) but image files are coming out garbled. I can open them but the image doesn't look like it should. Here's my code:</p>
<p>Servlet</p>
<pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
String customerPath = "\\leetest\\";
// Check that we have a file upload request
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (isMultipart) {
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload();
// Parse the request
FileItemIterator iter = upload.getItemIterator(request);
while (iter.hasNext()) {
FileItemStream item = iter.next();
String name = item.getFieldName();
if (item.isFormField()) {
// Form field. Ignore for now
} else {
BufferedInputStream stream = new BufferedInputStream(item
.openStream());
if (stream == null) {
LOGGER
.error("Something went wrong with fetching the stream for field "
+ name);
}
byte[] bytes = StreamUtils.getBytes(stream);
FileManager.createFile(customerPath, item.getName(), bytes);
stream.close();
}
}
}
} catch (Exception e) {
throw new UploadException("An error occured during upload: "
+ e.getMessage());
}
}
</code></pre>
<p>StreamUtils.getBytes(stream) looks like:</p>
<pre><code>public static byte[] getBytes(InputStream src, int buffsize)
throws IOException {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
byte[] buff = new byte[buffsize];
while (true) {
int nBytesRead = src.read(buff);
if (nBytesRead < 0) {
break;
}
byteStream.write(buff);
}
byte[] result = byteStream.toByteArray();
byteStream.close();
return result;
}
</code></pre>
<p>And finally FileManager.createFile looks like:</p>
<pre><code>public static void createFile(String customerPath, String filename,
byte[] fileData) throws IOException {
customerPath = getFullPath(customerPath + filename);
File newFile = new File(customerPath);
if (!newFile.getParentFile().exists()) {
newFile.getParentFile().mkdirs();
}
FileOutputStream outputStream = new FileOutputStream(newFile);
outputStream.write(fileData);
outputStream.close();
}
</code></pre>
<p>Can anyone spot what I'm doing wrong?</p>
<p>Cheers,
Lee</p>
|
<p>One thing I don't like is here in this block from StreamUtils.getBytes():</p>
<pre><code> 1 while (true) {
2 int nBytesRead = src.read(buff);
3 if (nBytesRead < 0) {
4 break;
5 }
6 byteStream.write(buff);
7 }
</code></pre>
<p>At line 6, it writes the entire buffer, no matter how many bytes are read in. I am not convinced this will always be the case. It would be more correct like this:</p>
<pre><code> 1 while (true) {
2 int nBytesRead = src.read(buff);
3 if (nBytesRead < 0) {
4 break;
5 } else {
6 byteStream.write(buff, 0, nBytesRead);
7 }
8 }
</code></pre>
<p>Note the 'else' on line 5, along with the two additional parameters (array index start position and length to copy) on line 6.</p>
<p>I could imagine that for larger files, like images, the buffer returns before it is filled (maybe it is waiting for more). That means you'd be unintentionally writing old data that was remaining in the tail end of the buffer. This is almost certainly happening most of the time at EoF, assuming a buffer > 1 byte, but extra data at EoF is probably not the cause of your corruption...it is just not desirable. </p>
|
<p>Are you sure that the image isn't coming through garbled or that you aren't dropping some packets on the way in. </p>
| 6,306
|
<p>I have the same problem as <a href="https://www.thingiverse.com/groups/tevo-tarantula-owners/forums/general/topic:29448" rel="nofollow noreferrer">this person</a> but I don't have those lines in my <code>RAMPS.h</code> file as seen <a href="http://joxi.ru/DmBgR75UNe8k52.png" rel="nofollow noreferrer">here</a>.</p>
<p>I've recently burnt my potentiometer on E0 so the motor isn't working properly anymore. I want to use it on E1 instead. If you have any better idea how to fix this instead of changing code in firmware, feel free to share.</p>
|
<p>Another <a href="https://3dprinting.stackexchange.com/questions/3925/how-to-switch-motor-outputs-and-use-e1-as-x-in-marlin-firmware/5786#5786">posting</a> already discusses how you can change the pins to use spare stepper controllers for broken controllers by changing the pin layout. Assuming you are using a RAMPS board and using <a href="http://marlinfw.org/" rel="nofollow noreferrer">Marlin firmware</a>, you should look at the <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/pins_RAMPS.h" rel="nofollow noreferrer">pins_RAMPS.h</a> file.</p>
<p>This file requires changes to address E1 to E0 and vice versa, please edit the file so that:</p>
<pre><code>#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define E0_CS_PIN 42
</code></pre>
<p>is changed to:</p>
<pre><code>#define E0_STEP_PIN 36
#define E0_DIR_PIN 34
#define E0_ENABLE_PIN 30
#define E0_CS_PIN 44
</code></pre>
<p>and also change:</p>
<pre><code>#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define E1_CS_PIN 44
</code></pre>
<p>to:</p>
<pre><code>#define E1_STEP_PIN 26
#define E1_DIR_PIN 28
#define E1_ENABLE_PIN 24
#define E1_CS_PIN 42
</code></pre>
<p>When the file is changed an saved, <a href="http://marlinfw.org/docs/basics/install.html" rel="nofollow noreferrer">build and upload</a> code to your board and plug the connector of the E0 stepper into the E1 header.</p>
|
<p>the fastest way is to slice using two extruders and assign all print work to E1.
Set the head offsets to [0,0] and that shall do the job.</p>
<p>The harder is to edit pins file and do remapping.</p>
| 880
|
<p>Looking at what's running and nothing jumps out. </p>
<p>Thanks!</p>
|
<p>It should be w3wp.exe</p>
<p>EDIT: In line with Darren's comment, you should also check the "Show processes from all users" in Task Manager if that is where you are looking for the process.</p>
|
<p>Furthermore if you need to look at the .NET/unmanaged stack just donwload <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="nofollow noreferrer">Process Explorer</a> and look at your w3wp.exe processes to examine memory and other stats without having to do a remote/local debugging (just look at the .NET Tab on the properties of the process). It will show all the .NET performance counters for that particular process.</p>
<p>Awesome tool!</p>
| 6,873
|
<p>I have a new 1 TB drive coming in tomorrow. What is the best way to divide this space for a development workstation?</p>
<p>The biggest problem I think I'm going to have is that some partitions (probably /usr) will become to small after a bit of use. Other partitions are probably to huge. The swap drive for example is currently 2GB (2x 1GB RAM), but it is almost never used (only once that I know of).</p>
|
<p>If you partition your drive using <a href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)" rel="noreferrer">LVM</a> you won't have to worry about any individual partition running out of space in the future. Just move space around as necessary.</p>
|
<p>Please tell me what are you doing to /boot that you need more than 64MB on it? Unless you never intend to clean it, anything more is a waste of space. Kernel image + initrd + System.map won't take more than 10MB (probably less - mine weight 5MB) and you really don't need to keep more than two spares.</p>
<p>And with the current prices of RAM - if you are needing swap, you'll be much better off buying more memory. Reserve 1GB for swap and have something monitoring it's usage (no swap at all is bad idea because the machine might lock up when it runs out of free memory).</p>
| 3,773
|
<p>When I turn an image (<code><img></code>) into a hyperlink (by wrapping it in <code><a></code>), Firefox adds a black border around the image. Safari does not display the same border. </p>
<p>What CSS declaration would be best to eliminate the border?</p>
|
<pre><code>img {
border: 0
}
</code></pre>
<p>Or old-fashioned:</p>
<pre><code><img border="0" src="..." />
^^^^^^^^^^
</code></pre>
|
<p>Try this:</p>
<pre><code>img {
border-style: none;
}
</code></pre>
| 7,260
|
<p>We have a deployment system at my office where we can automatically deploy a given build of our code to a specified dev environment (dev01, dev02, etc.). </p>
<p>These dev environments are generalized virtual machines, so our system has to configure them automatically. We have a new system requirement with our next version; we need to give certain user accounts read/write access to certain folders (specifically, giving the ASPNET user read/write to a logging folder). </p>
<p>I'm pretty sure we could do this with WMI or scripts (we use Sysinternals PSTools in a few places for deployment), but I'm not sure what is the best way to do it. The deployment system is written in C# 2.0, the dev environment is a VM with Windows XP. The VM is on the same domain as the deployment system and I have administrator access.</p>
<p>Edit: There's not really a right answer for this, so I'm hesitant to mark an answer as accepted.</p>
|
<p>Another option would be to investigate using a Powershell script There are a lot powershell community snap ins to support VMs and active directory.</p>
<p><a href="http://www.computerperformance.co.uk/powershell/powershell_active_directory.htm#ADUC_(Active_Directory_Users_and_Computers)_" rel="nofollow noreferrer">Active Directory Script Rescources</a></p>
<p><a href="http://www.myitforum.com/myITWiki/Default.aspx?Page=WPScripts&AspxAutoDetectCookieSupport=1" rel="nofollow noreferrer">Powershell Script Library</a></p>
<p><a href="http://www.microsoft.com/technet/scriptcenter/scripts/msh/ad/default.mspx?mfr=true" rel="nofollow noreferrer">Microsoft Script Resources</a></p>
<p><a href="http://blogs.vmware.com/vipowershell/" rel="nofollow noreferrer">VMWARE VI Toolkit (for Windows)</a></p>
|
<p>If you can run scripts, it might be as simple as runing the CACLS command on the VM. Perhaps just have your deployment script read in a config and run the appropriate CACLs commands.</p>
| 6,824
|
<p>I have a MySQL table with coordinates, the column names are X and Y. Now I want to swap the column values in this table, so that X becomes Y and Y becomes X. The most apparent solution would be renaming the columns, but I don't want to make structure changes since I don't necessarily have permissions to do that.</p>
<p>Is this possible to do with <b>UPDATE</b> in some way? <b>UPDATE table SET X=Y, Y=X</b> obviously won't do what I want.</p>
<hr>
<p>Edit: Please note that my restriction on permissions, mentioned above, effectively prevents the use of ALTER TABLE or other commands that change the table/database structure. Renaming columns or adding new ones are unfortunately not options.</p>
|
<p>I just had to deal with the same and I'll summarize my findings.</p>
<ol>
<li><p>The <code>UPDATE table SET X=Y, Y=X</code> approach obviously doesn't work, as it'll just set both values to Y.</p></li>
<li><p>Here's a method that uses a temporary variable. Thanks to Antony from the comments of <a href="http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/" rel="noreferrer">http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/</a> for the "IS NOT NULL" tweak. Without it, the query works unpredictably. See the table schema at the end of the post. This method doesn't swap the values if one of them is NULL. Use method #3 that doesn't have this limitation.</p>
<p><code>UPDATE swap_test SET x=y, y=@temp WHERE (@temp:=x) IS NOT NULL;</code></p></li>
<li><p>This method was offered by Dipin in, yet again, the comments of <a href="http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/" rel="noreferrer">http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/</a>. I think it’s the most elegant and clean solution. It works with both NULL and non-NULL values.</p>
<p><code>UPDATE swap_test SET x=(@temp:=x), x = y, y = @temp;</code></p></li>
<li><p>Another approach I came up with that seems to work:</p>
<p><code>UPDATE swap_test s1, swap_test s2 SET s1.x=s1.y, s1.y=s2.x WHERE s1.id=s2.id;</code></p></li>
</ol>
<p>Essentially, the 1st table is the one getting updated and the 2nd one is used to pull the old data from.<br/>
Note that this approach requires a primary key to be present.</p>
<p>This is my test schema:</p>
<pre><code>CREATE TABLE `swap_test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`x` varchar(255) DEFAULT NULL,
`y` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
INSERT INTO `swap_test` VALUES ('1', 'a', '10');
INSERT INTO `swap_test` VALUES ('2', NULL, '20');
INSERT INTO `swap_test` VALUES ('3', 'c', NULL);
</code></pre>
|
<p>Swapping of column values using single query</p>
<p>UPDATE my_table SET a=@tmp:=a, a=b, b=@tmp;</p>
<p>cheers...!</p>
| 5,842
|
<p>I am curious about the algorithm/principles behind the estimates that the slicing softwares provide. Is there a standard technique behind this and how accurate is it ?</p>
|
<p>Much of the software used in 3D printing is open-source, and so are some slicers. Cura, for instance, does (or did, this source code is from an older branch) its print time estimation in <a href="https://github.com/smorloc/Curation/blob/master/Cura/util/gcodeInterpreter.py" rel="noreferrer">gcodeInterpreter.py</a>.</p>
<p>The relevant portion of the source code is (simplified and with many lines removed for clarity):</p>
<pre><code> totalMoveTimeMinute = 0.0
pos = util3d.Vector3()
for line in gcodeFile:
G = self.getCodeInt(line, 'G')
if G is not None:
if G == 0 or G == 1: #Move
x = self.getCodeFloat(line, 'X')
y = self.getCodeFloat(line, 'Y')
z = self.getCodeFloat(line, 'Z')
e = self.getCodeFloat(line, 'E')
f = self.getCodeFloat(line, 'F')
oldPos = pos.copy()
pos.x = x
pos.y = y
pos.z = z
feedrate = f
currentE = e
totalMoveTimeMinute += (oldPos - pos).vsize() / feedRate
</code></pre>
<p>As you can see, (this version of) Cura simply:</p>
<ul>
<li><p>Loops over all the G-code instructions,</p></li>
<li><p>Computes the length of each move (in X/Y/Z) and divides that by the feedrate to get the time that move will take,</p></li>
<li><p>Sums this up over all the moves.</p></li>
</ul>
<p>and does not take into account:</p>
<ul>
<li><p>Acceleration or deceleration. It assumes the printer is always operating at the maximum feedrate,</p></li>
<li><p>The length of filament extruded. The feedrate is the speed for the move in (X,Y,Z,E), but Cura only looks at (X,Y,Z).</p></li>
<li><p>The time it takes to heat up the print bed/hotend or homing/autoleveling,</p></li>
<li><p>The effects of the printer slowing down if moves can not be read (from USB/SD-card) sufficiently fast (though this would be rather hard to include in any estimate).</p></li>
</ul>
<p>The accuracy of this estimate can be arbitrarily bad if the feedrate is set to some unrealistic value.</p>
<p>Newer versions of Cura use a much more advanced time estimate method, and it can be found in <a href="https://github.com/Ultimaker/CuraEngine/blob/master/src/timeEstimate.cpp" rel="noreferrer">timeEstimate.cpp</a>. It is much more complicated, and actually takes jerk/acceleration/deceleration into account. It is much more accurate.</p>
<p>We know <em>exactly</em> how 3D (open source) 3D printer firmwares work, so estimating print time is as easy as simulating execution of the G-code by your given firmware. There is no reason you can't get a really good estimation (if you take into account all of the intricacies of your given firmware's acceleration/deceleration techniques) but writing the code for it is rather involved.</p>
|
<p>Generally speaking, the typical algorithm takes into account the slicer's speed settings for specific features of the build, such as infill, perimeters, top/bottom layers, etc. The distance traveled by the nozzle at a specific speed for each feature is also part of the equations involved. There are some rather vague portions of the nozzle movement based on acceleration and other factors which makes the calculations less accurate.</p>
<blockquote>
<p>How accurate is it?</p>
</blockquote>
<p>Not too accurate. My experience with three different slicers is that it's never been within better than ten percent. I believe the various combinations of features of a build are not going to be identical from one model to the next, preventing even a ballpark figure to be created from previous builds.</p>
| 664
|
<p>I'm looking to implement httpOnly in my legacy ASP classic sites.
Anyone knows how to do it?</p>
|
<pre><code>Response.AddHeader "Set-Cookie", "mycookie=yo; HttpOnly"
</code></pre>
<p>Other options like <code>expires</code>, <code>path</code> and <code>secure</code> can be also added in this way. I don't know of any magical way to change your whole cookies collection, but I could be wrong about that.</p>
|
<p>HttpOnly does very little to improve the security of web applications. For one thing, it only works in IE (Firefox "supports" it, but still discloses cookies to Javascript in some situations). For another thing, it only prevents a "drive-by" attack against your application; it does nothing to keep a cross-site scripting attack from resetting passwords, changing email addresses, or placing orders.</p>
<p>Should you use it? Sure. It's not going to hurt you. But there are 10 things you should be sure you're doing before you start messing with HttpOnly. </p>
| 7,900
|
<p>Any good recommendations for a platform agnostic (i.e. Javascript) grid control/plugin that will accept pasted Excel data and can emit Excel-compliant clipboard data during a Copy?</p>
<p>I believe Excel data is formatted as CSV during "normal" clipboard operations.</p>
<hr>
<p><a href="http://dhtmlx.com/docs/products/dhtmlxGrid/" rel="noreferrer">dhtmlxGrid</a> looks promising, but the online demo's don't actually copy contents to my clipboard!</p>
|
<p>I'm currently using <strong>dhtmlxGrid</strong> and we have the Excel copy/paste functionality working. dhtmlXGrid is the most full featured javascript grid package that I've found.</p>
<p>On their website, dhtmlXGrid claims to support <a href="http://dhtmlx.com/docs/products/docsExplorer/index.shtml?node=dhtmlxgrid&type=smpl" rel="nofollow noreferrer">Clipboard functionality</a> in the Professional version. (However, I noticed the Sample on their site isn't working on my Firefox. EDIT: It's probably the permissions issue that Nathan mentioned.)</p>
<p>In any case, we had to do some extra work to get the exact Excel copy and paste functionality we wanted. We essentially had to override some of their functionality to get the desired behavior. Their support was pretty good in helping us come up with a solution.</p>
<p>So to answer your question, you should be able to get them to support copy and paste if you purchase the Professional version. I'm just warning you that it may take some additional work to fine tune that behavior. </p>
<p>Overall, I'm happy with dhtmlXGrid. We use a lot of their features. Their support is pretty good. They usually take one day to respond since they are in Europe (I think). And Javascript is by its very nature open source so I can always dive in when I need to. </p>
|
<p>I was wrestling with this problem several years ago (2004 I think). We ran into the problem that Firefox doesn't allow scripts to read the clipboard by default (but you can <a href="http://support.mozilla.com/en-US/kb/Granting+JavaScript+access+to+the+clipboard" rel="nofollow noreferrer">grant access to the clipboard</a>).</p>
<p>There's other ways of reading the clipboard data as well...Flash, for instance, can read the clipboard. There's a good article on <a href="http://ajaxian.com/archives/auto-copy-to-clipboard" rel="nofollow noreferrer">ajaxian</a> to explain how do to this behind the scenes.</p>
<p>In the end, we couldn't find a web-based Grid that fit the bill, so we had to create our own in a mixture of Actionscript and Javascript.</p>
| 2,471
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.