instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Firebug is the most convenient tool I've found for editing CSS - so why isn't there a simple "save" option for CSS?</p> <p>I am always finding myself making tweaks in Firebug, then going back to my original .css file and replicating the tweaks.</p> <p>Has anyone come up with a better solution?</p> <p><b>EDIT:</b>...
<p>Been wondering the same for quite some time now,<br> just gut-wrenching when your in-the-moment-freestyle-css'ing with firebug gets blown to bits by<br> an accidental reload or whatnot....</p> <p>For my intents and purposes, I've finally found the tool.... : <b>FireDiff</b>. </p> <p>It gives you a new tab, probab...
<p>Actually Firebug is a debug and analyze-Tool: not an editor and obviously not considered to be one. The other reason was already mentioned: how to you want to change CSS, stored on a server when debugging a webpage?</p>
19,666
<p>Today I found out that putting strings in a resource file will cause them to be treated as literals, i.e putting "Text for first line \n Text for second line" will cause the escape character itself to become escaped, and so what's stored is "Text for first line \n Text for second line" - and then these come out in t...
<p>Since <code>\n</code> is actually a single character, you cannot acheive this by simply replacing the backslashes in the string. You will need to replace each pair of <code>\</code> and the following character with the escaped character, like:</p> <pre><code>s.Replace("\\n", "\n"); s.Replace("\\t", "\t"); etc </cod...
<p>I'm actually going with John's solution and editing the XML directly as that's the better solution for the project, but codelogic answered the question that was driving me insane.</p>
46,657
<p>I have a Hashtable&lt;Integer, Sport> called sportMap and a list of sportIds (List&lt;Integer> sportIds) from my backing bean. The Sport object has a List&lt;String> equipmentList. Can I do the following using the unified EL to get the list of equipment for each sport?</p> <pre><code>&lt;h:dataTable value="#{bean...
<p>@<a href="https://stackoverflow.com/questions/136696/can-i-use-a-hashtable-in-a-unified-el-expression-on-a-cforeach-tag-using-jsf-12#137188">keith30xi.myopenid.com</a></p> <p><strong>Not TRUE in JSF 1.2</strong>. According to the <a href="http://wiki.java.net/bin/view/Projects/JavaServerFacesSpecFaq#12coreTags" re...
<p>Two issues: </p> <ol> <li>A dataTable can only have the following children: header facet, footer facet, column. Anything else is not going to be evaluated correctly. </li> <li>JSTL tags cannot be interweaved with JSF components. The JSTL tags are evaluated when the component tree is created. JSF components are ...
16,540
<p>I find that most of microsoft's new programs are very hard to use.</p> <p>Microsoft Office 2007 (word especially) I find to be hard to use. Microsoft IIS 7.0 is a PAIN, I never remember which icon to click on, things are just to cluttered and hard to find.</p> <p>As a programmer, we have to design according to wha...
<blockquote> <p>we have to design according to what people are used too</p> </blockquote> <p>Well that's a slight misconception. You're not wrong that people familiar with something will appreciate the interface remaining familiar, but not all change is bad. You have to weigh the power of the change up against the h...
<blockquote> <p>I find that most of microsoft's new programs are very hard to use.</p> </blockquote> <p>If you feel so, do yourself a favor and change to Mac. I did it and wont go back to windows. So much time wasted to achieve little things with Windows.</p> <p>And Apple has Style Guides for GUIs. You dont have ...
26,066
<p>In the past we had printers with poor mechanics and with primitive software algorithms, therefore we used to print inner perimeters faster than the outermost one. See for example (generic, found online):</p> <p><a href="https://i.stack.imgur.com/DJeIV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.co...
<p>Lowering speed on outer perimeter has always been mostly wrong, but possibly useful. Usually, it's a poor approximation for what you really want to do, which is lowering <em>acceleration</em> on the outer perimeter, to avoid surface quality and dimensional accuracy errors due to ringing and backlash. However, on bow...
<p>Thanks to Input Shaper, you can print faster, sometimes to the point of reaching your speed limit on the max nozzle flow speed. At that point, if all speeds are hitting that threshold without any changes in quality, you could print every part at the same maximum speed.</p>
1,843
<p>The ragged right flat file option is great for a single trailing field terminated with a CRLF, but when any number of trailing fields which are blank are suppressed and the line terminated early with CRLF, I have found no alternative in SSIS but to read a few columns in with a single "REMAINDER" column and then used...
<p>I think your proposed solution sounds reasonable. Disk space is cheap. It is perfectly acceptable to have a two-step process in which you clean the formatting before you import the data.</p>
<p>Use a script component to separated the column as the data source.</p>
33,033
<p>I have had problems with items sticking on the build plate, especially when they were big (as they didn't stick well, they corners warped -> all kind of problems).</p> <p>I also wanted to upgrade my printer (Scratch XYCore-Bowden) to have the ability to use flexible filament so first I modified my extruder motor/co...
<p>If your print is sticking too well, try printing directly onto the glass.<br> If then, your print isn't sticking well enough, try using something like a glue stick instead. Most people use a paint scraper (<a href="https://mobileimages.lowes.com/product/converted/820909/820909561316.jpg" rel="noreferrer">a small one...
<p>Technology has come to the rescue here. New printing surfaces are available that release PLA very easily. I am using the WhamBam system. A magnet is stuck to the AL bed. A flex steel sheet is placed on the magnet. The flexsteel has a PEX sheet stuck to it.</p> <p>After levelling the bed, a print is done normally....
914
<p>I'm trying to compile a Delphi 7 project that I've inherited, and I'm getting this error:</p> <blockquote> <p>[Error] WARNING. Duplicate resource(s):<br> [Error] Type 2 (BITMAP), ID EDIT:<br> [Error] File C:[path shortened]\common\CRGrid.res resource kept; file c:\common\raptree.RES resource discarded....
<p>Try firing up your resource editor (I'm pretty sure Delphi comes with one) and open the files. Check what bitmap resources are in the two, see which can be the duplicate.</p> <p>If you need to keep both resources, you need to renumber one of them.</p>
<p>You'll need to go into the components and rename one of the resources and then update the component code to use the new name. It's a pain, but that's all you can do.</p>
12,328
<p>I'm writing a construct in PHP where a parser determins which function to call dynamically, kind of like this:</p> <pre><code>// The definition of what to call $function_call_spec = array( "prototype" =&gt; "myFunction", "parameters" =&gt; array( "first_par" =&gt; "Hello", ...
<p>You should use <a href="http://php.net/call_user_func_array" rel="noreferrer"><code>call_user_func_array</code></a> which can call any function or method and takes parameteres from an array.</p> <p>Alternatively you can use <a href="http://php.net/manual/en/language.oop5.reflection.php#language.oop5.reflection.refl...
<p><code>call_user_func_array()</code> is the best choice if you don't need to enforce the contract, otherwise use <code>ReflectionFunction</code>.</p>
23,574
<p>I've been using <a href="http://www.rainlendar.net" rel="noreferrer">Rainlendar</a> for some time and I noticed that it has an option to put the window "on desktop". It's like a bottomMost window (as against topmost).</p> <p>How could I do this on a WPF app?</p> <p>Thanks</p>
<p>My answer is in terms of the Win32 API, not specific to WPF (and probably requiring P/Invoke from C#):</p> <p>Rainlendar has two options:</p> <ul> <li>"On Desktop", it becomes a child of the Explorer desktop window ("Program Manager"). You could achieve this with the <a href="http://msdn.microsoft.com/en-us/librar...
<p>The OnDesktop version that Im using:</p> <pre><code>[DllImport("user32.dll")] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); [DllImport("user32.dll", SetLastError = true)] static extern IntPtr FindWindow(string lpClassName, string lpWindowName); public static void SetOnDesktop(Window windo...
47,663
<p>I know this question has been asked before, but I ran into a problem.</p> <p>Oddly enough, when I execute this function, it includes the html of the page that the link you select to execute the function.</p> <pre><code>function exportCSV($table) { $result = mysql_query("SHOW COLUMNS FROM ".$table.""); $i =...
<p>My guess is that you've got some sort of template that generates the same HTML header and footer regardless of the page that is requested. Sometime before the exportCSV function is called, the header is generated.</p> <p>You don't show the bottom of the output, but I'll bet the footer is there too, since I suspect...
<p>You've got a control flow problem somewhere - it seems the html head part and navigation is included by default in any page, including in the one that generates the CSV. One solution would be to check for a CSV request and if that's the case, don't include the html code, another one would be to use output buffering ...
25,372
<p>In python, is there a difference between calling <code>clear()</code> and assigning <code>{}</code> to a dictionary? If yes, what is it? Example:<pre><code>d = {"stuff":"things"} d.clear() #this way d = {} #vs this way </code></pre></p>
<p>If you have another variable also referring to the same dictionary, there is a big difference:</p> <pre><code>&gt;&gt;&gt; d = {"stuff": "things"} &gt;&gt;&gt; d2 = d &gt;&gt;&gt; d = {} &gt;&gt;&gt; d2 {'stuff': 'things'} &gt;&gt;&gt; d = {"stuff": "things"} &gt;&gt;&gt; d2 = d &gt;&gt;&gt; d.clear() &gt;&gt;&gt; ...
<p>One thing not mentioned is scoping issues. Not a great example, but here's the case where I ran into the problem:</p> <pre><code>def conf_decorator(dec): """Enables behavior like this: @threaded def f(): ... or @threaded(thread=KThread) def f(): ... (assuming t...
48,315
<p>How can I cast long to HWND (C++ visual studio 8)?</p> <pre><code>Long lWindowHandler; HWND oHwnd = (HWND)lWindowHandler; </code></pre> <p>But I got the following warning:</p> <blockquote> <p>warning C4312: 'type cast' : conversion from 'LONG' to 'HWND' of greater size</p> </blockquote> <p>Thanks.</p>
<p>HWND is a handle to a window. This type is declared in WinDef.h as follows:</p> <blockquote> <p>typedef HANDLE HWND;</p> </blockquote> <p>HANDLE is handle to an object. This type is declared in WinNT.h as follows:</p> <blockquote> <p>typedef PVOID HANDLE;</p> </blockquote> <p>Finally, PVOID is a pointer to a...
<p>As long as you're sure that the LONG you have is really an HWND, then it's as simple as:</p> <pre><code>HWND hWnd = (HWND)(LONG_PTR)lParam; </code></pre>
11,584
<p>I am working on a collection MATLAB, Java, and C/C++ components that all inter-operate, but have distinctly different compilation/installation steps. We currently don't compile anything for MATLAB, use maven2 for our Java build and unit tests, and use autotools for our C/C++ build and unit tests.</p> <p>I would li...
<p>There is a keychain you can use - for code, the best bet is to check out the GenericKeychain sample application from Apple:</p> <p><a href="https://developer.apple.com/library/ios/DOCUMENTATION/Security/Conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html" rel="nofollow noreferrer">GenericKeychain sample</a...
<p>Here is one more good wrapper class from Mr.Granoff <a href="https://github.com/granoff/Lockbox" rel="nofollow">https://github.com/granoff/Lockbox</a> Thanks</p>
23,187
<p>I used to be able to right click Folders in my project and click 'refresh' to refresh the files within them, I don't see the option to do this any more, how do I fix it? The same thing has happened at work and at home.. has it always been like this and have I gone insane?</p>
<p>I still have the option. You might be able to get it back by <a href="http://blogs.msdn.com/saraford/archive/2008/01/30/did-you-know-you-can-customize-the-commands-on-the-context-menus.aspx" rel="nofollow noreferrer">customizing the context menu</a>. Refresh is under Commands > View in the Customize dialog.</p>
<p>The refresh icon is at the top of the solution explorer for me, does the job</p>
32,483
<p>In some VB6 code, I have a handler for a TreeView's Collapse event:</p> <pre><code>Private Sub MyTree_Collapse(ByVal Node as MSComCtlLib.Node) </code></pre> <p>This is called whenever a node in the tree is collapsed, whether by the user or programmatically. As it turns out, through some roundabout execution, it m...
<p>I think that like many events in VB, it can't be switched off.</p> <p>Just set a boolean flag as you've suggested.</p>
<p>I would declare the flag variable as STATIC in the Sub. This avoids making the variable global and makes it keep its value between calls.</p>
3,594
<p>We'd like to see if we can get some improved performance for analysis and reporting by moving some of our key data into Analysis Services cubes. However, I haven't been able to find much in the way of good client front ends. </p> <p>Our users have Office 2003. The move to 2007 is probably at least a year out and th...
<p>I am on a project now that is using SSAS 2008. We were able to get all of our pilot users upgraded to Office 2007 and during the pilot of this project we used Excel 2007 as the front end tool. It turned out to be a great move (for us..YMMV) and I have been very impressed with how well the data features of Excel 20...
<p>I've used <a href="http://www.dundas.com/Products/Chart/NET/OLAp/index.aspx" rel="nofollow noreferrer">Dundas' control for OLAP</a>. Very good and easy to use.</p>
43,080
<p>I have an array full of random content item ids. I need to run a mysql query (id in the array goes in the WHERE clause), using each ID that's in the array, in the order that they appear in the said array. How would I do this? </p> <p>This will be an UPDATE query, for each individual ID in the array.</p>
<p>As with nearly all "How do I do SQL from within PHP" questions - You <em>really</em> should use prepared statements. It's not that hard:</p> <pre><code>$ids = array(2, 4, 6, 8); // prepare an SQL statement with a single parameter placeholder $sql = "UPDATE MyTable SET LastUpdated = GETDATE() WHERE id = ?"; $stmt...
<p>You could do something like the following, however you need to be VERY careful that the array only contains integers otherwise you could end up with SQL injection.</p> <p>You really don't want to be doing multiple queries to get the content out if you can help it. Something like this might be what you are after.</p...
42,785
<p>I have the following code in a SQL Server 2005 trigger: </p> <pre> CREATE TRIGGER [myTrigger] ON [myTable] FOR UPDATE,DELETE AS BEGIN DECLARE @OperationType VARCHAR(6) IF EXISTS(SELECT 1 FROM INSERTED) BEGIN SET @OperationType='Update' END ELSE BEGIN SET @OperationType='Delete' END </pre> <p>My question: ...
<p>Why don't you just create two separate triggers?</p> <pre><code>CREATE TRIGGER [myUpdateTrigger] ON [myTable] FOR UPDATE AS BEGIN END CREATE TRIGGER [myDeleteTrigger] ON [myTable] FOR DELETE AS BEGIN END </code></pre>
<p>Simple answer: No, there will not be a situation in which the trigger fails to detect correctly (except when there are no changed rows).</p> <p>The trigger will be fired once for every statement, so the thing is not possible and it will work correctly, but the point is, if you really want to do different tasks for ...
46,003
<p>What would be the best way to develop a text box that remembers the last x number of entries that were put into it. This is a standalone app written with C#.</p>
<p>This is actually fairly easy, especially in terms of showing the "AutoComplete" part of it. In terms of remembering the last x number of entries, you are just going to have to decide on a particular event (or events) that you consider as an entry being completed and write that entry off to a list... an AutoComplete...
<p>I store the completion list in the registry. </p> <p>The code I use is below. It's reusable, in three steps: </p> <ol> <li>replace the namespace and classname in this code with whatever you use.</li> <li>Call the FillFormFromRegistry() on the Form's <strong>Load</strong> event, and call SaveFormToRegistry on the...
6,458
<p>This is what I have written:</p> <pre><code>if ((lstProperty[i].PropertyIdentifier as string).CompareTo("Name") == 0) </code></pre> <p>Resharper put me an error (I am new with ReSharper... I am trying it) and it suggests me :</p> <pre><code> if (((string) lstProperty[i].PropertyIdentifier).CompareTo("Name") == 0...
<p>The 'as' operator will return null if the cast cannot be executed, while a C-style cast will throw an exception if it can't cast.</p> <p>I suggest breaking this out into multiple statements:</p> <pre><code>string propertyIdentifier = lstProperty[u].PropertyIdentifier as string; if(propertyIdentifier != null &amp;&...
<p>Both examples will succeed or fail in the same circumstances, and when they succeed, the behavior will be identical.</p> <p>When they fail, the result will be slightly different: the second example fails slightly earlier (at the cast), and with a more specific exception (<code>InvalidCastException</code> vs. <code>...
32,345
<p>if you</p> <pre><code>Describe dbms_transform PROCEDURE COMPUTE_TRANSFORMATION Argument Name Type In/Out ------------------------------ ----------------------- ------ MESSAGE STANDARD IN TRANSFORMATION_SCHEMA VARCHAR2 ...
<p>The type is "&lt;ADT_1&gt;" which is defined in package <em>standard</em>.</p> <p>According to the <a href="http://www.psoug.org/reference/standard.html" rel="nofollow noreferrer">reference</a> these </p> <blockquote> <p>data types are generics, used specially within package STANDARD and some other Oracle pa...
<p>Abstract Data Type?</p> <p><a href="http://www.psoug.org/reference/dbms_transform.html" rel="nofollow noreferrer">http://www.psoug.org/reference/dbms_transform.html</a></p>
36,711
<p>Ok so before I even ask my question I want to make one thing clear. I am currently a student at NIU for Computer Science and this does relate to one of my assignments for a class there. So if anyone has a problem read no further and just go on about your business. </p> <p>Now for anyone who is willing to help heres...
<p>The problem with empty entries is in your while loop. If you get an empty string, you clean the next one, and add it without checking. Try changing: </p> <pre><code>not_s = ""; clean_entry(s, not_s); if((int)not_s.length() == 0) { input &gt;&gt; s; clean_entry(s, not_s); } mapz[not_s]++; ...
<p>A blank string is a valid instance of the string class, so there's nothing special about adding it into the map. What you could do is first check if it's empty, and only increment in that case:</p> <pre><code>if (!not_s.empty()) mapz[not_s]++; </code></pre> <p>Style-wise, there's a few things I'd change, one ...
14,186
<p>We have SQL Server 2005 running on Win2003/64, and we push it hard. We generate real time reports on several tables with a couple million records using asp.net 3.5, and they will periodically time out.</p> <p>I'd like to increase our memory from 8GB to 16GB or even 32GB to see how that helps, but I need to justify...
<p>First find out what is really the problem and that the server is properly tuned for the queries you are running. It's very sad to waste the money on RAM to find out you are I/O bound.</p> <p>After you gather data about the cause of the timeouts you should be able to convince the pencil wielders easily.</p> <p>Some...
<p>I would start by profiling and optimizing the queries as much as I could.</p> <p>I would build a testing system and run the queries using 1GB of RAM, 2GB of RAM, 4 GB of RAM and finally 8GB of RAM.</p> <p>I would calculate how the queries would behave with 16 or 32 GB of RAM (and show actual time values and percen...
32,514
<p>My company has tried to adopt the scrum methodology with mixed success. Theses are some areas where we've had issues. How do you handle these? </p> <ol> <li>Tracking requirements from Product Marketing through to product. We're trying out JIRA to track all requirements individually and assigning a release to eac...
<p>Let's see if my take adds anything (not certain by any means...)</p> <ol> <li><p>I'm not sure about the "assigning a release to each one" thing. I thought the idea was to put a "price" on each story/function point/unit of development and pick what goes into the current sprint. Everything else is backlog - you can o...
<p>If you are going to do anything in regards writing or designing code, one of the things you should always do, is write a spec, irrespective of whatever methodology you are using, wether it is Scrum, XP, Agile or SDLC. Many people who say that writing specs is so unagile and a monument to wasteful bureaucratic paper...
3,617
<p>I have a xslt stylesheet with multiple <code>xsl:import</code>s and I want to merge them all into the one xslt file.</p> <p>It is a limitation of the system we are using where it passes around the xsl stylesheet as a string object stored in memory. This is transmitted to remote machine where it performs the transfo...
<p>You can use an XSL stylesheet to merge your stylesheets. However, this is equivalent to using the xsl:include element, not xsl:import (as Azat Razetdinov has already pointed out). You can read up on the difference <a href="http://www.w3.org/TR/xslt#section-Combining-Stylesheets" rel="nofollow noreferrer">here</a>.</...
<pre><code> import multiple xsl in single xsl &lt;xsl:import href="FpML_FXOption_Trade_Template1.xsl"/&gt; &lt;xsl:apply-imports/&gt; &lt;calypso:keyword&gt; &lt;calypso:name&gt;DisplayOptionStyle&lt;/calypso:name&gt; &lt;calypso:value&gt;Vanilla&lt;/calypso:value&gt; &lt;/calypso:keyword&...
9,554
<p>I've set up multiple ssl sites on iis using Servier Bindings as per this article: <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/8d9f2a8f-cd23-448c-b2c7-f4e87b9e2d2c.mspx?mfr=true" rel="nofollow noreferrer">http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/II...
<p>If both the browser and the web server support the <a href="http://en.wikipedia.org/wiki/Server_Name_Indication" rel="noreferrer">Server Name Indication</a> extension, the web server can use it to select the correct certificate. Otherwise, you would have to use two separate IP addresses or the wildcard certificate (...
<p>Each site will need a seperate IP address.</p>
28,631
<p>I am working an a search page that allows users to search for houses for sale. Typical search criteria include price/zip code/# bedrooms/etc.</p> <p>I would like to allow the user to save this criteria in a database and email new homes daily.</p> <p>I could either:</p> <p>1) Serialize a "SavedSearch" object into ...
<p>I assume you will need to re-run the search daily in order to find new additions to the results. Maybe it is possible to make sure that you search form specifies a get method so that the search criteria is appended to the url as a query string then save the entire querystring in the database.</p> <p>So if you have ...
<p>If I can suggest, have a html page with search results (if it contains a moderate number of records). And, store the path to it alongwith search criteria in the DB</p> <p>This will avoid querying the DB.</p> <p>Edit: I am assuming records won't change as frequently. If it does, it is better to store search criteri...
35,237
<p>We're doing a complex bit of data accumulation. Our customer sends us some stuff that includes two dimensions (time and a business unit). Time is mostly year-month. The business unit dimension has just a few attributes: a name, and a few categories to which BU's can belong for reporting and analysis purposes.</p>...
<p>Only put things in the fact table if they are degenerate (causing a high-cardinality/uniqueness problems in your dimension where it takes the dimension to a 1-1 relationship to the fact table). Kimball recommends avoiding the temptation to put anything but degenerate dimensions in with the facts (unique order numbe...
<p>If the data is both directly related to the additive fact and is not something you want to be grouping/sorting/search on, then putting it in the fact table is okay.</p> <p>Be aware, though, that non-additive data in the fact table will either prevent roll-ups or will become a lossy operation.</p>
17,729
<p>I've never built a 3D printer before, but I understand dynamical systems and control theory, and I imagine a lot of the distortion/inaccuracy that happens during the FDM process (especially at high speeds) is due to position inaccuracies because of inertia. For example, a heavy print head moving fast enough might ov...
<p>Stepper motors &quot;want&quot; to keep their position as they are told to by the firmware, therefore they do whatever it's needed (accelerate and brake) to follow the orders they received.</p> <p>The question is: is the firmware telling them to move/accelerate/brake faster/harder than they can? if yes, they won't k...
<h1>Inertia is not what you think it is</h1> <p>Inertia is technically speaking something that in physics is not what you commonly understand under the term. There is no mysterious &quot;Inertia Force&quot; that slows your actions on a setup. Inertia is not what makes you overshoot a print's endpoint.</p> <p>Inertia is...
1,864
<p>I have a function that takes, amongst others, a parameter declared as <em>int privateCount</em>. When I want to call ToString() on this param, ReSharper greys it out and marks it as a redundant call. So, curious as I am, I remove the ToString(), and the code still builds!</p> <p>How can a C# compiler allow this, ...
<p>The + operator for string is overloaded to call String.Concat passing in the left and right side of the expression. Thus:</p> <pre><code>string x = "123" + 45; </code></pre> <p>Gets compiled to:</p> <pre><code>String.Concat("123", 45); </code></pre> <p>Since String.Concat takes in two objects, the right hand sid...
<p>This is a valid bad practice, as you must think twice if the variable is a string or an int. What if the variable would be called myInt?</p> <pre><code>myInt = myInt + 23; </code></pre> <p>it is more readable and understandable in this form?</p> <pre><code>myInt = mInt + "23"; </code></pre> <p>or even:</p> <pre...
10,013
<p>in Perl, when I do <code>use &lt;module name&gt; &lt;ver&gt;;</code>, the system finds the <code>.pm</code> file for the library somewhere in the <code>@INC</code> path.</p> <p>Is there a reliable way to which file was actually loaded?</p>
<p>Yes, <a href="http://perldoc.perl.org/perlvar.html#%25INC" rel="noreferrer"><code>%INC</code></a> contains the full path a module was loaded from.</p> <p>Example:</p> <pre><code>$ perl -M'Data::Dump qw(pp)' -e 'pp(\%INC)' { "Data/Dump.pm" =&gt; "/usr/share/perl5/Data/Dump.pm", "Exporter.pm" =&...
<p>You can use the instmodsh command: <a href="http://perldoc.perl.org/instmodsh.html" rel="nofollow">http://perldoc.perl.org/instmodsh.html</a>.</p>
44,389
<p>I'm attempting to deliver the same message whether its over FTP or email, but the saved file keeps coming out as different sizes. The textual content of the message is the same, but the nonprintable characters must be accounting for the different size!</p> <p>When transferring the text file over FTP (in Binary mode...
<p>During SMTP, you're supposed to end each line with CR LF. If your original email ends each line with a newline, after it's transferred, the mailers might have converted each newline to a CR LF, which would add one extra byte for each line.</p> <p>On the other hand, it might be coincidence. Have you looked to see if...
<p>Not a solution, but it would of course be a good idea to compare the two messages byte-for-byte, to determine exactly what the differences are. I agree based on what you've said that it sounds like a line-ending problem, but it would be better to be sure.</p> <p>Also, if you're really using FTP to transfer messages...
26,104
<p>Is there a general rule of thumb to follow when storing web application data to know what database backend should be used? Is the number of hits per day, number of rows of data, or other metrics that I should consider when choosing?</p> <p>My initial idea is that the order for this would look something like the fo...
<p>It's not quite that easy. The only general rule of thumb is that you should look for another solution when the current one can't keep up anymore. That could include using different software (not necessarily in any globally fixed order), hardware or architecture.</p> <p>You will probably get a lot more benefit out o...
<p>I think your list is subjective but I will play your game.</p> <p>Flat Files </p> <p>BDB </p> <p>SQLite</p> <p>MySQL</p> <p>PostgreSQL</p> <p>SQL Server </p> <p>Oracle</p> <p>Teradata</p>
9,992
<p>Suppose we have a stylesheet which pulls in metadata using the key() function. In other words we have instance documents like this:</p> <pre><code>&lt;items&gt; &lt;item type="some_type"/&gt; &lt;item type="another_type"/&gt; &lt;/items&gt; </code></pre> <p>and a table of additional data we would like to assoc...
<p>Selectors in key/keyref allow only a very restricted xpath syntax. Short, but not completely accurate: The selector must point to a subnode of the element declared.</p> <p>The full definition of the restricted syntax is <a href="http://www.w3.org/TR/xmlschema-1/#coss-identity-constraint" rel="nofollow noreferrer">-...
<p>Having thought about it a little more, I came up with the idea of having the stylesheet do that part of the validation. The schema would define the item type as a plain string, and the stylesheet would emit a message and stop processing if it couldn't look up the item type in the item-meta table.</p> <p>This solut...
14,183
<p>I am wondering what are the heuristics when creating releases of libraries to be included in other projects in relation to dependencies and if I should include them or not.</p> <p>My problem is the following:</p> <p>I have a CommonUtilities library that provides as the name implies a set of utilities that can be u...
<p>The short, easy version: </p> <blockquote> <p><strong>Every reference within one process to a given Assembly should reference the same version.</strong></p> </blockquote> <p>If you don't, you might get into deep troubles because one part of the app cannot talk to another due to version mismatch.</p> <p>Even wit...
<p>I suppose there might be some advantage with regards to keeping a bunch of localized assemblies in one (which, I am not even sure you can do)</p> <p>I would not merge libraries from other vendors - because they often have their own licensing, and updating them would require you to redistribute a new version of your...
31,161
<p>Is it possible to use Microsoft Entity Framework with Oracle database?</p>
<p>DevArt's OraDirect provider now supports entity framework. See <a href="http://devart.com/news/2008/directs475.html" rel="noreferrer">http://devart.com/news/2008/directs475.html</a></p>
<p>The answer is "mostly".</p> <p>We've hit a problem using it where the EF generates code that uses the CROSS and OUTER APPLY operators. <a href="http://msdn.microsoft.com/en-us/library/bb896273.aspx" rel="nofollow noreferrer">This link shows</a> that MS knows its a problem with SQL Server previous to 2005 however, t...
10,832
<p>I've seen a few COM controls which wrap the Gecko rendering engine (<a href="http://code.google.com/p/geckofx/" rel="noreferrer">GeckoFX</a>, as well as the control shipped by Mozilla - <a href="https://stackoverflow.com/questions/26147/is-it-possible-to-embed-gecko-or-webkit-in-a-cnet-win-form-just-like-a-webview">...
<p>There's a WebKit-Sharp component on <a href="https://github.com/mono/webkit-sharp" rel="noreferrer">Mono's GitHub Repository</a>. I can't find any web-viewable documentation on it, and I'm not even sure if it's WinForms or GTK# (can't grab the source from here to check at the moment), but it's probably your best be...
<p>try this one <a href="http://code.google.com/p/geckofx/" rel="nofollow">http://code.google.com/p/geckofx/</a> hope it ain't dupe or this one i think is better <a href="http://webkitdotnet.sourceforge.net/" rel="nofollow">http://webkitdotnet.sourceforge.net/</a></p>
17,188
<p>I am going to hosting for files that user submits. I need to grab some data from the file and then move it to some directory.</p> <p>There two points of interest for the lifetime of this file. The first is when the data is being abstracted and the second is when the file is archived so that it can be shared.</p> <...
<p>When data is being abstracted, I would choose something like : <code>filename + millisec();</code> It is unlikely that two call to millisec will be the same, and filename is more userfriendly when accessing.</p> <p>The date strategy can be convenient if you decide to remove old and unused files : you only have to g...
<p>I've used a relational database which tags ID's (int) to uuids that are the name of the files. This way it doesn't matter how they are on disk. It helps me obfuscate the files. Also, I can then use JOINs to "rename" the file arbitrarily. Also, I can use different file "names." It all depends on your app and where it...
10,601
<p>I have a client and server program (both in Obj-C) and I am transferring files between two devices using the programs.</p> <p>The transferring is working fine, but I would like to display to the user what transfer rate they are getting.</p> <p>So I know the total size of the file, and how much of the file has been...
<p>As soon as you start the download, capture the current system time and store it as the "start time". Then, all you need to do to calculate transfer speed at any point during the transfer is to look at the system time again and use it as the "current time" to calculate the total time spent so far:</p> <pre><code>tr...
<p>Keep track of the time that the transfer is taking. The transfer rate is simply bytes transferred/seconds elapsed, in other words bytes per second. You don't need the total size for this. (You can also show % completed, which is bytes transferred/total bytes*100)</p>
48,423
<p>I have a really simple WPF UserControl:</p> <pre><code>&lt;UserControl x:Class="dr.SitecoreCompare.WPF.ConnectionEntry" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="connEntry" BorderBrush="Navy" BorderThickness="1" Margin="5,0,0,5...
<p>Try Mode=TwoWay in your binding. I've seen this where the initialization sets the value and the control can not set the the value.</p> <pre><code>&lt;TextBox x:Name="txtDatabase" TabIndex="2" Text="{Binding Path=DatabaseName, Mode=TwoWay}"&gt;&lt;/TextBox&gt; </code></pre>
<p>This works in XamlPad, so I think there is something outside the code you posted that is causing the problem. Is DatabaseName readonly?</p>
33,901
<p>Is it possible to merge elements using XSLT.</p> <p>If I have the following XML</p> <pre><code>&lt;data&gt; &lt;item column="left" value="1" /&gt; &lt;item column="left" value="2" /&gt; &lt;item column="right" value="3" /&gt; &lt;item column="left" value="4" /&gt; &lt;item column="right" value="5" /&gt; &lt;item c...
<p>This transformation:</p> <pre> &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> &lt;xsl:output omit-xml-declaration="yes" indent="yes"/> &lt;xsl:template match="data"> &lt;xsl:variable name="vNumLeft" select="count(item[@column='left'])"/> &lt;data> &lt;...
<p>You would use the element and attribute tags...</p> <pre><code>&lt;xsl:element name="item"&gt; &lt;xsl:attribute name="left"&gt;&lt;xsl:value-of select="$theLeft"/&gt;&lt;/xsl:attribute&gt; &lt;xsl:attribute name="right"&gt;&lt;xsl:value-of select="$theRight"/&gt;&lt;/xsl:attribute&gt; &lt;/xsl:element&gt; ...
43,827
<p>What is a magic number?</p> <p>Why should it be avoided?</p> <p>Are there cases where it's appropriate?</p>
<p>A magic number is a direct usage of a number in the code.</p> <p>For example, if you have (in Java):</p> <pre class="lang-java prettyprint-override"><code>public class Foo { public void setPassword(String password) { // don't do this if (password.length() &gt; 7) { throw new I...
<p>What about return variables?</p> <p>I specially find it challenging when implementing <strong>stored procedures</strong>.</p> <p>Imagine the next stored procedure (wrong syntax, I know, just to show an example):</p> <pre><code>int procGetIdCompanyByName(string companyName); </code></pre> <p>It return the Id of t...
7,019
<p>I want to host a test app in ASP.NET 3.5 but I can't find a decent free host anywhere!</p> <p>I tried <a href="http://www.aspspider.com/" rel="nofollow noreferrer">http://www.aspspider.com/</a> and after some days I still have a pending virtual directory creation.</p> <p>Even if it has lots of banners with pub on...
<p>If you just want to try out something, there's always <a href="http://www.lullabot.com/articles/use-dynamic-dns-host-website-your-laptop" rel="nofollow noreferrer">the dynamic dns way</a>.</p> <p>And some dynamic dns providers: <a href="http://www.dyndns.com/" rel="nofollow noreferrer">dyndns</a> and <a href="http:...
<p>what is the nature of your application? I might have some space for you on my server.</p>
36,571
<p>Unfortunately on my project, we generate a lot of the HTML code in JavaScript like this:</p> <pre><code>var html = new StringBuffer(); html.append("&lt;td class=\"gr-my-deals\"&gt;&lt;a href=\"").append(deal.url).append("\" target=\"_blank\"&gt;").append(deal.description).append("&lt;/a&gt;&lt;/td&gt;"); </code></p...
<p>Here is a stringFormat function that helps eliminate concatenation and ugly replacment values. </p> <pre><code>function stringFormat( str ) { for( i = 0; i &lt; arguments.length; i++ ) { var r = new RegExp( '\\{' + ( i ) + '\\}','gm' ); str = str.replace( r, arguments[ i + 1 ] ); } ...
<p>There is a good reason why you should be using the StringBuffer() instead of string concatenation in JavaScript. The StringBuffer() and its append() method use Array and Array's join() to bring the string together. If you have a significant number of partial strings you want to join, this is known to be a faster met...
30,722
<p>I just got <a href="http://smile.amazon.com/Stronghero3D-Printing-Filaments-Accuracy-0-05mm/dp/B07HDZ9K22/" rel="noreferrer">my first spool of PETG</a> and tried to calibrate an Ultimaker Cura profile for it on my Ender 3 today with limited success. </p> <p>I've had severe issues with the filament not sticking to t...
<p>I have printed kilometers of PETG and found the sweet-spot for my brand to be 240 &deg;C for the hotend and 70 &deg;C for the build plate (for my Ultimaker 3 that is, the extruder temp is 5 &deg;C higher for my home build HyperCube Evolution). The reason for the 70 &deg;C is that the glass temperature of PETG is aro...
<p>Thanks to the magic of r/3Dprinting, I have a solution. <a href="https://www.reddit.com/r/3Dprinting/comments/9ltni1/petg_filament_doesnt_stick_reliably_to_ender_3/e79nq20" rel="nofollow noreferrer">u/Lhelge helped me out with a tip</a>:</p> <blockquote> <p>I would suggest a higher bed temperature. I print PETG a...
1,056
<p>Is it common practice to keep project files (i.e. files other that source code files) in the version control repository?</p> <p>Also, are these files checked in/out on a regular basis?</p> <p>I always envisioned a SCC repository as 'clean' with only source code files.</p> <p>How do you manage the non-source code ...
<p>I think the general rule of thumb is that the minimal amount of data required to make the project compile and run should be included. That includes art (or other basic data files) and any build scripts. In the case of an autotools project, this usually means a configure.ac. In a Visual Studio project, it means th...
<p>Typically anything that is rebuilt as part of the build is not checked into the respository. Otherwise there will be merge conflicts when the generated files are committed, especially if they are binaries or contain absolute paths.</p> <p>As Sydius mentioned, most SCM tools have a way to flag non-source files as b...
45,168
<p>We've all read the benchmarks and know the facts - event-based asynchronous network servers are faster than their threaded counterparts. Think lighttpd or Zeus vs. Apache or IIS. Why is that?</p>
<p>I think event based vs thread based is not the question - it is a nonblocking Multiplexed I/O, Selectable sockets, solution vs thread pool solution.</p> <p>In the first case you are handling all input that comes in regardless of what is using it- so there is no blocking on the reads- a single 'listener'. The singl...
<p>It isn't about the threads really. It is about the way the threads are used to service requests. For something like lighttpd you have a single thread that services multiple connections via events. For older versions of apache you had a process per connection and the process woke up on incoming data so you ended up w...
36,973
<p>Are the threadlocals variables global to all the requests made to the servlet that owns the variables?</p> <p>I am using resin for the server.</p> <p>Thanks for awnser.</p> <p>I think I can make my self more clear.</p> <p><strong>The specific Case:</strong> </p> <p>I want to:</p> <ul> <li>initialize a static ...
<p>I think they are global to all requests made with that specific thread only. Other threads get other copies of the <em>thread-local</em> data. This is the key point of thread-local storage: <a href="http://en.wikipedia.org/wiki/Thread-local_storage#Java" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Thread-...
<p>Threadlocal variables are always defined to be accessed globally, since the point is to transparently pass information around a system that can be accessed anywhere. The value of the variable is bound to the thread on which it is set, so even though the variable is global, it can have different values depending on ...
41,646
<p>For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior?</p> <p>some more info:</p> <p>a. It is possible to explicitely create a misaligned integer (*bar):</p> <blockquote> <p>char foo[5...
<p>As others have mentioned, this isn't part of the standard and is left up to the compiler to implement as it sees fit for the processor in question. For example, VC could easily implement different alignment requirements for an ARM processor than it does for x86 processors.</p> <p>Microsoft VC implements what is ba...
<p>Yes, all types are always aligned to at least their alignment requirements.</p> <p>How could it be otherwise?</p> <p>But note that the sizeof() a type is not the same as it's alignment.</p> <p>You can use the following macro to determine the alignment requirements of a type:</p> <pre><code>#define ALIGNMENT_OF( ...
11,909
<p>When I am trying to print something on my home made 3D printer, I can print the first and second layer, then the Bowden extruder's gear starts slipping; it cannot push the filament anymore,the gear is turning but slipping; the filament cannot go forward.</p> <p>I tried all configurations of the tightening screw of ...
<p>The PLA isn't advancing as fast as the gcode requires. Since you've already tried higher temperatures, try printing at half the speed (F value). If that works, try 3/4 of the original F value, etc., until you find the best feed rate at this temperature for your material, printer, and model.</p>
<p>I had such effects and fixed it by reducing the flow. It might be that your filament is thicker than it should be. Therefore too much filament ends up in the nozzle. Once the molten filament accumulates enough to rise to the cold end of the hot end it solidifies and nothing moves anymore -> clicking.</p> <p>So eith...
1,390
<p>I'm writing an application which reads large arrays of floats and performs some simple operations with them. I'm using floats, because I thought it'd be faster than doubles, but after doing some research I've found that there's some confusion about this topic. Can anyone elaborate on this?</p>
<p>The short answer is, "use whichever precision is required for acceptable results."</p> <p>Your one guarantee is that operations performed on floating point data are done in at least the highest precision member of the expression. So multiplying two <strong>float</strong>'s is done with at least the precision of <st...
<p>This indicates that floats are slightly faster than doubles: <a href="http://www.herongyang.com/cs_b/performance.html" rel="nofollow noreferrer">http://www.herongyang.com/cs_b/performance.html</a></p> <p>In general, any time you do a comparison on performance, you should take into account any special cases, like do...
19,221
<p>Consider the following example. It consists of two header files, declaring two different namespaces:</p> <pre><code>// a1.h #pragma once #include "a2.h" namespace a1 { const int x = 10; typedef a2::C B; } </code></pre> <p>and the second one is</p> <pre><code>// a2.h #pragma once #include "a1.h" nam...
<p>You need to use a forward declaration in your header files because you have a circular reference. Something like this:</p> <pre><code>// a1.h #pragma once namespace a2 { class C; } namespace a1 { const int x = 10; typedef a2::C B; } </code></pre>
<p>When you include a1.h first, it immediately tries to include a2.h before declaring anything</p> <p>a2.h references something in namespace a1 that hasn't been declared yet</p> <p>When you include a2.h first, it immediately tries to include a1.h before declaring anything</p> <p>a1.h references something in namespac...
49,631
<p>I know there's some <code>JAVA_OPTS</code> to set to remotely debug a Java program.</p> <p>What are they and what do they mean ?</p>
<p>I have <a href="http://www.eclipsezone.com/eclipse/forums/t53459.html" rel="noreferrer">this article</a> bookmarked on setting this up for Java 5 and below.</p> <p>Basically <a href="http://download.oracle.com/otn_hosted_doc/jdeveloper/904preview/jdk14doc/docs/tooldocs/windows/jdb.html" rel="noreferrer">run it with<...
<p>If you are using java 9 or higher, to remotely debug (which is also the case when you use docker at local) you have to provide <code>--debug *:($port)</code>. Because from java 9 <code>--debug ($port)</code> will only allow to debug <em><strong>at local, not remotely</strong></em>.</p> <p>So, you can provide command...
16,772
<p>I am working on a stored procedure with several optional parameters. Some of these parameters are single values and it's easy enough to use a WHERE clause like:</p> <pre><code>WHERE (@parameter IS NULL OR column = @parameter) </code></pre> <p>However, in some instances, the WHERE condition is more complicated:</p...
<p>I would create separate queries for the parameter being available or not.</p> <p>This will create simpler SQL, and the optimizer will do a better job.</p> <p>Like this:</p> <pre><code>if (@parameter IS NULL) then begin select * from foo end else begin select * from foo where value = @parameter end </code></...
<p>IMHO, the parameter sniffing issue can be solved by copying all parameters into variables; then avoid using the parameters directly at all cost, use the variables instead. Example:</p> <pre><code> create proc ManyParams ( @pcol1 int, @pcol2 int, @pcol3 int ) as declare @col1 int, @col2 int, ...
28,422
<p>After I call <code>getpwuid(uid)</code>, I have a reference to a pointer. Should I free that pointer when I don't use it anymore? Reading the man pages, it says that it makes reference to some static area, that may be overwritten by subsequent calls to the same functions, so I'm not sure if I should touch that memor...
<p>No. You do not need to free the result. You can only call free(3) on pointers allocated on the heap with malloc(3), calloc(3) or realloc(3).</p> <p>Static data is part of a program's data or bss segments and will persist until the process exits (or is overwritten by exec(2)).</p>
<p>Actually it returns a pointer to an already existing structure, so you should <strong>not</strong> free it.</p>
19,383
<p>I've come up with:</p> <pre><code>re.findall("([a-fA-F\d]*)", data) </code></pre> <p>but it's not very fool proof, is there a better way to grab all MD5-hash codes?</p>
<p>Well, since md5 is just a string of 32 hex digits, about all you could add to your expression is a check for "32 digits", perhaps something like this?</p> <pre><code>re.findall(r"([a-fA-F\d]{32})", data) </code></pre>
<p>How about "([a-fA-F\d]{32})" which requires it to be 32 characters long?</p>
48,800
<p>I have around 20 or so active blogs that get quite a bit of spam. As I hate CAPCHA the alternative is very smart spam filtering. I want to build a simple REST api like spam checking service which I would use in all my blogs. That way I can consolidate IP blocks and offload spam detection to 3rd party such as <a hr...
<p>My first question - <strong>why don't you just use one of those three services you listed?</strong> It seems they do exactly what you want. Sorry for being cynical, but I doubt that you working alone could in a reasonable amount of time beat the software engineers designing the algorithms used at those websites, esp...
<p>I humbly recommend <a href="http://www.lua.org" rel="nofollow noreferrer">Lua</a>, not only because it's a great, fast language, already integrated with web servers, but also because you can then exploit <a href="http://osbf-lua.luaforge.net/" rel="nofollow noreferrer">OSBF-Lua</a>, an existing spam filter that has ...
42,295
<p>What is the difference between <code>atan</code> and <code>atan2</code> in C++?</p>
<p>From school mathematics we know that the tangent has the definition</p> <pre><code>tan(α) = sin(α) / cos(α) </code></pre> <p>and we differentiate between four quadrants based on the angle that we supply to the functions. The sign of the <code>sin</code>, <code>cos</code> and <code>tan</code> have the following rel...
<p><code>atan2(y,x)</code> is generally used if you want to convert cartesian coordinates to polar coordinates. It will give you the angle, while <code>sqrt(x*x+y*y)</code> or, if available, <code>hypot(y,x)</code> will give you the size.</p> <p><code>atan(x)</code> is simply the inverse of tan. In the annoying case y...
35,922
<p>I read through the Wikipedia article <em><a href="https://en.wikipedia.org/wiki/Type_system#Existential_types" rel="noreferrer">Existential types</a></em>. I gathered that they're called existential types because of the existential operator (∃). I'm not sure what the point of it is, though. What's the difference bet...
<p>When someone defines a universal type <code>∀X</code> they're saying: <em>You can plug in whatever type you want, I don't need to know anything about the type to do my job, I'll only refer to it opaquely as <code>X</code></em>.</p> <p>When someone defines an existential type <code>∃X</code> they're saying: <em>I'll ...
<p>As I understand it's a math way to describe interfaces/abstract class.</p> <p>As for T = ∃X { X a; int f(X); }</p> <p>For C# it would translate to a generic abstract type:</p> <pre><code>abstract class MyType&lt;T&gt;{ private T a; public abstract int f(T x); } </code></pre> <p>"Existential" just means ...
37,292
<p>I am looking into building an <strong>authentication</strong> in my ASP.NET application with the following requirements.</p> <ul> <li>A user has exactly one Role (i.e. Admin, SalesManager, Sales, ....)</li> <li>A role has a set of permissions to CRUD access a subset of existing objects. I.e. "Sales has CREAD, READ,...
<p>I think what you need to do here is implement a set of permissions query methods in either your business objects or your controller. Examples: CanRead(), CanEdit(), CanDelete()</p> <p>When the page renders, it needs to query the business object and determine the users authorized capabilities and enable or disable f...
<p>I would build the user/role relationship so users can have more than 1 role. I see a 1-1 relationship and I get nervous because I know that even if we don't see a need for it now, someone is someday going to want someone to be both a Sales user and a Customer Service user.</p> <p>In our customer system, we use rol...
49,841
<p>I have a class that inherits from a base class and implements the following...</p> <pre><code> Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo </code></pre> <p>Now the base class it inherits from also implements this System.IComparable.CompareTo so I'm getting t...
<p>Only use 'Implements' in the base class:</p> <p>Signature in the base class: </p> <pre><code>Public Overridable Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo </code></pre> <p>Signature in the inherited class:</p> <pre><code>Public Overrides Function CompareTo(ByVal ob...
<p>On the properties of your project, go to the build tab and use the suppress warnings textbox.</p>
34,394
<p>I have a flash movie with a dynamic text that supposedly is Arial, and in my windows machine it displays as Arial. But when I tried it in a Mac, it shows as something like Times New Roman.</p> <p>I tried every property available and can't seem to get it to show as Arial on the Mac.</p> <p>I found another movie I h...
<p>When you use a dynamic text field, you have two options - either you embed (part of) the font into your SWF, or you use device fonts. If you embed, then the actual character shapes will be built into your SWF; if you don't, then you're including only the font's <em>name</em> - and if the OS doesn't have any fonts of...
<p>Use Arial/Helvetica FontFamily</p>
12,215
<p>If I had the following select, and did not know the value to use to select an item in advance like in this <a href="https://stackoverflow.com/questions/196684/jquery-get-select-option-text">question</a> or the index of the item I wanted selected, how could I select one of the options with jQuery if I did know the te...
<pre><code>var option; $('#list option').each(function() { if($(this).text() == 'Option C') { option = this; return false; } }); </code></pre>
<pre><code>function SelectItemInDropDownList(itemToFind){ var option; $('#list option').each(function(){ if($(this).text() == itemToFind) { option = this; option.selected = true; return false; } }); } <...
29,923
<p>I am looking for a more technical explanation than the OS calls the function.</p> <p>Is there a website or book?</p>
<p>The .exe file (or equivalent on other platforms) contains an 'entry point' address. To a first approximation, the OS loads the relevant sections of the .EXE file into RAM, and then jumps to the entry point.</p> <p>As others have said, this entry point will not be 'main', but will instead be a part of the runtime li...
<p><a href="http://books.google.com/books?id=wZoQyVi5f60C&amp;printsec=frontcover&amp;dq=expert+c%2B%2B%2Fcli&amp;ei=MKylSPz2JJOaigHlkLn7BA&amp;sig=ACfU3U36tvex7dO7wVyGtuy1arcJuU3N0g" rel="nofollow noreferrer">Expert C++/CLI</a> (check around page 279) has very specific details of the different bootstrap scenarios for ...
3,339
<p>My web page sits in a DIV that is 960px wide, I center this DIV in the middle of the page by using the code: </p> <pre><code>html,body{background: url(images/INF_pageBg.gif) center top repeat-y #777777;text-align:center;} #container{background-color:#ffffff;width:960px;text-align:left;margin:0 auto 0 auto;} </co...
<p>Yeah, it's known issue. Unfortunately you only can fix div and image width, or use script to dynamically change stye.backgroundPosition property. Another trick is to put expression to the CSS class definition.</p>
<p>I had the same problem. </p> <p>To get the <em>background centered</em>, you need to have a <strong>background-image wider than the viewport</strong>. Try to use a background <strong>2500px</strong> wide. It will force the browser to center the part of image that is viewable.</p> <p>Let me know if it works for you...
13,833
<p>If I'm adding a column via MySQL, I can specify where in the table that column will be using the AFTER modifier. But if I do the add_column via a Rails migration, the column will be created at the end of the table.</p> <p>Is there any functionality for rails migrations to specify the position of an added column?</p...
<p>This is now possible in Rails 2.3.6+ by passing the :after parameter</p> <p><a href="https://rails.lighthouseapp.com/projects/8994/tickets/3286-patch-add-support-for-mysql-column-positioning-to-migrations" rel="noreferrer">https://rails.lighthouseapp.com/projects/8994/tickets/3286-patch-add-support-for-mysql-column...
<p>There is no way within Rails to specify the position of a column. In fact, I think it's only coincidental (and therefore not to be relied on) that columns are created in the order they are named in a migration.</p> <p>The order of columns within a table is almost relevant and should be so: the common "reason" given...
48,596
<p>Is it possible to do like this:</p> <pre><code>interface IDBBase { DataTable getDataTableSql(DataTable curTable,IDbCommand cmd); ... } class DBBase : IDBBase { public DataTable getDataTableSql(DataTable curTable, SqlCommand cmd) { ... } } </code></pre> <p>I want to use the interface t...
<p>No it's not possible. Method should have same signature that one declared in the interface.</p> <p>However you can use type parameter constraints:</p> <pre><code>interface IDBClass&lt;T&gt; where T:IDbCommand { void Test(T cmd); } class DBClass:IDBClass&lt;SqlCommand&gt; { public void Test(SqlCommand cmd)...
<p>Try compiling it. The compiler will report an error if <code>DBBase</code> doesn't implement <code>IDBBase</code>.</p>
12,582
<p>I know that there at least two approaches to leverage the web.config file:</p> <ul> <li>using the <code>configSource</code> attribute which was introduced in .NET 2.0 - <a href="http://blog.andreloker.de/post/2008/06/Keep-your-config-clean-with-external-config-files.aspx" rel="nofollow noreferrer">here is a good bl...
<p>I have the same scenario and after reading you post I realised that asp.net won't let you do this for various security reasons. </p> <p>Therefore I turned to the OS to find an equivalent to the Linux soft link function which in turn led me to the <a href="http://technet.microsoft.com/en-gb/sysinternals/bb896768.asp...
<p>Virtual Directories can be set as applications, and you can just place another web.config there.</p> <p>It will inherit any changes from the parent config, and you can add custom settings in it.</p>
34,645
<p>Since I've started to use jQuery, I have been doing a lot more JavaScript development.</p> <p>I have the need to parse different date formats and then to display them into another format.</p> <p>Do you know of any good tool to do this?</p> <p>Which one would you recommend?</p>
<p>2014 update: <a href="http://momentjs.com/" rel="nofollow noreferrer">Moment.js</a> is an excellent date manipulation library, which includes parsing functions. It doesn't include automatic date format detection, but you can <a href="http://momentjs.com/docs/#/parsing/string-formats/" rel="nofollow noreferrer">speci...
<p>Just another option (which I wrote - full disclosure):</p> <p><a href="http://depressedpress.com/javascript-extensions/dp_dateextensions/" rel="nofollow noreferrer">DP_DateExtensions Library</a></p> <p>Supports date/time formatting, date math (add/subtract date parts), date compare, date parsing, etc. It's liberal...
25,339
<p>Is user-friendliness an important aspect of the quality of software? For example most of the Microsoft products are quite user friendly, but does that necessarily imply that their quality is superior too.</p>
<p>Quality is the measure of completeness of the requirements or the completeness of features in a product scenario.</p> <p>User-friendliness is one of the features, right? So yes, it's part of the quality. So, one can say the Quality of User-friendliness of MS Excel is great but the quality of its memory management i...
<p>User-friendlyness is definitely an important aspect of software quality, but it is often more elusive than maintaining stability (i.e. absence of software errors). A program can have a hideous and unusable user-interface but be perfectly stable. Such a program would grade very high on the quality scale, IMO.</p>
35,419
<p>I was wondering if it's possible to calculate the average of some numbers if I have this:</p> <pre><code>int currentCount = 12; float currentScore = 6.1123 (this is a range of 1 &lt;-&gt; 10). </code></pre> <p>Now, if I receive another score (let's say 4.5), can I recalculate the average so it would be something...
<p>The following formulas allow you to track averages just from stored average and count, as you requested.</p> <pre><code>currentScore = (currentScore * currentCount + newValue) / (currentCount + 1) currentCount = currentCount + 1 </code></pre> <p>This relies on the fact that your average is currently your sum divid...
<p>float currentScore now equals (currentScore * (currentCount-1) + 4.5)/currentCount ?</p>
44,225
<p>I have heard mention of Objective-C but I have never used it myself. I was curious what everyones opinion of it was in general and also in relation to C++. Are there any types of projects where it would be more useful or less useful?</p>
<p>Like many others I've just started looking at Obj-C due to iPhone. I've done a lot of C++ and C# and from what I can see Obj-C has a basically different approach to OO in that it adds Smalltalk-like messaging to C. Like C++ it's basically still C-compatible but the OO extensions let you send any message to any objec...
<p>For Mac and iPhone development, it is definitely better. The latest version has a GC, so if you like that, you'll probably like it better than C++.</p>
13,774
<p>I have used the Entity Framework to start a fairly simple sample project. In the project, I have created a new Entity Data Model from a SQL Server 2000 database. I am able to query the data using LINQ to Entities and display values on the screen.</p> <p>I have an Oracle database with an extremely similar schema (I ...
<p>What is generally understood under the term "Persistence Ignorance" is that your entity classes are not being flooded with framework dependencies (important for N-tier scenarios). This is not the case right now, as entity classes must implement certain EF interfaces ("IPOCO"), as opposed to plain old CLR objects. As...
<p><a href="http://blogs.msdn.com/jkowalski/archive/2008/09/09/persistence-ignorance-poco-adapter-for-entity-framework-v1.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/jkowalski/archive/2008/09/09/persistence-ignorance-poco-adapter-for-entity-framework-v1.aspx</a></p> <p>The main problem is that the entity fra...
10,161
<p>What is the best method of hiding php errors from being displayed on the browser?</p> <p>Would it be to use the following:</p> <pre><code>ini_set("display_errors", 1); </code></pre> <p>Any best practice tips would be appreciated as well!</p> <p>I am logging the errors, I just want to make sure that setting the d...
<p>The best way is to log your errors instead of displaying or ignoring them.</p> <p>This example will log the errors to syslog instead of displaying them in the browser.</p> <pre><code>ini_set("display_errors", 0); ini_set("log_errors", 1); //Define where do you want the log to go, syslog or a file of your liking w...
<p>The best way? Fix the errors!</p> <p>If you need a quick temporary solution then it's OK to turn display_errors off, but make sure you're logging them somewhere, because that setting will make serious/parse errors silent otherwise.</p>
43,032
<p>Is there a security limit to the number of Ajax <a href="http://en.wikipedia.org/wiki/XMLHttpRequest" rel="nofollow noreferrer">XMLHttpRequest</a> objects you can create on a single page? If so, does this vary from one browser to another?</p>
<p>I don't think so, but there's a limit of two simultaneous HTTP connections per domain per client (you can override this in Firefox, but practically no one does so).</p>
<p>Yes, as Kevin says, HTTP/1.1 specifications say "A single-user client should not maintain more than 2 connections with any server or proxy."</p>
7,783
<p>How can i restrict adding controls in Panel in C# window controls? I have to restrict user to add controls in a panel at design time.</p>
<p>If you want to limit the types of controls or number of controls one can add to the panel you can make your own subclass of the panel and check the Control type or Control count in an overload of the Controls.Add method. </p> <p>Edit: Overloading the Controls.Add method was not as easy as I thought, but you can mak...
<p>Set AllowDrop to false.</p>
31,077
<p>I am only one person working on project - so I am developer without PM above me. I finished portal, hovewer client from time to time attacks me with request such as "make font bigger" or change margin in css or make button which makes "xxx and yyy". There are simple task, sometimes only for few clicks, but it takes...
<p>Create an established queue where your users can submit requests, in a manner that doesn't disrupt your day-to-day workflow.</p> <p>From the sounds of this you are getting requests via a communication channel that you check regularly, you might try to move it off to the side.</p> <p>Cutting off communication is NE...
<p>Although not a technical "bug", usability by the client is the most important bug to the user. If you want to continue business with the client, the small things need to be worked.</p> <p>fixing small bugs == client happiness == more work == more $$</p>
31,611
<p>An OleDB provider is a binary implementing COM interfaces provided by Microsoft. From that it seems to be possible to create a provider using C#. Is that correct? Is there a sample demonstrating that? If not, would you discourage me from doing that? I see that there are multiple unmanaged samples but I can't find an...
<p>The article is good, but doesn't actually answer the question. OLEDB is a set of COM interfaces that could in fact be implemented in .Net via COM Interop though I've never heard of such an implementation and probably isn't advisable.</p> <p>The set of OLEDB interfaces are documented by Microsoft <a href="http://msd...
<p>I am not sure I really understand your question?! There already <em>is</em> a managed OleDBProvider?!</p> <pre><code>using System.Data.OleDb; </code></pre> <p>I would certainly discourage writing a provider that exists and works absolutely fine! :)</p> <p>But in answer to your first question, you can of course cr...
7,683
<p>On a site where 90% of the pages use the same libraries, should you just load the libraries all the time or only load them when needed? The other pages would be ajax or simple pages that don't have any real functionality.</p> <p>Also, should you only load the code when needed? If part way down a page you need a lib...
<p>I would always try to give a file, class, and method a <a href="http://en.wikipedia.org/wiki/Single_responsibility_principle" rel="noreferrer" title="Single responsibility principle - Wikipedia, the free encyclopedia">single responsibility</a>. Because of that, separating the displaying from the editing code could b...
<p>Bear in mind that each script that is loaded gets parsed as PHP is compiled at run-time, so there is a penalty for loading unneeded scripts. This might be minor depending on your application structure and requirements, but there are cases which this is not the case. </p> <p>There are two things you can do to negate...
37,444
<p>Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance.</p> <p>e.g.</p> <pre><code>public DerivedClass : BaseClass {} </code></pre> <p>Now I want to develop a method C in DerivedClass that uses A and B. Is there a way I can override methods A and B to be private in De...
<p><strong>It's not possible, why?</strong></p> <p>In C#, it is forced upon you that if you inherit public methods, you must make them public. Otherwise they expect you not to derive from the class in the first place.</p> <p>Instead of using the is-a relationship, you would have to use the has-a relationship. </p> ...
<p>If they're defined public in the original class, you cannot override them to be private in your derived class. However, you could make the public method throw an exception and implement your own private function.</p> <p>Edit: Jorge Ferreira is correct.</p>
13,186
<p>There is small system, where a database table as queue on MSSQL 2005. Several applications are writing to this table, and one application is reading and processing in a FIFO manner.</p> <p>I have to make it a little bit more advanced to be able to create a distributed system, where several processing application ca...
<p>This will work, but you'll probably find you'll run into blocking or deadlocks where multiple processes try and read/update the same data. I wrote a procedure to do exactly this for one of our systems which uses some interesting locking semantics to ensure this type of thing runs with no blocking or deadlocks, <a hr...
<p>This approach looks reasonable to me, and is similar to one I have used in the past - successfully.</p> <p>Also, the row/ table will only be locked while the update and select operations take place, so I doubt the row vs table question is really a major consideration.</p> <p>Unless the processing overhead of your ...
31,031
<p>I am writing in C#.<br> How can i find out which methods/functions I can use in an unmanaged dll that doesn't belong to windows?<br> Exmaple : I have some installed software on my computer, it has a dll, and i want to know what my options are as to creating code to connect to that software?</p>
<p>For native DLL's that you do not have a reference for you can use the dumpbin utility in the Visual Studio SDK to extract the list of exported functions in a DLL.</p> <p>Dumpbin reference is here: <a href="http://msdn.microsoft.com/en-us/library/c1h23y6c(VS.71).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us...
<p>I read a blog about PInvoke Interop Assistant, which can deal with our own DLLs as well <a href="http://www.codeplex.com/clrinterop/Release/ProjectReleases.aspx?ReleaseId=14120" rel="nofollow noreferrer">http://www.codeplex.com/clrinterop/Release/ProjectReleases.aspx?ReleaseId=14120</a></p>
23,347
<p>I need to get all the dates present in the date range using SQL Server 2005</p>
<p>Here you go:</p> <pre><code>DECLARE @DateFrom smalldatetime, @DateTo smalldatetime; SET @DateFrom='20000101'; SET @DateTo='20081231'; ------------------------------- WITH T(date) AS ( SELECT @DateFrom UNION ALL SELECT DateAdd(day,1,T.date) FROM T WHERE T.date &lt; @DateTo ) SELECT date FROM T OPTION (MAXRECURSION...
<p>To generate a range of dates you could write a table-valued function. This is a function that creates a date dimension for a data warehouse - you could probably adapt it fairly readily by trimming out the specials.</p> <p>Edit: Here it is without the date dimension hierarchy.</p> <pre><code>if object_id ('ods.uf_...
34,159
<p>I'm building a Kossel Mini, and I'm stuck on the extruder motor holder.</p> <p>My Kossel came without instructions, I was given a set of instructions by a friend (the "Kossel Build Guide" by Blomker industries). I also found some instructions on the net. However, my components are different from those in the build...
<p>Have a look at the image provided in this seller's part description. it probably says more than my words could (which would also only rely on images - your parts just looked like I saw them somewhere before). </p> <p><a href="http://de.aliexpress.com/item/3D-printer-parts-right-hand-bowden-Extruder-kit-set-no-motor...
<p>The extruder is an MK8 derivative, <em>I think</em>.</p> <p>After a <em>lot</em> of searching, the closest that I could find (with an assembly diagram) is this product which has more or less the same parts as yours (apart from the small black bolt and sleeve - used as the axis - which you don't have): <a href="http...
220
<p>How do I pick/ delete all the documents from Solr using the boolean NOT notion?</p> <p>i.e. How do I delete all the documents from Solr who's id does NOT start with A59?</p>
<p>Use <code>-</code> to indicate <code>NOT</code>.</p> <p>For example, to query documents with id not starting with A59, the query would be: <code>-id:A59*</code>, that is: <code>/solr/select/?q=-id:A59*</code></p> <p>To delete by query, post the query in a delete message to the update handler, as specified <a href...
<p>before deleting please ensure that the ids that you are referring to is string and in no way would be formed by two terms combined . The way I would do it is read the data from solr from a script and do a singular delete or in batches , because it provides a better control and validations over each ids which reduces...
34,122
<p>I've noticed in many places in Java (C# included), that many "getter" methods are prefixed with "get" while many other aren't. I never noticed any kind of pattern Sun seems to be following. What are some guidelines or rules for using "get" in getter method names?</p>
<p>It comes down to semantics. Yes, C# has "properties" which give you a get/set 'method' stub... but functions (..."methods"...) in the .NET Framework that start with "Get" is supposed to clue the developer into the fact that some operation is happening for the sole purpose of getting some results.</p> <p>You may thi...
<p>Objective C 2.0 also uses properties, using the same dot syntax.</p> <p>Prior to that, it used a slightly different naming scheme for getters and setters (which, naturally, can still be used with properties, or for plain old attributes).</p> <pre><code>value = [obj attr]; [obj setAttr:value]; [obj getAttr:&amp;v...
32,680
<p>On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php <code>error_log</code> between virtual hosts.</p> <p>Overriding this setting in the <code>&lt;Location&gt;</code> of the <code>httpd.conf</code> does not seem to do anything.</p> ...
<p>To set the <em>Apache</em> (<em>not the PHP</em>) log, the easiest way to do this would be to do:</p> <pre><code>&lt;VirtualHost IP:Port&gt; # Stuff, # More Stuff, ErrorLog /path/where/you/want/the/error.log &lt;/VirtualHost&gt; </code></pre> <p>If there is no leading "/" it is assumed to be relative.</p>...
<p>My Apache had something like this in httpd.conf. Just change the ErrorLog and CustomLog settings </p> <pre><code>&lt;VirtualHost myvhost:80&gt; ServerAdmin webmaster@dummy-host.example.com DocumentRoot /opt/web ServerName myvhost ErrorLog logs/myvhost-error_log CustomLog logs/myvhost-access_log ...
2,267
<p>I have been searching for a way to insert linebreaks in my code for when I view my source. I am not looking for <code>&lt;br /&gt;</code></p> <p>Something like the PHP equiv to <code>\n</code></p> <p>Any ideas on how to do this in ASP? I will be placing this inside a string.</p>
<p>There's no way to do it inside a string. You will have to append vbCrLf like so:</p> <pre><code>Response.Write "hello" &amp; vbCrLf &amp; "world" </code></pre> <p>If you want to include it in the string, you could do a replace after like so:</p> <pre><code>output = "hello\nworld" output = Replace(output, "\n", vb...
<p>easiest way is just print html break line with response function</p> <p>like this : <code>Response.Write "&lt;BR&gt;"</code> you can send any other HTML command as well with this method just watch for Quotation marks </p>
47,899
<p>If I have the following setting in my app.config file. It is a setting I need to make sure my WCF client can negotiate the default proxy server.</p> <pre><code>&lt;system.net&gt; &lt;defaultProxy enabled="true" useDefaultCredentials="true"&gt;&lt;/defaultProxy&gt; &lt;/system.net&gt; </code></pre> <p>Unfortun...
<p>I think what you do is create a <code>System.Net.WebProxy</code> object, then set the appropriate variables, then set the <code>System.Net.WebRequest.DefaultWebProxy</code>:</p> <pre><code>System.Net.WebProxy proxy = new WebProxy(); proxy.UseDefaultCredentials = true; WebRequest.DefaultWebProxy = proxy; </code></pr...
<p>Whatever the defined name of your executable (not a library dll) assembly is, add a ".config" at the end...</p> <p>so if your executable is to be </p> <p>AcmeWidgets.EastCoast.MyApplicationName.exe </p> <p>Then the app.config will get renamed to</p> <p>AcmeWidgets.EastCoast.MyApplicationName.exe.config</p> <...
38,387
<p>I'm pretty new to the idea of recursion and this is actually my first attempt at writing a recursive method. </p> <p>I tried to implement a recursive function Max that passes an array, along with a variable that holds the array's size in order to print the largest element. </p> <p>It works, but it just doesn't <em...
<p>Your use of static variables for holding state outside the function will be a source of difficulty.</p> <p>An example of a recursive implementation of a max() function in pseudocode might be:</p> <pre><code>function Max(data, size) { assert(size &gt; 0) if (size == 1) { return data[0] } max...
<p>First, let's take care of the static scope issue ... Your class is defining an object, but never actually instantiating one. Since main is statically scoped, the first thing to do is get an object, then execute it's methods like this:</p> <pre><code>public class RecursiveTry{ private int[] n = {1,2,4,3,3,32,1...
30,450
<p>Can you explain STA and MTA in your own words?</p> <p>Also, what are apartment threads and do they pertain only to COM? If so, why?</p>
<p>The COM threading model is called an "apartment" model, where the execution context of initialized COM objects is associated with either a single thread (Single Thread Apartment) or many threads (Multi Thread Apartment). In this model, a COM object, once initialized in an apartment, is part of that apartment for the...
<p>Side note: If you are using some PowerShell 2.0 snap-ins, you need to launch PowerShell version 3 or greater with -MTA option to use them. PowerShell 2 apartment model is MTA versus later versions use STA as default. Other point is bitness. Normal calls in apartment are not marshalled (direct calls), so if your call...
15,477
<p>When looking at a SSI printenv dump I see a variable URI_REQUEST.</p> <p>When reading the Apache mod_include docs I see DOCUMENT_URI which they define as "The (%-decoded) URL path of the document requested by the user."</p> <p>Anyone know the difference between the two?</p> <p>TIA.</p>
<p>REQUEST_URI includes the Query String (?q=testing...) where DOCUMENT_URI does not.</p>
<p>ok. seems like it is exactly the opposite according to Apache docs and RFC 2616.</p> <p>REQUEST_URI does not contain the query string. DOCUMENT_URI does contain the query string.</p> <p>cheers,</p> <p>Rob</p>
6,031
<p>I have a page which dynamically loads a section of content via AJAX. I'm concerned that this means the content will not be found by search engines.</p> <p>To show you what I mean, the site is at <a href="http://www.gold09.net" rel="nofollow noreferrer">http://www.gold09.net</a> and the dynamic content is at <a href...
<p>Make the links that point to the pages you want indexed to have a real HREF to the content - but use javascript to intercept the event and "return false;" at the end.</p>
<p>as nelson laquet said you need to provide return: false; on every anchor you have on your page without omitting their href values [as that's what's really important for screen readers like google]</p> <p>it will also be cool if you use rewrite methods that would mask this: <br> on your server side code provide par...
27,770
<p>Additionally, how can I format it as a string padded with zeros?</p>
<p>To generate the number call rand with the result of the expression "10 to the power of 10"</p> <pre><code>rand(10 ** 10) </code></pre> <p>To pad the number with zeros you can use the string format operator</p> <pre><code>'%010d' % rand(10 ** 10) </code></pre> <p>or the <code>rjust</code> method of string</p> <p...
<p>Random 10 numbers:</p> <pre><code>require 'string_pattern' puts "10:N".gen </code></pre>
5,486
<p>the <a href="https://www.thingiverse.com/thing:763622" rel="noreferrer">3D Benchy</a> is everywhere. It is one of <strong>the</strong> top test prints if you look away from a simple cube.</p> <p>But what makes the Benchy a good test print at all? It does have almost no critical dimensions that would be measurable to...
<h2>the 3D Benchy isn't a specific calibration test</h2> <p>With the Benchy you don't see if your printer is calibrated in any axis, but it is a general use-case test for a model that can show you many of the issues you might face in a normal print. For all intents and purposes, it is more a general Benchmark item than...
<p>Benchy is cute. That goes a long way in attracting attention.</p> <p>The benchy is one of the earlier STLs that was freely available to download, dating from April 2015, and was released under the Creative Commons Sharealike licence, which clearly states the requirements and limitations/requirements.</p> <p>Curious...
2,078
<p>I have seen various rules for naming stored procedures. </p> <p>Some people prefix the sproc name with usp_, others with an abbreviation for the app name, and still others with an owner name. You shouldn't use sp_ in SQL Server unless you really mean it.</p> <p>Some start the proc name with a verb (Get, Add, Save,...
<p>For my last project i used usp_[Action][Object][Process] so for example, usp_AddProduct or usp_GetProductList, usp_GetProductDetail. However now the database is at 700 procedures plus, it becomes a lot harder to find all procedures on a specific object. For example i now have to search 50 odd Add procedures for the ...
<p>I think the usp_ naming convention does nobody any good.</p> <p>In the past, I've used Get/Update/Insert/Delete prefixes for CRUD operations, but now since I use Linq to SQL or the EF to do most of my CRUD work, these are entirely gone. Since I have so few stored procs in my new applications, the naming convention...
29,467
<p>Can I ignore a folder on svn checkout? I need to ignore DOCs folder on checkout at my build server.</p> <p><strong>edit:</strong> Ignore externals isn't an option. I have some externals that I need.</p>
<p>You can't directly ignore folders on a checkout, but you can use sparse checkouts in svn 1.5. For example:</p> <pre><code>$ svn co http://subversion/project/trunk my_checkout --depth immediates </code></pre> <p>This will check files and directories from your project trunk into 'my_checkout', but not recurse into ...
<p>The best way I have seen is to check out a zero depth version and then go into the directories you need to change and update the depth.</p> <p>Checking out a zero depth folder</p> <pre><code>$ svn co svn://subversion/project/my_project_dir --depth immediates </code></pre> <p>Then going into the working folders and a...
23,432
<p>I've had my anycubic kossel for a good while now, and whenever I print something, it seems like it falls out of calibration very quickly. The biggest example is that the prints tend to scale up as the print progresses, or maybe the print starts to drift, and comes out slanted. This seems to never happen in any simil...
<p>user77232's points are valid but I have done several things to mitigate these issues on my Anycubic Deltas. </p> <p>First, both of my deltas have linear slide bearings. If your's has the bearing trucks that run in the extrusion slots this will lead to less precise operation and also is a source of wear over time. <...
<p>(The XYZ Printers are called Cartesian Printers)</p> <p>Delta printers are harder to get right, because they require precision parts. The arms have to be EXACTLY the same length, the frame must be square, the universal joints must have no slop. You should check to see if any of the universal joints need replacing, ...
1,441
<p>I have a nice and lovely Django site up and running, but have noticed that my <code>error.log</code> file was getting huge, over 150 MB after a couple of months of being live. Turns out a bunch of spambots are looking for well known URL vulnerabilities (or something) and hitting a bunch of sub-directories like <code...
<p>Um, perhaps, use <a href="http://linuxcommand.org/man_pages/logrotate8.html" rel="noreferrer">logrotate</a> to rotate and compress the logs periodically, if it isn't being done already.</p>
<p>A programming solution would be to :</p> <ul> <li>open the log file</li> <li>read the lines in a buffer</li> <li>replace the lines that match the errors the bots caused</li> <li>seek to the beginning of the file</li> <li>write the new buffer</li> <li>truncate the file to current pointer position</li> <li>close</li>...
40,711