instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>In a stored procedure, I need to get the count of the results of another stored procedure. Specifically, I need to know if it returns any results, or an empty set.</p> <p>I could create a temp table/table variable, exec the stored procedure into it, and then run a select count on that data. But I really don't care...
<p>Well, depending on how the stored procedures work, @@ROWCOUNT returns the # of results for ANYthing that SP will do (including updates): <a href="http://msdn.microsoft.com/en-us/library/ms187316.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms187316.aspx</a></p> <p>This will only work if t...
<p>If you can rewrite other procedure to be a simple function that returns a resultset, you can simply select count(*) from it.</p>
10,526
<p>Let me start with a specific example of what I'm trying to do.</p> <p>I have an array of year, month, day, hour, minute, second and millisecond components in the form <code>[ 2008, 10, 8, 00, 16, 34, 254 ]</code>. I'd like to instantiate a Date object using the following standard constructor:</p> <pre><code>new Da...
<p>I've done more investigation of my own and came up with the conclusion that <strong>this is an impossible feat</strong>, due to how the Date class is implemented.</p> <p>I've inspected the <a href="http://www.mozilla.org/js/spidermonkey/" rel="noreferrer">SpiderMonkey</a> source code to see how Date was implemented...
<p>Edited</p> <p>Sorry, I was sure I made it that way years ago, right now I'll stick to:</p> <p>var d = new Date(comps[0],comps[1],comps[2],comps[3],comps[4],comps[5],comps[6]);</p> <p>Edit:</p> <p>But do remember that a javascript Date-object uses indexes for months, so the above array means</p> <p>November 8 20...
21,888
<p>I'm working on a star schema for analysis of posted form data. The site that the form data will be posted to is actually external to the site hosting the form, so only the data in the form will be available. I'm going to give the option to include some extra useful information with hidden fields, original referrer, ...
<p>You aren't designing a star schema. You're designing an <a href="http://en.wikipedia.org/wiki/Entity-Attribute-Value_model" rel="nofollow noreferrer">Entity-Attribute-Value</a> table, which has all the problems you're identifying.</p> <p>If you really have no idea what your data will look like, i.e. what form fiel...
<p>It's ok to have fact tables with no measurements - they're just called "factless fact tables". But you still typically put a row_count column in there - even though it'll always have a value of one - to easily add summary tables. And you may end up adding other measurements later - like a measurement of the sentim...
38,169
<p>I'm creating a database, and prototyping and benchmarking first. I am using H2, an open-source, commercially free, embeddable, relational, java database. I am not currently indexing on any column.</p> <p>After the database grew to about 5GB, its batch write speed doubled (the rate of writing was slowed 2x the ori...
<p>One factor that can complicate inserts as a database grows is the number of indexes on the table, and the depth of those indexes if they are B-trees or similar. There's simply more work to do, and it may be that you're causing index nodes to split, or you may simply have moved from, say, a 5-level B-tree to a 6-lev...
<p>Another cause is whether the entire database is held in memory or if the OS has to do a lot of disk swapping to find the location to store the record.</p>
23,464
<p>Last week we released Omniture's analytics code onto a large volume of web sites after tinkering and testing for the last week or so.</p> <p>On almost all of our site templates, it works just fine. In a few scattered, unpredictable situations, there is a <em>crippling, browser-crashing experience</em> that <em>may<...
<p>I did an "inspect element" on a link in that page with firebug, and in the DOM tab it says there is an onclick function (anonymous), and also some other function called "s_onclick_0".</p> <p>I coaxed firebug placing a watch like </p> <pre><code>alert(document.links[0].onclick) </code></pre> <p>to alert me the onc...
<p>A set of recommendations to the implementers of on-page analytics:</p> <ul> <li><p>Use document-level event capturing only, this is in almost every case (besides change/submit events) sufficient</p></li> <li><p>Do not execute computation-intensive code (as well as any IO operations) in the handlers, rather postpone...
21,089
<p>Would it be possible to write a class that is virtually indistinguishable from an actual PHP array by implementing all the necessary SPL interfaces? Are they missing anything that would be critical?</p> <p>I'd like to build a more advanced Array object, but I want to make sure I wouldn't break an existing app that ...
<p>The only problems i can think of are the gettype() and the is_array() functions. Check your code for</p> <pre><code>gettype($FakeArray) == 'array' is_array($FakeArray) </code></pre> <p>Because although you can use the object just like an array, it will still be identified as an object. </p>
<p>Other differences include the '+' operator for arrays (merging) and the failure of the entire <code>array_*</code> functions, including the commonly used <code>array_merge</code> and <code>array_shift</code>.</p>
17,530
<p>Is there a way to upload a file to a FTP server when behind an HTTP proxy ?</p> <p>It seems that uploading a file is not supported behind an HTTP Proxy using .Net Webclient. (<a href="http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.proxy.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/librar...
<p>In active FTP mode, the server initiates a data connection to the client. If the client is behind an HTTP proxy, this obviously won't work. In passive FTP mode it is the client who initiates both the initial and the data connections. Since HTTP proxies can tunnel arbitrary outgoing TCP connections (using the CONNECT...
<p>Id don't really see the connection between a http proxy and uploading to an ftp server. If you use the http proxy class thats for accessing http resources trough a http proxy. ftp is another protocol and the ftp proxies use a different protocol.</p>
19,484
<p>I have a file and I don't know how big it's going to be (it could be quite large, but the size will vary greatly). I want to search the last 10 lines or so to see if any of them match a string. I need to do this as quickly and efficiently as possible and was wondering if there's anything better than:</p> <pre><co...
<pre><code># Tail from __future__ import with_statement find_str = "FIREFOX" # String to find fname = "g:/autoIt/ActiveWin.log_2" # File to check with open(fname, "r") as f: f.seek (0, 2) # Seek @ EOF fsize = f.tell() # Get Size f.seek (max (fsize-1024, 0), 0) # Set...
<p>This will return the last 10 lines as a list then you can search your line easily. (Python 3 compatible)</p> <pre><code>def read_last_n_lines_new(lines_need=10): with open('Log.txt', 'rb') as f: f.seek(0, 2) data = [] lines_found = 0 while True: try: f...
32,532
<p>I'm writing a website that will sell items from one of my classes. It will be linked to a SQL Server db where I will pull pricing, item name, quantity and description. If I wanted to display the items from the database in a thinkgeek fashion, what would be the best control to use so I can custimize the display to ac...
<p>You'll get the best flexibility with an asp:Repeater. This means you'll have to program more, but it will give you more flexibility.</p>
<p>@rslite and @Bryant both have good suggestions. My initial go of the problem would probably involve creating a "Thinkgeek-esque" user control, and plopping that into a repeater for display. However, the DDP would be a good call as well. Really depends on deeper level requirements than you mention.</p>
22,843
<p>I am trying to write a fragment program that will take a texture and clamp the texels between two values. That is, if the min value is say 0.2 and the max value is 0.6, any texel less than 0.2 will become 0, any texel greater than 0.6 will become 1.0, and all values in between will be mapped from 0 to 1.0.</p> <p>M...
<p>I haven't really programed any shaders, but maybe the shader compiler doesn't recognize the new line? have you tried putting "\n\r"?</p> <p>EDIT:</p> <p>Another question that you may ask yourself is what language are you using? Are strings in UNICODE, ie 16-bits/char? I just noticed that the format you are pas...
<p>First: I don't know much about ARB_fragment_program so I'm partly guessing here.</p> <p>Your best option would be to get the error string (glGetString(GL_PROGRAM_ERROR_STRING_ARB)) and see what that tells you.</p> <p>After looking at the shader, you seem to be using the wrong number of components in lines 3 and 7 ...
44,022
<p>Do any .NET frameworks allow you to create Business Entities first then Database. In other words allow you to use DDD / Persistence Ignorance method of backing into the database later. Any tools that allow the Models/Classes you have written to generate the SQL DDL and migration scripts.</p> <p>Feel free to rework ...
<p>NHibernate supports domain-driven design, persistence ignorance, and automated data-model generation.</p>
<p>You may opt for Castle ActiveRecord which hides the complexity of NHibernate and can create the schema from business entities with various options like creating a schema file and creating the database entities directly.</p>
45,016
<p>When debugging an asp.net web application in VS2008 IDE, i feel it takes 'long' to launch the application because it my app is not big (about six pages).</p> <p>I am not using the in-built VS web-server, I'm using the standard IIS web-server on my development machine. (That is, on the 'Start Options' dialog, I have...
<p>One thing that's helped improve launch speed for me is to set up a separate AppPool and assign just the application you're trying to debug to that AppPool. </p>
<p>I would try turning off Indexing for the "temporary asp.net files" folder (located in your windows dir/microsoft.net/framework/%whatever version% folder).</p>
28,050
<p>I have terabytes of files and database dumps that I need to backup off-site.</p> <p>What's the best way to accomplish this?</p> <p>I'm currently weighing rsyinc to Amazon EBS or getting an appliance (eg barracuda).</p> <p>I called a buddy of mine, and he said he uses backula to get all the files on a single disk,...
<p>One common solution to offsite backups that is worth considering is performing the backup onsite and then physically transporting the backup elsewhere, either via secure snail mail or with a service designed for that purpose. If bandwidth is an issue, this may be more practical.</p>
<p>Back in the late 80s I worked at a place where every week we received a box of tapes of various sorts every monday - we would do one set of weekly backups on the tapes on that box and send them off-site. Evidently they had two of these boxes, one that was in our office and the other they kept locked up somewhere. ...
47,501
<p>I have a many to many index table, and I want to do an include/exclude type query on it.</p> <p>fid is really a integer index, but here as letters for easier understanding. Here's a sample table :</p> <p>table t</p> <pre><code>eid | fid ----+---- 1 | A 1 | B 1 | C 2 | B 2 | C 3 | A 3 | C 4 | A 4 ...
<p>Use <a href="http://msdn.microsoft.com/en-us/library/ms188055.aspx" rel="nofollow noreferrer">set subtraction</a></p> <blockquote> <pre><code>Select eid from t where fid = 'B' EXCEPT select eid from t where fid = 'A' </code></pre> </blockquote>
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/exists-and-not-exists-subqueries.html" rel="nofollow noreferrer">MySQL 5.0</a> supports the where exists/where not exists, as described by Nigel and Mike.</p>
15,712
<p>Can someone explain how XSS works in plain english? Maybe with an example. Googling didn't help much.</p>
<p>Cross Site Scripting basically is a security vulnerability of dynamic web pages where an attacker can create a malicious link to inject unwanted executable JavaScript into a Web site. The most usual case of this vulnerabilities occurs when GET variables are printed or echoed without filtering or checking their conte...
<p>XSS - </p> <p>Vulnerability caused when the web-site places the trust on the user and does not filter the user-input. The user-input causes unwanted script to be executed on the site.</p> <ol> <li><p>Prevention:</p> <ul> <li><p>Filter user input using HTML input sanitizers</p> <p>(e.g strip_tags, htmlspecialcha...
29,591
<p>I have an existing codebase targeting a Windows environment and with an eye to the future, would like to make this as cross platform as possible. I've had some sucess with standard Linux distributions by using cross platform libraries but would like to extend this to Realtime and or embedded operating systems.</p> ...
<p>If you are using the windows COM interface (I assume you're not talking about serial port here, but the Common Object Model), your code might need to be abstracted away from that.</p> <p>As you talk about IPC, then obviously this is a multi-tasking/multi-processing type code base. With that being the case, you wil...
<p>Depends on the capabilities of your embedded platform. If it's an 8-bit, you've got a hard road ahead but if it's 32 bit with decent RAM and such, there are a lot of open source cross-platform libraries available.</p> <p>I used <a href="http://www.directfb.org/" rel="nofollow noreferrer">DirectFB</a> for my last em...
13,214
<p>How, in general, does one determine if a PC supports hardware virtualization? I use VirtualPC to set up parallel test environments and I'd enjoy a bit of a speed boost.</p>
<p>Download this: <a href="http://www.cpuid.com/cpuz.php" rel="noreferrer">http://www.cpuid.com/cpuz.php</a></p> <p>Also check, <a href="http://en.wikipedia.org/wiki/X86_virtualization" rel="noreferrer">http://en.wikipedia.org/wiki/X86_virtualization</a></p> <p>Edit: Additional, I know it's for XEN but the instructio...
<p>Try just turning the option on in VirtualPC. If it doesn't do anything (or the option isn't available), then your PC doesn't.</p>
4,097
<p>How do I get ms-access to connect (through ODBC) to an ms-sql database as a different user than their Active Directory ID? </p> <p>I don't want to specify an account in the ODBC connection, I want to do it on the ms-access side to hide it from my users. Doing it in the ODBC connection would put me right back in to ...
<p>I think you can get this to work the way you want it to if you use an <a href="http://www.carlprothman.net/Default.aspx?tabid=90#ODBCDriverForSQLServer" rel="noreferrer">"ODBC DSN-LESS connection"</a></p> <p>If you need to, keep your ODBC DSN's on your users' machines using windows authentication. Give your users r...
<p>I think you'd have to launch the MS Access process under the account you want to use to connect. There are various tools that let you do this, such as <a href="http://www.joeware.net/freetools/tools/cpau/index.htm" rel="nofollow noreferrer">CPAU</a>. This tool will let you encrypt the password as well.</p>
7,357
<p>I know that <code>JTable</code> can sort by a single column. But is it possible to allow for multiple column sort or do I need to write the code myself?</p>
<p>You can sort by multiple columns by specifying more than one sort key when calling <code>setSortKeys</code> in the <a href="http://java.sun.com/javase/6/docs/api/javax/swing/RowSorter.html" rel="noreferrer"><code>RowSorter</code></a> you're using.</p>
<p>ETable from the netbeans collection.<br/> It is part of org-netbeans-swing-outline.jar<br/> A google search aught to turn it up. The ETable is primarily a foundation for Outline (a TreeTable) but it has multi-column ordering built in as well as many other nice features</p>
13,525
<p>So for the past day or so I have been fixing a bug that is caused by a modal dialog. I work on an application which communicates with the server through the Windows message pump. When I use ShowDialog() to show a modal form, the message pump is blocked and none of my messages are processed, yet they do build up in...
<p>Yes, I am calling ShowDialog() from the menu item's click event. In this case, the messages are pumped through the modal dialog to the main form.</p>
<p>Are you calling ShowDialog() from the click event, or some other way?</p>
16,550
<p>Say I have an object that stores a byte array and I want to be able to efficiently generate a hashcode for it. I've used the cryptographic hash functions for this in the past because they are easy to implement, but they are doing a lot more work than they should to be cryptographically oneway, and I don't care about...
<p>The hash code of an object does not need to be unique. </p> <p>The checking rule is: </p> <ul> <li>Are the hash codes equal? Then call the full (slow) <code>Equals</code> method.</li> <li>Are the hash codes not equal? Then the two items are definitely not equal.</li> </ul> <p>All you want is a <code>GetHashCode</...
<p><a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.runtimehelpers.gethashcode.aspx" rel="nofollow noreferrer">RuntimeHelpers.GetHashCode</a> might help:</p> <blockquote> <p>From Msdn:</p> <p>Serves as a hash function for a particular type, suitable for use in hashing algorit...
3,706
<p>Are use cases just multiple user stories??</p> <p>What are the benefits of using user stories over use cases.. and vice-versa... When to use one over other... Does all agile methodologies uses user stories??</p>
<p>Actually, the original use cases (see <a href="https://rads.stackoverflow.com/amzn/click/com/0201544350" rel="noreferrer" rel="nofollow noreferrer">Jacobson's OOSE</a>) were pretty lightweight, much as user stories are now. Over time, they evolved until a common format for "use cases" now is a complicated document ...
<p><strong>User Stories</strong> is a tool used in Agile development to make sure you create the product your user really needs. </p> <ul> <li>It describes rather <strong>why</strong> you should make this or that feature instead of <strong>HOW</strong> or <strong>WHAT feature</strong>. </li> <li>From my personal exper...
49,628
<p>I'm using the following view function to iterate over all items in the database (in order to find a tag), but I think the performance is very poor if the dataset is large. Any other approach?</p> <pre><code>def by_tag(tag): return ''' function(doc) { if (doc.tags.length &gt; 0) { ...
<p><em>Disclaimer: I didn't test this and don't know if it can perform better.</em> </p> <p>Create a single perm view:</p> <pre><code>function(doc) { for (var tag in doc.tags) { emit([tag, doc.published], doc) } }; </code></pre> <p>And query with _view/your_view/all?startkey=['your_tag_here']&amp;endkey=['...
<pre><code># Works on CouchDB 0.8.0 from couchdb import Server # http://code.google.com/p/couchdb-python/ byTag = """ function(doc) { if (doc.type == 'post' &amp;&amp; doc.tags) { doc.tags.forEach(function(tag) { emit(tag, doc); }); } } """ def findPostsByTag(self, tag): server = Server("http://lo...
25,929
<p>When defining or calling functions with enough arguments to span multiple lines, I want vim to line them up. For example,</p> <pre><code>def myfunction(arg1, arg2, arg, ... argsN-1, argN) </code></pre> <p>The idea is for argsN-1 to have its 'a' lined up with args1.</p> <p>Does anyone have a way to ...
<p>The previous poster had it, but forgot the <code>set</code></p> <pre><code>:set cino=(0&lt;Enter&gt; </code></pre> <p>From <code>:help cinoptions-values</code></p> <pre><code>The 'cinoptions' option sets how Vim performs indentation. In the list below, "N" represents a number of your choice (the number can be ne...
<p>you might get some good mileage out of using a language-specific external tool as a Vim filter. for example, if you can write a <a href="http://perltidy.sf.net" rel="nofollow noreferrer">Perltidy</a> config file to generate the formatting you want (it looks like you would want the <strong>-lp -vtc=2</strong> flags)...
11,458
<p>How can I make cookies in my Flash application using ActionScript 2.0?</p>
<p>You would need to use JavaScript to work with cookies. You can do so from ActionScript using the <a href="http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00002200.html" rel="nofollow noreferrer">ExternalInterface API</a>.</p>
<p>In AS2, I would say just create a javascript function to set the cookie and call it from within flash using a geturl request.</p> <pre><code>// Javascript Function function setCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=...
36,379
<p>When a script runs under Apache, I insert <code>$_SERVER['SERVER_NAME']</code> value into an error reporting e-mail message.</p> <p>However, if a Web script forks a "worker" job with <code>nohup php ...</code>, <code>$_SERVER['SERVER_NAME']</code> appears to be empty there. Thus, if an error occurs, it's reported w...
<p><a href="http://uk.php.net/manual/en/function.php-uname.php" rel="nofollow noreferrer">php_uname("n")</a></p> <blockquote> <p>(PHP 4 >= 4.0.2, PHP 5)<br> php_uname — Returns information about the operating system PHP is running on</p> <p>php_uname() returns a description of the operating system PHP is ...
<p>You can use <code>_GLOBALS['MACHINENAME']</code> to obtain the information straight from the <code>globals</code> <code>array</code>.</p>
26,044
<p>My strongest lead is that the code who deals with the incoming XMLs is actually receiving an invalid/incomplete file hence failing the DOM parsing. Any suggestions?</p>
<p>Incomplete file is definitely the place to start looking. I'd print out the file right before the point you parse it to see what's getting sent to the parser. If it's incomplete it will be obvious. If it's invalid, you'll have a little searching to do.</p>
<p>You should have a stack trace pointing to where you NPE is thrown. That should narrow down the number of variables that can be null. Rather than getting the debugger or printf out, I suggest adding appropriate checks and throwing an exception where as soon as the error can be detected. It's a good habit to get into ...
11,090
<p>As part of the base class for some extensive unit testing, I am writing a helper function which recursively compares the nodes of one XmlDocument object to another in C# (.NET). Some requirements of this:</p> <ul> <li>The first document is the <strong>source</strong>, e.g. what I want the XML document to look like...
<p>Microsoft has an <a href="http://msdn.microsoft.com/en-us/library/aa302294.aspx" rel="noreferrer">XML diff API</a> that you can use.</p> <p>Unofficial NuGet: <a href="https://www.nuget.org/packages/XMLDiffPatch" rel="noreferrer">https://www.nuget.org/packages/XMLDiffPatch</a>.</p>
<p>Based @Two Cents answer and using this link <a href="http://www.java2s.com/Code/CSharp/XML/AlphabeticalsortingoftheXmlNodes.htm" rel="nofollow noreferrer">XMLSorting</a> i have created my own XmlComparer </p> <p><strong>Compare XML program</strong></p> <pre><code>private static bool compareXML(XmlNode node, XmlNod...
20,286
<p>What's the best data type in SQL to represent Decimal in .NET?</p> <p>We want to store decimal numbers with up to 9 decimal place precision and want to avoid rounding errors etc on the front end.</p> <p>Reading about data types, it appears using Decimal in .NET is the best option because you will not get rounding ...
<p>So we did some testing on SQL Server. It looks like the sql type <code>decimal</code> cannot completely store any .net decimal.</p> <p>SQL Server can store a number up to <a href="http://msdn.microsoft.com/en-us/library/ms187746.aspx" rel="noreferrer">38 decimal digits long</a>. That's the total of the number of di...
<p>If you're using SQL Server, <a href="http://msdn.microsoft.com/en-us/library/ms131092.aspx" rel="nofollow noreferrer">this table</a> might help with data type mappings.</p>
28,484
<p>I got an Anycubic Predator last month, and after resolving a few mechanical problems, I was able to get it printing decently well. The only significant modification I've made so far is a set of 8-diode TL Smoothers, and I'm now mostly operating it via Octoprint.</p> <p>However, during the last few prints, I've noti...
<h2>Safety First</h2> <p>Let's look at the graphs. First: you should swap firmware for one that has <a href="https://3dprinting.stackexchange.com/questions/8466/what-is-thermal-runaway-protection">Thermal Runaway</a>, as, as it is, running about 15 minutes with 28 K less than the printer is ordered to work at is a clea...
<p>The rise times are quicker than the fall times, which is not what I expected. Maybe a fan is turning on and off, but I'd expect to see the heater struggling to heat up. On both graphs, the rise times look like good heating and not much interference. </p> <p>It seems to me that power to the hotend is the problem, bu...
1,560
<p>I am trying to set up my tab order on the html side of my project. How do I set the tab order. Usually in visual basic, the option is in the menu bar under view/tab Order. How do I do this in asp?</p>
<p>Add TabIndex="x" to each control that can receive focus where x is an integer indicating the desired order of the controls.</p>
<p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.tabindex.aspx" rel="nofollow noreferrer">TabIndex</a> property</p>
46,906
<p>If I create a Stored Procedure in SQL and call it (<code>EXEC spStoredProcedure</code>) within the BEGIN/END TRANSACTION, does this other stored procedure also fall into the transaction?</p> <p>I didn't know if it worked like try/catches in C#.</p>
<p>Yes, <em>everything</em> that you do between the Begin Transaction and Commit (or Rollback) is part of the transaction.</p>
<p>Yes, all nested stored procedure calls are included in the scope of the transaction. If you are using SQL Server 2005 or greater, you can use Try...Catch as well. <a href="https://web.archive.org/web/20211020150034/http://www.4guysfromrolla.com/webtech/041906-1.shtml" rel="nofollow noreferrer">Here</a> is more det...
21,725
<p>I have a stored procedure on SQL Server 2005 doing a Serializable Transaction. Inside this transaction, it selects a table with rowlock. At the end of the procedure, after rollback/commit, it sets the transaction isolation level to Read Commited.</p> <p>This procedure is running, different processes have concurrent...
<p>you have too many locks for your memory. increase ram or rewrite your queries to use fewer locks. serializable is a lock hog. do you really need it?</p>
<p>I resolved this error by reducing the data range been passed between servers, meaning if you are selecting 1000 records try reducing the transaction into two batches for 500 records and another 500 records keep reducing the number until error stops</p>
36,946
<p>This is not a question with a precise answer (strictly speaking the answer would be best captured by a poll, but that functionality is not available), but I am genuinely interested in the answer, so I will ask it anyway.</p> <p>Over the course of your career, how much time have you spent on <a href="http://en.wikip...
<p>I think it's typical for professionals who deal with customers to spend more time in brownfield development. The reason is that customers typically aren't willing to throw out their existing software to adopt the "latest and greatest" (green) software.</p> <p>Developers in research or academics, however, may be mo...
<p>Over the past decade or so, I've always worked on software that was used as the center of my company's business. (Both SaaS and a software product.) And while I've always come into the with an existing system (so brownfield), we've usually put out a ground-up redesign/rewrite (so greenfield.) So, to break to down...
6,201
<p>There is no summary available of the big O notation for operations on the most common data structures including arrays, linked lists, hash tables etc.</p>
<p>Information on this topic is now available on Wikipedia at: <a href="http://en.wikipedia.org/wiki/Search_data_structure" rel="noreferrer">Search data structure</a></p> <pre><code>+----------------------+----------+------------+----------+--------------+ | | Insert | Delete | Search | Sp...
<p>Amortized Big-O for hashtables:</p> <ul> <li>Insert - O(1)</li> <li>Retrieve - O(1)</li> <li>Delete - O(1)</li> </ul> <p>Note that there is a constant factor for the hashing algorithm, and the amortization means that actual measured performance may vary dramatically.</p>
14,941
<p>The SQL implementation of relational databases has been around in their current form for something like 25 years (since System R and Ingres). Even the main (loosely adhered to) standard is ANSI-92 (although there were later updates) is a good 15 years old.</p> <p>What innovations can you think of with SQL based da...
<ul> <li>Hash joins</li> <li>Cost-based optimizers (pretty much turned query-writing on its head)</li> <li>Partitioning (enables much better VLDB management)</li> <li>Parallel (multi-threaded) query processing</li> <li>Clustering (not just availability but scalability too)</li> <li>More flexibility in SQL as well as ea...
<p>I think most of the progress has been in the realm of performance - query profilers and clusters.</p>
23,324
<p>How do you rotate an image with the canvas html5 element from the bottom center angle?</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;script type="text/javascript"&gt; function startup() { var canvas = document.getElementById('canvas'); ...
<p>First you have to translate to the point around which you would like to rotate. In this case the image dimensions are 64 x 120. To rotate around the bottom center you want to translate to 32, 120.</p> <pre><code>ctx.translate(32, 120); </code></pre> <p>That brings you to the bottom center of the image. Then rotate...
<pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Canvas Pinball flippers by stirfry&lt;/title&gt; &lt;script type="application/x-javascript"&gt; /*THIS SCRIPT ADAPTED BY STIRFRY. SOURCE TEETHGRINDER no warranty or liability implied or otherwise. use at your own risk. No credit required. Enjoy.stirfry.th...
47,705
<p>I have some ASP.NET web services which all share a common helper class they only need to instantiate one instance of <em>per server</em>. It's used for simple translation of data, but does spend some time during start-up loading things from the web.config file, etc. <em>The helper class is 100% thread-safe. Think of...
<p>You can place your Helper in the Application State. Do this in global.asax:</p> <pre><code> void Application_Start(object sender, EventArgs e) { Application.Add("MyHelper", new MyHelperClass()); } </code></pre> <p>You can use the Helper that way:</p> <pre><code> MyHelperClass helper = (MyHelperClass)Htt...
<p>I 'v done something like this in my own app in the past and it caused all kinds of weird errors. Every user will have access to everyone else's data in the property. Plus you could end up with one user being in the middle of using it and than getting cut off because its being requested by another user.</p> <p>No th...
8,807
<p>Does anyone know how to modify the content of the Excel ribbon at runtime with VSTO 2005SE? Not only update labels or dynamic menus, but also add or remove buttons, tabs, groups, drop downs etc. At runtime means not only at my add-in startup, but also during work with Excel.</p>
<p>Irrespective of VS version, I don't think all that you want is actually possible with the current version of the RibbonX control*. Specifically, there's no functionality for adding and removing. You <em>can</em> control visibility, though, so you can put everything in by default and make it visible or otherwise as n...
<p>If you use Visual Studio 2008, you have a great ribbon designer.</p> <p>Do you want to have methods that is triggered by excel?</p>
36,408
<p>I'm writing an application that can be started either as a standard WinForms app or in unattended mode from the command-line. The application was built using the VS 2k5 standard WinForms template.</p> <p>When the application is executed from the command-line, I want it to output information that can be captured by ...
<p>Raymond Chen recently posted (a month after the question was posted here on SO) a short article about this:</p> <p><a href="http://blogs.msdn.com/oldnewthing/archive/2009/01/01/9259142.aspx" rel="noreferrer">How do I write a program that can be run either as a console or a GUI application?</a></p> <blockquote> <...
<p>If you want to check if your app is started from the command line in .NET, you can use <code>Console.GetCursorPosition()</code>. The reason that this works is that when you start it from the command line, the cursor moves away from the initial point (<code>(0, 0)</code>) because you typed something in the terminal (...
44,012
<p>I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array.</p> <p>I couldn't have phrased it better than the person that posted <a href="http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21062554.html" rel="noreferrer">the same question here</...
<p>Update (2021) - <strong>Java 17</strong> now includes <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/HexFormat.html" rel="noreferrer"><code>java.util.HexFormat</code></a> (only took 25 years):</p> <p><code>HexFormat.of().parseHex(s)</code></p> <hr> For older versions of Java: <p>Here...
<p>I think will do it for you. I cobbled it together from a similar function that returned the data as a string:</p> <pre><code>private static byte[] decode(String encoded) { byte result[] = new byte[encoded/2]; char enc[] = encoded.toUpperCase().toCharArray(); StringBuffer curr; for (int i = 0; i &lt;...
16,956
<p>I'm working on a program that is form based but I have been asked to add some command line support, this works fine apart from the form flashes up and closes down when running from the command line. Is there anyway to hide the form whilst the command line is running? Some code does refer to controls so the gui would...
<p>In your Main method you can create the form such as:</p> <pre><code>main = new MainForm(); </code></pre> <p>then do any command line processing required.</p> <p>When not in command line mode simply call:</p> <pre><code>Application.Run(main); </code></pre>
<p>There are a few apps that I've run across which have this behavior right from the constructor of the form class. Basically their constructor handles the command line arguments and the calls an Environment.Exit(0) when the process for the command line args has completed successfully. Calling Environment.Exit before...
24,283
<p>So, I've been doing Java for a number of years now, but now I'm starting a C++ project. I'm trying to determine best practices for setting up said project.</p> <p>Within the project, how do you generally structure their code? Do you do it Java style with namespace folders and break up your source that way? Do you k...
<p>Edit: Oh well, the question edit was made while I was typing. This is an answer to</p> <blockquote> <p>Is there a way to combine two or more repositories maintaining the version history for both?</p> </blockquote> <hr> <p>Assuming that </p> <p>The existing repositories have a structure like:</p> <ul> <li...
<p>The other answers for this question enabled me to make the script below. Adapt the REPOS map for your case. Also, you may want to move the tags and branches into a "preaggregate" directory in stead of directly into the new branches and trunk.</p> <pre><code>#!/bin/bash NEWREPO=$(pwd)/newrepo NEWREPOCO="${NEWREPO}_...
33,522
<p>I have a Monoprice Select Mini v2 and it came with a 256 MB SD card. I have a bunch of 16 GB cards. I have made sure that the new SD card has a FAT32 filesystem. I copy the gcode file onto this card and when I put it in the printer, it can't find any files!</p> <p>And yes, the file is at the root level of the files...
<p>Unfortunately, the answer isn't as simple as that a specific size of SD card works and another size doesn't. The <a href="https://github.com/MarlinFirmware/Marlin/wiki/SD-cards" rel="nofollow noreferrer">Marlin firmware wiki</a> mentions:</p> <blockquote> <p>The SD- or MMC- Card must be formatted as FAT and must ...
<p>The maximum size is 32 GB, however using microSD has a little disadvantage:</p> <ol> <li><p>The microSD adapter and Micro memory are wrong assembled and the chip are unable to be read.</p> <p>Solution: stick with a tape adhesive to keep Micro memory and SD adapter well aligned</p> </li> <li><p>The SD adapter can't b...
785
<p>How to to configure apache + mod_lisp + clisp and set up a "Hello World!"? I couldn't find any complete howto on the subject. Thanks.</p> <p>Edit: Vebjorn's solution works, but then I don't how to code the "hello world!". Can anyone tell me how to proceed? There's something like SWANKing the clisp, then connect to ...
<ol> <li>Download <a href="http://www.fractalconcept.com:8000/public/open-source/mod_lisp/mod_lisp.c" rel="noreferrer">http://www.fractalconcept.com:8000/public/open-source/mod_lisp/mod_lisp.c</a> <ul> <li>Compile and install Apache module with <code>sudo apxs -i -c mod_lisp.c</code></li> <li>Add the following to your...
<p><a href="http://www.newartisans.com/blog_files/common.lisp.with.apache.php" rel="nofollow noreferrer">This article</a> seems to be a fairly thorough "how-to" guide to set up Common Lisp on Apache using mod_lisp2.</p> <blockquote> <p>If all has gone as planned, you should now have a Common Lisp app server running ...
23,115
<p>Is there any way to find out if a file is a directory?</p> <p>I have the file name in a variable. In Perl I can do this:</p> <pre><code>if(-d $var) { print "it's a directory\n" } </code></pre>
<p>You can do it like so:</p> <pre><code>IF EXIST %VAR%\NUL ECHO It's a directory </code></pre> <p>However, this only works for directories without spaces in their names. When you add quotes round the variable to handle the spaces it will stop working. To handle directories with spaces, convert the filename to shor...
<p>Can't we just test with this : </p> <pre><code>IF [%~x1] == [] ECHO Directory </code></pre> <p>It seems to work for me.</p>
16,820
<p>I have a class that contains a list of objects. What's the best way to run some code in the class when the list is modified?</p> <pre><code>class MyManagerClass { ArrayList list = new ArrayList(); // will likely be a different collection class private OnItemAddedToList(object o) { // how to call...
<p>The method I've been using so far is to make a private collection class derived from <code>System.Collections.ObjectModel.Collection&lt;T&gt;</code>, and call the methods directly in the overrides:</p> <pre><code>class MyManagerClass { private class MyCollection : System.Collections.ObjectModel.Collection&lt;ob...
<p>Personally I'd implement <code>IList&lt;T&gt;</code>, in a class that has <code>Added</code>, <code>Removed</code> and <code>Replaced</code> events/delegates. The class would have a private instance member of type <code>List&lt;T&gt;</code> that all implemented calls would delegate to, as well as raising the events...
48,500
<p>I wish to build a compiler (GCC port) for Linux, so that the built GCC runs on Windows and creates executables for an embedded platform.</p> <p>Is the above possible?</p>
<p>Yes, it is possible. </p> <p>It also utterly painful to try to do this yourself -- it is OK on Linux, mostly, but very tricky on Windows. My suggestion is to see if some ready-built compiler from a place like DENX.de, CodeSourcery, or the manufacturer of your embedded platform is available. </p> <p>I have become ...
<p>You have to build GCC on Windows using MinGW or Cygwin for your target platform (e.g. ARM little endian).</p>
45,377
<p>Let's say I have a container (std::vector) of pointers used by a multi-threaded application. When adding new pointers to the container, the code is protected using a critical section (boost::mutex). All well and good. The code should be able to return one of these pointers to a thread for processing, but another ...
<p>For the threading safety of boost::shared_ptr you should check <a href="http://www.boost.org/doc/libs/1_36_0/libs/smart_ptr/shared_ptr.htm#ThreadSafety" rel="nofollow noreferrer">this link</a>. It's not guarantied to be safe, but on many platforms it works. Modifying the std::vector is not safe AFAIK.</p>
<p>If in addition, you synchronize the accesses to the vector (as in your original raw pointer proposal), your usage is safe. Otherwise, you may fall foul of example 4 in the link provided by the other respondent. </p>
13,947
<p>Whilst trying to get our app working in Firefox (I'm a big proponent of X-Browser support but our lead dev is resisting me saying IE is good enough). So I'm doing a little side project to see how much work it is to convert.</p> <p>I've hit a problem straight away.</p> <p>The main.aspx page binds to a webservice us...
<p>I don't think that you are on the right way for achieving real cross-browser compatibility. Adding support for IE-specific features for Firefox is definitely <strong>not</strong> the way to go. What about Opera, Safari, Chrome...? If the app you're working on is used strictly on the intranet then supporting Firefox ...
<p>Your jQuery snippet has an error: since <code>useService</code> is a method defined on the node itself, not the jQuery object, you'd have to do:</p> <pre><code>$("#webservice")[0].useService(url + asmpath + "/WebServiceWrapper.asmx?WSDL","WebServiceWrapper"); </code></pre>
31,580
<p>I am a C++/C# developer and never spent time working on web pages. I would like to put text (randomly and diagonally perhaps) in large letters across the background of some pages. I want to be able to read the foreground text and also be able to read the "watermark". I understand that is probably more of a functi...
<pre><code>&lt;style type="text/css"&gt; #watermark { color: #d0d0d0; font-size: 200pt; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); position: absolute; width: 100%; height: 100%; margin: 0; z-index: -1; left:-100px; top:-200px; } &lt;/style&gt; </code></pre> <p>This lets yo...
<p>You could make an image with the watermark and then set the image as the background via css.</p> <p>For example:</p> <pre><code>&lt;style type="text/css"&gt; .watermark{background:url(urltoimage.png);} &lt;/style&gt; &lt;div class="watermark"&gt; &lt;p&gt;this is some text with the watermark as the background.&lt;...
9,407
<p>I am receiving a 3rd party feed of which I cannot be certain of the namespace so I am currently having to use the local-name() function in my XSLT to get the element values. However I need to get an attribute from one such element and I don't know how to do this when the namespaces are unknown (hence need for local-...
<p>I don't have an XSLT editor here, but have you tried using</p> <pre><code>*[local-name()='category']/@*[local-name()='term'] </code></pre>
<p>I'm not really sure why you have to use local-name(), but if you share a little more info as to what xslt processor you are using along with the language, I'll be that can be figured out. I say this b/c you should be able to do something like:</p> <pre><code>&lt;xsl:stylesheet xmlns="http://www.w3.org/2005/Atom" .....
10,177
<p>I have a database with DateTime fields that are currently stored in local time. An upcoming project will require all these dates to be converted to universal time. Rather than writing a c# app to convert these times to universal time, I'd rather use available sqlserver/sql features to accurately convert these date...
<p>Here's what I do:</p> <pre><code>using System.Runtime.InteropServices; [DllImport("user32.dll")] static extern int SendMessage(IntPtr hWnd, uint wMsg, UIntPtr wParam, IntPtr lParam); </code></pre> <p>then call:</p> <pre><code>SendMessage(myRichTextBox.Handle, (uint)0x00B6, (UIntPt...
<p>window.scrollBy(0,20); </p> <p>This will scroll the window. 20 is an approximate value I have used in the past that typically equals one line... but of course font size may impact how far one line really is.</p>
25,216
<p>I run a game and the running is done by hand, I have a few scripts that help me but essentially it's me doing the work. I am at the moment working on web app that will allow the users to input directly some of their game actions and thus save me a lot of work.</p> <p>The problem is that I'm one man working on a mod...
<p>This is my general approach to testing/launching. How you test/launch depends mostly on:</p> <ol> <li>What your application <strong>is</strong>.</li> <li>Who your users <strong>are</strong>.</li> </ol> <p>If you application is a technical application and is geared to the technically-minded, the word "beta" won't r...
<p>I don't understand what you mean by "bring in the app" and "one turn drop it". By "bring in the app" do you mean deploy? As for "One turn drop", I totally don't understand it.</p> <p>As for open betas, that depends on your audience, really. Counterstrike, for example, apparently run a few closed betas before doing ...
4,971
<p>I have an HTML input box</p> <pre><code>&lt;input type="text" id="foo" value="bar"&gt; </code></pre> <p>I've attached a handler for the '<em>keyup</em>' event, but if I retrieve the current value of the input box during the event handler, I get the value as it was, and not as it will be!</p> <p>I've tried picking...
<p>Can you post your code? I'm not finding any issue with this. Tested on Firefox 3.01/safari 3.1.2 with:</p> <pre><code>function showMe(e) { // i am spammy! alert(e.value); } .... &lt;input type="text" id="foo" value="bar" onkeyup="showMe(this)" /&gt; </code></pre>
<p><a href="http://www.quirksmode.org/dom/events/index.html" rel="nofollow noreferrer">Here</a> is a table of the different events and the levels of browser support. You need to pick an event which is supported across at least all modern browsers. </p> <p>As you will see from the table, the <code>keypress</code> and <...
27,483
<p>I have a DTS package that is raising an error with a "Copy SQL Server Objects" task. The task is copying a table plus data from one SQL Server 2000 SP4 server to another (same version) and is giving the error: -</p> <p><em>Could not find CHECK constraint for 'dbo.MyTableName', although the table is flagged as havin...
<p>This indicates that the metadata in the sys tables has gotten out of sync with your actual schema. If you aren't seeing any other signs of more generalized corruption, doing a rebuild of the table by copying it to another table (select * into newtable from oldtable), dropping the old table and then renaming the new ...
<p>This error started when a new column (with a check constraint) was added to an existing table. To investigate I have: -</p> <ul> <li>Copied the table to a different destination SQL Server and got the same error.</li> <li>Created a new table with exactly the same structure but different name and copied with no error...
25,608
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/19147/what-is-the-correct-way-to-create-a-single-instance-application">What is the correct way to create a single instance application?</a> </p> </blockquote> <p>How to force C# .net app to run only one instanc...
<p>I prefer a mutex solution similar to the following. As this way it re-focuses on the app if it is already loaded</p> <pre><code>using System.Threading; [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetForegroundWindow(IntPtr hWnd); /// &lt;summary&gt; /// The main entry poi...
<p>another way to single instance an application is to check their hash sums. after messing around with mutex (didn't work as i want) i got it working this way:</p> <pre><code> [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetForegroundWindow(IntPtr hWnd); public ...
22,262
<p>Where can I find the redistributable version of the IBM DB2 Type 4 driver? I suppose this is the driver I would use to connect from a Java app (on windows) to DB2 on the mainframe?</p>
<p><a href="http://www-01.ibm.com/support/docview.wss?rs=71&amp;uid=swg21288110" rel="noreferrer">IBM's Fix pack site</a> has the "IBM Data Server Driver for JDBC and SQLJ" which is nothing but the JDBC type 4 driver. Though the page I pointed to above happens to be the windows page, it's the same type 4 driver for al...
<p>If I need any IBM JARs for DB2 or MQ, I usually just add it to the instructions that DB2 or MQ needs to be installed as a prerequisite along with a URL to download it.</p> <p>The same goes for Java and many other not easily redistributable products as well.</p> <p>This eliminates the need to worry about licensing ...
6,883
<p>I have a core .NET application that needs to spawn an arbitrary number of subprocesses. These processes need to be able to access some form of state object in the core application.</p> <p>What is the best technique? I'll be moving a large amount of data between processes (Bitmaps), so it needs to be fast.</p>
<p><a href="https://en.wikipedia.org/wiki/Windows_Communication_Foundation" rel="nofollow noreferrer">WCF</a> would probably fit the bill.</p> <p>Here's a <a href="http://msdn.microsoft.com/en-us/magazine/cc163792.aspx" rel="nofollow noreferrer">really good article on .NET Remoting</a> for performing distributed intens...
<p>I have similar requirements and am using <a href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx" rel="nofollow noreferrer">Windows Communication Foundation</a> to do that right now. My data sizes are probably a bit smaller though.</p> <p>For reference I'm doing about 30-60 requests of about 5 KB-30 KB p...
28,753
<p>At what length of text and/or length of audio snippet does a piece of commercially distributable software pass the threshold of fair use and violate the included work's copyright? Does attribution absolve the developer from infringement? An example would be a quote from a novel used on a start-up screen.</p>
<p>Unfortunately, there is no cut and dried answer. Determining what is fair use involves a very subjective and fact-dependent <a href="http://en.wikipedia.org/wiki/Fair_use#Fair_use_under_United_States_law" rel="noreferrer">four point test</a>. You're never really going to know for sure if a borderline use is permis...
<p>Also, keep in mind that laws vary from country to country, and since most software is distributed anywhere in the world over the web... well, it's a huge headache. It's unfortunate because the threat of lawsuit has a chilling effect on interesting, innovative work.</p>
11,465
<p>I have a <a href="http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JPanel.html" rel="noreferrer">JPanel</a> to which I'd like to add JPEG and PNG images that I generate on the fly.</p> <p>All the examples I've seen so far in the <a href="http://java.sun.com/docs/books/tutorial/uiswing/" rel="noreferrer"...
<p>Here's how I do it (with a little more info on how to load an image):</p> <pre><code>import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JPane...
<p>I can see many answers, not really addressing the three questions of the OP.</p> <p><strong>1)</strong> A word on performance: byte arrays are likely unefficient unless you can use an exact pixel byte ordering which matches to your display adapters current resolution and color depth. </p> <p>To achieve the best dr...
38,371
<p>How would I assign a variable within scriplet code in JSP &lt;%> and then use struts logic tags to do stuff based on the value of the variable assigned in the scriplet code block?</p> <p>I have tried using struts:logic equal and greaterthan to no avail....</p> <p>Many Thanks,</p>
<p>What you are trying to do (if I understand you correct) is basically this:</p> <pre><code>&lt;% String foo = "Test"; %&gt; &lt;bean:write name="foo" /&gt; </code></pre> <p>Which, as you already know, doesn't work. That would give an error like this:</p> <blockquote> <p>Cannot find bean foo in any scope</p> </bl...
<p>You can set a variable in Struts2 using tags. for Example:</p> <pre><code>&lt;c:set var="contains" value="true" /&gt; </code></pre> <p>logic can be tested:</p> <pre><code>&lt;c:if test="%{#variable=='String 1'}"&gt; This is String 1 &lt;/c:if&gt; </code></pre> <p>other sources: <a href="http://www.mkyong.com...
25,657
<p>I need to enumerate all the user defined types created in a <code>SQL Server</code> database with <code>CREATE TYPE</code>, and/or find out whether they have already been defined.</p> <p>With tables or stored procedures I'd do something like this:</p> <pre><code>if exists (select * from dbo.sysobjects where name='...
<p>Types and UDTs don't appear in sys.objects. You should be able to get what you're looking for with the following:</p> <pre><code>select * from sys.types where is_user_defined = 1 </code></pre>
<p>To expand on jwolly2's answer, here's how you get a list of definitions including the standard data type:</p> <pre><code>-- User Defined Type definitions TP 20180124 select t1.name, t2.name, t1.precision, t1.scale, t1.max_length as bytes, t1.is_nullable from sys.types t1 join sys.types t2 on t2.system_type_id = t1....
7,808
<p>Does anyone have any experience with how well web services build with Microsoft's WCF will scale to a large number of users?</p> <p>The level I'm thinking of is in the region of 1000+ client users connecting to a collection of WCF services providing the business logic for our application, and these talking to a dat...
<p>To ensure your WCF application can scale to the desired level I think you might need to tweak your thinking about the stats your services have to meet.</p> <p>You mention servicing "1000+ client users" but to gauge if your services can perform at that level you'll also need to have some estimated usage figures, whi...
<p><a href="http://weblogs.asp.net/paolopia/archive/2008/03/23/wcf-configuration-default-limits-concurrency-and-scalability.aspx" rel="nofollow noreferrer">WCF configuration default limits, concurrency and scalability</a></p>
6,545
<p>How do we create a search plugin for Safari? Like <a href="https://stackoverflow.com/questions/20830/firefox-users-here-is-your-stackoverflow-search-plugin">this post</a> </p>
<p><a href="http://pimpmysafari.com/plugins/keywurl" rel="nofollow noreferrer">Here</a> is a Safari plugin whereby you can customize it to search other sites. May work with Stack Overflow (I haven't tried it). Check out that site too for other Safari plugins.</p>
<p>AFAIK, Safari doesn't have a Search plugin capability. You could try <a href="http://www.inquisitorx.com/safari/index_en.php" rel="nofollow noreferrer">Inquisitor</a>; just add the URL <a href="https://stackoverflow.com/search?s=%@">https://stackoverflow.com/search?s=%@</a></p>
4,262
<p>I understand Big-O notation, but I don't know how to calculate it for many functions. In particular, I've been trying to figure out the computational complexity of the naive version of the Fibonacci sequence:</p> <pre><code>int Fibonacci(int n) { if (n &lt;= 1) return n; else return Fibonacc...
<p>You model the time function to calculate <code>Fib(n)</code> as sum of time to calculate <code>Fib(n-1)</code> plus the time to calculate <code>Fib(n-2)</code> plus the time to add them together (<code>O(1)</code>). This is assuming that repeated evaluations of the same <code>Fib(n)</code> take the same time - i.e....
<p>Well, according to me to it is <code>O(2^n)</code> as in this function only recursion is taking the considerable time (divide and conquer). We see that, the above function will continue in a tree until the leaves are approaches when we reach to the level <code>F(n-(n-1))</code> i.e. <code>F(1)</code>. So, here when ...
47,077
<p>This seems trivial, but I've never had to worry about it before and my Google skills are failing me. How far-reaching is the <strong>in-process</strong> session bucket for ASP.NET/IIS6, in the sense that you can call Session["whatever"] and get the same value back? Obviously it can't stretch across different servers...
<p>AFAIK the <strong>in-process</strong> session has an AppDomain scope, so no, two web applications running in the same pool cannot share an in-process session. Actually the name "in-AppDomain" would be more appropriate.</p>
<p>It can stretch across servers in a farm if the asp.net session is stored in the database.</p> <p>Perimeter of session is strictly within the one app domain for security reasons</p>
30,252
<p>You have an ascending list of numbers, what is the most efficient algorithm you can think of to get the ascending list of sums of every two numbers in that list. Duplicates in the resulting list are irrelevant, you can remove them or avoid them if you like.</p> <p>To be clear, I'm interested in the algorithm. Fee...
<p>Edit as of 2018: You should probably stop reading this. (But I can't delete it as it is accepted.)</p> <p>If you write out the sums like this:</p> <pre><code>1 4 5 6 8 9 --------------- 2 5 6 7 9 10 8 9 10 12 13 10 11 13 14 12 14 15 16 17 18 </code></pre> <p>You'll noti...
<p>If you are looking for a truly language agnostic solution then you will be sorely disappointed in my opinion because you'll be stuck with a for loop and some conditionals. However if you opened it up to functional languages or functional language features (I'm looking at you LINQ) then my colleagues here can fill th...
2,324
<p>I'm about to build a <a href="https://toms3d.org/2017/02/23/building-cheapest-possible-prusa-i3-mk2/" rel="noreferrer">Prusa i3 dolly</a>. I am confused whether to use RAMPS 1.4 or 1.5 or 1.6.</p> <p>What is the big difference? Is it only the MOSFETs and the poly-fuses? If that is the case, would it be advisable to...
<p>One of the thermistor wires had come loose from the crimp ferrules. I re-crimped it and it works fine now. </p>
<p>This can come from several sources:</p> <h1>Hardware</h1> <p>The thermistor or its connections might be damaged, and the fault is only observable when the hotend is hot or moved to a certain area. Start by checking the wiring! You may be able to repair a bad connection easily, but depending what was broken, you may ...
845
<p>I'm confused about what the various testing appliances in Ruby on Rails are for. I have been using the framework for about 6 months but I've never understood the testing part of it. The only testing I've used is JUnit3 in Java and that only briefly.</p> <p>Everything I've read about it just shows testing validation...
<blockquote> <p>Shouldn't the validations in rails just work? It seems more like testing the framework than testing the your code. Why would you need to test validations?</p> </blockquote> <p>The validations in Rails do work -- in fact, there are unit tests in the Rails codebase to ensure it. When you test ...
<p>For example: I work on a 25000+ lines project (yes, in rails 1.2) and last monday I was told if I could make Users dissapear from every list except admin ones if they had "leave_date" attribute set to the past.</p> <p>You can rewrite every list action (50+) to put a </p> <p>@users.reject!{|u| Date.today > u.leave_...
15,428
<p>We are currently using a somewhat complicated deployment setup that involves a remote SVN server, 3 SVN branches for DEV, STAGE, and PROD, promoting code between them through patches, etc. I wonder what do you use for deployment in a small dev team situation?</p>
<p>trunk for development, and a branch (production) for the production stuff.</p> <p>On my local machine, I have a VirtualHost that points to the trunk branch, to test my changes.</p> <p>Any commit to trunk triggers a commit hook that does an svn export and sync to the online server's dev URL - so if the site is stac...
<p>We use release branching - this seems to be more efficient for us than the feature branching we were doing. </p> <p>Don't make different branches for the different environments.</p>
2,574
<p>Does anyone know of a good tool to test load and stress on webservices? I've been looking at Watir and Selenium, but there more web page centered.</p>
<p>Here are some common load testing tools:</p> <ul> <li><a href="http://www.acme.com/software/http_load/" rel="nofollow noreferrer">HTTP_Load</a></li> <li><a href="http://jmeter.apache.org/" rel="nofollow noreferrer">Apache JMeter</a></li> <li><a href="http://grinder.sourceforge.net/" rel="nofollow noreferrer">Grinde...
<p>I've used <a href="http://www.radview.com" rel="nofollow">WebLOAD</a> before for webservice testing</p>
45,829
<p>I need to pick up list items from an list, and then perform operations like adding event handlers on them. I can think of two ways of doing this.</p> <p>HTML:</p> <pre><code> &lt;ul id="list"&gt; &lt;li id="listItem-0"&gt; first item &lt;/li&gt; &lt;li id="listItem-1"&gt; second item &lt;/li&gt; ...
<p>You can avoid adding event handlers to each list item by adding a single event handler to the containing element (the unordered list) and leveraging the concept of event bubbling. In this single event handler, you can use properties of the event object to determine what was clicked.</p> <p>It appears that you are w...
<p>As stated before, if you want to retrieve the list of li, you should use getElementsByTagName on your ul, because childNodes might retrieve some text nodes as well as li nodes.</p> <p>Now if what you need is to use the index in the event handler, you might be better directly using a closure in order to reuse the lo...
37,340
<p>I noticed last night that the WCF extensions for Visual Studio 2005 aren't available on their site any longer. I've read that they want people to use Visual Studio 2008 for WCF/WF/WPF.</p> <p>Have they made an official statement regarding this?</p> <p>edit:</p> <p>I already have the CTP3 for VS2005. I want to k...
<p>I faced the same problem... I needed to use WCF from Visual Studio 2005 and when I installed VS2008 the WCF extensions were gone. I googled around a lot and I found a hack to being able of working with WCF in Visual Studio 2005 or 2008.</p> <p>You have to run the following command from a VS2005 command promtp: <str...
<p>There was never anything but CTP released for MS Visual Studio 2008</p> <p>According to <a href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3695753&amp;SiteID=1" rel="nofollow noreferrer">this</a> thread MS wants you to move to Visual Studio 2008.</p> <p>This <a href="http://blogs.msdn.com/acangialosi/a...
20,086
<p>When refactoring away some <code>#defines</code> I came across declarations similar to the following in a C++ header file:</p> <pre><code>static const unsigned int VAL = 42; const unsigned int ANOTHER_VAL = 37; </code></pre> <p>The question is, what difference, if any, will the static make? Note that multiple inc...
<p>The <code>static</code> means that there will be one copy of <code>VAL</code> created for each source file it is included in. But it also means that multiple inclusions will not result in multiple definitions of <code>VAL</code> that will collide at link time. In C, without the <code>static</code> you would need t...
<p>Static prevents the compiler from adding multiple instances. This becomes less important with #ifndef protection, but assuming the header is included in two seperate libraries, and the application is linked, two instances would be included.</p>
11,802
<p>I have a small problem where plastic comes out of the nozzle while the printer is at a standstill (normally towards the end of heating the nozzle for a print), and whilst it moves from the line for clearing the nozzle on the left of the bed (Cura) before the actual print starts. This causes a slight problem where th...
<h1>basics first</h1> <p>The viscosity of plastic is temperature dependent: the warmer it is, the lower it gets and thus the more "runny". The lower the viscosity is, the less force is needed to move it.</p> <p>In printing, a pressure is applied to the filament from the extruder. Pressure is the force by area, thus f...
<p>This effect is called oozing. At the end of heating up the hot end, left filament becomes so liquid that it oozes out of the nozzle. This left filament could be a left over from the previous print where an insufficient retract prior to the last print finish causes this (you could retract the filament a little furthe...
1,102
<p>OK, I'm not looking for anti-patterns - I'm looking for things that aren't really patterns, or perhaps patterns that have been abused.</p> <p>My personal least favourite is the "Helper" pattern.</p> <p>E.g. I need to create a SQL query, so call SQLQueryHelper. This needs to process some strings, so it in turn call...
<p>Singleton.</p> <p>It's a global variable in disguise and difficult to mock/stub for unit testing.</p> <p>Service Locator better, Dependency injection / Inversion of Control better still.</p> <p>The majority of references on the <a href="http://en.wikipedia.org/wiki/Singleton_pattern" rel="noreferrer">wikipedia ar...
<p>MVP. It's MVC but broken.</p> <p>Oh no but wait, developing an application IS completely different than following good practise such as "It's just a view".</p> <p><strong>Update</strong></p> <p>I reference "It's just a view" which is from the book Pragmatic Programmer. My main issue is that almost every single MV...
16,863
<p>I was writing some code, and I notice a pattern in the exception handling that got me thinking:</p> <pre><code>try{ // do stuff... throws JMS, Create and NamingException } catch (NamingException e) { log1(e); rollback(); doSomething(e) } catch (CreateException e) { log1(e); ...
<p>They are considering an extension of this type for Java 7.</p> <p>See: <a href="http://tech.puredanger.com/java7#catch" rel="nofollow noreferrer">http://tech.puredanger.com/java7#catch</a></p>
<p>I would like if it would be possible to do some pattern matching on exception type as a syntactic addiotion. Something like</p> <pre> try { ... } catch ((IOException && !FileNotFoundException) || IllegalArgumentException ) { ... handle it } </pre>
44,274
<p>I am trying to build a dependency graph of tables based on the foreign keys between them. This graph needs to start with an arbitrary table name as its root. I could, given a table name look up the tables that reference it using the all_constraints view, then look up the tables that reference them, and so on, but ...
<pre><code> select parent, child, level from ( select parent_table.table_name parent, child_table.table_name child from user_tables parent_table, user_constraints parent_constraint, user_constraints child_constraint, user_tables child_table where parent_table.table_name = parent_constrai...
<p>Simplest way to do this is to copy all the FK info into a simple, 2-column (parent,child) table, and then use the following algorithm:</p> <pre><code>while (rows left in that table) list = rows where table name exists in child but not in parent print list remove list from rows </code></pre> <p>that's all. Ba...
11,347
<p>How should I configure the class to bind three dropdowns (date, month, year) to a single Date property so that it works the way it works for 'single request parameter per property' scenario ? I guess a should add some custom PropertyEditors by overriding initBinder method. What else ?</p>
<p>Aleksey Kudryavtsev: you can override the onBind method in your controller, i which you cant fiddle something special in command object, like </p> <pre><code>dateField = new SimpleFormat("YYYY-mm-dd").parse(this.year + "-" + this.month + "-" this.day); </code></pre> <p>or:</p> <pre><code>Calendar c = Calendar.get...
<p>then i would have three fields in my command object - year, month, day and would use standard spring validation for date checking</p>
19,516
<p>I know how to create an array of structs but with a predefined size. However is there a way to create a dynamic array of structs such that the array could get bigger?</p> <p>For example:</p> <pre><code> typedef struct { char *str; } words; main() { words x[100]; // I do not want...
<p>You've tagged this as C++ as well as C.</p> <p>If you're using C++ things are a lot easier. The standard template library has a template called vector which allows you to dynamically build up a list of objects.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;vector&gt; typedef std::vector&lt;char*&gt; words;...
<p>If you want to grow the array dynamically, you should use malloc() to dynamically allocate some fixed amount of memory, and then use realloc() whenever you run out. A common technique is to use an exponential growth function such that you allocate some small fixed amount and then make the array grow by duplicating t...
32,622
<p>Now that I've finnaly moved to doing some development/support work for Windows 2008 I find myself annoyed by the lack of one feature I just can't enable: the desktop shortcut to "My Computer" I've grown used to. I know how to enable this on XP and 2003, but I just can't find the setting on 2008.</p> <p>How can a u...
<p>Right click on the Computer menu item on the start menu, and select 'Show on Desktop' from the context menu that pops up.</p>
<p>Create a Registry Editor file (<code>.reg</code> file) with the following content, and import it into the Registry:</p> <pre><code>Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel] "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"=dw...
36,887
<p>I have a thread running in the background that is reading events from an input device in a blocking fashion, now when I exit the application I want to clean up the thread properly, but I can't just run a pthread_join() because the thread would never exit due to the blocking IO.</p> <p>How do I properly solve that s...
<p>I too would recommend using a select or some other non-signal-based means of terminating your thread. One of the reasons we have threads is to try and get away from signal madness. That said...</p> <p>Generally one uses pthread_kill() with SIGUSR1 or SIGUSR2 to send a signal to the thread. The other suggested si...
<p>Signals and thread is a subtle problem on Linux according to the different man pages. Do you use LinuxThreads, or NPTL (if you are on Linux) ?</p> <p>I am not sure of this, but I think the signal handler affects the whole process, so either you terminate your whole process or everything continue.</p> <p>You should...
24,926
<p>Windows Azure looks like a promising cloud platform. The big unknown right now is the pricing model. Microsoft says that they are still working on that, but it will be competitive. What do you think would make a good pricing model? </p> <p>Let's hope that Microsoft will take note of what a bunch of programmers ...
<p>Azure can go one of two ways:</p> <ol> <li><p>Simple Pay-as-you-go model, like Amazon has, with tiered pricing for higher usage (more usage = lower per-unit pricing). This is the model I would like to see. It works well for Amazon, the industry gets it, anybody reading the pricing will quickly be able to estimate...
<p>Windows Azure pricing has gone through several revisions since its commercial launch. Current pricing is <a href="https://www.windowsazure.com/en-us/pricing/calculator/" rel="nofollow">here</a>, including a price calculator to help you when looking at monthly costs for given services.</p> <p>One comment in this dis...
40,402
<p>Is there a reliable Delta RGB formula or code snippet that does colour Delta of the full RGB tri stim values, like how DeltaE 2000/cmc does Lab/Lch that takes <em>perceptual</em> differences into account?</p> <p>The RGB Colourspace could be any, but if it needed to be a particular one I could keep it sRGB for the c...
<p>I'm afraid you already gave the only right answer: conversion to a perceptual color space, where the simple delta formula makes sense.</p> <p>Brilliant color scientists have been trying to answer the question of perceptual color differences for over a century. They've looked for a simple RGB formula that works, but...
<p>Just in case you didn't find them:</p> <ul> <li><a href="http://www.easyrgb.com/index.php?X=FAQS&amp;H=05#text5" rel="nofollow noreferrer">http://www.easyrgb.com/index.php?X=FAQS&amp;H=05#text5</a></li> <li><a href="http://www.easyrgb.com/index.php?X=DELT" rel="nofollow noreferrer">http://www.easyrgb.com/index.php?...
24,543
<p>I have been working on Flex for last couple of months and as this was the first time I had to actually do Flex I ended up underestimating the project tasks which resulted in a delay. So how does one estimate the project timings when working on a new technology?</p>
<p>I would give myself a set period of time to experiment with and learn the new technology before promising to deliver anything on a specific date.</p> <p>After that first period, make some rough estimates, and make sure your superiors know how rough they really are.</p>
<p>I guess for projects of a certain size, give yourself some time to make a reasonably simple yet still complete and not trivial prototype of some representative part of your project. Then you will have some time to play with the technology, and also earn valuable insights with regards to the time it takes to create s...
44,693
<p>How to delete a file which is in use/open by some process in runtime. I am using vb.net for my project and a image is shown in picturebox, and that should be deleted, without closing that file.</p>
<p>If the file is opened by another process in exclusive mode, you can't -- Windows won't let you. In that case, the best you can do is to either wait for the other process to close the file and then delete it, or have it be deleted at the next reboot by using <a href="http://msdn.microsoft.com/en-us/library/aa365240(...
<p>I don't think that it is possible. On windows, you cannot delete a file which has open handles. <a href="http://support.microsoft.com/kb/320081" rel="nofollow noreferrer">http://support.microsoft.com/kb/320081</a></p> <p>However, from your description you don't need to keep the file open in your application. Open t...
38,624
<p>When building REST web services in .NET, what is the most "RESTful" way of mapping <strong>System.ArgumentNullException</strong> and <strong>System.ArgumentException</strong> to HTTP status codes? My first guess would be to use <strong>HTTP 400/Bad Request</strong> with an appropriate description.<br/><br />What is ...
<p>In general, the 4xx status codes tell the client that the request failed but may succeed if the request i smodified. The 5xx codes inform the client about problems that where the client has no influence.</p> <p>So the first distinction you have to make is between 4xx and 5xx codes, i.e. tell the client if it should...
<p>It depends on the context. E.g. an ArgumentNullException could stem from a violated precondition or be an internal server error.</p> <p>Regards, tamberg</p>
39,220
<p>I love the StringTemplate engine, and I love the CherryPy web server, and I know that they can be integrated.</p> <p>Who has done it? How?</p> <p>EDIT: The TurboGears framework takes the CherryPy web server and bundles other related components such as a template engine, data access tools, JavaScript kit, etc. I...
<p>Based on the tutorials for both, it looks pretty straightforward:</p> <pre> import stringtemplate import cherrypy class HelloWorld(object): def index(self): hello = stringtemplate.StringTemplate("Hello, $name$") hello["name"] = "World" return str(hello) index.exposed = True cherryp...
<p>Rob,</p> <p>There's reason behind people's selection of tools. StringTemplate is not terribly popular for Python, there are templating engines that are much better supported and with a much wider audience. If you don't like Kid, there's also Django's templating, Jinja, Cheetah and others. Perhaps you can find in on...
49,694
<p>I have a prusa 13 that's shipping in the mail, and I intend to make good use of it, one also own a da vinci jr. and the one time it got so clogged that the extruder itself was filled with pla, with that said I replace the extruder, for the da vinci, but besides that, as for my a prusa, what should I do if the extrud...
<p>From an electrical standpoint, a two-phase stepper motors (what most 3D printers use) works the same backwards and forwards, the phase just reverses. If you are stalling on only one direction, I would look to see if you have a mechanical bind in that direction. Generally a wiring issue will cause the motor to eith...
<p>Sounds like you are configured for NC switches but are using NO switches, causing them to invert their reported state. Issue a <strong>M119</strong> command and see if the endstop statuses are correct when none are triggered.</p>
776
<p>in our application we have a Java applet running inside a .NET browser control. It is a know issue from Sun that running an applet this way may crash the control.</p> <p>Has anyone come across the same problem and solved it?</p> <p>Atm we are running the applet in a Webbrowser but we need to run it in a browser co...
<p>After some time the problem solved itself. It was indeed a bug in the java runtime which is now fixed by sun. Just make sure your JRE is > 1.6.10.</p>
<p>If you wrote the applet and have source, then you could try to migrate the Java Applet to a J# Browser control and stuff that in your .net application. </p> <pre><code>Here is a link - http://msdn.microsoft.com/en-us/library/aa290083(VS.71).aspx </code></pre>
9,726
<p>Using <code>WritePrivateProfileString</code> and <code>GetPrivateProfileString</code> results in <code>???</code> instead of the real characters.</p>
<p><code>GetPrivateProfileString()</code> and <code>WritePrivateProfileString()</code> will work with Unicode, sort of.</p> <p>If the ini file is UTF-16LE encoded, i.e. it has a UTF-16 BOM, then the functions will work in Unicode. However if the functions have to create the file they will create an ANSI file and only ...
<p>It might just be a problem with how you are displaying or handling the strings. For example, the normal console window can't display japanese strings with printf.</p> <p>Can you post some of your code?</p>
24,991
<p>Am new to Lucene.Net Which is the best Analyzer to use in Lucene.Net? Also,I want to know how to use Stop words and word stemming features ?</p>
<p>I'm also new to Lucene.Net, but I do know that the Simple Analyzer omits any stop words, and indexes all tokens/works.</p> <p>Here's a link to some Lucene info, by the way, the .NET version is an almost perfect, byte-for-byte rewrite of the Java version, so the Java documentation should work fine in most cases: <a ...
<p>The best analyzer which i found is the StandardAnalyzer in which you can specify the stopwords also. For Example :- </p> <pre><code> string indexFileLocation = @"C:\Index"; string stopWordsLocation = @"C:\Stopwords.txt"; var directory = FSDirectory.Open(new DirectoryInfo(indexFileLocation));...
42,238
<p>Most of the guides I can find are just canned responses to specific questions. Instead I'm looking for something meant to teach good fundamental understanding and core needed skills. Beginner's guides are common in other hobbies but I am having trouble finding one for 3d printing.</p>
<p>Here's a brief outline I threw out in chat once. I'm marking this as a &quot;community Wiki&quot; answer so feel free to edit.</p> <p>It is not a full Primer, so should date better than a Word6.0 manual.</p> <hr /> <p>Start by reading the instructions that came with your printer. There's a high chance that some as...
<p>Thera are plenty of such guides. But from necessity they deal with specifics, there are too many things to cover otherwise.</p> <p>Multiple types of printers, multiple brands, multiple slicers, multiple ways of modelling etc,. With more all the time. Reading up on something that tells me how to model and slice in Fr...
2,143
<p>I would like to do something like <code>&lt;test:di id="someService"</code>/`><br> &lt;% someService.methodCall(); %></p> <p>where <code>&lt;test:di</code><br> gets and instantiates a service bean and creates a scripting variable for use. similar to how jsp:usebean works for example <code>...
<p>The way this is done in a Tag Library is by using a Tag Extra Info (TEI) class.</p> <p>You can find an <a href="http://www.stardeveloper.com/articles/display.html?article=2001081601&amp;page=2" rel="nofollow noreferrer">example here</a>.</p>
<p>I think you're trying to write your own tag library.</p> <p>Check out the tutorial at: <a href="http://www.ironflare.com/docs/tutorials/taglibs/" rel="nofollow noreferrer">http://www.ironflare.com/docs/tutorials/taglibs/</a></p> <p>Edit: As Garth pointed out, you want to use the TagExtraInfo class after you've def...
18,067
<p>I am trying to print this really cool <a href="https://www.thingiverse.com/thing:4551901/comments" rel="nofollow noreferrer">flying toy model</a> on my <a href="https://toybox.com/" rel="nofollow noreferrer">ToyBox</a> 3D printer, but when I try to print the &quot;copter_key-175.stl&quot; file it complains it is a &...
<h2>ToyBox 3D printer true print dimensions and limit switch problems</h2> <p>So I figured out that the problem is my print area is so small the printer was occasionally fully pressing and triggering the end-point limit switches! This apparently causes it to stop slightly early, shifting the next layer as it prints.</p...
<p>Non-manifold objects are only accidentally solid, as sometimes it becomes unclear what is the inside and what is the outside. Some slicers attempt to fix this and do a good job of guessing how to correct it. Also, some non-manifold errors are easier to fix than others.</p> <p>If your slicer is complaining about a ...
2,062
<p>My ultimate goal here is to write a utility that lets me quickly set the folder on <em>any</em> dialog box, choosing from a preset list of 'favorites'. As I'm just a hobbyist, not a pro, I'd prefer to use .NET as that's what I know best. I do realize that some of this stuff might require something more than what I c...
<p>Sounds like a job for <a href="http://www.autohotkey.com" rel="noreferrer">AutoHotkey</a> to me.</p> <p>I am a "pro" (at least I get paid to program), but I would first look at using AutoHotkeys' many well tested functions to access windows, rather then delving into C#/.NET and most likey the WinAPI via PInvoke.</p...
<p>For something like this you're probably going to get heavy into Win32 API calls. Working from .Net means making a lot of pinvokes. I'm afraid I can't help you much, but I do remember there being a book called <a href="http://oreilly.com/catalog/9780596001186/" rel="nofollow noreferrer">" Subclassing and Hooking with...
15,285
<p>Are there any algorithms that can help with hierarchical clustering? Google's map-reduce has only an example of k-clustering. In case of hierarchical clustering, I'm not sure how it's possible to divide the work between nodes. Other resource that I found is: <a href="http://issues.apache.org/jira/browse/MAHOUT-19" r...
<p>First, you have to decide if you're going to build your hierarchy bottom-up or top-down. </p> <p>Bottom-up is called Hierarchical agglomerative clustering. Here's a simple, well-documented algorithm: <a href="http://nlp.stanford.edu/IR-book/html/htmledition/hierarchical-agglomerative-clustering-1.html" rel="norefer...
<p>You could look at some of the work being done with Self-Organizing maps (Kohonen's neural network method)... the guys at <a href="http://www.ifs.tuwien.ac.at/~andi/somlib/experiments_wfb90.html#integration" rel="nofollow noreferrer">Vienna University of Technology</a> have done some work on distributed calculation o...
11,032
<p>Is there a neat archiving library that automatically handles archiving a folder or directories for you out there? I am using Jython, so Java libs are also open for use. -UPDATE- Also Im looking for timestamp archiving. ie </p> <p>archive-dir/2008/11/16/zipfilebypreference.zip</p> <p>then the next day call it again...
<p>You have either the:</p> <ul> <li><a href="http://www.xhaus.com/alan/python/httpcomp.html" rel="nofollow noreferrer">gzip library</a> used here in a Jython servlet: </li> </ul> <p>&nbsp;</p> <pre><code>import javax.servlet.http.HttpServlet import cStringIO import gzip import string def compressBuf(buf): ...
<p>You can use java.util.zip, when I was using Jython the built in zip library in python didn't work </p>
38,136
<p>I have an application that takes the quality results for a manufacturing process and creates graphs both to show Pareto charts of the bad, and also to show production throughput.</p> <p>To automate the task of testing these statistical procedures I would like to deterministically be able to add records into the da...
<p>You'll want to use a <a href="http://en.wikipedia.org/wiki/Fisher-Yates_shuffle" rel="nofollow noreferrer">shuffle algorithm.</a> Make sure to use a proper shuffle algorithm and not a home-baked one, because it may introduce some form of subtle pattern to the data. See <a href="http://www.codinghorror.com/blog/archi...
<p>the way i used to do this was to have a loop that ran a number of times that would generate two random numbers between 0 and the length of the list, then swap those two elements.</p>
20,293