instruction
stringlengths
27
22.5k
chosen
stringlengths
27
28.2k
rejected
stringlengths
19
24.9k
__index_level_0__
int64
0
10k
<p>Is there a way to easily convert Crystal Reports reports to Reporting Services RDL format? We have quite a few reports that will be needing conversion soon.</p> <p>I know about the manual process (which is basically rebuilding all your reports from scratch in SSRS), but my searches pointed to a few possibilities w...
<p>I have searched previously for this, with no luck. There does not seem to be any tools available for this conversion, the manual method thereby becomes the only method. And yes, there are consulting firms who will do the manual work for you, but they still do it manually.</p> <p>Crystal Reports and Reporting Servic...
<p>As suggested by <a href="https://msdn.microsoft.com/en-us/library/aa964127(SQL.90).aspx" rel="nofollow noreferrer">Microsoft</a> you may try any of the following migration tools for SAP Crystal Reports to SSRS conversion:</p> <ol> <li>Hitachi Consulting <a href="http://www.hitachiconsulting.com/page.cfm?ID=bi" rel...
3,708
<p>Given an array of characters which forms a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.</p> <p>Example input and output:</p> <pre><code>&gt;&gt;&gt; reverse_words("this is a string") 'string a is this' </code></pre> <p>It should be O(N) time and O(1) spa...
<p>A solution in C/C++:</p> <pre class="lang-cpp prettyprint-override"><code>void swap(char* str, int i, int j){ char t = str[i]; str[i] = str[j]; str[j] = t; } void reverse_string(char* str, int length){ for(int i=0; i&lt;length/2; i++){ swap(str, i, length-i-1); } } void reverse_words(ch...
<p>Push each word onto a stack. Pop all the words off the stack.</p>
6,963
<p>I have a web application that receives messages through an HTTP interface, e.g.:</p> <pre><code>http://server/application?source=123&amp;destination=234&amp;text=hello </code></pre> <p>This request contains the ID of the sender, the ID of the recipient and the text of the message.</p> <p>This message should be pr...
<p>You should decouple from the JPA interface and use the bare TopLink API. You can probably chuck the objects you're persisting into a UnitOfWork and commit the UnitOfWork on your schedule (sync or async). Note that one of the costs of em.persist() is the implicit clone that happens of the whole object graph. TopLink ...
<p>What is your measure of "requests/sec"? In other words, what happens for the 31st request? What resource is being blocked? If it is the front-end/servlet/web portion, can you run em.persist() in another thread and return immediately?</p> <p>Also, are you creating transactions each time? Are you creating EntityM...
9,037
<p>Why does Visual Studio declare new classes as private in C#? I almost always switch them over to public, am I the crazy one?</p>
<p>I am not sure WHY it does that, but here's what you do in order to get Visual Studio to create the class as Public by default:</p> <p>Go over to “Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033″, you will find a file called Class.zip, inside the .zip file open the file called Cl...
<p>C++, upon which C# is derived, specified that the default class access level is private. C# carries this forward for better or worse.</p>
6,106
<p>I have a little game written in C#. It uses a database as back-end. It's a <a href="http://en.wikipedia.org/wiki/Collectible_card_game" rel="noreferrer">trading card game</a>, and I wanted to implement the function of the cards as a script.</p> <p>What I mean is that I essentially have an interface, <code>ICard</c...
<p><a href="https://www.codeproject.com/Articles/8656/C-Script-The-Missing-Puzzle-Piece" rel="nofollow noreferrer">Oleg Shilo's C# Script solution (at The Code Project</a>) really is a great introduction to providing script abilities in your application.</p> <p>A different approach would be to consider a language that...
<p>Yes, I thought about that, but I soon figured out that another Domain-Specific-Language (DSL) would be a bit too much.</p> <p>Essentially, they need to interact with my gamestate in possibly unpredictable ways. For example, a card could have a rule "When this cards enter play, all your undead minions gain +3 attack...
2,275
<p>I've seen lots of descriptions how anonymous types work, but I'm not sure how they're really useful. What are some scenarios that anonymous types can be used to address in a well-designed program?</p>
<p>Anonymous types have nothing to do with the design of systems or even at the class level. They're a tool for developers to use when coding.</p> <p>I don't even treat anonymous types as types per-se. I use them mainly as method-level anonymous tuples. If I query the database and then manipulate the results, I would ...
<p>@Wouter :</p> <pre><code>var query = from item in database.Items select new Person { ID =item.id, NAME= item.Name }; </code></pre> <p>where ID and NAME are real property of your Person class.</p>
7,113
<p>I've seen a few print time-lapse videos lately which use gyroid infill: wavy lines, which deform across layers so that the waves end up alternating between the two axes. Other than making the time-lapse videos look much cooler, what are the benefits of this infill style compared to the more common hatching or cross-...
<p>From <a href="https://mattshub.com/2018/03/15/gyroid-infill/" rel="noreferrer">this reference</a> you can read that:</p> <blockquote> <p>A gyroid is a naturally occurring structure which be found in butterfly wings and even within membranes inside cells. In 2017, MIT researchers discovered that when graphene ...
<p>This answer builds on to both 0scar and tedder42's answer:</p> <p>Martin's experiment was about shear strength, where as Stefan of CNC Kitchen's experiment was about compressive strength on 2 directions.</p> <p>From their experiments, it is reasonable to conclude that gyroid does well on sheer strength, and above ...
1,052
<h2>Update below</h2> <p>Printed 650 of these tokens, no problem. Then all of a sudden I can't get them to stick and the first layer looks wavy and weird.</p> <p><a href="https://i.stack.imgur.com/BYuDc.jpg" rel="nofollow noreferrer" title="Closeup"><img src="https://i.stack.imgur.com/BYuDc.jpg" alt="Closeup" title="Cl...
<p>A new day, a new nozzle, an old result!</p> <p><a href="https://i.stack.imgur.com/nGdyx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nGdyx.jpg" alt="Success"></a></p> <h2>EDIT</h2> <p>The success was a one off. The problem remains!<br> Heat on the heated bed seems to differ a lot in differen...
<p>Okay so I am not an expert but I think I can help.</p> <ul> <li><p>First off, your <strong>nozzle is too close to your bed</strong>. Take it up, I guess, to like between -0.75 to -0.6&nbsp;mm. Play around there.</p></li> <li><p>For not sticking part, see whether it sticks with <strong>higher bed and nozzle temperat...
1,520
<p>First post here, so please forgive me for any silly mistakes.</p> <p>Recently the y-axis (I think, forward-backward) has started skipping forward when printing the first layer of my print. It prints the raft with no issues at all, sticks the bed nice and flat and the raft is perfect every time. </p> <p>Then it sta...
<p>Layer shifting is a result of the use of open-loop control systems. This means that the printer just instructs the head to go to certain positions without checking that it actually did arrive at that position. If something happens along the path, like hitting some part of the print or the printer, the motors could l...
<p>I'm guessing that the bed in the offending corner is farther away and your raft is curling and lifting off the bed in that corner, and your nozzle it hitting it. Try releveling your bed, paying particular close attention to that corner. In addition, work on bed adhesion in general. Clean the bed, make sure fan is of...
1,116
<p>I am an absolute beginner having issues with my Monoprice Maker select v2 printer. The left half of my prints look fine but the right half always gets messed up. When I watch it print the right half of an object it seems that the PLA isn't sticking even though I level the bed thoroughly beforehand. I don't think th...
<p>I found the problem. This model of printer Monoprice Select v2 has bed warping issues so when the bed heated up it would warp severely. I bought a glass bed and all my problems were solved. </p>
<ul> <li>Try cleaning bed with isopropyl alcohol to remove grease from the bed. (increases stickyness)</li> <li>Try increasing bed temp to 70°C (increases stickyness)</li> <li>If this is not enough, do a fresh bed leveling.</li> </ul>
1,566
<p>Despite primarily being a windows user, I am a huge fan of rsync. Now, I don't want to argue the virtues of rsync vs any other tool...this is not my point.</p> <p>The only way I've ever found of running rsync on windows is via a version that is built to run on top of Cygwin, and as Cygwin has issues with Unicode, ...
<p>The way that windows locks open files might cause an issue requiring you to hook into the Volume Shadowcopy Service. </p> <p>About two years ago this fellow ported the algorithm to C#. I haven't taken a look at the code (or the provided binary), but it might be a place to start looking or someone to try contactin...
<p>Have you seen this:</p> <p><a href="http://www.itefix.no/i2/taxonomy/term/39" rel="nofollow noreferrer">http://www.itefix.no/i2/taxonomy/term/39</a></p> <p>I have used cwrsync without any problem (and with the much of the usual cygwin misery), but I haven't had any need for unicode filenames, so I've not seen that...
5,469
<p>I am experimenting with using the FaultException and FaultException&lt;T&gt; to determine the best usage pattern in our applications. We need to support WCF as well as non-WCF service consumers/clients, including SOAP 1.1 and SOAP 1.2 clients.</p> <p>FYI: using FaultExceptions with wsHttpBinding results in SOAP 1.2...
<p>This is my current workaround:</p> <pre><code> /// &lt;summary&gt; /// Replacement for the static methods on FaultCode to generate Sender and Receiver fault codes due /// to what seems like bugs in the implementation for basicHttpBinding (SOAP 1.1). wsHttpBinding /// (SOAP 1.2) seems to work just fi...
<p>Response from Microsoft:</p> <p>As discussed in <a href="http://msdn.microsoft.com/en-us/library/ms789039.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms789039.aspx</a>, there are two methods outlined in the Soap 1.1 specification for custom fault codes:</p> <p>(1) Using the "dot" notation as you...
9,070
<p>I'm currently trying to get into the Java EE development with the Spring framework. As I'm new to Spring, it is hard to imaging how a good running project should start off.</p> <p>Do you have any <em>best practices</em>, tipps or major <em>DO NOTs</em> for a starter? How did you start with Spring - big project or s...
<p>Small tip - I've found it helpful to modularize and clearly label my Spring xml context files based on application concern. Here's an example for a web app I worked on:</p> <ul> <li><code>MyProject / src / main / resources / spring /</code> <ul> <li><em><strong>datasource.xml</strong></em> - My single data sourc...
<p>Spring is also very much about unit testing and therefore testability of your classes. That basically means thinking about modularization, separation of concerns, referencing a class through interfaces etc.</p>
3,002
<p>I'm looking for (arguably) the correct way to return data from a <code>XmlHttpRequest</code>. Options I see are:</p> <ul> <li><p><strong>Plain HTML</strong>. Let the request format the data and return it in a usable format.<br> <em>Advantage</em>: easy to consume by the calling page.<br><em>Disadvantage</em>: Very...
<p>If you're looking for a quick solution that should work with most available frameworks, I'd go for JSON. It's easy to start with and works.</p> <p>If you're trying to build a larger application that you're going to extend (in terms of size or maybe your own API for 3rd party extensions) I'd go for XML. You could wr...
<p>I think this sort of depends on the level of "ajaxyness" your app is going to have. If your front end is a "rich client", al'a gmail, I'd go with the JSON solution, as you'd have to solve the problem of having client side view generation anyway. If you're using ajax sparingly, to provide simple messages to the user,...
4,200
<p>What is the difference in ASP/VBScript between <code>Int()</code> and <code>CInt()</code>?</p>
<ul> <li><a href="http://www.w3schools.com/Vbscript/func_int.asp" rel="noreferrer">Int()</a></li> </ul> <blockquote> <p>The Int function returns the integer part of a specified number.</p> </blockquote> <ul> <li><a href="http://www.w3schools.com/VBScript/func_cint.asp" rel="noreferrer">CInt()</a></li> </ul> <block...
<p>Here is another difference:</p> <p>Script:</p> <pre><code>wscript.echo 40.91 * 100 wscript.echo Int(40.91 * 100) wscript.echo CInt(40.91 * 100) </code></pre> <p>result:</p> <pre><code>4091 4090 (????) 4091 </code></pre> <p>Any thoughts?</p>
4,100
<p>Is anyone using the Obout controls in C# .Net? How would you rate these controls, especially the Grid Control?</p>
<p>I was thoroughly impressed with them. Of all the other control sets out there (infragistics, telerik) this is the only (more than) respectable one I've worked with that was 1) free! and 2) lightweight!. The only caveat to Obout is I had trouble with merging some of these controls and some of the stock AJAX compone...
<p>I used their tree for a project. Not bad for free controls.</p>
8,158
<p>"Evidence-based scheduling" in FogBugz is interesting, but how do I use it w/ an Agile methodology?</p>
<p>As <a href="https://stackoverflow.com/questions/55693/how-do-you-use-fogbugz-with-an-agile-methodology#55702">eed3si9n</a> said, if you are consistent in your estimates for EBS, FogBugz will take care of this for you.</p> <p>As to the more general, how does FogBugz fit with the Agile methodology, your best bet is to...
<p>I asked the FogBugz guys the same thing because in XP for example you'd provide the estimate in IET (ideal engineering time). Their answer was to be consistent in the way you provide the estimate.</p>
7,951
<p>I've been using a lot of new .NET 3.5 features in the work that I've been doing, lately. The application that I'm building is intended for distribution among consumers who will probably not have the latest version (or perhaps <em>any version</em>) of the .NET framework on their machines.</p> <p>I went to go <a href...
<p>That's one of the sad reasons i'm still targeting .net 2.0 whenever possible :/</p> <p>But people don't neccessarily need the full 200 MB Package. There is a 3 MB Bootstrapper which will only download the required components:</p> <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-41...
<p>Also, it is worth including (in some fashion) the Service Pack downloads as well. In fact, depending on how your executables are built, you might be forced to install the Framework and the Service Packs.</p>
2,818
<p>I am writing an application in Java for the desktop using the Eclipse SWT library for GUI rendering. I think SWT helps Java get over the biggest hurdle for acceptance on the desktop: namely providing a Java application with a consistent, responsive interface that looks like that belonging to any other app on your d...
<p>To follow up on pauxu's answer, I'm using launch4j and NSIS on a project of mine and thought it would be helpful to show just how I'm using them. Here's what I'm doing for Windows. BTW, I'm creating .app and .dmg for Mac, but haven't figured out what to do for Linux yet.</p> <h2>Project Copies of launch4j and NSI...
<p>I went through the same and found that all of the free options weren't very good. Looks like you'll be writing your own. I'd be interested to see if someone has a free/cheap option that works</p>
2,933
<p>I am trying to scrape an html table and save its data in a database. What strategies/solutions have you found to be helpful in approaching this program.</p> <p>I'm most comfortable with Java and PHP but really a solution in any language would be helpful.</p> <p>EDIT: For more detail, the UTA (Salt Lake's Bus syste...
<p>It all depends on how properly your HTML to scrape is? If it's valid XHTML, you can simply use some XPath queries on it to get whatever you want.</p> <p>Example of xpath in php: <a href="http://blogoscoped.com/archive/2004_06_23_index.html#108802750834787821" rel="nofollow noreferrer">http://blogoscoped.com/archive...
<p>I have tried screen-scraping before, but I found it to be very brittle, especially with dynamically-generated code. I found a third-party DOM-parser and used it to navigate the source code with Regex-like matching patterns in order to find the data I needed.</p> <p>I suggested trying to find out if the owners of th...
9,886
<p>I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this:</p> <pre><code>import unittest l = [[&quot;foo&quot;, &quot;a&quot;, &quot;a&quot;,], [&quot;bar&quot;, &quot;a&quot;, &quot;b&quot;], [&quot;lee&quot;, &quot;b&quot;, &quot;b&quot;]] class TestSequenc...
<p>This is called &quot;parametrization&quot;.</p> <p>There are several tools that support this approach. E.g.:</p> <ul> <li><a href="https://docs.pytest.org/en/latest/parametrize.html" rel="noreferrer">pytest's decorator</a></li> <li><a href="https://github.com/wolever/parameterized" rel="noreferrer">parameterized</a>...
<p>Besides using setattr, we can use <em>load_tests</em> with Python 3.2 and later.</p> <pre><code>class Test(unittest.TestCase): pass def _test(self, file_name): open(file_name, 'r') as f: self.assertEqual('test result',f.read()) def _generate_test(file_name): def test(self): _test(self, ...
5,290
<p>Basically I would like to find a way to ddo something like:</p> <pre><code>&lt;asp:Label ID="lID" runat="server" AssociatedControlID="txtId" Text="&lt;%# MyProperty %&gt;"&gt;&lt;/asp:Label&gt; </code></pre> <p>I know I could set it from code behind (writing lId.Text = MyProperty), but I'd prefer doing it in the m...
<p>You can do </p> <pre><code>&lt;asp:Label runat="server" Text='&lt;%# MyProperty %&gt;' /&gt; </code></pre> <p>And then a Page.DataBind() in the codebehind.</p>
<p>Call lID.Databind() from code-behind</p>
9,916
<p>What is the best method to parse multiple, discrete, custom XML documents with Java?</p>
<p>I would use <a href="http://jcp.org/en/jsr/detail?id=173" rel="noreferrer">Stax</a> to parse XML, it's fast and easy to use. I've been using it on my last project to parse XML files up to 24MB. There's a nice introduction on <a href="http://today.java.net/pub/a/today/2006/07/20/introduction-to-stax.html" rel="norefe...
<p>Below is the code of extracting some value value using <a href="http://vtd-xml.sf.net" rel="nofollow">vtd-xml</a>.</p> <pre><code>import com.ximpleware.*; public class extractValue{ public static void main(String s[]) throws VTDException, IOException{ VTDGen vg = new VTDGen(); if (!vg.parseFil...
4,311
<p>I'm having an issue where prints with narrow tolerance come out fused. This makes it pretty much impossible to print anything with narrow parts. It seems to be mostly (maybe only) an issue in the bottom skin layers. Once it gets through those, the rest of the print goes smoothly and tight tolerances are not a proble...
<p>I think this is resolved. After looking at every conceivable source of over-extrusion and coming up negative, <code>R.. GitHub STOP HELPING ICE</code> suggested that it might be a mechanical problem in Z axis movement, like in <a href="https://3dprinting.stackexchange.com/questions/8022/first-3-mm-prints-poorly-then...
<p>I had the same problem with my Ender-3 V2.</p> <p>You need to check if the feeder bracket is square like explained in <a href="https://www.youtube.com/watch?v=xnzNd_FIMKY" rel="nofollow noreferrer">this YouTube</a></p> <p>If that is not the problem maybe you need a custom bracket to change the spacing between the Z-...
1,694
<p>Is there a way to have TortoiseSVN (or any other tool) auto-add any new .cs files I create within a directory to my working copy so I don't have to remember which files I created at the end of the day?</p>
<p>If you just commit your working copy, you'll get a file list showing you your unversioned files, which you can tick to add as you commit. You don't have to add them explicitly before you commit.</p>
<p>Yes, you can add a bat file to svn (on the installed server) so that anytime you update a particular branch, that change get mimicked.. I believe its called hooks... </p> <p>I hope this is what you meant. </p>
7,349
<p>This caught my attention last night.</p> <p>On the latest <a href="http://altnetpodcast.com/episodes/10-oop-in-ruby" rel="nofollow noreferrer">ALT.NET Podcast</a> Scott Bellware discusses how as opposed to Ruby, languages like C#, Java et al. are not truly object oriented rather opting for the phrase &quot;class-ori...
<p>The duck typing comments here are more attributing to the fact that Ruby and Python are more <em>dynamic</em> than C#. It doesn't really have anything to do with it's OO Nature.</p> <p>What (I think) Bellware meant by that is that in Ruby, everything is an object. Even a class. A class definition is an instance ...
<p>I'll take a stab at this.</p> <p>Python and Ruby are duck-typed. To generate any maintainable code in these languages, you pretty much have to use test driven development. As such, it is very important for a developer to easily inject dependencies into their code without having to create a giant supporting framewor...
7,533
<p>Marlin offers a bunch of different choices for auto-levelling and assisted manual levelling for bent build plates (mesh levelling), but for the moment I want to level things completely manually.</p> <p>That is, I want to move Z to 0, disable steppers, and then move around the print head and adjust the distance betw...
<p>Write a few pieces of gcode to do this. Place it on an SD-card (I assume you have a reader) and select the file you want to execute.</p> <p>Home all:</p> <pre><code>G28 G1 Z0 </code></pre> <p>Do you really want to home it directly? I would say you want to take it down slowly and adjusting end-stops incrementally....
<p>The way I manually level my bed is by connecting a computer to the printer via USB. As far as I am aware, if you have a touchscreen this should be available on the printer options as well for marlin.</p> <p>But if you connect a computer, simply run something like pronterface or any other manual control gui and:</p>...
532
<p>We've embedded an OSGi runtime (Equinox) into out custom client-server application to facilitate plugin development and so far things are going great. We've been using Eclipse to build plugins due to the built-in manifest editor, dependency management, and export wizard. Using Eclipse to manager builds isn't very co...
<p>Maven2 all the way; has an Eclipse plugin called <a href="http://m2eclipse.codehaus.org/" rel="nofollow noreferrer">m2eclipse</a> to help with managing it, solves exactly the dependency problem and then some. Has a <a href="http://www.sonatype.com/community/definitive_guide.html" rel="nofollow noreferrer">free onlin...
<p>Can you please elaborate where the problem occurs? You mention OSGi bundle dependencies. Is this during runtime? Or during compile-time? In the first case you should consider Declarative Services (see OSGi Spec).</p>
4,747
<p>Question is pretty self explanitory. I want to do a simple find and replace, like you would in a text editor on the data in a column of my database (which is MsSQL on MS Windows server 2003)</p>
<p>The following query replace each and every <code>a</code> character with a <code>b</code> character.</p> <pre><code>UPDATE YourTable SET Column1 = REPLACE(Column1,'a','b') WHERE Column1 LIKE '%a%' </code></pre> <p>This will not work on SQL server 2003.</p>
<p>If you are working with SQL Server 2005 or later there is also a CLR library available at <a href="http://www.sqlsharp.com/" rel="nofollow noreferrer">http://www.sqlsharp.com/</a> that provides .NET implementations of string and RegEx functions which, depending on your volume and type of data may be easier to use an...
8,350
<p>How can I copy a line 10 times easily in Emacs? I can't find a copy-line shortcut or function. I can use C-aC-spcC-eM-w to laboriously copy the line but how can I then paste it more than once?</p> <p>Any ideas before I go and write my own functions.</p>
<p>you can use a keyboard macro for that:-</p> <p>C-a C-k C-x ( C-y C-j C-x ) C-u 9 C-x e</p> <p><strong>Explanation:-</strong></p> <ul> <li>C-a : Go to start of line</li> <li>C-k : Kill line</li> <li>C-x ( : Start recording keyboard macro</li> <li>C-y : Yank killed line</li> <li>C-j : Move to next line</li>...
<p>You get the line with C-k, you make the next command happen ten times with C-u 10, then you paste the line with C-y. Pretty simple.</p> <p>If you always want C-k to do the whole line, you can set kill-whole-line to t. No more fiddling with C-a or C-e.</p> <p>There's a lot you can do with fancy kill rings, regist...
9,755
<p><a href="http://hessian.caucho.com" rel="nofollow noreferrer">Hessian</a> is a custom binary serialization protocol, (which is open-source - I think), that forms the basis for a binary cross platform remoting framework. I'd like to know if anyone here has used it, and if so, what sort of performance can we expect fr...
<p>Have you looked at the HessianC# project (<a href="http://www.hessiancsharp.org/" rel="nofollow noreferrer">http://www.hessiancsharp.org/</a>)?</p>
<p>This is the sort of problem that web services were designed to solve. Although no longer simple, the SOAP format allows you to serialize objects to an XML representation on a Java/C# application, transmit them across the wire and deserialize them in the corresponding Java/C# application (Java/C# may be replaced wit...
8,845
<p>Does Django have any template tags to generate common HTML markup? For example, I know that I can get a url using</p> <pre><code>{% url mapper.views.foo %} </code></pre> <p>But that only gives me the URL and not the HTML code to create the link. Does Django have anything similar to Rails' link_to helper? I found <...
<p>No it doesn't.</p> <p><a href="http://www.b-list.org/" rel="noreferrer">James Bennett</a> answered a <a href="http://www.b-list.org/weblog/2006/jul/02/django-and-ajax/" rel="noreferrer">similar question</a> a while back, regarding Rails' built-in JavaScript helpers.</p> <p>It's <em>really</em> unlikely that Django...
<p>This won't answer directly to the question, but why not using <code>&lt;a href="{% url mapper.views.foo %}"&gt;foo&lt;/a&gt;</code> in template then?</p>
8,670
<p>When you send an email using C# and the System.Net.Mail namespace, you can set the "From" and "Sender" properties on the MailMessage object, but neither of these allows you to make the MAIL FROM and the from address that goes into the DATA section different from each other. MAIL FROM gets set to the "From" property...
<p><code>MailMessage.Sender</code> will always insert a <code>Sender</code> header (interpreted as <em>on behalf of</em> in your e-mail client). </p> <p>If you use the <code>Network</code> delivery method on the <code>SmtpClient</code>, <code>.Sender</code> will also change the sender in the envelope. Using the <code>...
<p>Do you mean this?:</p> <pre><code>//create the mail message MailMessage mail = new MailMessage(); //set the addresses mail.From = new MailAddress("me@mycompany.com"); mail.To.Add("you@yourcompany.com"); //set the content mail.Subject = "This is an email"; mail.Body = "this is a sample body with html in it....
7,501
<p>I have an Ender 5 with an auto bed leveling sensor (TRU-LEV 600).</p> <p>It is working fine, however, as the sensor probes the bed, the nozzle and the bed cool down and are not staying heated as it is getting the points, even though they were heated up in the first place.</p> <p>How do I stop the bed and hotend from...
<p>For Marlin firmware, you should <strong>check the setting <code>PROBING_HEATERS_OFF</code></strong> in <em>Configuration.h</em> file:</p> <pre><code>//#define PROBING_HEATERS_OFF // Turn heaters off when probing #if ENABLED(PROBING_HEATERS_OFF) //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back u...
<p>Eco mode under settings shuts off the bed after a 30 minutes ish maybe an hour. Either way it is probably the issue</p>
1,846
<p>How do I check if an object property in JavaScript is undefined?</p>
<p>The usual way to check if the value of a property is the special value <code>undefined</code>, is:</p> <pre class="lang-js prettyprint-override"><code>if(o.myProperty === undefined) { alert(&quot;myProperty value is the special value `undefined`&quot;); } </code></pre> <p>To check if an object does not actually ha...
<pre><code>if (somevariable == undefined) { alert('the variable is not defined!'); } </code></pre> <p>You can also make it into a function, as shown <a href="http://verens.com/archives/2005/07/25/isset-for-javascript/" rel="nofollow noreferrer">here</a>:</p> <pre><code>function isset(varname){ return(typeof(windo...
4,711
<p>I've written a stored proc that will do an update if a record exists, otherwise it will do an insert. It looks something like this:</p> <pre><code>update myTable set Col1=@col1, Col2=@col2 where ID=@ID if @@rowcount = 0 insert into myTable (Col1, Col2) values (@col1, @col2) </code></pre> <p>My logic behind writing...
<p>Your assumption is right, this is the optimal way to do it and it's called <a href="http://en.wikipedia.org/wiki/Upsert" rel="noreferrer">upsert/merge</a>.</p> <p><a href="http://www.sqlservercentral.com/articles/T-SQL/61773/" rel="noreferrer">Importance of UPSERT - from sqlservercentral.com</a>: </p> <blockquote>...
<p>Your logic seems sound, but you might want to consider adding some code to prevent the insert if you had passed in a specific primary key.</p> <p>Otherwise, if you're always doing an insert if the update didn't affect any records, what happens when someone deletes the record before you "UPSERT" runs? Now the recor...
3,446
<p>I'm dynamically loading user controls adding them to the Controls collection of the web form.</p> <p>I'd like to hide user controls if they cause a unhandled exception while rendering.</p> <p>So, I tried hooking to the Error event of each UserControl but it seems that this event never fires for the UserControls as...
<p>mmilic, following on from <a href="https://stackoverflow.com/questions/10793/catching-unhandled-exceptions-in-aspnet-usercontrols#10910">your response</a> to my <a href="https://stackoverflow.com/questions/10793/catching-unhandled-exceptions-in-aspnet-usercontrols#10815">previous idea</a>..</p> <p>No additional log...
<p>Global.asax and Application_Error?</p> <p><a href="http://www.15seconds.com/issue/030102.htm" rel="nofollow noreferrer">http://www.15seconds.com/issue/030102.htm</a></p> <p>Or the Page_Error Event on an individual Page only:</p> <p><a href="http://support.microsoft.com/kb/306355" rel="nofollow noreferrer">http://...
3,194
<p>I am working with a bunch of Makerbot Replicator+ printers and one Z18 in a classroom. I would like my students to be able to print cups and stuff to drink from if they want. I know I need a food-safe material AND a food safe nozzle if it can be managed.</p> <p>So, I wanted to check the following:</p> <ol> <li><p>Is...
<p>FDM itself is not particularly food-safe, coating the print may prevent bacteria to settle in crevices. Furthermore, the filament should be able to withstand high temperatures for extended periods of time in case you want to clean the printed cups to kill bacteria.</p> <p>An overview of food-safe filaments is given ...
<p>A better alternative would be PETG, it's food safe on it's own and has more heat tolerance than PLA. It prints with much the same ease as PLA.</p> <p>I'm not familiar with your particular printer, but nozzles are standard sizes. Swapping a brass nozzle for a stainless steel one doesn't need anything extra done. They...
2,200
<p>I am new to any scripting language. But, Still I worked on scripting a bit like tailoring other scripts to work for my purpose. For me, What is the best online resource to learn Python?</p> <p>[Response Summary:] </p> <p>Some Online Resources:</p> <p><a href="http://docs.python.org/tut/tut.html" rel="nofollow nor...
<p>If you need to learn python from scratch - you can start here: <a href="http://docs.python.org/tut/tut.html" rel="nofollow noreferrer">http://docs.python.org/tut/tut.html</a> - good begginers guide</p> <p>If you need to extend your knowledge - continue here <a href="http://diveintopython3.ep.io/" rel="nofollow nore...
<p>There are some screencasts on <a href="http://showmedo.com" rel="nofollow noreferrer">http://showmedo.com</a></p>
9,601
<p>There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps?</p> <p><strong>Linq</strong></p> <p>Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't run Async queries in ASP.NET using Linq...
<p>I would recommend either NHibernate or Entity Framework. For large sites, I'd use ADO.NET Data Services. I wouldn't do anything large with LINQ to SQL. I think Stack Overflow might end up with some interesting scale problems being 2-tier rather than 3-tier, and they'll also have some trouble refactoring as the physi...
<p>This post is from 2008 before the cloud really took off. It seems like an update to the answer is required. I will just provide some links and an overview. I am sure that there are more up-to-date posts at this site on this topic, and if I find them, then I will add the links here.</p> <p>When it comes to data scal...
9,339
<p>Do you have any strategies for retrofitting unit tests onto a code base that currently has no unit tests ?</p>
<p>Read <a href="https://rads.stackoverflow.com/amzn/click/com/0131177052" rel="noreferrer" rel="nofollow noreferrer">Working Effectively With Legacy Code by Feathers</a>.</p> <p>Jimmy Bogard has a <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/tags/Refactoring/default.aspx" rel="noreferrer">good blog s...
<p>Is it possible that we are in a panic and are getting confused between unit tests and performance tests? Is it that your application works fine with few users, but starts throwing errors when under heavier load? If so, unit tests are not the answer. Unit tests != Load tests.</p> <p>If unit tests are in fact the ...
6,436
<p>Browsing through the git documentation, I can't see anything analogous to SVN's commit hooks or the "propset" features that can, say, update a version number or copyright notice within a file whenever it is committed to the repository.</p> <p>Are git users expected to write external scripts for this sort of functio...
<p>Quoting from the <a href="https://git.wiki.kernel.org/index.php/GitFaq#Does_git_have_keyword_expansion.3F" rel="noreferrer">Git FAQ</a>:</p> <blockquote> <p>Does git have keyword expansion?</p> <p>Not recommended. Keyword expansion causes all sorts of strange problems and isn't really useful anyway, especially withi...
<p>Perhaps the most common SVN property, 'svn:ignore' is done through the .gitignore file, rather than metadata. I'm afraid I don't have anything more helpful for the other kinds of metadata.</p>
6,088
<p>I need a real DBA's opinion. Postgres 8.3 takes 200 ms to execute this query on my Macbook Pro while Java and Python perform the same calculation in under 20 ms (350,000 rows):</p> <pre><code>SELECT count(id), avg(a), avg(b), avg(c), avg(d) FROM tuples; </code></pre> <p>Is this normal behaviour when using a SQL da...
<p>Postgres is doing a lot more than it looks like (maintaining data consistency for a start!)</p> <p>If the values don't have to be 100% spot on, or if the table is updated rarely, but you are running this calculation often, you might want to look into Materialized Views to speed it up.</p> <p>(Note, I have not used...
<p>You need to increase postgres' caches to the point where the whole working set fits into memory before you can expect to see perfomance comparable to doing it in-memory with a program.</p>
7,466
<p>I've found <a href="http://blogs.msdn.com/priozersk/archive/2007/08/06/implementing-mvc-pattern-in-net-cf-applications-part-1.aspx" rel="noreferrer">an article</a> on this subject by a Microsoft employee, but has anyone implemented a more robust framework for this? Is there a lightweight framework for WinForms that ...
<p>I personally think that the Mobile Software Factory doesn't hold much joy for CF. We still use one part of it (EventBroker) at work and I'd like to even remove that part if possible (as it doesn't support generic events and you have to cast the arguments into their strong types from EventArgs). A sister project at w...
<p><strong>Edit: The above posters are correct. I saw MVC and immediately thought of web forms. My apologies. Feel free to disregard this. I'll leave my original message in place just in case anyone who <em>is</em> interested in web forms MVC needs the links. :-)</strong></p> <p>There are a couple MVC frameworks o...
4,591
<p>In C++, what alternatives do I have for exposing a collection, from the point of view of performance and data integrity?</p> <p>My problem is that I want to return an internal list of data to the caller, but I don't want to generate a copy. Thant leaves me with either returning a reference to the list, or a pointer...
<p><a href="https://stackoverflow.com/questions/44693/in-c-what-alternatives-do-i-have-for-exposing-a-collection-from-the-point-of-vi#44734">RichQ's answer</a> is a reasonable technique, if you're using an array, vector, etc. </p> <p>If you're using a collection that isn't indexed by ordinal values... or think you <em...
<p>Using const is a reasonable choice. You may also wish to check out the boost C++ library for their shared pointer implementation. It provides the advantages of pointers i.e. you may have the requirement to return a shared pointer to "null" which a reference would not allow.</p> <p><a href="http://www.boost.org/doc/...
6,644
<p>I want to format my existing comments as 'RDoc comments' so they can be viewed using <code>ri</code>.</p> <p>What are some recommended resources for starting out using RDoc?</p>
<p>A few things that have bitten me:</p> <ul> <li><code>:main:</code> -- RDoc uses only the last one evaluated; best to make sure there's only one in your project and you don't also use the <code>--main</code> command-line argument.</li> <li>same as previous, but for <code>:title:</code></li> <li><code>:section:</code...
<p>RDoc uses SimpleMarkup so it's fairly simple to create lists, etc. using *, - or a number. It also treats lines that are indented at the same column number as part of the same paragraph until there is an empty line which signifies a new paragraph. Do you have a few examples of comments you want RDoc'ed so we could s...
2,248
<p>If I have an issue with my FLSUN printer how can I contact customer support?</p>
<p>They have a webpage by now <a href="http://www.flsun3d.com" rel="noreferrer">www.flsun3d.com</a></p>
<p>I have had good luck contacting them via AliExpress <a href="https://flsun.aliexpress.com/store/2383013" rel="nofollow noreferrer">https://flsun.aliexpress.com/store/2383013</a> even though I bought my printer on Amazon. </p>
1,681
<p>I'm writing a little desktop app that should be able to encrypt a data file and protect it with a password (i.e. one must enter the correct password to decrypt). I want the encrypted data file to be self-contained and portable, so the authentication has to be embedded in the file (or so I assume).</p> <p>I have a ...
<h3>Key Generation</h3> <p>I would recommend using a recognized algorithm such as PBKDF2 defined in <a href="ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-5v2/pkcs5v2-0.pdf" rel="nofollow noreferrer">PKCS #5 version 2.0</a> to generate a key from your password. It's similar to the algorithm you outline, but is capable of ge...
<p>Is there really need to save the hashed password into the file. Can't you just use the password (or hashed password) with some salt and then encrypt the file with it. When decrypting just try to decrypt the file with the password + salt. If user gives wrong password the decrypted file isn't correct.</p> <p>Only dra...
7,971
<p>This is in reference to my other question <a href="https://stackoverflow.com/questions/16110/c-auto-clearing-winform-textbox">Auto Clearing Textbox</a>.<br> If I choose to derive a new TextBox control from TextBox instead of implement a user control just containing my Textbox, how would I include that in the toolbox...
<blockquote> <p>Right-click the toolbox, click "Choose Items" from the context menu, browse to your DLL, and select it.</p> </blockquote> <p>To extend on Greg's answer... Just to clarify, you cannot add a user control to the tool box if the code for it is in the same project that you want to use it in. For some...
<p>Right-click the toolbox, click "Choose Items" from the context menu, browse to your DLL, and select it.</p>
3,685
<p>Admittedly this might not be a problem on larger screens, but my employer is abit tight and refuses to buy monitors larger than 19inch, this means that I dont have much screen real estate to view all the Visual Studio windows and my code at the same time, or two pieces of code at once. Is there anything that allows ...
<p>You can right click on the tab strip and insert a new vertical (or horizontal) tab group.</p> <p>This allows you to view multiple tabs at the same time.</p>
<p>Hmm.. I don't think there is a way from within Visual Studio. For maximizing real estate and working on simultaneous files, I use that method plus viewing the files on Full Screen mode.</p> <p>Do you multiple monitors?</p>
3,764
<p>I'm looking for a python library that will help me to create an authentication method for a desktop app I'm writing. I have found several method in web framework such as django or turbogears.</p> <p>I just want a kind of username-password association stored into a local file. I can write it by myself, but I'm reall...
<p>dbr said:</p> <blockquote> <pre><code>def hash_password(password): """Returns the hashed version of a string """ return hasher.new( str(password) ).hexdigest() </code></pre> </blockquote> <p>This is a really insecure way to hash passwords. You <em>don't</em> want to do this. If you want to know why rea...
<p>Use " md5 " it's much better than base64</p> <pre><code>&gt;&gt;&gt; import md5 &gt;&gt;&gt; hh = md5.new() &gt;&gt;&gt; hh.update('anoop') &gt;&gt;&gt; hh.digest &lt;built-in method digest of _hashlib.HASH object at 0x01FE1E40&gt; </code></pre>
9,607
<p>I'm giving a presentation to a Java User's Group on Groovy and I'm going to be doing some coding during the presentation to show some side-by-side Java/Groovy. I really like the GroovyConsole as it's simple and I can resize the text easily. </p> <p>I'm wondering if there is anything similar for Java? I know I co...
<p><a href="http://www.drjava.org/" rel="nofollow noreferrer">DrJava</a> is your best bet. It also has an <a href="http://www.drjava.org/eclipse.shtml" rel="nofollow noreferrer">Eclipse plugin</a> to use the interactions pane like GroovyConsole.</p>
<p>Why not use the GroovyConsole ? Groovy accepts the vast majority of Java syntax</p>
5,003
<p>The situation: We're out of beta and version 1.0 has been released to several customer sites. Team A is already busy working on version 1.1 that will have incremental bugfixes and usability tweaks, while another team works on version 2.0 with large-scale changes, where the core of the product may have been completel...
<p>One good way is to fix each bug in the stable branch and merge the stable branch into the development branch. This is the <a href="http://www.cmcrossroads.com/bradapp/acme/branching/branch-structs.html#ParallelMaintDev" rel="nofollow noreferrer">Parallel Maintenance/Development Lines</a> pattern, and the key is to m...
<p>Merge early, merge often, and make sure that QA on the mainline knows and regresses/verifies the defects fixed in each patch of the maintenance releases. </p> <p>It's really easy to let something slip out and "unfix" a bug in a subsequent release, and let me tell you, customers don't care about how complicated it ...
6,634
<p>I know two approaches to Exception handling, lets have a look at them.</p> <ol> <li><p>Contract approach.</p> <p>When a method does not do what it says it will do in the method header, it will throw an exception. Thus the method &quot;promises&quot; that it will do the operation, and if it fails for some reason, it ...
<p>I favor what you call the "contract" approach. Returning nulls or other special values to indicate errors isn't necessary in a language that supports exceptions. I find it much easier to understand code when it doesn't have a bunch of "if (result == NULL)" or "if (result == -1)" clauses mixed in with what could be...
<p>I believe that if you are building a class which will be used by an external program (or will be reused by other programs) then you should use the contract approach. A good example of this is an API of any kind.</p>
4,595
<p>I want to create dynamic content based on this. I know it's somewhere, as web analytics engines can get this data to determine how people got to your site (referrer, search terms used, etc.), but I don't know how to get at it myself.</p>
<p>You can use the "referer" part of the request that the user sent to figure out what he searched for. Example from Google:</p> <blockquote> <p><a href="http://www.google.no/search?q=stack%20overflow" rel="nofollow noreferrer">http://www.google.no/search?q=stack%20overflow</a></p> </blockquote> <p>So you must sear...
<p>This is some code to backup the idea of using a querystring method and if that's not available using the UrlReferrer property of the Request object. This can then be stashed in a session object (or somewhere else if that works better for you) so that you can track the source between pages. (Page_Load doesn't seem to...
8,120
<p>I'm looking to create <code>favicon.ico</code> files programatically from Python, but PIL only has support for reading <code>ico</code> files.</p>
<p>You can use <a href="http://pillow.readthedocs.org" rel="noreferrer">Pillow</a>:</p> <pre><code>from PIL import Image filename = r'logo.png' img = Image.open(filename) img.save('logo.ico') </code></pre> <p>Optionally, you may specify the icon sizes you want:</p> <pre><code>icon_sizes = [(16,16), (32, 32), (48, 48...
<p>I don't know if this applies for all cases, but on WinXP an .ico can be a bmp of size 16x16, 32x32 or 64x64. Just change the extension to ico from bmp and you're ready to go.</p>
6,740
<p>Here is my code, which takes two version identifiers in the form "1, 5, 0, 4" or "1.5.0.4" and determines which is the newer version.</p> <p>Suggestions or improvements, please!</p> <pre><code> /// &lt;summary&gt; /// Compares two specified version strings and returns an integer that /// indicates thei...
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.version.aspx" rel="nofollow noreferrer">System.Version</a> class does not support versions with commas in it, so the solution presented by <a href="https://stackoverflow.com/questions/30494#30510">Darren Kopp</a> is not sufficient.</p> <p>Here is a version...
<p>If you can assume that each place in the version string will only be one number (or at least the last 3, you can just remove the commas or periods and compare...which would be a lot faster...not as robust, but you don't always need that.</p> <pre><code>public static int CompareVersions(string strA, string strB) { ...
5,036
<p>Is there a way to access Visual Studio's built-in ASP.NET Development Server over HTTPS?</p>
<p>As of now we can use IIS Express to develop and test in SSL. Here is a complete article explaning how to use IIS Express and Visual Studion 2010 to develop websites in SSL.</p> <p><img src="https://i.stack.imgur.com/jvqeG.png" alt="enter image description here"></p> <p><strong>Next</strong></p> <p><img src="https...
<p><strong>Select the project-file in the Solution Explorer:</strong> for example: "WebApplication1". </p> <p>With pressing <strong>ALT+ENTER</strong> you enter the project-properties. </p> <p>Select <strong>"DEBUG"</strong> on the <strong>left side</strong>.</p> <p>Here you can select <strong>"Enable SSL"</strong>....
8,493
<p>This is a follow-on question to the <a href="https://stackoverflow.com/questions/29061/how-do-you-use-ssh-in-a-shell-script">How do you use ssh in a shell script?</a> question. If I want to execute a command on the remote machine that runs in the background on that machine, how do I get the ssh command to return? ...
<p>I had this problem in a program I wrote a year ago -- turns out the answer is rather complicated. You'll need to use nohup as well as output redirection, as explained in the wikipedia artcle on <a href="http://en.wikipedia.org/wiki/Nohup" rel="noreferrer">nohup</a>, copied here for your convenience. </p> <blockquot...
<p>First follow this procedure: </p> <p>Log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:</p> <pre><code>a@A:~&gt; ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/a/.ssh/id_rsa): Created directory '/home/a/.ssh'. Enter pa...
4,881
<p>Here is an example of what I've got going on:</p> <pre><code>CREATE TABLE Parent (id BIGINT NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB; CREATE TABLE Child (id BIGINT NOT NULL, parentid BIGINT NOT NULL, PRIMARY KEY (id), KEY (parentid), CONSTRAINT fk_parent FOREIGN KEY (parentid) REFERENCES Parent (id) ON ...
<p>In the simpler case, what happens if a record is deleted from Child and it has a referencing Uncle? That's unspecified, so the constraints fail for that anyway.</p> <p>If deleting a Child does not delete its Uncles, then what happens instead? Uncle.childid cannot be null.</p> <p>What you want is one of these three...
<p>the design is all wrong. You should have single table, with parent child relationship (literrally). Then you can figure out uncles (and aunts) with a query</p> <p><code> select id from persons where -find all children of the grandparents<br> parent id in (<br> select parentid from persons --find the grandpare...
8,500
<p>I'm wondering what is the quickest and most reliable way to forward mail from an IMAP account.</p> <p>My university does not allow our student-mailbox to forward to a private e-mail account (everybody uses either Gmail or Hotmail here). It's a political thing, not technical. We do have IMAP access to the mailbox. I...
<p>You might want to look at <A HREF="http://www.fetchmail.info//" rel="nofollow noreferrer">Fetchmail</A>, as this sounds like the problem it was designed to solve. Fetchmail retrieves mail from POP/IMAP/etc servers and forwards it to SMTP/LMTP/etc servers. Fetchmail has the advantage of a few years and lots of users ...
<p>If using Gmail you can configure GMAIL to pick up mail from other accounts.</p>
8,184
<p>I have a tomcat instance setup but the database connection I have configured in <code>context.xml</code> keeps dying after periods of inactivity.</p> <p>When I check the logs I get the following error:</p> <p>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the s...
<p><a href="http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html" rel="noreferrer">Tomcat Documentation</a></p> <p>DBCP uses the Jakarta-Commons Database Connection Pool. It relies on number of Jakarta-Commons components:</p> <pre><code>* Jakarta-Commons DBCP * Jakarta-Commons Collections * Jak...
<p>I do not know whether the above answer does basically the same thing, but some of our systems use the DB connection about once a week and I've seen that we provide a -Otimeout flag or something of that sort to mysql to set the connection timeout.</p>
3,672
<p>Is there a way when executing a stored procedure in Management Studio to get the data types of the result sets coming back? I'm looking for something like functionality of when you pass a table name to sp_help</p>
<p>You do get to look at the types though, if you call the stored procedure via ADO, ADO.NET, ODBC or the likes: The resulting recordsets have the type information you are looking for. Are you really restricted to Management Studio?</p>
<p>You could always use an actual table that is garrenteed to be unique. It's a kludge, but it's an option. This will not work inside a stored proc though.</p> <pre><code>if exists (select * from sys.tables where name = 'tmp_TableName') drop table tmp_TableName go select * into tmp_TableName from MyTable --do s...
5,317
<p>So I have a Sybase stored proc that takes 1 parameter that's a comma separated list of strings and runs a query with in in an IN() clause:</p> <pre><code>CREATE PROCEDURE getSomething @keyList varchar(4096) AS SELECT * FROM mytbl WHERE name IN (@keyList) </code></pre> <p>How do I call my stored proc with more than...
<p>If you're using Sybase 12.5 or earlier then you can't use functions. A workaround might be to populate a temporary table with the values and read them from there.</p>
<p>Do you need to use a comma separated list? The last couple of years, I've been taking this type of idea and passing in an XML file. The openxml "function" takes a string and makes it like xml and then if you create a temp table with the data, it is queryable.</p> <pre><code>DECLARE @idoc int DECLARE @doc varchar(10...
2,810
<p>Using ASP.NET MVC there are situations (such as form submission) that may require a <code>RedirectToAction</code>. </p> <p>One such situation is when you encounter validation errors after a form submission and need to redirect back to the form, but would like the URL to reflect the URL of the form, not the action ...
<p>The solution is to use the TempData property to store the desired Request components.</p> <p>For instance:</p> <pre><code>public ActionResult Send() { TempData["form"] = Request.Form; return this.RedirectToAction(a =&gt; a.Form()); } </code></pre> <p>Then in your "Form" action you can go:</p> <pre><code>...
<p>TempData is the solution which keeps the data from action to action.</p> <pre><code>Employee employee = new Employee { EmpID = "121", EmpFirstName = "Imran", EmpLastName = "Ghani" }; TempData["Emp...
2,416
<p>A tutorial I have on Regex in python explains how to use the re module in python, I wanted to grab the URL out of an A tag so knowing Regex I wrote the correct expression and tested it in my regex testing app of choice and ensured it worked. When placed into python it failed:</p> <pre><code>result = re.match(&quot;a...
<p>In Python, there's a distinction between "match" and "search"; match only looks for the pattern at the start of the string, and search looks for the pattern starting at any location within the string.</p> <p><a href="http://docs.python.org/lib/module-re.html" rel="noreferrer">Python regex docs</a><br> <a href="http...
<p>Are you using the <code>re.match()</code> or <code>re.search()</code> method? My understanding is that <code>re.match()</code> assumes a "<code>^</code>" at the beginning of your expression and will only search at the beginning of the text, while <code>re.search()</code> acts more like the Perl regular expressions a...
9,801
<p>I'm storing a Word document in a SQL Server 2005 database in a varbinary(max) column. Is there a way to open this document from a VB.NET Windows Forms application without serialising to a file first (i.e. directly from the byte array I've read from the database)?</p>
<p>Depends on what's reading it. If it's Word, you'll probably have to serialize to a file, but if it's a function or library that can take an IO.Stream then you could wrap a new MemoryStream around the byte array and pass that.</p>
<p>Not really. You need to treat it like an e-mail attachment, where the file is generally copied to a temp folder that is cleaned out periodically.</p>
8,103
<p>I am wondering if anyone here knows of any 3D printers that work by assembling models from parts instead of extruding or setting material.</p> <p>The closest I have found is the <a href="https://www.youtube.com/channel/UCtoqCrwr91bNH_hbPtBrprw" rel="nofollow noreferrer">pixelstone</a> but it appears to only be a pro...
<h2>Yes and no</h2> <p><strong>Yes</strong>, there are machines, that assemble things from parts. For example, <a href="https://en.wikipedia.org/wiki/SMT_placement_equipment" rel="nofollow noreferrer">SMT placement equipment &amp; pick-and-place-machines</a>. Almost all electronics are made this way. In fact, a lot of ...
<p>I've prototyped a design that used beads similar to these <a href="http://www.infostir.com/images/plastic-beads-350.jpg" rel="nofollow noreferrer">http://www.infostir.com/images/plastic-beads-350.jpg</a> on a rod with a heated tip and then you just press them off into the design. But it wasn't too strong and had som...
542
<p>I've been given a job of 'translating' one language into another. The source is too flexible (complex) for a simple line by line approach with regex. Where can I go to learn more about lexical analysis and parsers?</p>
<p>If you want to get "emotional" about the subject, pick up a copy of "<a href="http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools" rel="noreferrer">The Dragon Book</a>." It is <em>usually</em> the text in a compiler design course. It will definitely meet your need "learn more about lexical an...
<p>If you prefer Java based tools, the Java Compiler Compiler, JavaCC, is a nice parser/scanner. It's config file driven, and will generate java code that you can include in your program. I haven't used it a couple years though, so I'm not sure how the current version is. You can find out more here: <a href="https:/...
5,424
<p>Is there any IL level debugger in form of a VS plugin or standalone application?</p> <p>Visual studio’s debugger is great, but it allows you to debug on either HLL code level or assembly language, you can’t debug IL. It seems that in some situations it would be useful to have an opportunity to debug at IL level. </...
<p>The best way to do this is to use ILDASM to disassemble the managed binary, which will generate the IL instructions. Then recompile that IL source code in debug mode using ILASM, when you fire up the Visual Studio debugger you will be able to step through the raw IL.</p> <ol> <li><code>ildasm foo.exe /OUT=foo.exe.i...
<p>ISTR there's a debugger plug-in for Reflector. </p> <p>Not used it myself, though I have used TestDriven.net to debug a 3rd-party assembly with the aid of Reflector:</p> <p><a href="http://weblogs.asp.net/nunitaddin/archive/2006/11/05/Debug-With-Reflector.aspx" rel="nofollow noreferrer">weblogs.asp.net/nunitaddin...
3,062
<p>Is there a good yacc/bison type LALR parser generator for .NET ?</p>
<p><a href="http://antlr.org/" rel="noreferrer">Antlr</a> supports C# code generation, though it is LL(k) not technically LALR. Its tree rewriting rules are an interesting feature though.</p>
<p>Check out <a href="http://goldparser.org/grammars/index.htm" rel="nofollow">Gold</a>. It is LALR compliant and supports lots of languages, if not the most. Gold can convert YACC and Bison type grammars. </p> <p>If it does not suit your needs then check out <a href="http://en.wikipedia.org/wiki/Comparison_of_parser_...
5,732
<p>I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux).</p> <p>I have implemented <code>QueryPerformanceCounter</code> by giving the uSeconds since the process start up: </p> <pre><code>BOOL QueryPerformanceCounter(LARGE_INTEGER* pe...
<p>Maybe. But you have bigger problems. <code>gettimeofday()</code> can result in incorrect timings if there are processes on your system that change the timer (ie, ntpd). On a "normal" linux, though, I believe the resolution of <code>gettimeofday()</code> is 10us. It can jump forward and backward and time, consequentl...
<p>From my experience, and from what I've read across the internet, the answer is "No," it is not guaranteed. It depends on CPU speed, operating system, flavor of Linux, etc.</p>
2,252
<p>In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a <code>std::string</code>).<br> <a href="http://rapidxml.sourceforge.net/" rel="nofollow noreferrer">RapidXml</a> has been recommended to me, but I can't see how to retrieve the XML back as a text stri...
<p>Althoug the documentation is poor on this topic, I managed to get some working code by looking at the source. Although it is missing the xml header which normally contains important information. Here is a small example program that does what you are looking for using rapidxml:</p> <pre><code>#include &lt;iostream&g...
<p>If you aren't yet committed to Rapid XML, I can recommend some alternative libraries:</p> <ul> <li><p>Xerces - This is probably the defacto C++ implementation.</p></li> <li><p>XMLite - I've had some luck with this minimal XML implementation. See the article at <a href="http://www.codeproject.com/KB/recipes/xmlite....
5,896
<p>Ok, so there has to be a way to do this... no? If not I'd love some ideas. </p> <p>I have two repeaters and an image inside an update panel along with some AJAX dropdowns with link buttons to the left. I want to update the data inside the update panel as fast as possible as values are selected from the dropdowns. <...
<p>As far as I know, it is not easy to get just Data and data-bind the repeater on the client side. But, you might want to <a href="http://dotnetslackers.com/articles/ajax/ASPNETRepeater.aspx" rel="nofollow noreferrer">check this out</a>.</p>
<p>Wrap only the repeater you want to rebind with an update panel of its own. The only viewstate transferred when doing this is the portion inside the update panel. You may have to play around with the triggers and update mode of the panels to get everything to play nicely. </p> <p>Another option is instead of usin...
8,715
<p>For my Frankenstein's printer I am at a loss with the hotend mount. I cannot drill holes of 16 (upper diameter) and 12 mm (clamping diameter, 6mm high) which i would need to mount the E3D V6 clone I have.</p> <p>What I am looking for: a hotend mount plate that tightly fixes the hotend while having some holes for sc...
<p>If you do not have the tools to fabricate this component yourself, but have a 3D model available, I would suggest getting someone else to 3D print it for you.</p> <p>There are multiple options for getting your model printed, such as:</p> <ul> <li>Friends</li> <li>Your local makerspace, library or similar</li> <li>...
<p>If you do not have the tools to fabricate this component yourself, but have a 3D model available, I would suggest getting someone else to 3D print it for you.</p> <p>There are multiple options for getting your model printed, such as:</p> <ul> <li>Friends</li> <li>Your local makerspace, library or similar</li> <li>...
227
<p>I found some wild remarks that ASP.NET MVC is 30x faster than ASP.NET WebForms. What real performance difference is there, has this been measured and what are the performance benefits.</p> <p>This is to help me consider moving from ASP.NET WebForms to ASP.NET MVC.</p>
<p>We haven't performed the type of scalability and perf tests necessary to come up with any conclusions. I think ScottGu may have been discussing potential perf targets. As we move towards Beta and RTM, we will internally be doing more perf testing. However, I'm not sure what our policy is on publishing results of per...
<p><img src="https://i.stack.imgur.com/I7eXy.png" alt="enter image description here"></p> <p>I did a small VSTS load test experiment with some basic code and found ASP.NET MVC response time to be twice faster as compared to ASP.NET Webforms. Above is the attached graph with the plot. </p> <p>You can read this load t...
6,531
<p>I've just introduced a friend to <strong>GNU Screen</strong> and they're having a hard time getting used to it. That makes me think about the essential things he needs to know about the excellent <strong>Screen</strong> utility, the same things that you'd think worthwhile to teach someone, a beginner, from the groun...
<p>I've been using <code>Screen</code> for over 10 years and probably use less than half the features. So it's definitely not necessary to learn all its features right away (and I wouldn't recommend trying). My day-to-day commands are:</p> <pre><code>^A ^W - window list, where am I ^A ^C - create new window ^A space -...
<p>^A A switches back to the screen you just came from.</p>
9,605
<p>I start to write a client - server application using .net (C#) for both client and server side.</p> <p>Unfortunately, my company refuse to pay for Windows licence on server box meaning that I need to rewrite my code in Java, or go to the Mono way.</p> <p>Is there any good way to translate C# code in Java ? The ser...
<p>I'd suggest building for Mono. You'll run into some gray area, but overall it's great. However, if you want to build for Java, you might check out <a href="http://dev.mainsoft.com/Default.aspx?tabid=130" rel="noreferrer">Grasshopper</a>. It's a commercial product, but it claims to be able to translate CIL (the outpu...
<p>I only know the other way. <a href="http://www.db4o.com/" rel="nofollow noreferrer">Dbo4</a> is developed in java and the c# version is generated from the java sources automaticaly.</p>
9,077
<p>Is there a good library for extracting text from a PDF? I'm willing to pay for it if I have to.</p> <p>Something that works with C# or classic ASP (VBScript) would be ideal and I also need to be able to separate the pages from the PDF.</p> <p><a href="https://stackoverflow.com/questions/25665/python-module-for-co...
<p>You can use the IFilter interface built into Windows to extract text and properties (author, title, etc.) from any supported file type. It's a COM interface so you would have use the .NET interop facilities.</p> <p>You'd also have to download the free PDF IFilter driver from Adobe.</p>
<p>Here is a good list: <a href="http://csharp-source.net/open-source/pdf-libraries" rel="nofollow noreferrer">Open Source Libs for PDF/C#</a></p> <p>Most of these are geared toward creating PDFs, but they should have read capability as well.</p> <p>There is this one as well: <a href="http://www.lowagie.com/iText/" r...
6,904
<p>I have installed and setup RubyCAS-Server and RubyCAS-Client on my machine. Login works perfectly but when I try to logout I get this error message from the RubyCAS-Server:</p> <pre><code>Camping Problem! CASServer::Controllers::Logout.GET ActiveRecord::StatementInvalid Mysql::Error: Unknown column 'username' in ...
<p>Do you need something more than what can be provided by MsgBox?</p> <pre><code>MsgBox("Do you want to see this message?", MsgBoxStyle.OkCancel + MsgBoxStyle.Information, "Respond") </code></pre>
<p>Are you unable to use the <a href="http://msdn.microsoft.com/en-us/library/aa335422(VS.71).aspx" rel="nofollow noreferrer">MessageBox class</a>?</p>
8,840
<p>I am looking for either a FireFox extension, or a similar program, that allows you to craft GET and POST requests. The user would put in a form action, and as many form key/value pairs as desired. It would also send any cookie information (or send the current cookies from any domain the user chooses.) The Web Develo...
<p>If you're a windows user, use <a href="http://www.fiddler2.com/fiddler2/version.asp" rel="nofollow noreferrer">Fiddler</a>. It is invaluable for looking at the raw Http requests and responses. It also has the ability to create requests with the request builder and it has an auto responder also, so you can intercep...
<p>If you've got Greasemonkey installed you might want to try the XSS Assistant user script: <a href="http://www.whiteacid.org/greasemonkey/#xss_assistant" rel="nofollow noreferrer">http://www.whiteacid.org/greasemonkey/#xss_assistant</a></p>
3,655
<p>I'm currently designing a very large and complicated model, because it's large and should be strong enough completely hollow I want to print it with no infill to save material.</p> <p>However, there are some points in the model where there are indentations in the top shell.</p> <p>The bottom of those indentations ...
<p>I'm not really sure if i get you right but it seems like you gotta switch on support material. That's all. Correct me if I'm wrong but it sounds like very common situation where some parts are hanging like your yellow disks.</p> <p>Otherwise if your model is going to be closed at the bottom and at the top you can m...
<p>In Cura 2 you can do several things:</p> <ol> <li><p>Design internal support pillars, and make them an Infill Mesh via the Per-object settings. I suggest you also reduce the top/bottom thickness and Wall thickness of the infill mesh.</p></li> <li><p>Enable Hollow Out Objects and enable support.</p></li> <li><p>Enab...
340
<p>In trying to understand 3D printers, I have watched some YouTube videos where the crafters make items with hinges. That in itself blows my mind. It is hard to grasp how something with moving parts can be printed. But specifically I am wondering if the concept can be extended to food printers to make, for example, a ...
<p>No, M108 does not do that. You are looking for <strong>T#</strong>, where # is the tool position you want:</p> <pre><code>T1 ; switch to tool position 1 T3 ; switch to tool position 3 </code></pre> <p>This tells the processor to send all heating, cooling and flow commands to this tool until another tool change ...
<p>As @tbm0115 has mentioned - it differs. Your <code>M108 T{index of tool}</code> command is perfectly fine on some FlashForge printers, a company known for its different sorts of proprietary code. It is indeed used for tool changing here.</p> <p>While on the common Marlin firmware (e.g. used on the popular Creality E...
539
<p>Currently my workflow with Emacs when I am coding in C or C++ involves three windows. The largest on the right contains the file I am working with. The left is split into two, the bottom being a shell which I use to type in compile or make commands, and the top is often some sort of documentation or README file th...
<p>You'll have to be specific as to what you mean by "the rest". Except for the object inspector (that I"m aware of), emacs does all the above quite easily:</p> <ul> <li>editor (obvious)</li> <li>compiler - just run <code>M-x compile</code> and enter your compile command. From there on, you can just <code>M-x compil...
<p>In the Unix or X windows style, I don't know that there is an integrated IDE that works for everything. </p> <p>For interacting with debuggers, just one component of an IDE, consider <a href="https://github.com/realgud" rel="nofollow noreferrer">realgud</a>. The other thing it has that I find useful are parsers for...
8,889
<p>I'm looking for a GPS with a good API. I would like to be able to send an address to it, and tell it to navigate to that address. I also need to pull the current location from the GPS. I'd like to be able to do this with the GPS hooked up to a laptop by bluetooth or even just a USB cable.</p> <p>I've looked at t...
<p>If you want to talk to a Garmin GPS, you can check out their <a href="http://developer.garmin.com" rel="nofollow noreferrer">developer website</a>. They've got resources ranging from talking to Web Services all the way to doing low-level Serial &amp; USB I/O to interface directly with the devices.</p>
<p>I presume that by GPS you mean Satellite Navigation? Most GPS units don't offer the turn-by-turn capability required to navigate effectively on roads, or the underlying road map data for that matter.</p> <p><strong><em>updated:</em></strong> OK, since Garmin are by far the biggest dog in the yard, I'd recommend tak...
3,133
<p>I have a winforms application where users will be creating stock items, and a time of creation there are a number of different things that need to happen.</p> <p>I think the UI for this should probably be a wizard of some kind, but I'm unsure as to the best way to achieve this. I have seen a couple of 3rd party Wiz...
<p>Here are a few more resources you should check out:</p> <ol> <li><p>This DevExpress WinForms control: <a href="http://www.devexpress.com/Products/NET/Controls/WinForms/Wizard/" rel="nofollow noreferrer">http://www.devexpress.com/Products/NET/Controls/WinForms/Wizard/</a></p></li> <li><p>A home-grown wizards framew...
<p>The easiest way to create a wizard dialog is to use one of the third-party versions available that handle all of the "hard stuff" (the page navigation, UI framework, etc.) for you. The one I like the most is from <a href="http://www.divelements.co.uk/net/" rel="nofollow noreferrer">Divelements</a>; they have both a ...
5,966
<p>I'd like to execute JavaScript code from within a C# assembly and have the results of the JavaScript code returned to the calling C# code.</p> <p>It's easier to define things that I'm not trying to do:</p> <ul> <li><p>I'm not trying to call a JavaScript function on a web page from my code behind.</p></li> <li><p>I...
<p>The code should be pretty self explanitory, so I'll just post that.</p> <pre><code>&lt;add assembly="Microsoft.Vsa, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/&gt;&lt;/assemblies&gt; </code></pre> <hr> <pre><code>using Microsoft.JScript; public class MyClass { public static Microsoft...
<p>Could it be simpler to use <a href="https://github.com/pivotal/jsunit" rel="nofollow noreferrer">JSUnit</a> to write your tests, and then use a <a href="http://watin.sourceforge.net/" rel="nofollow noreferrer">WatiN</a> test wrapper to run them through C#, passing or failing based on the JSUnit results?</p> <p>It ...
9,329
<p>Sorry, I'm new in 3D printing and modeling and I need help.</p> <p>I bought a 3D model with a hollow part of the body that doesn't print on my printer normally (with very high resolution (layer is 0.12 mm, the nozzle is 0.4 mm) because the walls are very thin). I tried to make it as a solid in MeshMixer or ZBrush, ...
<p>The model clearly contains an enclosed surface, which is directed to the inside - in other words, it was modeled to contain a volume of air.</p> <p>Those surfaces need to be removed to print the body solid. To do this, you could check if those surfaces constitute a separate shell for meshmixer. If yes, you can just ...
<p>This is a problem with the model, you need to make sure that the model isn't hollow. You might be able to get around this though if you use scaffolding, it might recognize the overhand hand build supports for your print inside of your print, you just might have to mess around with the scaffolding settings a bit.</p>...
1,938
<p>This seems to be an overlooked area that could really use some insight. What are your best practices for:</p> <ul> <li>making an upgrade procedure</li> <li>backing out in case of errors</li> <li>syncing code and database changes</li> <li>testing prior to deployment</li> <li>mechanics of modifying the table</li> </...
<p>That's a great question. ( There is a high chance this is going to end up a normalised versus denormalised database debate..which I am not going to start... okay now for some input.)</p> <p>some off the top of my head things I have done (will add more when I have some more time or need a break)</p> <p>client desig...
<p>As Pat said, use liquibase. Especially when you have several developers with their own dev databases making changes that will become part of the production database.</p> <p>If there's only one dev, as on one project I'm on now(ha), I just commit the schema changes as SQL text files into a CVS repo, which I check ou...
4,950
<p>I'm looking for a library/method to parse an html file with more html specific features than generic xml parsing libraries.</p>
<p><a href="https://html-agility-pack.net" rel="nofollow noreferrer">Html Agility Pack</a></p> <blockquote> <p>This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allow...
<p>You could use a HTML DTD, and the generic XML parsing libraries.</p>
8,000
<p>I try to print a stamp with flexible filaments. The problem I encounter is that the filament is flexible, but not soft. This leads to small differences in height to parts of the stamp not working.</p> <p>One solution would be to add a small 'cushion' to add some squishyness to the stamp. I designed the stamp and th...
<p>As the rubber stamp needs to be soft in one axis for the whole area, you could use an infill that causes the same softness in all directions, but is sliced as such that the stamp experiences the same softness. Alternatively you can use the specific infill types for flexibility, but beware of the orientation:</p> <u...
<p>Sinusoidal infill provides great squishiness in the infill direction, but you'll still have the problem that where the infill meets the perimeter wall, it'll be less squishy than where the perimeter wall isn't touching any infill. You can reduce this effect by using a stiffer filament for that wall (if you can print...
1,303
<p>Having been a PHP developer on LAMP servers for quite a while, is there anything that I will need to take into consideration while preparing an application for <em>IIS</em> on windows.</p>
<p>Make sure you get the FastCGI extension for IIS 6.0 or IIS 7.0. It is the single most important thing you can have when running PHP under IIS. Also this article should get you setup:</p> <p><a href="http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/" rel="noreferrer">http://learn....
<p>One of the major sticking points I've had with IIS is the lack of Apache's mod_rewrite. There are other work-arounds and work-alikes depending on what you're doing, but just keep in mind that you'll need to change things up a bit to work with IIS if you're using mod rewrite extensively.</p>
3,171
<p>In Python one can get a dictionary of all local and global variables in the current scope with the built-in functions <code>locals()</code> and <code>globals()</code>. Is there some equivalent way of doing this in Javascript? For instance, I would like to do something like the following:</p> <pre><code>var foo = ...
<ul> <li><p>locals() - No. </p></li> <li><p>globals() - Yes.</p></li> </ul> <p><code>window</code> is a reference to the global scope, like <code>globals()</code> in python.</p> <pre><code>globals()["foo"] </code></pre> <p>is the same as:</p> <pre><code>window["foo"] </code></pre>
<p>AFAIK, no. If you just want to check the existence of a given variable, you can do it by testing for it, something like this:</p> <pre><code>if (foo) foo(); </code></pre>
6,115
<p>I have just received a 3D printer for Christmas (Robo R2). I am confused by the sheer amount of settings that I can tweak and I'm hesitant to do so until I know more about them. I was wondering if anybody has any recommendations for literature on:</p> <ul> <li>3D printing in general (geared towards beginners);</l...
<p>Welcome to the fantastic, sometimes frustrating but most often glorious world of 3D printing David! :)</p> <p>Your question is really very very broad, but here's my contribution to make your first steps a success. First of all: I don't have experience with the Robo R2, but judging from the specs available online, ...
<p>I have found that "Troubleshooting and Maintaining your 3d Printer" by Charles Bell has a good overview of:</p> <ul> <li><p>3d Printer Assembly and parts</p></li> <li><p>3d Printer Calibration</p></li> <li><p>3d Printer Software</p></li> <li><p>Filament materials</p></li> <li><p>3d Printer Maintenance (both prevent...
779
<p>I specifically want to add the style of <code>background-color</code> to the <code>&lt;body&gt;</code> tag of a master page, from the code behind (C#) of a content page that uses that master page. </p> <p>I have different content pages that need to make the master page has different colors depending on which conte...
<p>What I would do for the particular case is:</p> <p>i. Define the body as a server side control</p> <pre><code>&lt;body runat="server" id="masterpageBody"&gt; </code></pre> <p>ii. In your content aspx page, register the MasterPage with the register:</p> <pre><code>&lt;% MasterPageFile="..." %&gt; </code></pre> <...
<p>I believe you are talking about a content management system. The way I have delt with this situation in the past is to either:</p> <ol> <li>Allow a page/content to define an extra custom stylesheet or</li> <li>Allow a page/content to define inline style tags</li> </ol>
2,438
<p>Where I work, the design and development departments are totally separated, however we (the design department) are responsible for managing the CSS for our sites. Typically, new CSS needs to be released to the production server far more often than new website code. Because of this, we are deploying the CSS separatel...
<p>I'll advocate the use of source control here. Especially if the development team uses branching to deal with structured releases. That way, whatever CSS is checked into the production branch is what should be deployed ... and if it is updated mid-stream, it's the responsibility of the person (designer?) that updat...
<p>The fancy name is "Content Delivery Network" <a href="http://en.wikipedia.org/wiki/Content_Delivery_Network" rel="nofollow noreferrer">(Wikipedia)</a>.</p> <p>We store our CSS files in a database, and then have a separate website that does nothing but serve CSS resources. We implemented this in May 2007 for 1000+ w...
7,625
<p>I've been trying to understand how to read the memory of other processes on Mac OS X, but I'm not having much luck. I've seen many examples online using <code>ptrace</code> with <code>PEEKDATA</code> and such, however it doesn't have that option on BSD <sup>[<a href="http://developer.apple.com/documentation/Darwin/R...
<p>Matasano Chargen had a good post a while back on porting some debugging code to OS X, which included learning how to read and write memory in another process (among other things).</p> <p><a href="http://replay.web.archive.org/20090627062246/http://www.matasano.com/log/1100/what-ive-been-doing-on-my-summer-vacation-...
<p>Manipulating a process's memory behind its back is a Bad Thing and is fraught with peril. That's why Mac OS X (like any Unix system) has protected memory, and keeps processes isolated from one another.</p> <p>Of course it can be done: There are facilities for shared memory between processes that explicitly cooper...
3,188
<p>How can I determine the IP of my router/gateway in Java? I can get my IP easily enough. I can get my internet IP using a service on a website. But how can I determine my gateway's IP?</p> <p>This is somewhat easy in .NET if you know your way around. But how do you do it in Java?</p>
<p>Java doesn't make this as pleasant as other languages, unfortunately. Here's what I did:</p> <pre><code>import java.io.*; import java.util.*; public class ExecTest { public static void main(String[] args) throws IOException { Process result = Runtime.getRuntime().exec("traceroute -m 1 www.amazon.com");...
<p>I'm not sure if it works on every system but at least here I found this:</p> <pre><code>import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static void main(String[] args) { try { //Variables to find out the Default Gateway IP(s) ...
3,305
<p>This print failed a couple of hours in. I was wondering if the nature of the print surface, with lots of retracts (similarly the previous print which was OK) might have contributed to the clog, or if it's just bad luck? To be clear, the surface has lots of short dead-end, not just a wiggly perimeter. <a href="https...
<p>Reading your question it's not clear to me if you are referring to <em>filament retraction</em> (which is a configurable setting) or <em>surface recesses</em> which seems what you are referring to when writing:</p> <blockquote> <p>the nature of the print surface, with lots of retracts</p> </blockquote> <p>If it ...
<p>In addition to the retraction distance, in the case of this model, I was seeing some places where there were a lot of very close retractions. I think these were increasing the risk of damaged filament, so I reduced the 'maximum retraction count' which at 50 over a 5mm length seemed fairly high.</p>
837
<p>I've read the book <a href="http://oreilly.com/catalog/9780596529321/" rel="noreferrer" title="Programming Collective Intelligence">Programming Collective Intelligence</a> and found it fascinating. I'd recently heard about a challenge amazon had posted to the world to come up with a better recommendation engine for...
<p>You don't want to use "overall popularity" unless you have no information about the user. Instead, you want to align this user with similar users and weight accordingly.</p> <p>This is exactly what <a href="http://en.wikipedia.org/wiki/Bayesian_inference" rel="noreferrer">Bayesian Inference</a> does. In English, ...
<p>@Lao Tzu, I agree with you.</p> <p>According to me, recommendation engines are made up of: </p> <blockquote> <ul> <li>Context Input fed from context aware systems (logging all your data)</li> <li>Logical reasoning to filter the most obvious</li> <li>Expert systems that improve your subjective data over the...
7,778