qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
88,651
<p>Is it possible to get notifications using <a href="http://www.microsoft.com/sql/technologies/reporting/default.mspx" rel="nofollow noreferrer">SQL Server Reporting Services</a>? Say for example I have a report that I want by mail if has for example suddenly shows more than 10 rows or if a specific value drop below 100 000. Do I need to tie Notification Services into it and how do I do that?</p> <p>Please provide as much technical details as possible as I've never used <a href="http://www.microsoft.com/sql/technologies/notification/default.mspx" rel="nofollow noreferrer">Notification Services</a> before.</p> <p>Someone also told me that Notifications Services is replaced by new functionality in Reporting Services in Sql Server 2008 - is this the case?</p>
[ { "answer_id": 239482, "author": "James Green", "author_id": 31736, "author_profile": "https://Stackoverflow.com/users/31736", "pm_score": 3, "selected": true, "text": "exec ReportServer.dbo.AddEvent @EventType='TimedSubscription', @EventData='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx'\n" ...
2008/09/17
[ "https://Stackoverflow.com/questions/88651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298/" ]
88,710
<p>I need to create a repeatable process for deploying SQL Server Reporting Services reports. I am not in favor of using Visual Studio and or Business Development Studio to do this. The rs.exe method of scripting deployments also seems rather clunky. Does anyone have a very elegant way that they have been able to deploy reports. The key here is that I want the process to be completely automated.</p>
[ { "answer_id": 91077, "author": "Lukáš Rampa", "author_id": 10560, "author_profile": "https://Stackoverflow.com/users/10560", "pm_score": 6, "selected": true, "text": "'=====================================================================\n' File: PublishReports.rss\n'\n' Summary:...
2008/09/17
[ "https://Stackoverflow.com/questions/88710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16980/" ]
88,711
<p>I want to use <a href="http://alistapart.com/articles/sprites" rel="noreferrer">CSS sprites</a> on a web site instead of separate image files, for a large collection of small icons that are all the same size. How can I concatenate (tile) them into one big image using <a href="http://www.imagemagick.org/" rel="noreferrer">ImageMagick</a>?</p>
[ { "answer_id": 8187638, "author": "Alexander M.", "author_id": 1044587, "author_profile": "https://Stackoverflow.com/users/1044587", "pm_score": 5, "selected": false, "text": "montage -background transparent -geometry +4+4 *.png sprite.gif\n" }, { "answer_id": 10655028, "auth...
2008/09/17
[ "https://Stackoverflow.com/questions/88711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2670/" ]
88,717
<p>I want to load one or more DLLs dynamically so that they run with a different security or basepath than my main application. How do I load these DLLs into a separate AppDomain and instantiate objects from them?</p>
[ { "answer_id": 93045, "author": "Jon Turner", "author_id": 16979, "author_profile": "https://Stackoverflow.com/users/16979", "pm_score": 6, "selected": true, "text": "AppDomain domain = AppDomain.CreateDomain(\"New domain name\");\n//Do other things to the domain like set the security po...
2008/09/17
[ "https://Stackoverflow.com/questions/88717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16979/" ]
88,743
<p>I'm using jmockit for unit testing (with TestNG), and I'm having trouble using the Expectations class to mock out a method that takes a primitive type (boolean) as a parameter, using a matcher. Here's some sample code that illustrates the problem.</p> <pre><code>/******************************************************/ import static org.hamcrest.Matchers.is; import mockit.Expectations; import org.testng.annotations.Test; public class PrimitiveMatcherTest { private MyClass obj; @Test public void testPrimitiveMatcher() { new Expectations(true) { MyClass c; { obj = c; invokeReturning(c.getFoo(with(is(false))), "bas"); } }; assert "bas".equals(obj.getFoo(false)); Expectations.assertSatisfied(); } public static class MyClass { public String getFoo(boolean arg) { if (arg) { return "foo"; } else { return "bar"; } } } } /******************************************************/ </code></pre> <p>The line containing the call to invokeReturning(...) throws a NullPointerException.</p> <p>If I change this call to not use a matcher, as in:</p> <pre><code>invokeReturning(c.getFoo(false), "bas"); </code></pre> <p>it works just fine. This is no good for me, because in my real code I'm actually mocking a multi-parameter method and I need to use a matcher on another argument. In this case, the Expectations class requires that <strong>all</strong> arguments use a matcher.</p> <p>I'm pretty sure this is a bug, or perhaps it's not possible to use Matchers with primitive types (that would make me sad). Has anyone encountered this issue, and know how to get around it?</p>
[ { "answer_id": 90136, "author": "Kris Pruden", "author_id": 16977, "author_profile": "https://Stackoverflow.com/users/16977", "pm_score": 3, "selected": true, "text": " protected final <T> T with(Matcher<T> argumentMatcher)\n {\n argMatchers.add(argumentMatcher);\n\n TypeVa...
2008/09/17
[ "https://Stackoverflow.com/questions/88743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16977/" ]
88,773
<p>There must be a generic way to transform some hierachical XML such as:</p> <pre><code>&lt;element1 A="AValue" B="BValue"&gt; &lt;element2 C="DValue" D="CValue"&gt; &lt;element3 E="EValue1" F="FValue1"/&gt; &lt;element3 E="EValue2" F="FValue2"/&gt; &lt;/element2&gt; ... &lt;/element1&gt; </code></pre> <p>into the flattened XML (html) picking up selected attributes along the way and providing different labels for the attributes that become column headers.</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;th&gt;A_Label&lt;/th&gt; &lt;th&gt;D_Label&lt;/th&gt; &lt;th&gt;E_Label&lt;/th&gt; &lt;th&gt;F_Label&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;AValue&lt;/td&gt; &lt;td&gt;DValue&lt;/td&gt; &lt;td&gt;EValue1&lt;/td&gt; &lt;td&gt;FValue1&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;AValue&lt;/td&gt; &lt;td&gt;DValue&lt;/td&gt; &lt;td&gt;EValue2&lt;/td&gt; &lt;td&gt;FValue2&lt;/td&gt; &lt;/tr&gt; &lt;table&gt; </code></pre> <p>OK, so there's not generic solution due to the attribute re-labelling but you get what I mean hopefully. I've just started on all the XSLT/XPATH stuff so I'll work it out in good time but any clues would be useful.</p>
[ { "answer_id": 88875, "author": "Darrel Miller", "author_id": 6819, "author_profile": "https://Stackoverflow.com/users/6819", "pm_score": 4, "selected": true, "text": "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n xmlns:msxsl=\"urn:schemas-micros...
2008/09/17
[ "https://Stackoverflow.com/questions/88773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
88,775
<p>I work at a college and have been developing an ASP.NET site with many, many reports about students, attendance stats... The basis for the data is an MSSQL server DB which is the back end to our student management system. This has a regular maintenance period on Thursday mornings for an unknown length of time (dependent on what has to be done). </p> <p>Most of the staff are aware of this but the less regular users seem to be forever ringing me up. What is the easiest way to disable the site during maintenance obviously I can just try a DB query to test if it is up but am unsure of the best way to for instance redirect all users to a "The website is down for maintenance" message, bearing in mind they could have started a session prior to the website going down.</p> <p>Hopefully, something can be implemented globally rather than per page.</p>
[ { "answer_id": 88854, "author": "Matt Blaine", "author_id": 16272, "author_profile": "https://Stackoverflow.com/users/16272", "pm_score": 1, "selected": false, "text": "protected void Application_Error(object sender, EventArgs e)\n{\n Exception e = Server.GetLastError().GetBaseExcepti...
2008/09/17
[ "https://Stackoverflow.com/questions/88775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16989/" ]
88,791
<p>I was wondering what people thought of using properties as object initializers in C#. For some reason it seems to break the fundamentals of what constructors are used for.</p> <p>An example...</p> <pre><code>public class Person { string firstName; string lastName; public string FirstName { get { return firstName; } set { firstName = value; } } public string LastName { get { return lastName; } set { lastName= value; } } } </code></pre> <p>Then doing object intialization with.....</p> <pre><code>Person p = new Person{ FirstName = "Joe", LastName = "Smith" }; Person p = new Person{ FirstName = "Joe" }; </code></pre>
[ { "answer_id": 88807, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 4, "selected": true, "text": "Person _p$1 = new Person();\n_p$1.FirstName = \"Joe\";\n_p$1.LastName = \"Smith\";\nPerson p = _p$1;\n" }, { "a...
2008/09/17
[ "https://Stackoverflow.com/questions/88791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342514/" ]
88,800
<p>How can I restore a mysql database that was dropped using a "drop database" command? I have access to binary logs which should make this type of rollback possible.</p>
[ { "answer_id": 28412669, "author": "melloc", "author_id": 2817739, "author_profile": "https://Stackoverflow.com/users/2817739", "pm_score": 0, "selected": false, "text": "drop database" } ]
2008/09/17
[ "https://Stackoverflow.com/questions/88800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17002/" ]
88,831
<p>Anyone has ever programmed a PHP (or Perl) function to get the ceiling value Excel style?</p>
[ { "answer_id": 88888, "author": "Jacob", "author_id": 8119, "author_profile": "https://Stackoverflow.com/users/8119", "pm_score": 3, "selected": false, "text": "function excel_ceil($num){\n return ($num>0)?ceil($num):floor($num);\n}\n" }, { "answer_id": 10091498, "author":...
2008/09/18
[ "https://Stackoverflow.com/questions/88831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
88,838
<p>In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions?</p>
[ { "answer_id": 88847, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 4, "selected": false, "text": "String original = \"hello world\";\nbyte[] utf8Bytes = original.getBytes(\"UTF-8\");\n" }, { "answer_id": 8886...
2008/09/18
[ "https://Stackoverflow.com/questions/88838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14570/" ]
88,850
<p>Is there a polynomial time algorithm for finding a Hamiltonian walk in a graph?</p> <p>My algorithm is N factorial and is really slow.</p>
[ { "answer_id": 3949267, "author": "user477959", "author_id": 477959, "author_profile": "https://Stackoverflow.com/users/477959", "pm_score": 1, "selected": false, "text": "SR={ x : R(x) ≠ ∅ }" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/88850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13813/" ]
88,904
<p>We're working on a very large .NET WinForms composite application - not CAB, but a similar home grown framework. We're running in a Citrix and RDP environment running on Windows Server 2003. </p> <p>We're starting to run into random and difficult to reproduct "Error creating window handle" error that seems to be an old fashion handle leak in our application. We're making heavy use of 3rd Party controls (Janus GridEX, Infralution VirtualTree, and .NET Magic docking) and we do a lot of dynamic loading and rendering of content based on metadata in our database.</p> <p>There's a lot of info on Google about this error, but not a lot of solid guidance about how to avoid issues in this area.</p> <p>Does the stackoverflow community have any good guidance for me for building handle-friendly winforms apps?</p>
[ { "answer_id": 39303696, "author": "Sudhakar Mallu", "author_id": 6789962, "author_profile": "https://Stackoverflow.com/users/6789962", "pm_score": 2, "selected": false, "text": "For k = 1 To Panel.Controls.Count\n Panel.Controls.Item(0).Dispose()\nNext\n" }, { "answer_id": 39...
2008/09/18
[ "https://Stackoverflow.com/questions/88904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8133/" ]
88,918
<p>This is my first experience using the Zend Framework. I am attempting to follow the <a href="http://framework.zend.com/docs/quickstart/introduction" rel="nofollow noreferrer">Quick Start</a> tutorial. Everything was working as expected until I reached the section on the <a href="http://framework.zend.com/docs/quickstart/create-an-error-controller-and-view" rel="nofollow noreferrer">Error Controller and View</a>. When I navigate to a page that does not exist, instead of receiving the error page I get the Fatal Error screen dump (in all it's glory):</p> <blockquote> <p>Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /home/.fantasia/bcnewman/foo.com/library/Zend/Controller/Dispatcher/Standard.php:249 Stack trace: #0 /home/.fantasia/bcnewman/foo.com/library/Zend/Controller/Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /home/.fantasia/bcnewman/foo.com/public/index.php(42): Zend_Controller_Front->dispatch() #2 {main} thrown in /home/.fantasia/bcnewman/foo.com/library/Zend/Controller/Dispatcher/Standard.php on line 249</p> </blockquote> <p>I do not believe this is caused by a syntax error on my part (a copied and pasted the example file's content from the tutorial) and I believe I have the application directory structure correct:</p> <pre><code>./application ./application/controllers ./application/controllers/IndexController.php ./application/controllers/ErrorHandler.php ./application/views ./application/views/scripts ./application/views/scripts/index ./application/views/scripts/index/index.phtml ./application/views/scripts/error ./application/views/scripts/error/error.phtml ./application/bootstrap.php ./public ./public/index.php </code></pre> <p>And finally, the <code>IndexController</code> and <code>index.phtml</code> view does work.</p>
[ { "answer_id": 89347, "author": "dragonmantank", "author_id": 204, "author_profile": "https://Stackoverflow.com/users/204", "pm_score": 2, "selected": false, "text": "$frontController->throwExceptions(true);\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/88918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3210/" ]
88,929
<p>Is there a command that would allow me to check if the string <code>"xyz"</code> was ever in file <code>foo.c</code> in the repository and print which revisions they were found in? </p>
[ { "answer_id": 89008, "author": "CaptainPicard", "author_id": 15203, "author_profile": "https://Stackoverflow.com/users/15203", "pm_score": 6, "selected": true, "text": "git log -Sxyz foo.c\n" }, { "answer_id": 51486627, "author": "Nwyfiant", "author_id": 9020923, "au...
2008/09/18
[ "https://Stackoverflow.com/questions/88929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
88,931
<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 have this happen automatically in vim? I've seen the align plugin for lining equal signs (in assignment statements) and such, but I'm not sure if it can be made to solve this problem?</p>
[ { "answer_id": 89119, "author": "solinent", "author_id": 13852, "author_profile": "https://Stackoverflow.com/users/13852", "pm_score": 3, "selected": false, "text": ":set cino=(0\n" }, { "answer_id": 89169, "author": "rampion", "author_id": 9859, "author_profile": "ht...
2008/09/18
[ "https://Stackoverflow.com/questions/88931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7706/" ]
88,957
<p>When <code>{0}</code> is used to initialize an object, what does it mean? I can't find any references to <code>{0}</code> anywhere, and because of the curly braces Google searches are not helpful.</p> <p>Example code:</p> <pre><code>SHELLEXECUTEINFO sexi = {0}; // what does this do? sexi.cbSize = sizeof(SHELLEXECUTEINFO); sexi.hwnd = NULL; sexi.fMask = SEE_MASK_NOCLOSEPROCESS; sexi.lpFile = lpFile.c_str(); sexi.lpParameters = args; sexi.nShow = nShow; if(ShellExecuteEx(&amp;sexi)) { DWORD wait = WaitForSingleObject(sexi.hProcess, INFINITE); if(wait == WAIT_OBJECT_0) GetExitCodeProcess(sexi.hProcess, &amp;returnCode); } </code></pre> <p>Without it, the above code will crash on runtime.</p>
[ { "answer_id": 88960, "author": "Don Neufeld", "author_id": 13097, "author_profile": "https://Stackoverflow.com/users/13097", "pm_score": 9, "selected": true, "text": "{0}" }, { "answer_id": 89093, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https:/...
2008/09/18
[ "https://Stackoverflow.com/questions/88957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17027/" ]
88,971
<p>I'm building a toy database in C# to learn more about compiler, optimizer, and indexing technology.</p> <p>I want to maintain maximum parallelism between (at least read) requests for bringing pages into the buffer pool, but I am confused about how best to accomplish this in .NET.</p> <p>Here are some options and the problems I've come across with each:</p> <ol> <li><p>Use <code>System.IO.FileStream</code> and the <code>BeginRead</code> method</p> <p>But, the position in the file isn't an argument to <code>BeginRead</code>, it is a property of the <code>FileStream</code> (set via the <code>Seek</code> method), so I can only issue one request at a time and have to lock the stream for the duration. (Or do I? The documentation is unclear on what would happen if I held the lock only between the <code>Seek</code> and <code>BeginRead</code> calls but released it before calling <code>EndRead</code>. Does anyone know?) I know how to do this, I'm just not sure it is the best way.</p> </li> <li><p>There seems to be another way, centered around the <code>System.Threading.Overlapped</code> structure and P\Invoke to the <code>ReadFileEx</code> function in kernel32.dll.</p> <p>Unfortunately, there is a dearth of samples, especially in managed languages. This route (if it can be made to work at all) apparently also involves the <code>ThreadPool.BindHandle</code> method and the IO completion threads in the thread pool. I get the impression that this is the sanctioned way of dealing with this scenario under windows, but I don't understand it and I can't find an entry point to the documentation that is helpful to the uninitiated.</p> </li> <li><p>Something else?</p> </li> <li><p>In a comment, jacob suggests creating a new <code>FileStream</code> for each read in flight.</p> </li> <li><p>Read the whole file into memory.</p> <p>This would work if the database was small. The codebase is small, and there are plenty of other inefficiencies, but the database itself isn't. I also want to be sure I am doing all the bookkeeping needed to deal with a large database (which turns out to be a huge part of the complexity: paging, external sorting, ...) and I'm worried it might be too easy to accidentally cheat.</p> </li> </ol> <p><strong>Edit</strong></p> <p>Clarification of why I'm suspicious with solution 1: holding a single lock all the way from BeginRead to EndRead means I need to block anyone who wants to initiate a read just because another read is in progress. That feels wrong, because the thread initiating the new read might be able (in general) to do some more work before the results become available. (Actually, just writing this has led me to think up a new solution, I put as a new answer.)</p>
[ { "answer_id": 89123, "author": "Doug McClean", "author_id": 11173, "author_profile": "https://Stackoverflow.com/users/11173", "pm_score": 0, "selected": false, "text": "Seek" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/88971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11173/" ]
88,991
<p>I do not mean the compile errors because I made a syntax mistake or whatever. In C++ we can create compile time errors based on conditions as in the following example:</p> <pre><code>template&lt;int&gt; struct CompileTimeError; template&lt;&gt; struct CompileTimeError&lt;true&gt; {}; #define STATIC_CHECK(expr, msg) { CompileTimeError&lt;((expr) != 0)&gt; ERROR_##msg; (void)ERROR_##msg; } int main(int argc, char* argv[]) { STATIC_CHECK(false, Compile_Time_Failure); return 0; } </code></pre> <p>In VS 2005 this will output:</p> <pre><code>------ Build started: Project: Test, Configuration: Debug Win32 ------ Compiling... Test.cpp f:\temp\test\test\test.cpp(17) : error C2079: 'ERROR_Compile_Time_Failure' uses undefined struct 'CompileTimeError&lt;__formal&gt;' with [ __formal=0 ] Build log was saved at "file://f:\temp\Test\Test\Debug\BuildLog.htm" Test - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== </code></pre> <p>Is there any way to achieve this in Java?</p>
[ { "answer_id": 90563, "author": "Matt Quail", "author_id": 15790, "author_profile": "https://Stackoverflow.com/users/15790", "pm_score": 3, "selected": true, "text": "@MyStaticCheck(false, \"Compile Time Error, kind-of\")\npublic static void main(String[] args) {\n return;\n}\n" }, ...
2008/09/18
[ "https://Stackoverflow.com/questions/88991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6508/" ]
89,051
<p>What I'd like to know is if there is a nice way to queue jQuery functions to execute after a set amount of time. This wouldn't pause the execution of other functions, just the ones following in the chain. Perhaps an example of what I'd envisage it would look like would illustrate:</p> <pre><code>$('#alert') .show() .wait(5000) // &lt;-- this bit .hide() ; </code></pre> <p>I know that it's possible by using timeouts, but it seems like that's a messy way to do it, especially compared to the above example (if it were real).</p> <p>So, is something like this already built-in to jQuery, and if not, what is the best way to emulate it?</p>
[ { "answer_id": 89076, "author": "Prestaul", "author_id": 5628, "author_profile": "https://Stackoverflow.com/users/5628", "pm_score": 4, "selected": true, "text": "var el = $('#alert');\nel.show()\nsetTimeout(function() { el.hide() }, 5000);\n" }, { "answer_id": 89792, "author...
2008/09/18
[ "https://Stackoverflow.com/questions/89051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
89,056
<p>I have heard of some methods, but none of them have stuck. Personally I try to avoid complex types in C and try to break them into component typedef.</p> <p>I'm now faced with maintaining some legacy code from a so called 'three star programmer', and I'm having a hard time reading some of the ***code[][].</p> <p>How do you read complex C declarations? </p>
[ { "answer_id": 89100, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 5, "selected": false, "text": "cdecl" }, { "answer_id": 90549, "author": "Friedrich", "author_id": 15068, "author_profile": "htt...
2008/09/18
[ "https://Stackoverflow.com/questions/89056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4319/" ]
89,112
<p>What are the steps and techniques to debug an apparent hang due to a deadlock in a Win32 production process. I heard that WinDbg can be used for this purpose but could you please provide clear hints on how this can be accomplished?</p>
[ { "answer_id": 89164, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 2, "selected": false, "text": "WaitForSingleObject" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6508/" ]
89,118
<p>I am getting an 403 access forbidden when attempting to open a page under a vhost where the document root is sitting on a different drive than where apache is sitting. I installed using the apachefriends release. This is my httpd-vhosts.conf file: </p> <p><pre><code> NameVirtualHost 127.0.0.1</p> <p>&lt;VirtualHost 127.0.0.1> ServerName foo.localhost DocumentRoot "C:/xampp/htdocs/foo/public" &lt;/VirtualHost></p> <p>&lt;VirtualHost 127.0.0.1> ServerName bar.localhost DocumentRoot "F:/bar/public" &lt;/VirtualHost> </pre></code></p> <p>When opening bar.localhost in my browser, Apache is giving me 403 Access Forbidden. I tried setting lots of different access rights, even full rights to everyone, but nothing I tried helped.</p> <p>Edit: Thanks! For future reference, add 'Options indexes' within to show directory indexes.</p>
[ { "answer_id": 91885, "author": "Mark Embling", "author_id": 6844, "author_profile": "https://Stackoverflow.com/users/6844", "pm_score": 6, "selected": false, "text": "<Directory \"F:/bar/public\">\n Order Allow,Deny\n Allow from All\n # Any other directory-specific stuff\n</Dir...
2008/09/18
[ "https://Stackoverflow.com/questions/89118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6752/" ]
89,154
<pre><code>boolean a = false, b = true; if ( a &amp;&amp; b ) { ... }; </code></pre> <p>In most languages, <code>b</code> will not get evaluated because <code>a</code> is false so <code>a &amp;&amp; b</code> cannot be true. My question is, wouldn't short circuiting be slower in terms of architecture? In a pipeline, do you just stall while waiting to get the result of a to determine if b should be evaluated or not? Would it be better to do nested ifs instead? Does that even help?</p> <p>Also, does anyone know what short-circuit evaluation is typically called? This question arose after I found out that my programming friend had never heard of short-circuit evaluation and stated that it is not common, nor found in many languages, and is inefficient in pipeline. I am not certain about the last one, so asking you folks!</p> <p>Okay, I think a different example to perhaps explain where my friend might be coming from. He believes that since evaluating a statement like the following in parallel:</p> <pre><code>(a) if ( ( a != null ) &amp;&amp; ( a.equals(b) ) ) { ... } </code></pre> <p>will crash the system, an architecture that doesn't have short-circuiting (and thereby not allowing statements like the above) would be faster in processing statements like these:</p> <pre><code>(b) if ( ( a == 4 ) &amp;&amp; ( b == 5 ) ) </code></pre> <p>since if it couldn't do (a) in parallel, it can't do (b) in parallel. In this case, a language that allows short-circuiting is slower than one that does not.</p> <p>I don't know if that's true or not.</p> <p>Thanks</p>
[ { "answer_id": 89179, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 3, "selected": false, "text": "if ( ConfirmAction() && DestroyAllData() )\n Reboot();\n" }, { "answer_id": 89180, "author": "scubabbl", "autho...
2008/09/18
[ "https://Stackoverflow.com/questions/89154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12682/" ]
89,178
<p>For example:</p> <pre><code>&gt;&gt;&gt; x = [1, 1, 2, 'a', 'a', 3] &gt;&gt;&gt; unique(x) [1, 2, 'a', 3] </code></pre> <p>Assume list elements are hashable.</p> <p><strong>Clarification:</strong> The result should keep the first duplicate in the list. For example, [1, 2, 3, 2, 3, 1] becomes [1, 2, 3].</p>
[ { "answer_id": 89198, "author": "Matthew Schinckel", "author_id": 188, "author_profile": "https://Stackoverflow.com/users/188", "pm_score": -1, "selected": false, "text": "x = [1, 1, 2, 'a', 'a', 3]\ny = []\nfor each in x:\n if each not in y:\n y.append(each)\n" }, { "a...
2008/09/18
[ "https://Stackoverflow.com/questions/89178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16976/" ]
89,181
<p>How do i check out a specific directory from CVS and omit the tree leading up to that directory?</p> <p>EX. </p> <p>Id like to checkout to this directory C:/WebHost/MyWebApp/www</p> <p>My CVS Project directory structure is MyWebApp/Trunk/www</p> <p>How do i omit the Trunk and MyWebApp directories?</p>
[ { "answer_id": 89269, "author": "Alex M", "author_id": 9652, "author_profile": "https://Stackoverflow.com/users/9652", "pm_score": 6, "selected": true, "text": "-d/cvsroot checkout -d directory project/path/directory" }, { "answer_id": 89299, "author": "Orion Edwards", "a...
2008/09/18
[ "https://Stackoverflow.com/questions/89181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16703/" ]
89,188
<p>Is it possible to get the x,y coordinates of a Flex app within an HTML page? I know you can use ExternalInterface.ObjecID to get the "id attribute of the object tag in Internet Explorer, or the name attribute of the embed tag in Netscape" but I can't seem to get past that step. It seems like it should be possible to get a handle on that embed object. Any suggestions? </p> <p>Thanks.</p>
[ { "answer_id": 91732, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 3, "selected": true, "text": "var jsCode : String = \"function( id ) { return $('#' + id).offset(); }\";\n\nvar offset : Object = ExternalInterface.call(jsCode...
2008/09/18
[ "https://Stackoverflow.com/questions/89188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15899/" ]
89,193
<p>Speaking as a non-C# savvy programmer, I'm curious as to the evaluation semantics of LINQ queries like the following:</p> <pre><code>var people = from p in Person where p.age &lt; 18 select p var otherPeople = from p in people where p.firstName equals "Daniel" select p </code></pre> <p>Assuming that <code>Person</code> is an ADO entity which defines the <code>age</code> and <code>firstName</code> fields, what would this do from a database standpoint? Specifically, would the <code>people</code> query be run to produce an in-memory structure, which would then be queried by the <code>otherPeople</code> query? Or would the construction of <code>otherPeople</code> merely pull the data regarding the query from <code>people</code> and then produce a new database-peered query? So, if I iterated over both of these queries, how many SQL statements would be executed?</p>
[ { "answer_id": 89211, "author": "David Thibault", "author_id": 5903, "author_profile": "https://Stackoverflow.com/users/5903", "pm_score": 1, "selected": false, "text": "people" }, { "answer_id": 89982, "author": "Ant", "author_id": 3709, "author_profile": "https://St...
2008/09/18
[ "https://Stackoverflow.com/questions/89193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9815/" ]
89,203
<p>What is the difference in C# between <code>Convert.ToDecimal(string)</code> and <code>Decimal.Parse(string)</code>?</p> <p>In what scenarios would you use one over the other?</p> <p>What impact does it have on performance?</p> <p>What other factors should I be taking into consideration when choosing between the two?</p>
[ { "answer_id": 89231, "author": "dimarzionist", "author_id": 10778, "author_profile": "https://Stackoverflow.com/users/10778", "pm_score": 2, "selected": false, "text": "TryParse()" }, { "answer_id": 89235, "author": "David J. Sokol", "author_id": 1390, "author_profil...
2008/09/18
[ "https://Stackoverflow.com/questions/89203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3821/" ]
89,212
<p>I'm familiar with object-oriented architecture, including use of design patterns and class diagrams for visualization, and I know of service-oriented architecture with its contracts and protocol bindings, but <strong>is there anything characteristic about a software architecture for a system written in a functional programming language?</strong></p> <p>I know that FP has been used for medium-size to large scale projects. Paul Graham wrote the first incarnation of Yahoo! Store in Common Lisp. Some lisp development systems are complex. Artifical intelligence and financial systems written in functional languages can get pretty big. They all have at least some kind of inherent architecture, though, I'm wondering if they have anything in common?</p> <p>What does an architecture based on the evaluation of expressions look like? Are FP architectures more composable?</p> <p><strong>Update:</strong> Kyle reminded me that <a href="http://mitpress.mit.edu/sicp/" rel="noreferrer">SICP</a> is a good resource for this subject.</p> <p><strong>Update 2:</strong> I found a good post on the subject: <em><a href="http://lorgonblog.spaces.live.com/Blog/cns!701679AD17B6D310!511.entry" rel="noreferrer">How does functional programming affect the structure of your code?</a></em></p>
[ { "answer_id": 89276, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 2, "selected": false, "text": "(define (make-counter)\n (let ((count 0))\n (lambda ()\n (set! count (+ count 1))\n count)))\n\n(define x (ma...
2008/09/18
[ "https://Stackoverflow.com/questions/89212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1659/" ]
89,228
<p>How do I call an external command within Python as if I'd typed it in a shell or command prompt?</p>
[ { "answer_id": 89237, "author": "nimish", "author_id": 3926, "author_profile": "https://Stackoverflow.com/users/3926", "pm_score": 8, "selected": false, "text": "import os\nos.system(\"your command\")\n" }, { "answer_id": 89238, "author": "Alexandra Franks", "author_id": ...
2008/09/18
[ "https://Stackoverflow.com/questions/89228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17085/" ]
89,233
<p>Using Windows Server 2003 in a multi-user environment (via Remote Desktop, using it as an application server), how to mount a (preferably encrypted) volume in a way, that won't show up on any other user's desktop?</p> <p>Tried, and failed approaches:</p> <ul> <li><p>tweaking user rights -display of mounted volume can not be changed.</p></li> <li><p>Bestcrypt / truecrypt. Both of them displays the volume for a local administrator</p></li> </ul>
[ { "answer_id": 89249, "author": "Robit", "author_id": 17026, "author_profile": "https://Stackoverflow.com/users/17026", "pm_score": 0, "selected": false, "text": "A 1 00 00 00\nB 2 00 00 00\nC 4 00 00 00\nD 8 00 00 00\nE 16 00 00 00\nF 32 00 00 00\nG 64 00 00 00\nH 128 00 00 00\nI 00 1 0...
2008/09/18
[ "https://Stackoverflow.com/questions/89233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9440/" ]
89,245
<p>Suppose a large composite application built on several foundation components packaged in their own assemblies: (database reading, protocol handlers, etc.). For some deployments, this can include over 20 assemblies. Each of these assemblies has settings or configuration information. Our team tends to like the VS settings editor (and the easy-to-use code it generates!), and the application vs. user distinction meets most of our needs.</p> <p>BUT....</p> <p>It is very tedious to copy &amp; paste the many configuration sections into our application's .xml. Furthermore, for shared components that tend to have similar configurations across applications, this means we need to maintain duplicate settings in multiple .config files.</p> <p>Microsoft's EntLib solves this problem with an external tool to generate the monster .config file, but this feels klunky as well.</p> <p>What techniques do you use to manage large .NET .config files with sections from multiple shared assemblies? Some kind of include mechanism? Custom configuration readers?</p> <p>FOLLOWUP:</p> <p>Will's <a href="https://stackoverflow.com/questions/89245/how-do-you-manage-net-appconfig-files-for-large-applications#89618">answer</a> was exactly what I was getting at, and looks elegant for flat key/value pair sections. Is there a way to combine this approach with <a href="https://stackoverflow.com/questions/89245/how-do-you-manage-net-appconfig-files-for-large-applications#89618">custom configuration sections</a> ? </p> <p>Thanks also for the suggestions about managing different .configs for different build targets. That's also quite useful.</p> <p>Dave </p>
[ { "answer_id": 89261, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 5, "selected": true, "text": "<pages configSource=\"pages.config\"/>\n" }, { "answer_id": 90118, "author": "sontek", "author_id": 17176, "...
2008/09/18
[ "https://Stackoverflow.com/questions/89245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6996/" ]
89,246
<p>I’m trying to run this SQL using get external.</p> <p>It works, but when I try to rename the sub-queries or anything for that matter it remove it.</p> <p>I tried <code>as</code>, <code>as</code> and the name in <code>''</code>, <code>as</code> then the name in <code>""</code>, and the same with space. What is the right way to do that? </p> <p>Relevant SQL:</p> <pre><code>SELECT list_name, app_name, (SELECT fname + ' ' + lname FROM dbo.d_agent_define map WHERE map.agent_id = tac.agent_id) as agent_login, input, CONVERT(varchar,DATEADD(ss,TAC_BEG_tstamp,'01/01/1970')) FROM dbo.maps_report_list list JOIN dbo.report_tac_agent tac ON (tac.list_id = list.list_id) WHERE input = 'SYS_ERR' AND app_name = 'CHARLOTT' AND convert(VARCHAR,DATEADD(ss,day_tstamp,'01/01/1970'),101) = '09/10/2008' AND list_name LIKE 'NRBAD%' ORDER BY agent_login,CONVERT(VARCHAR,DATEADD(ss,TAC_BEG_tstamp,'01/01/1970')) </code></pre>
[ { "answer_id": 89314, "author": "jttraino", "author_id": 3203, "author_profile": "https://Stackoverflow.com/users/3203", "pm_score": 1, "selected": false, "text": "dbo.d_agent_define" }, { "answer_id": 89450, "author": "Brettski", "author_id": 5836, "author_profile": ...
2008/09/18
[ "https://Stackoverflow.com/questions/89246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13122/" ]
89,257
<p>I've run into what appears to be a variable scope issue I haven't encountered before. I'm using Perl's CGI module and a call to DBI's do() method. Here's the code structure, simplified a bit:</p> <pre><code>use DBI; use CGI qw(:cgi-lib); &amp;ReadParse; my $dbh = DBI-&gt;connect(...............); my $test = $in{test}; $dbh-&gt;do(qq{INSERT INTO events VALUES (?,?,?)},undef,$in{test},"$in{test}",$test); </code></pre> <p>The #1 placeholder variable evaluates as if it is uninitialized. The other two placeholder variables work.</p> <p><strong>The question: Why is the %in hash not available within the context of do(), unless I wrap it in double quotes (#2 placeholder) or reassign the value to a new variable (#3 placeholder)?</strong></p> <p>I think it's something to do with how the CGI module's ReadParse() function assigns scope to the %in hash, but I don't know Perl scoping well enough to understand why %in is available at the top level but not from within my do() statement.</p> <p>If someone does understand the scoping issue, is there a better way to handle it? Wrapping all the %in references in double quotes seems a little messy. Creating new variables for each query parameter isn't realistic.</p> <p>Just to be clear, my question is about the variable scoping issue. I realize that ReadParse() isn't the recommended method to grab query params with CGI.</p> <p>I'm using Perl 5.8.8, CGI 3.20, and DBI 1.52. Thank you in advance to anyone reading this.</p> <p>@Pi &amp; @Bob, thanks for the suggestions. Pre-declaring the scope for %in has no effect (and I always use strict). The result is the same as before: in the db, col1 is null while cols 2 &amp; 3 are set to the expected value.</p> <p>For reference, here's the ReadParse function (see below). It's a standard function that's part of CGI.pm. The way I understand it, I'm not meant to initialize the %in hash (other than satisfying strict) for purposes of setting scope, since the function appears to me to handle that:</p> <pre><code>sub ReadParse { local(*in); if (@_) { *in = $_[0]; } else { my $pkg = caller(); *in=*{"${pkg}::in"}; } tie(%in,CGI); return scalar(keys %in); } </code></pre> <p>I guess my question is what is the best way to get the %in hash within the context of do()? Thanks again! I hope this is the right way to provide additional info to my original question.</p> <p>@Dan: I hear ya regarding the &amp;ReadParse syntax. I'd normally use CGI::ReadParse() but in this case I thought it was best to stick to how <a href="http://search.cpan.org/src/LDS/CGI.pm-3.42/cgi-lib_porting.html" rel="nofollow noreferrer">the CGI.pm documentation has it</a> exactly.</p>
[ { "answer_id": 89282, "author": "Alex M", "author_id": 9652, "author_profile": "https://Stackoverflow.com/users/9652", "pm_score": 2, "selected": false, "text": "use strict;" }, { "answer_id": 89573, "author": "Dan", "author_id": 17121, "author_profile": "https://Stac...
2008/09/18
[ "https://Stackoverflow.com/questions/89257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17092/" ]
89,266
<p>I'm designing a language. First, I want to decide what code to generate. The language will have lexical closures and prototype based inheritance similar to javascript. But I'm not a fan of gc and try to avoid as much as possible. So the question: Is there an elegant way to implement closures without resorting to allocate the stack frame on the heap and leave it to garbage collector?</p> <p>My first thoughts:</p> <ol> <li>Use reference counting and garbage collect the cycles (I don't really like this)</li> <li>Use spaghetti stack (looks very inefficient)</li> <li>Limit forming of closures to some contexts such a way that, I can get away with a return address stack and a locals' stack.</li> </ol> <p>I won't use a high level language or follow any call conventions, so I can smash the stack as much as I like.</p> <p>(Edit: I know reference counting is a form of garbage collection but I am using gc in its more common meaning)</p>
[ { "answer_id": 89346, "author": "Allen", "author_id": 6043, "author_profile": "https://Stackoverflow.com/users/6043", "pm_score": 4, "selected": false, "text": "gcc" }, { "answer_id": 89386, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Sta...
2008/09/18
[ "https://Stackoverflow.com/questions/89266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7988/" ]
89,275
<p>What is the best C++ IDE or editor for using on Windows? I use Notepad++, but am missing IntelliSense from Visual Studio.</p>
[ { "answer_id": 2640588, "author": "pyon", "author_id": 46571, "author_profile": "https://Stackoverflow.com/users/46571", "pm_score": 1, "selected": false, "text": "msdev.exe" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2039/" ]
89,320
<p>The scenario is this</p> <p>We have two applications A and B, both which are running in separate database (Oracle 9i ) transactions</p> <p>Application A - inserts some data into the database, then calls Application B Application B - inserts some data into the database, related (via foreign keys) to A's data. Returns an &quot;ID&quot; to Application A Application A - uses ID to insert further data, including the ID from B</p> <p>Now, because these are separate transactions, but both rely on data from each others transactions, we need to commit between the calls to each application. This of course makes it very difficult to rollback if anything goes wrong.</p> <p>How would you approach this problem, with minimal refactoring of the code. Surely this kind of this is a common problem in the SOA world?</p> <p>------ Update --------</p> <p>I have not been able to find anything in Oracle 9i, however Oracle 11g provides <a href="http://www.morganslibrary.org/reference/dbms_xa.html" rel="nofollow noreferrer">DBMS_XA</a>, which does exactly what I was after.</p>
[ { "answer_id": 89819, "author": "Brad Gilbert", "author_id": 1337, "author_profile": "https://Stackoverflow.com/users/1337", "pm_score": 0, "selected": false, "text": "App_A =={0}=> database # App_A stores information for App_B\nApp_A ------> App_B # App_A ...
2008/09/18
[ "https://Stackoverflow.com/questions/89320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3839/" ]
89,332
<p>I frequently use <code>git stash</code> and <code>git stash pop</code> to save and restore changes in my working tree. Yesterday, I had some changes in my working tree that I had stashed and popped, and then I made more changes to my working tree. I'd like to go back and review yesterday's stashed changes, but <code>git stash pop</code> appears to remove all references to the associated commit.</p> <p>I know that if I use <code>git stash</code> then <em>.git/refs/stash contains</em> the reference of the commit used to create the stash. And <em>.git/logs/refs/stash contains</em> the whole stash. But those references are gone after <code>git stash pop</code>. I know that the commit is still in my repository somewhere, but I don't know what it was.</p> <p>Is there an easy way to recover yesterday's stash commit reference?</p>
[ { "answer_id": 89388, "author": "Nathan Jones", "author_id": 5848, "author_profile": "https://Stackoverflow.com/users/5848", "pm_score": 6, "selected": false, "text": "git fsck --unreachable | grep commit" }, { "answer_id": 89394, "author": "Greg Hewgill", "author_id": 89...
2008/09/18
[ "https://Stackoverflow.com/questions/89332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/893/" ]
89,350
<p>quick question: my customer has a situation where he has his database with a varchar field and the corresponding jdbc code is storing/retrieving a boolean.</p> <p>I guess that the boolean values false and true are going to be translated to "0" and "1" but I would like to have a confirmation of this (I can't find the precise behavior specification online, maybe it depends on each driver, Oracle in this case).</p> <p>I know I could experiment by myself, but I want to have a try at stackoverflow.com!</p> <p>Thanks for your answer,</p> <p>Eric.</p>
[ { "answer_id": 89405, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 0, "selected": false, "text": "BOOLEAN" }, { "answer_id": 89533, "author": "Joe Skora", "author_id": 14057, "author_profile": "ht...
2008/09/18
[ "https://Stackoverflow.com/questions/89350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7611/" ]
89,372
<p>Has anyone been able to get a variable record length text file (CSV) into SQL Server via SSIS?</p> <p>I have tried time and again to get a CSV file into a SQL Server table, using SSIS, where the input file has varying record lengths. For this question, the two different record lengths are 63 and 326 bytes. All record lengths will be imported into the same 326 byte width table.</p> <p>There are over 1 million records to import.<br> I have no control of the creation of the import file.<br> I must use SSIS.<br> I have confirmed with MS that this has been reported as a bug. I have tried several workarounds. Most have been where I try to write custom code to intercept the record and I cant seem to get that to work as I want.</p>
[ { "answer_id": 9721041, "author": "Chris H", "author_id": 1271693, "author_profile": "https://Stackoverflow.com/users/1271693", "pm_score": 1, "selected": false, "text": "1" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14728/" ]
89,387
<p>Since Rails is not multithreaded (yet), it seems like a threaded web framework would be a better choice for a Facebook application. (reason being is cuz each Rails process can only handle one request at a time, and facebook actions tend to be slow, because there is a lot of network communication between your app and facebook)</p> <p>Has anyone used Merb to write a Facebook application? Is there a port of Facebooker (the Facebook plugin for Rails) to Merb?</p>
[ { "answer_id": 90716, "author": "Zach", "author_id": 9128, "author_profile": "https://Stackoverflow.com/users/9128", "pm_score": 2, "selected": false, "text": "gem install facebooker\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17076/" ]
89,402
<p>I need a very fast algorithm for the following task. I have already implemented several algorithms that complete it, but they're all too slow for the performance I need. It should be fast enough that the algorithm can be run at least 100,000 times a second on a modern CPU. It will be implemented in C++.</p> <p>I am working with spans/ranges, a structure that has a start and an end coordinate on a line.</p> <p>I have two vectors (dynamic arrays) of spans and I need to merge them. One vector is src and the other dst. The vectors are sorted by span start coordinates, and the spans do not overlap within one vector.</p> <p>The spans in the src vector must be merged with the spans in the dst vector, such that the resulting vector is still sorted and has no overlaps. Ie. if overlaps are detected during the merging, the two spans are merged into one. (Merging two spans is just a matter of changing the coordinates in the structure.)</p> <p>Now, there is one more catch, the spans in the src vector must be "widened" during the merge. This means that a constant will be added to the start and another (larger) constant to the end coordinate of every span in src. This means that after the src spans are widened they might overlap.</p> <hr> <p>What I have arrived at so far is that it cannot be done fully in-place, some kind of temporary storage is needed. I think it should be doable in linear time over the number of elements of src and dst summed.</p> <p>Any temporary storage can probably be shared between multiple runs of the algorithm.</p> <p>The two primary approaches I have tried, which are too slow, are:</p> <ol> <li><p>Append all elements of src to dst, widening each element before appending it. Then run an in-place sort. Finally iterate over the resulting vector using a "read" and "write" pointer, with the read pointer running ahead of the write pointer, merging spans as they go. When all elements have been merged (the read pointer reaches end) dst is truncated.</p></li> <li><p>Create a temporary work-vector. Do a naive merge as described above by repeatedly picking the next element from either src or dst and merging into the work-vector. When done, copy the work-vector to dst, replacing it.</p></li> </ol> <p>The first method has the problem that sorting is O((m+n)*log(m+n)) instead of O(m+n) and has somewhat overhead. It also means the dst vector has to grow much larger than it really needs.</p> <p>The second has the primary problem of a lot of copying around and again allocation/deallocation of memory.</p> <p>The data structures used for storing/managing the spans/vectors can be altered if you think that's needed.</p> <p>Update: Forgot to say how large the datasets are. The most common cases are between 4 and 30 elements in either vector, and either dst is empty or there is a large amount of overlap between the spans in src and dst.</p>
[ { "answer_id": 89424, "author": "Dark Shikari", "author_id": 11206, "author_profile": "https://Stackoverflow.com/users/11206", "pm_score": 0, "selected": false, "text": "if(src1[x] < src2[x])\n dst[x] = src1[x];\nelse\n dst[x] = src2[x];\n" }, { "answer_id": 89688, "aut...
2008/09/18
[ "https://Stackoverflow.com/questions/89402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6223/" ]
89,418
<p>Assume I have an "images" folder directory under the root of my application. How can I, from within a .css file, reference an image in this directory using an ASP.NET app relative path. </p> <p>Example:</p> <p>When in development, the path of <strong>~/Images/Test.gif</strong> might resolve to <strong>/MyApp/Images/Test.gif</strong> while, in production, it might resolve to <strong>/Images/Test.gif</strong> (depending on the virtual directory for the application). I, obviously, want to avoid having to modify the .css file between environments.</p> <p>I know you can use Page.ResolveClientUrl to inject a url into a control's Style collection dynamically at render time. I would like to avoid doing this.</p>
[ { "answer_id": 89431, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 3, "selected": false, "text": "background-image: url(../images/test.gif);\n" }, { "answer_id": 442383, "author": "Marcel Popescu", "a...
2008/09/18
[ "https://Stackoverflow.com/questions/89418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10834/" ]
89,441
<p>I have Visual Studio web test attached nicely to a data source, but I need to be able to iterate over each entry in the data source. How should I do this?</p>
[ { "answer_id": 89492, "author": "Ola Karlsson", "author_id": 10696, "author_profile": "https://Stackoverflow.com/users/10696", "pm_score": 2, "selected": true, "text": "[DataSource(\"System.Data.SqlClient\",\n \"Data Source=VSTS;Initial Catalog=ContactManagerWebTest;\n Integrated S...
2008/09/18
[ "https://Stackoverflow.com/questions/89441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13813/" ]
89,465
<p>Currently, WScript pops up message box when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box. </p> <p>What I'd like is for the error message to be dumped to STDOUT, and execution to return the calling process. Popping as a MSGBox just hangs the entire thing.</p> <p>Ideas?</p>
[ { "answer_id": 89804, "author": "Jay Michaud", "author_id": 8613, "author_profile": "https://Stackoverflow.com/users/8613", "pm_score": 2, "selected": false, "text": "cscript //?" }, { "answer_id": 96124, "author": "aphoria", "author_id": 2441, "author_profile": "http...
2008/09/18
[ "https://Stackoverflow.com/questions/89465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
89,480
<p>For reasons I won't go into, I wish to ban an entire company from accessing my web site. Checking the remote hostname in php using gethostbyaddr() works, but this slows down the page load too much. Large organizations (eg. hp.com or microsoft.com) often have blocks of IP addresses. Is there anyway I get the full list, or am I stuck with the slow reverse-DNS lookup? If so, can I speed it up?</p> <p>Edit: Okay, now I know I can use the .htaccess file to ban a range. Now, how can I figure out what that range should be for a given organization?</p>
[ { "answer_id": 89495, "author": "UnkwnTech", "author_id": 115, "author_profile": "https://Stackoverflow.com/users/115", "pm_score": 5, "selected": true, "text": "Deny from x.x.x.x\n" }, { "answer_id": 89522, "author": "John Millikin", "author_id": 3560, "author_profil...
2008/09/18
[ "https://Stackoverflow.com/questions/89480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15947/" ]
89,487
<p>I suppose it allows for moving changes from one branch to the next but that's what cherry picking is for and if you're not making a commit of your changes, perhaps you shouldn't be moving them around?</p> <p>I have on occasion applied the wrong stash at the wrong branch, which left me wondering about this question.</p>
[ { "answer_id": 89572, "author": "Patrick_O", "author_id": 11084, "author_profile": "https://Stackoverflow.com/users/11084", "pm_score": 4, "selected": false, "text": "git checkout -b new_stash\ngit commit -a -m \"stashed changes\"\n" }, { "answer_id": 11389081, "author": "Igb...
2008/09/18
[ "https://Stackoverflow.com/questions/89487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2108922/" ]
89,488
<p>I've been trying to implement a C#-like event system in C++ with the tr1 function templates used to store a function that handles the event. </p> <p>I created a vector so that multiple listeners can be attached to this event, i.e.:</p> <pre><code>vector&lt; function&lt;void (int)&gt; &gt; listenerList; </code></pre> <p>I'd like to be able to remove a handler from the list to stop a listener receiving events.</p> <p>So, how can I find the entry in this list that corresponds to a given listener? Can I test if a 'function' object in the list refers to a particular function?</p> <p>Thanks!</p> <p>EDIT: Having looked into the boost::signal approach, it seems it's probably implemented using a token system as some of you have suggested. <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/signals/tutorial.html" rel="nofollow noreferrer">Here's some info on this</a>. An observer retains a "Connection" object when they attach to an event, and this connection object is used to disconnect if needed. So it looks like whether you use Boost or roll your own with tr1, the basic principle's the same. i.e. it will be a bit clumsy :) </p>
[ { "answer_id": 89595, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 0, "selected": false, "text": "typeid" }, { "answer_id": 89693, "author": "Flame", "author_id": 5387, "author_profile": "https://Stackov...
2008/09/18
[ "https://Stackoverflow.com/questions/89488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17136/" ]
89,489
<p>I was following along with the railscast regarding the restful_authentication plugin.</p> <p>He recommended running the command:</p> <p>script/generate authenticated user session</p> <p>Which I did, and everything generated "fine", but then sessions wouldn't work. Checking the site again, he mentions a naming standard and listed updated code which stated:</p> <p>script/generate authenticated user sessions</p> <p>With sessions being pluralized.</p> <p>So now I have session_controller.rb with a SessionController in it, but I guess by naming standards, it is looking for SessionsController, causing the code to fail out with the error "NameError in SessionsController#create "</p> <p>I see the problem, which is pretty obvious, but what I don't know is, how do I fix this without regenerating the content? Is there a way to reverse the generation process to clear out all changes made by the generation?</p> <p>I tried just renaming the files to sessions_controller with e SessionsController class, but that failed.</p> <p>While writing this, I solved my own problem. I had to rename session to sessions in the routes file as a map.resource and rename the view directory from session to sessions, and update session_path in the html.erb file to sessions_path.</p> <p>So I solved my problem, but my answer regarding removing generated content still remains. Is it possible to ungenerate content?</p>
[ { "answer_id": 89525, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 1, "selected": false, "text": "script/destroy" }, { "answer_id": 90044, "author": "Misplaced", "author_id": 13710, "author_profile":...
2008/09/18
[ "https://Stackoverflow.com/questions/89489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9450/" ]
89,490
<p>How do I set the symbol for the <em>angle</em> or <em>annuity</em> operation in LaTeX? Specifically, this is the actuarial <em>a</em> angle <em>s</em> = (1-v<sup>s</sup>)/i.</p>
[ { "answer_id": 89851, "author": "Joseph Holsten", "author_id": 16981, "author_profile": "https://Stackoverflow.com/users/16981", "pm_score": 3, "selected": false, "text": "\\DeclareRobustCommand{\\lcroof}[1]{\n \\hbox{\\vtop{\\vbox{%\n \\hrule\\kern 1pt\\hbox{%\n $\\scriptst...
2008/09/18
[ "https://Stackoverflow.com/questions/89490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16981/" ]
89,504
<p>I've got a standard Rails app with Nginx and Mongrel running at <a href="http://mydomain" rel="noreferrer">http://mydomain</a>. I need to run a Wordpress blog at <a href="http://mydomain.com/blog" rel="noreferrer">http://mydomain.com/blog</a>. My preference would be to host the blog in Apache running on either the same server or a separate box but I don't want the user to see a different server in the URL. Is that possible and if not, what would you recommend to accomplish the goal?</p>
[ { "answer_id": 89530, "author": "joelhardi", "author_id": 11438, "author_profile": "https://Stackoverflow.com/users/11438", "pm_score": 3, "selected": false, "text": "server {\n listen example.com:80;\n server_name example.com;\n charset utf-8;\n error_log /www...
2008/09/18
[ "https://Stackoverflow.com/questions/89504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14619/" ]
89,543
<p>I want to set something up so that if an Account within my app is disabled, I want all requests to be redirected to a "disabled" message.</p> <p>I've set this up in my ApplicationController:</p> <pre><code>class ApplicationController &lt; ActionController::Base before_filter :check_account def check_account redirect_to :controller =&gt; "main", :action =&gt; "disabled" and return if !$account.active? end end </code></pre> <p>Of course, this doesn't quite work as it goes into an infinite loop if the Account is not active. I was hoping to use something like:</p> <pre><code>redirect_to :controller =&gt; "main", :action =&gt; "disabled" and return if !$account.active? &amp;&amp; @controller.controller_name != "main" &amp;&amp; @controller.action_name != "disabled" </code></pre> <p>but I noticed that in Rails v2.1 (what I'm using), @controller is now controller and this doesn't seem to work in ApplicationController.</p> <p>What would be the best way to implement something like this?</p>
[ { "answer_id": 89647, "author": "Ian Terrell", "author_id": 9269, "author_profile": "https://Stackoverflow.com/users/9269", "pm_score": 3, "selected": false, "text": "before_filter :check_account, :except => :disabled\n" }, { "answer_id": 90149, "author": "Tony Pitale", "...
2008/09/18
[ "https://Stackoverflow.com/questions/89543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14530/" ]
89,576
<p>I am trying to connect to a Microsoft SQL 2005 server which is not on port 1433. How do I indicate a different port number when connecting to the server using SQL Management Studio?</p>
[ { "answer_id": 89583, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 11, "selected": true, "text": "127.0.0.1,6283" }, { "answer_id": 89677, "author": "James", "author_id": 2719, "author_profile": "https:...
2008/09/18
[ "https://Stackoverflow.com/questions/89576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5836/" ]
89,588
<p>You do <code>AssignProcessToJobObject</code> and it fails with "access denied" but only when you are running in the debugger. Why is this?</p>
[ { "answer_id": 89589, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 6, "selected": true, "text": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\"...
2008/09/18
[ "https://Stackoverflow.com/questions/89588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146/" ]
89,603
<p>When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker. In the case of GCC, the option is -g. When the debug option is enabled, how does the affect the binary executable? What additional data is stored in the file that allows the debugger function as it does?</p>
[ { "answer_id": 89669, "author": "Bernard", "author_id": 61, "author_profile": "https://Stackoverflow.com/users/61", "pm_score": 2, "selected": false, "text": "-g" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10216/" ]
89,606
<p>I have a table that got into the "db_owner" schema, and I need it in the "dbo" schema.</p> <p>Is there a script or command to run to switch it over?</p>
[ { "answer_id": 89635, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 6, "selected": false, "text": "ALTER SCHEMA [NewSchema] TRANSFER [OldSchema].[Table1]\n" }, { "answer_id": 89658, "author": "Craig", ...
2008/09/18
[ "https://Stackoverflow.com/questions/89606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1220/" ]
89,607
<p>I have added some code which compiles cleanly and have just received this Windows error:</p> <pre><code>--------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred in the application at location 0x00486752. </code></pre> <p>I am about to go on a bug hunt, and I am expecting it to be something silly that I have done which just happens to produce this message. The code compiles cleanly with no errors or warnings. The size of the EXE file has grown to 1,454,132 bytes and includes links to <code>ODCS.lib</code>, but it is otherwise pure C to the Win32 API, with DEBUG on (running on a P4 on Windows&nbsp;2000).</p>
[ { "answer_id": 89643, "author": "Tim Williscroft", "author_id": 2789, "author_profile": "https://Stackoverflow.com/users/2789", "pm_score": 2, "selected": false, "text": "std::string" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3137/" ]
89,609
<p>I'm looking for the best way to take a simple input:</p> <pre><code>echo -n "Enter a string here: " read -e STRING </code></pre> <p>and clean it up by removing non-alphanumeric characters, lower(case), and replacing spaces with underscores.</p> <p>Does order matter? Is <code>tr</code> the best / only way to go about this?</p>
[ { "answer_id": 89642, "author": "Devin Reams", "author_id": 16248, "author_profile": "https://Stackoverflow.com/users/16248", "pm_score": 0, "selected": false, "text": "tr" }, { "answer_id": 89780, "author": "Axeman", "author_id": 11289, "author_profile": "https://Sta...
2008/09/18
[ "https://Stackoverflow.com/questions/89609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16248/" ]
89,650
<p>I would like to pass an argument(s) to a method being defined using define_method, how would I do that?</p>
[ { "answer_id": 89661, "author": "easeout", "author_id": 10906, "author_profile": "https://Stackoverflow.com/users/10906", "pm_score": 9, "selected": true, "text": "define_method(:say_hi) { |other| puts \"Hi, \" + other }\n" }, { "answer_id": 109379, "author": "Jörg W Mittag",...
2008/09/18
[ "https://Stackoverflow.com/questions/89650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1681/" ]
89,672
<p>When you create a new content type in Drupal using the Content Creation Kit, you automatically get Title and Body fields in the generated form. Is there a way to remove them?</p>
[ { "answer_id": 1196442, "author": "Volomike", "author_id": 105539, "author_profile": "https://Stackoverflow.com/users/105539", "pm_score": 2, "selected": false, "text": "<?php echo $node->field_staff_email[0]['email']; ?>\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5808/" ]
89,696
<p>I have Oracle SQL Developer already installed and am able to connect to and query Oracle databases.</p> <p>Using Help -> Check for Updates I was able to install the Oracle MySQL Browser extension but there are no connection options for MySQL databases.</p>
[ { "answer_id": 26598840, "author": "codingknob", "author_id": 668624, "author_profile": "https://Stackoverflow.com/users/668624", "pm_score": 0, "selected": false, "text": "ntlmauth.dll" }, { "answer_id": 37999123, "author": "Ale", "author_id": 6505642, "author_profil...
2008/09/18
[ "https://Stackoverflow.com/questions/89696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5808/" ]
89,705
<p>I'm going through the problems on projecteuler.net to learn how to program in Erlang, and I am having the hardest time creating a prime generator that can create all of the primes below 2 million, in less than a minute. Using the sequential style, I have already written three types of generators, including the Sieve of Eratosthenes, and none of them perform well enough.</p> <p>I figured a concurrent Sieve would work great, but I'm getting bad_arity messages, and I'm not sure why. Any suggestions on why I have the problem, or how to code it properly? </p> <p>Here's my code, the commented out sections are where I tried to make things concurrent:</p> <pre> -module(primeserver). -compile(export_all). start() -> register(primes, spawn(fun() -> loop() end)). is_prime(N) -> rpc({is_prime,N}). rpc(Request) -> primes ! {self(), Request}, receive {primes, Response} -> Response end. loop() -> receive {From, {is_prime, N}} -> if N From ! {primes, false}; N =:= 2 -> From ! {primes, true}; N rem 2 =:= 0 -> From ! {primes, false}; true -> Values = is_not_prime(N), Val = not(lists:member(true, Values)), From ! {primes, Val} end, loop() end. for(N,N,_,F) -> [F(N)]; for(I,N,S,F) when I + S [F(I)|for(I+S, N, S, F)]; for(I,N,S,F) when I + S =:= N -> [F(I)|for(I+S, N, S, F)]; for(I,N,S,F) when I + S > N -> [F(I)]. get_list(I, Limit) -> if I [I*A || A [] end. is_not_prime(N) -> for(3, N, 2, fun(I) -> List = get_list(I,trunc(N/I)), lists:member(N,lists:flatten(List)) end ). %%L = for(1,N, fun() -> spawn(fun(I) -> wait(I,N) end) end), %%SeedList = [A || A %% lists:foreach(fun(X) -> %% Pid ! {in_list, X} %% end, SeedList) %% end, L). %%wait(I,N) -> %% List = [I*A || A lists:member(X,List) %% end. </pre>
[ { "answer_id": 89726, "author": "theo", "author_id": 7870, "author_profile": "https://Stackoverflow.com/users/7870", "pm_score": -1, "selected": false, "text": "For Each NUMBER in LIST_OF_PRIMES\n If TEST_VALUE % NUMBER == 0\n Then FALSE\nEND\nTRUE\n\nif isPrime == TRUE add ...
2008/09/18
[ "https://Stackoverflow.com/questions/89705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8040/" ]
89,708
<p>I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code:</p> <pre><code>LOGO_GIF RCDATA logo.gif </code></pre> <p>Using resource explorer I verified it is in the DLL properly.</p> <p>using the following code always throws an exception, "resource not found" (using Delphi 2009)</p> <pre><code>var rc : tResourceStream; begin rc := tResourceStream.Create(hInstance,'LOGO_GIF','RCDATA'); end; </code></pre>
[ { "answer_id": 90496, "author": "Tim Knipe", "author_id": 10493, "author_profile": "https://Stackoverflow.com/users/10493", "pm_score": 3, "selected": true, "text": "rc := tResourceStream.Create(hInstance,'LOGO_GIF', MakeIntResource(RT_RCDATA));\n" }, { "answer_id": 90742, "a...
2008/09/18
[ "https://Stackoverflow.com/questions/89708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9217/" ]
89,741
<p>I'd like to know what the currently checked out revision number is for a file or directory. Is there a way to do this in TortoiseSVN on Windows ?</p>
[ { "answer_id": 89817, "author": "DevelopingChris", "author_id": 1220, "author_profile": "https://Stackoverflow.com/users/1220", "pm_score": 5, "selected": false, "text": "svn info\n" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5324/" ]
89,745
<p>I am trying to find the virtual file that contains the current users id. I was told that I could find it in the proc directory, but not quite sure which file.</p>
[ { "answer_id": 89763, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 2, "selected": false, "text": "/proc" }, { "answer_id": 89765, "author": "dreamlax", "author_id": 10320, "author_profile": "https://...
2008/09/18
[ "https://Stackoverflow.com/questions/89745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17162/" ]
89,752
<p>How can I get <strong>hierarchy recordset</strong> in ms access through <strong>select</strong> statement?</p>
[ { "answer_id": 89763, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 2, "selected": false, "text": "/proc" }, { "answer_id": 89765, "author": "dreamlax", "author_id": 10320, "author_profile": "https://...
2008/09/18
[ "https://Stackoverflow.com/questions/89752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
89,767
<p>I'm currently trying to port a SIP stack library (pjSIP) to the PSP Console (using the PSPSDK toolchain), but I'm having too much trouble with the makefiles (making the proper changes and solving linking issues). </p> <p>Does anyone know a good text, book or something to get some insight on porting libraries?</p> <p>The only documentation this project offers on porting seems too dedicated to major OS's.</p>
[ { "answer_id": 414319, "author": "Paulo Lopes", "author_id": 51560, "author_profile": "https://Stackoverflow.com/users/51560", "pm_score": 2, "selected": false, "text": "LDFLAGS=\"-L$(psp-config --pspsdk-path)/lib -lc -lpspuser\" ./configure --host psp --prefix=$(pwd)/../target/psp\n" ...
2008/09/18
[ "https://Stackoverflow.com/questions/89767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2731698/" ]
89,791
<p>When I start my process from Visual Studio, it is always created inside a job object. I would like to know how to turn this behaviour off. Any ideas?</p> <p>I expect that it is created in a job object to be debugged. I want to place my program in a different job object.</p> <p>It's not the hosting process. I'm talking about a <a href="http://msdn.microsoft.com/en-us/library/ms684161(VS.85).aspx" rel="noreferrer">Job Object</a>. This is an unmanaged C++ application.</p>
[ { "answer_id": 4232259, "author": "Tom Minka", "author_id": 513835, "author_profile": "https://Stackoverflow.com/users/513835", "pm_score": 5, "selected": false, "text": "devenv.exe" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/89791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146/" ]
89,796
<p>I've been using the YUI Components and want to begin using the Loader Utility to specify my dependencies on my page. From your experience, is the YUI Loader Utility a reliable way to load Javascript dependencies in web pages?</p>
[ { "answer_id": 3638698, "author": "Kreegr", "author_id": 296765, "author_profile": "https://Stackoverflow.com/users/296765", "pm_score": 1, "selected": false, "text": "var TheBase = function(oConfig){\nvar thisBase = this;\nvar EVENTS = {\n ON_SCRIPTS_LOADED : \"onScriptsLoaded\"\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/89796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3289/" ]
89,820
<p>I am using mssql and am having trouble using a subquery. The real query is quite complicated, but it has the same structure as this:</p> <pre><code>select customerName, customerId, ( select count(*) from Purchases where Purchases.customerId=customerData.customerId ) as numberTransactions from customerData </code></pre> <p>And what I want to do is order the table by the number of transactions, but when I use</p> <pre><code>order by numberTransactions </code></pre> <p>It tells me there is no such field. Is it possible to do this? Should I be using some sort of special keyword, such as <code>this</code>, or <code>self</code>?</p>
[ { "answer_id": 89831, "author": "Jonathan Rupp", "author_id": 12502, "author_profile": "https://Stackoverflow.com/users/12502", "pm_score": 4, "selected": true, "text": "order by 3\n" }, { "answer_id": 89834, "author": "Jason Punyon", "author_id": 6212, "author_profil...
2008/09/18
[ "https://Stackoverflow.com/questions/89820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6062/" ]
89,866
<p>We are creating a Real-Time Process in VxWorks 6.x, and we would like to limit the amount of memory which can be allocated to the heap. How do we do this?</p>
[ { "answer_id": 89911, "author": "Benoit", "author_id": 10703, "author_profile": "https://Stackoverflow.com/users/10703", "pm_score": 3, "selected": true, "text": "\n char * envp[] = {\"HEAP_INITIAL_SIZE=0x20000\", \"HEAP_MAX_SIZE=0x100000\", NULL);\n rtpSpawn (\"myrtp.vxe\", NULL, en...
2008/09/18
[ "https://Stackoverflow.com/questions/89866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10703/" ]
89,873
<p>Is it possible to manipulate the components, such as <code>year</code>, <code>month</code>, <code>day</code> of a <code>date</code> in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date.</p>
[ { "answer_id": 89899, "author": "Swati", "author_id": 12682, "author_profile": "https://Stackoverflow.com/users/12682", "pm_score": 4, "selected": true, "text": "DateSerial(YEAR, MONTH, DAY)\n" }, { "answer_id": 89903, "author": "Prestaul", "author_id": 5628, "author_...
2008/09/18
[ "https://Stackoverflow.com/questions/89873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10439/" ]
89,891
<p>I just learned about how the Java Collections Framework implements data structures in linked lists. From what I understand, <code>Iterators</code> are a way of traversing through the items in a data structure such as a list. Why is this interface used? Why are the methods <code>hasNext()</code>, <code>next()</code> and <code>remove()</code> not directly coded to the data structure implementation itself?</p> <p>From the Java website: <a href="http://java.sun.com/javase/6/docs/api/" rel="noreferrer">link text</a></p> <blockquote> <p>public interface Iterator&lt;&#69;><p> An iterator over a collection. Iterator takes the place of Enumeration in the Java collections framework. Iterators differ from enumerations in two ways:</p> <p><ul><li>Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics. <li>Method names have been improved.</ul> This interface is a member of the Java Collections Framework.</p> </blockquote> <p>I tried googling around and can't seem to find a definite answer. Can someone shed some light on why Sun chose to use them? Is it because of better design? Increased security? Good OO practice?</p> <p>Any help will be greatly appreciated. Thanks.</p>
[ { "answer_id": 90068, "author": "coobird", "author_id": 17172, "author_profile": "https://Stackoverflow.com/users/17172", "pm_score": 2, "selected": false, "text": "Iterator" }, { "answer_id": 90180, "author": "Dustman", "author_id": 16398, "author_profile": "https://...
2008/09/18
[ "https://Stackoverflow.com/questions/89891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17182/" ]
89,897
<p>Maybe the need to do this is a 'design smell' but thinking about another question, I was wondering what the cleanest way to implement the <strong>inverse</strong> of this:</p> <pre><code>foreach(ISomethingable somethingableClass in collectionOfRelatedObjects) { somethingableClass.DoSomething(); } </code></pre> <p>i.e. How to get/iterate through all the objects that <em>don't</em> implement a particular interface?</p> <p>Presumably you'd need to start by upcasting to the highest level:</p> <pre><code>foreach(ParentType parentType in collectionOfRelatedObjects) { // TODO: iterate through everything which *doesn't* implement ISomethingable } </code></pre> <p>Answer by solving the TODO: in the cleanest/simplest and/or most efficient way</p>
[ { "answer_id": 89933, "author": "J D OConal", "author_id": 17023, "author_profile": "https://Stackoverflow.com/users/17023", "pm_score": 3, "selected": false, "text": "foreach (ParentType parentType in collectionOfRelatedObjects) {\n if (!(parentType is ISomethingable)) {\n }\n}\n"...
2008/09/18
[ "https://Stackoverflow.com/questions/89897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12726/" ]
89,908
<p>I have three models:</p> <pre><code>class ReleaseItem &lt; ActiveRecord::Base has_many :pack_release_items has_one :pack, :through =&gt; :pack_release_items end class Pack &lt; ActiveRecord::Base has_many :pack_release_items has_many :release_items, :through=&gt;:pack_release_items end class PackReleaseItem &lt; ActiveRecord::Base belongs_to :pack belongs_to :release_item end </code></pre> <p>The problem is that, during execution, if I add a pack to a release_item it is not aware that the pack is a pack. For instance:</p> <pre><code>Loading development environment (Rails 2.1.0) &gt;&gt; item = ReleaseItem.new(:filename=&gt;'MAESTRO.TXT') =&gt; #&lt;ReleaseItem id: nil, filename: "MAESTRO.TXT", created_by: nil, title: nil, sauce_author: nil, sauce_group: nil, sauce_comment: nil, filedate: nil, filesize: nil, created_at: nil, updated_at: nil, content: nil&gt; &gt;&gt; pack = Pack.new(:filename=&gt;'legion01.zip', :year=&gt;1998) =&gt; #&lt;Pack id: nil, filename: "legion01.zip", created_by: nil, filesize: nil, items: nil, year: 1998, month: nil, filedate: nil, created_at: nil, updated_at: nil&gt; &gt;&gt; item.pack = pack =&gt; #&lt;Pack id: nil, filename: "legion01.zip", created_by: nil, filesize: nil, items: nil, year: 1998, month: nil, filedate: nil, created_at: nil, updated_at: nil&gt; &gt;&gt; item.pack.filename NoMethodError: undefined method `filename' for #&lt;Class:0x2196318&gt; from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1667:in `method_missing_without_paginate' from /usr/local/lib/ruby/gems/1.8/gems/mislav-will_paginate-2.3.3/lib/will_paginate/finder.rb:164:in `method_missing' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations/association_collection.rb:285:in `send' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations/association_collection.rb:285:in `method_missing_without_paginate' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1852:in `with_scope' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations/association_proxy.rb:168:in `send' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations/association_proxy.rb:168:in `with_scope' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations/association_collection.rb:281:in `method_missing_without_paginate' from /usr/local/lib/ruby/gems/1.8/gems/mislav-will_paginate-2.3.3/lib/will_paginate/finder.rb:164:in `method_missing' from (irb):5 &gt;&gt; </code></pre> <p>It seems that I should have access to item.pack, but it is unaware that the pack is a Pack item.</p>
[ { "answer_id": 90003, "author": "Misplaced", "author_id": 13710, "author_profile": "https://Stackoverflow.com/users/13710", "pm_score": 4, "selected": true, "text": "model_id" }, { "answer_id": 90055, "author": "Ian Terrell", "author_id": 9269, "author_profile": "http...
2008/09/18
[ "https://Stackoverflow.com/questions/89908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13179/" ]
89,909
<p>I know how to do this if I iterate through all of the characters in the string but I am looking for a more elegant method.</p>
[ { "answer_id": 89915, "author": "easeout", "author_id": 10906, "author_profile": "https://Stackoverflow.com/users/10906", "pm_score": -1, "selected": false, "text": "([a-z][A-Z][0-9]\\_\\-)*\n" }, { "answer_id": 89919, "author": "Thomas", "author_id": 14637, "author_p...
2008/09/18
[ "https://Stackoverflow.com/questions/89909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4527/" ]
89,959
<p>I am just starting out with DI &amp; unit testing and have hit a snag which I am sure is a no brainer for those more experienced devs :</p> <p>I have a class called MessageManager which receives data and saves it to a db. Within the same assembly (project in Visual Studio) I have created a repository interface with all the methods needed to access the db. The concrete implementation of this interface is in a separate assembly called DataAccess.</p> <p>So DataAccess needs a project reference to MessageManager to know about the repository interface. And MessageManager needs a project reference to DataAccess so that the client of MessageManager can inject a concrete implementation of the repository interface. This is of courser not allowed</p> <p>I could move the interface into the data access assembly but I believe the repository interface is meant to reside in the same assembly as the client that uses it</p> <p>So what have I done wrong?</p>
[ { "answer_id": 89983, "author": "user11087", "author_id": 11087, "author_profile": "https://Stackoverflow.com/users/11087", "pm_score": 1, "selected": false, "text": "Foo f = new Foo();\nBar b = new Bar();\nf.setBar(b);\nb.setFoo(f);\n" }, { "answer_id": 90045, "author": "Sim...
2008/09/18
[ "https://Stackoverflow.com/questions/89959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17194/" ]
89,987
<p>My DataView is acting funny and it is sorting things alphabetically and I need it to sort things numerically. I have looked all across the web for this one and found many ideas on how to sort it with ICompare, but nothing really solid.</p> <p>So my questions are </p> <ol> <li>How do I implement ICompare on a DataView (Looking for code here).</li> <li>How to correctly decipher from a column full of strings that are actual strings and a column full of numbers(with commas).</li> </ol> <p>I need code to help me out with this one guys. I am more or less lost on the idea of ICompare and how to implement in different scenarios so an over all good explanation would be great.</p> <p>Also, Please don't hand me links. I am looking for solid answers on this one.</p> <p>Some Code that I use.</p> <pre><code> DataView dataView = (DataView)Session["kingdomData"]; dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection); gvAllData.DataSource = dataView; gvAllData.DataBind(); private string ConvertSortDirectionToSql(SortDirection sortDirection) { string newSortDirection = String.Empty; if (Session["SortDirection"] == null) { switch (sortDirection) { case SortDirection.Ascending: newSortDirection = "ASC"; break; case SortDirection.Descending: newSortDirection = "DESC"; break; } } else { newSortDirection = Session["SortDirection"].ToString(); switch (newSortDirection) { case "ASC": newSortDirection = "DESC"; break; case "DESC": newSortDirection = "ASC"; break; } } Session["SortDirection"] = newSortDirection; return newSortDirection; } </code></pre> <hr> <p>For the scenario, I build a datatable dynamically and shove it into a dataview where I put the dataview into a gridview while also remembering to put the dataview into a session object for sorting capabilities.</p> <p>When the user calls on the gridview to sort a column, I recall the dataview in the session object and build the dataview sorting expression like this:</p> <pre><code>dataview.sort = e.sortexpression + " " + e.Sortdirection; </code></pre> <p>Or something along those lines. So what ussually comes out is right for all real strings such as </p> <p>Car; Home; scott; zach etc...</p> <p>But when I do the same for number fields WITH comma seperated values it comes out something like</p> <p>900; 800; 700; 600; 200; 120; 1,200; 12,340; 1,000,000;</p> <p>See what I mean? It just sorts the items as an alpha sort instead of a Natural sort. I want to make my Dataview NATURALLY sort the numeric columns correctly like</p> <p>120; 200; 600; 700; 800; 900; 1,200; 12,340; 1,000,000;</p> <p>Let me know what you can do to help me out.<br> P.S. I have looked through countless articles on how to do this and all of them say to shove into a List/Array and do it that way, but is there a much more efficient way?</p>
[ { "answer_id": 90498, "author": "rslite", "author_id": 15682, "author_profile": "https://Stackoverflow.com/users/15682", "pm_score": 2, "selected": false, "text": "DataView dv = new DataView(dt);\nArrayList lst = new ArrayList();\nlst.AddRange(dv.Table.Rows);\nlst.Sort(new MyComparer());...
2008/09/18
[ "https://Stackoverflow.com/questions/89987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7644/" ]
89,989
<p>I want to download a lot of urls in a script but I do not want to save the ones that lead to HTTP errors.</p> <p>As far as I can tell from the man pages, neither <code>curl</code> or <code>wget</code> provide such functionality. Does anyone know about another downloader who does?</p>
[ { "answer_id": 90009, "author": "Thomas", "author_id": 14637, "author_profile": "https://Stackoverflow.com/users/14637", "pm_score": 5, "selected": false, "text": "-f" }, { "answer_id": 2327058, "author": "Oct", "author_id": 112514, "author_profile": "https://Stackove...
2008/09/18
[ "https://Stackoverflow.com/questions/89989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65724/" ]
90,002
<p>If you were to mandate a minimum percentage code-coverage for unit tests, perhaps even as a requirement for committing to a repository, what would it be?</p> <p>Please explain how you arrived at your answer (since if all you did was pick a number, then I could have done that all by myself ;)</p>
[ { "answer_id": 795683, "author": "Gary Kephart", "author_id": 17967, "author_profile": "https://Stackoverflow.com/users/17967", "pm_score": 2, "selected": false, "text": "<cobertura-check linerate=\"0\"\n branchrate=\"0\"\n totallinerate=\"70\"\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/90002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16050/" ]
90,023
<h2>Update: giving a much more thorough example.</h2> <p>The first two solutions offered were right along the lines of what I was trying to say <em>not</em> to do. I can't know location, it needs to be able to look at the whole document tree. So a solution along these lines, with /Books/ specified as the context will not work:</p> <pre><code>SELECT x.query('.') FROM @xml.nodes('/Books/*[not(@ID) or @ID = 5]') x1(x) </code></pre> <h2>Original question with better example:</h2> <p>Using SQL Server 2005's XQuery implementation I need to select all nodes in an XML document, just once each and keeping their original structure, but only if they are missing a particular attribute, or that attribute has a specific value (passed in by parameter). The query also has to work on the whole XML document (descendant-or-self axis) rather than selecting at a predefined depth.</p> <p>That is to say, each individual node will appear in the resultant document only if it and every one of its ancestors are missing the attribute, or have the attribute with a single specific value.</p> <h2>For example:</h2> <p>If this were the XML:</p> <pre><code> DECLARE @Xml XML SET @Xml = N' &lt;Library&gt; &lt;Novels&gt; &lt;Novel category=&quot;1&quot;&gt;Novel1&lt;/Novel&gt; &lt;Novel category=&quot;2&quot;&gt;Novel2&lt;/Novel&gt; &lt;Novel&gt;Novel3&lt;/Novel&gt; &lt;Novel category=&quot;4&quot;&gt;Novel4&lt;/Novel&gt; &lt;/Novels&gt; &lt;Encyclopedias&gt; &lt;Encyclopedia&gt; &lt;Volume&gt;A-F&lt;/Volume&gt; &lt;Volume category=&quot;2&quot;&gt;G-L&lt;/Volume&gt; &lt;Volume category=&quot;3&quot;&gt;M-S&lt;/Volume&gt; &lt;Volume category=&quot;4&quot;&gt;T-Z&lt;/Volume&gt; &lt;/Encyclopedia&gt; &lt;/Encyclopedias&gt; &lt;Dictionaries category=&quot;1&quot;&gt; &lt;Dictionary&gt;Webster&lt;/Dictionary&gt; &lt;Dictionary&gt;Oxford&lt;/Dictionary&gt; &lt;/Dictionaries&gt; &lt;/Library&gt; ' </code></pre> <p>A parameter of 1 for category would result in this:</p> <pre class="lang-xml prettyprint-override"><code>&lt;Library&gt; &lt;Novels&gt; &lt;Novel category=&quot;1&quot;&gt;Novel1&lt;/Novel&gt; &lt;Novel&gt;Novel3&lt;/Novel&gt; &lt;/Novels&gt; &lt;Encyclopedias&gt; &lt;Encyclopedia&gt; &lt;Volume&gt;A-F&lt;/Volume&gt; &lt;/Encyclopedia&gt; &lt;/Encyclopedias&gt; &lt;Dictionaries category=&quot;1&quot;&gt; &lt;Dictionary&gt;Webster&lt;/Dictionary&gt; &lt;Dictionary&gt;Oxford&lt;/Dictionary&gt; &lt;/Dictionaries&gt; &lt;/Library&gt; </code></pre> <p>A parameter of 2 for category would result in this:</p> <pre class="lang-xml prettyprint-override"><code>&lt;Library&gt; &lt;Novels&gt; &lt;Novel category=&quot;2&quot;&gt;Novel2&lt;/Novel&gt; &lt;Novel&gt;Novel3&lt;/Novel&gt; &lt;/Novels&gt; &lt;Encyclopedias&gt; &lt;Encyclopedia&gt; &lt;Volume&gt;A-F&lt;/Volume&gt; &lt;Volume category=&quot;2&quot;&gt;G-L&lt;/Volume&gt; &lt;/Encyclopedia&gt; &lt;/Encyclopedias&gt; &lt;/Library&gt; </code></pre> <p>I know XSLT is perfectly suited for this job, but it's not an option. We have to accomplish this entirely in SQL Server 2005. Any implementations not using XQuery are fine too, as long as it can be done entirely in T-SQL.</p>
[ { "answer_id": 90795, "author": "rslite", "author_id": 15682, "author_profile": "https://Stackoverflow.com/users/15682", "pm_score": 3, "selected": true, "text": "//Book[not(@ID) or @ID = 5]\n" }, { "answer_id": 91138, "author": "Jonas Lincoln", "author_id": 17436, "a...
2008/09/18
[ "https://Stackoverflow.com/questions/90023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8507/" ]
90,029
<p>I'm trying to create a deployment tool that will install software based on the hardware found on a system. I'd like the tool to be able to determine if the optical drive is a writer (to determine if burning software sould be installed) or can read DVDs (to determine if a player should be installed). I tried uing the following code </p> <pre><code>strComputer = "." Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive") For Each objItem in colItems Wscript.Echo "MediaType: " &amp; objItem.MediaType Next </code></pre> <p>but it always respons with CD-ROM</p>
[ { "answer_id": 90072, "author": "blowdart", "author_id": 2525, "author_profile": "https://Stackoverflow.com/users/2525", "pm_score": 1, "selected": false, "text": "Win32_DiskDrive" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/90029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
90,049
<p>I'm using a table to design the layout of my web page. I want the table to fill the page even if it doesn't contain much content. Here's the CSS I'm using:</p> <pre class="lang-css prettyprint-override"><code>html, body { height: 100%; margin: 0; padding: 0; } #container { min-height: 100%; width: 100%; } </code></pre> <p>And I place something like this in the page code:</p> <pre><code>&lt;table id="container"&gt; &lt;tr&gt; &lt;td&gt; ... </code></pre> <p>This works for Opera 9, but not for Firefox 2 or Internet Explorer 7. Is there a simple way to make this solution work for all popular browsers?</p> <p>(Adding <code>id="container"</code> to <code>td</code> doesn't help.)</p>
[ { "answer_id": 90109, "author": "Vincent McNabb", "author_id": 16299, "author_profile": "https://Stackoverflow.com/users/16299", "pm_score": 4, "selected": true, "text": "height" }, { "answer_id": 6577742, "author": "deathlock", "author_id": 651170, "author_profile": ...
2008/09/18
[ "https://Stackoverflow.com/questions/90049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17216/" ]
90,052
<p>Ok, so i'm working on a regular expression to search out all the header information in a site.</p> <p>I've compiled the regular expression:</p> <pre><code>regex = re.compile(r''' &lt;h[0-9]&gt;\s? (&lt;a[ ]href="[A-Za-z0-9.]*"&gt;)?\s? [A-Za-z0-9.,:'"=/?;\s]*\s? [A-Za-z0-9.,:'"=/?;\s]? ''', re.X) </code></pre> <p>When i run this in python reg ex. tester, it works out wonderfully.</p> <p>Sample data:</p> <pre><code>&lt;body&gt; &lt;h1&gt;Dog &lt;/h1&gt; &lt;h2&gt;Cat &lt;/h2&gt; &lt;h3&gt;Fancy &lt;/h3&gt; &lt;h1&gt;Tall cup of lemons&lt;/h1&gt; &lt;h1&gt;&lt;a href="dog.com"&gt;Dog thing&lt;/a&gt;&lt;/h1&gt; &lt;/body&gt; </code></pre> <p>Now, in the REDemo, it works wonderfully.</p> <p>When i put it in my python code, however, it only prints <code>&lt;a href="dog.com"&gt;</code></p> <p>Here's my python code, I'm not sure if i'm doing something wrong or if something is lost in translation. I appreciate your help.</p> <pre><code>stories=[] response = urllib2.urlopen('http://apricotclub.org/duh.html') html = response.read().lower() p = re.compile('&lt;h[0-9]&gt;\\s?(&lt;a href=\"[A-Za-z0-9.]*\"&gt;)?\\s?[A-Za-z0-9.,:\'\"=/?;\\s]*\\s?[A-Za-z0-9.,:\'\"=/?;\\s]?') stories=re.findall(p, html) for i in stories: if len(i) &gt;= 5: print i </code></pre> <p>I should also note, that when i take out the <code>(&lt;a href=\"[A-Za-z0-9.]*\"&gt;)?</code> from the regular expression it works fine for non-link <code>&lt;hN&gt;</code> lines.</p>
[ { "answer_id": 90206, "author": "molasses", "author_id": 11293, "author_profile": "https://Stackoverflow.com/users/11293", "pm_score": 1, "selected": false, "text": "import re\n\nhtml = '''\n<body>\n\n<h1>Dog </h1>\n<h2>Cat </h2>\n<h3>Fancy </h3>\n<h1>Tall cup of lemons</h1>\n<h1><a href...
2008/09/18
[ "https://Stackoverflow.com/questions/90052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
90,061
<p>The application I'm writing is almost complete and I'd like people who speak different languages to use it.</p> <p>I'm not sure where to start, what's the difference between globalisation and culture in regards to programming?</p> <p>How does one take uncommon phrases such as "this application was built to do this and that" instead of File, Open, Save etc...and turn them into say, Spanish?</p> <p>Many thanks :-)</p>
[ { "answer_id": 90133, "author": "easeout", "author_id": 10906, "author_profile": "https://Stackoverflow.com/users/10906", "pm_score": 0, "selected": false, "text": "save=Save\nclose=Close\nok=OK\nareYouSure=Are you sure?\n" }, { "answer_id": 90351, "author": "Francis B.", ...
2008/09/18
[ "https://Stackoverflow.com/questions/90061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17211/" ]
90,067
<p>I'm using the following html to load dojo from Google's hosting.</p> <pre><code>&lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt;google.load("dojo", "1.1.1");&lt;/script&gt; &lt;script type="text/javascript"&gt; dojo.require("dojox.gfx"); ... </code></pre> <p>This errors out on the requre line with an error like dojox.gfx is undefined. Is there a way to make this work, or does Google not support the dojox extensions?</p> <p>Alternatively, is there another common host I can use for standard dojo releases?</p>
[ { "answer_id": 90088, "author": "William Keller", "author_id": 17095, "author_profile": "https://Stackoverflow.com/users/17095", "pm_score": 0, "selected": false, "text": "google.dojo.require" }, { "answer_id": 90169, "author": "Felipe", "author_id": 2333, "author_pro...
2008/09/18
[ "https://Stackoverflow.com/questions/90067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17209/" ]
90,075
<p>Businesses Analyst from my team keeps sending us the updated Requirements documents often and I end up hunting the recent changes by comparing the old version. Is their a good way of comparing the Word documents? </p> <p>Note: We have the track changes option ON, but now the documents looks like a blood bath, complicating it much more :(</p>
[ { "answer_id": 3119456, "author": "Daenyth", "author_id": 350351, "author_profile": "https://Stackoverflow.com/users/350351", "pm_score": 1, "selected": false, "text": "diff" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/90075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4718/" ]
90,092
<p>I have a table in <code>MySQL</code> that has 3 fields and I want to enforce uniqueness among two of the fields. Here is the table <code>DDL</code>:</p> <pre><code>CREATE TABLE `CLIENT_NAMES` ( `ID` int(11) NOT NULL auto_increment, `CLIENT_NAME` varchar(500) NOT NULL, `OWNER_ID` int(11) NOT NULL, PRIMARY KEY (`ID`), ) ENGINE=InnoDB DEFAULT CHARSET=utf8; </code></pre> <p>The <code>ID</code> field is a surrogate key (this table is being loaded with ETL). The <code>CLIENT_NAME</code> is a field that contains names of clients The <code>OWNER_ID</code> is an id indicates a clients owner.</p> <p>I thought I could enforce this with a unique index on <code>CLIENT_NAME</code> and <code>OWNER_ID</code>, </p> <pre><code>ALTER TABLE `DW`.`CLIENT_NAMES` ADD UNIQUE INDEX enforce_unique_idx(`CLIENT_NAME`, `OWNER_ID`); </code></pre> <p>but MySQL gives me an error: </p> <blockquote> <p>Error executing SQL commands to update table. Specified key was too long; max key length is 765 bytes (error 1071)</p> </blockquote> <p>Anyone else have any ideas?</p>
[ { "answer_id": 90129, "author": "Terry G Lorber", "author_id": 809, "author_profile": "https://Stackoverflow.com/users/809", "pm_score": -1, "selected": false, "text": "CLIENT_NAME" }, { "answer_id": 90189, "author": "Aeon", "author_id": 13289, "author_profile": "http...
2008/09/18
[ "https://Stackoverflow.com/questions/90092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4082/" ]
90,121
<p>The question is how to make the similar thing like symlink in windows like in *nix. It's really hard to write whole path to the file in console (even using [tab], it's not the way if you need to change language). Adding everything in PATH is tiring too. It'll be great to make a symlink running one command.</p> <p>Actually I'm looking for console app.</p>
[ { "answer_id": 90132, "author": "William Keller", "author_id": 17095, "author_profile": "https://Stackoverflow.com/users/17095", "pm_score": -1, "selected": false, "text": "mklink" }, { "answer_id": 90395, "author": "willson", "author_id": 11972, "author_profile": "ht...
2008/09/18
[ "https://Stackoverflow.com/questions/90121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11972/" ]
90,151
<p>Anyone got a working example of using ruby to post to a presigned URL on s3</p>
[ { "answer_id": 98952, "author": "Dan Harper", "author_id": 14530, "author_profile": "https://Stackoverflow.com/users/14530", "pm_score": 1, "selected": false, "text": "AWS::S3::S3Object.url_for(self.full_filename,\n self.bucket_name, {\n ...
2008/09/18
[ "https://Stackoverflow.com/questions/90151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17232/" ]
90,176
<p>I am writing a simple checkers game in Java. When I mouse over the board my processor ramps up to 50% (100% on a core).</p> <p>I would like to find out what part of my code(assuming its my fault) is executing during this.</p> <p>I have tried debugging, but step-through debugging doesn't work very well in this case.</p> <p>Is there any tool that can tell me where my problem lies? I am currently using Eclipse.</p>
[ { "answer_id": 90575, "author": "Rejeev Divakaran", "author_id": 10980, "author_profile": "https://Stackoverflow.com/users/10980", "pm_score": 1, "selected": false, "text": "while(true){\n if(status) break;\n // Thread.sleep(60000); // such a statement would have avoided busy wait\n}\n...
2008/09/18
[ "https://Stackoverflow.com/questions/90176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2598/" ]
90,178
<p>I am working on a web application where I want the content to fill the height of the entire screen.</p> <p>The page has a header, which contains a logo, and account information. This could be an arbitrary height. I want the content div to fill the rest of the page to the bottom.</p> <p>I have a header <code>div</code> and a content <code>div</code>. At the moment I am using a table for the layout like so:</p> <p>CSS and HTML</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>#page { height: 100%; width: 100% } #tdcontent { height: 100%; } #content { overflow: auto; /* or overflow: hidden; */ }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table id="page"&gt; &lt;tr&gt; &lt;td id="tdheader"&gt; &lt;div id="header"&gt;...&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="tdcontent"&gt; &lt;div id="content"&gt;...&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;</code></pre> </div> </div> </p> <p>The entire height of the page is filled, and no scrolling is required.</p> <p>For anything inside the content div, setting <code>top: 0;</code> will put it right underneath the header. Sometimes the content will be a real table, with its height set to 100%. Putting <code>header</code> inside <code>content</code> will not allow this to work.</p> <p>Is there a way to achieve the same effect without using the <code>table</code>?</p> <p><strong>Update:</strong></p> <p>Elements inside the content <code>div</code> will have heights set to percentages as well. So something at 100% inside the <code>div</code> will fill it to the bottom. As will two elements at 50%.</p> <p><strong>Update 2:</strong></p> <p>For instance, if the header takes up 20% of the screen's height, a table specified at 50% inside <code>#content</code> would take up 40% of the screen space. So far, wrapping the entire thing in a table is the only thing that works.</p>
[ { "answer_id": 90414, "author": "Jerph", "author_id": 1701, "author_profile": "https://Stackoverflow.com/users/1701", "pm_score": 4, "selected": false, "text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n...
2008/09/18
[ "https://Stackoverflow.com/questions/90178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16299/" ]
90,181
<p>I've just run into a display glitch in IE6 with the ExtJS framework. - Hopefully someone can point me in the right direction.</p> <p>In the following example, the bbar for the panel is displayed 2ems narrower than the panel it is attached to (it's left aligned) in IE6, where as in Firefox it is displayed as the same width as the panel.</p> <p>Can anyone suggest how to fix this?</p> <p>I seem to be able to work around either by specifying the width of the panel in ems or the padding in pixels, but I assume it would be expected to work as I have it below.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/&gt; &lt;script type="text/javascript" src="ext/ext-base.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="ext/ext-all-debug.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; Ext.onReady(function(){ var main = new Ext.Panel({ renderTo: 'content', bodyStyle: 'padding: 1em;', width: 500, html: "Alignment issue in IE - The bbar's width is 2ems less than the main panel in IE6.", bbar: [ "-&gt;", {id: "continue", text: 'Continue'} ] }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="content"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
[ { "answer_id": 90414, "author": "Jerph", "author_id": 1701, "author_profile": "https://Stackoverflow.com/users/1701", "pm_score": 4, "selected": false, "text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n...
2008/09/18
[ "https://Stackoverflow.com/questions/90181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797/" ]
90,184
<p>I need a pseudorandom number generator algorithm for a assembler program assigned in a course, and I would prefer a simple algorithm. However, I cannot use an external library. </p> <p>What is a good, simple pseudorandom number generator algorithm for assembly?</p>
[ { "answer_id": 92554, "author": "ICW", "author_id": 17664, "author_profile": "https://Stackoverflow.com/users/17664", "pm_score": 2, "selected": false, "text": "MOD 2^32" }, { "answer_id": 104462, "author": "Nils Pipenbrinck", "author_id": 15955, "author_profile": "ht...
2008/09/18
[ "https://Stackoverflow.com/questions/90184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10344/" ]
90,203
<p>What is the difference between different optimization levels in GCC? Assuming I don't care to have any debug hooks, why wouldn't I just use the highest level of optimization available to me? does a higher level of optimization necessarily (i.e. provably) generate a faster program?</p>
[ { "answer_id": 90228, "author": "Todd Gamblin", "author_id": 9122, "author_profile": "https://Stackoverflow.com/users/9122", "pm_score": 4, "selected": false, "text": "-O2" }, { "answer_id": 152710, "author": "Mihai Limbășan", "author_id": 14444, "author_profile": "ht...
2008/09/18
[ "https://Stackoverflow.com/questions/90203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17231/" ]
90,238
<p>As an example in pseudocode:</p> <pre><code>if ((a mod 2) == 0) { isEven = true; } else { isEven = false; } </code></pre>
[ { "answer_id": 90242, "author": "martinatime", "author_id": 1353, "author_profile": "https://Stackoverflow.com/users/1353", "pm_score": 7, "selected": false, "text": "boolean isEven = a % 2 == 0;\n" }, { "answer_id": 90244, "author": "J D OConal", "author_id": 17023, ...
2008/09/18
[ "https://Stackoverflow.com/questions/90238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17245/" ]
90,246
<p>I want to let users specify a date that may or may not include a day and month (but will have at least the year.) The problem is when it is stored as a datetime in the DB; the missing day/month will be saved as default values and I'll lose the original format and meaning of the date.</p> <p>My idea was to store the real format in a column as a string in addition to the datetime column. Then I could use the string column whenever I have to display the date and the datetime for everything else. The downside is an extra column for every date column in the table I want to display, and printing localized dates won't be as easy since I can't rely on the datetime value... I'll probably have to parse the string.</p> <p>I'm hoping I've overlooked something and there might be an easier way.</p> <p>(Note I'm using Rails if it matters for a solution.)</p>
[ { "answer_id": 90282, "author": "André Chalella", "author_id": 4850, "author_profile": "https://Stackoverflow.com/users/4850", "pm_score": 0, "selected": false, "text": "int" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/90246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9128/" ]
90,288
<p>If you have an 68K application written using CodeWarrior for Palm OS, how do you assign individual functions to different segments without manually moving files around in the segment tab in the IDE?</p>
[ { "answer_id": 90282, "author": "André Chalella", "author_id": 4850, "author_profile": "https://Stackoverflow.com/users/4850", "pm_score": 0, "selected": false, "text": "int" } ]
2008/09/18
[ "https://Stackoverflow.com/questions/90288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1323/" ]
90,308
<p>This is probably too much to ask, but is there any language that does a really terrific job of representing time and date operations? I'll grant straight away that it's <b>really hard</b> to write a truly great time library. That said, are there any widespread languages that have one? Basically, I want something that handles time and date as comprehensively as modern regular expression libraries do their jobs. Everything I've seen so far in Python and Java omits one or more pretty important pieces, or makes too many things hard.</p> <p>At least this should be intuitive to do:</p> <ul> <li>find the number of days between two given dates, number of minutes between two given minute periods, etc. </li> <li>add and subtract intervals from timestamps </li> <li>allow simple conversion between timezones, with Daylight Saving Time changes by region automatically accounted for (given that there's an accurate supporting database of regional settings available) </li> <li>get the period that a given timestamp falls into, given period granularity ("what calendar day is this date in?") </li> <li>support very general string-to-date conversions (given a pattern)</li> </ul> <p>Further, if there's a Java-style Calendar/GregorianCalendar setup, the general Calendar class should be accommodating toward subclasses if I need to roll my own Hebrew, Babylonian, Tolkien, or MartianCalendar. (Java Calendars make this pointlessly hard, for example.)</p> <p>I am completely language-agnostic here. It's fine if the thing chokes on computing ambiguous stuff like "how many minutes are there between 2002 and next Valentine's Day?"</p>
[ { "answer_id": 90339, "author": "Redbeard", "author_id": 14977, "author_profile": "https://Stackoverflow.com/users/14977", "pm_score": 1, "selected": false, "text": "start_time = 5.months_ago.at_end_of_week \nend_time = 6.months.since(start_time)\n" }, { "answer_id": 90341, ...
2008/09/18
[ "https://Stackoverflow.com/questions/90308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]