instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>The web service endpoint usually is defined in an early stage of a project. Since it follows the "contract first" principle, it shouldn't be changed after communicated to client systems.</p> <p>Therefore, it is vital to label the web service in a good way.</p> <p>How would you label web services?</p> <p>e.g.</p> ...
<p>We decide on names by talking to the developers, business guys, and support guys. We formed a committee called the "interface control committee", and we approach it kind of like you described in the question. We want service names to be descriptive, reflect the processes they support, and fit the needs of the techni...
<p>I would include a version number in the URLs. </p>
39,215
<p>An existing Java site is designed to run under "/" on tomcat and there are many specific references to fixed absolute paths like "/dir/dir/page".</p> <p>Want to migrate this to Java EE packaging, where the site will need to run under a context-root e.g. "/dir/dir/page" becomes "/my-context-root/dir/dir/page"</p> <...
<p>Check out a related <a href="https://stackoverflow.com/questions/125359/any-clever-ways-of-handling-the-context-in-a-web-app">question</a></p> <p>Also consider <a href="http://tuckey.org/urlrewrite/" rel="nofollow noreferrer">URLRewriteFilter</a></p> <p>Another thing (I keep editing this darn post). If you're usin...
<p>the apache world used Redirects(mod_rewrite) to do the same.</p> <p>The Servlet world started using filters</p> <p>The ruby world (or the RoR) does more of the same stuff and they call it routing.</p> <p>So, there's no getting around it (Unless you want to use smart regex through out -- which has been tried and i...
17,272
<p>We moved our Visual C++ 2003 solution to Visual 2005 and now we have problems deploying to clean XP machines.</p> <p>Our solution has a DLL project and a command line executable which uses this DLL. Both projects create and embed manifest files.</p> <p>Our installer also copies the VC8 CRT runtimes from the C:\Pro...
<p>Copying the CRT dlls around is not recommended. As Vinay says you should use the correct merge modules.</p> <p>You can also use the redist install exe's if merge modules don't work with your installer technology:</p> <ul> <li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C9...
<p>Select Visual Studio 2005 Merge modules in the installer. This can also occur if you have built the exe/dll using visual studio which has service pack installed.</p>
33,275
<p>Can I do something like this in the markup of an asp.net page, based off the "Define DEBUG constant" setting?</p> <pre><code>#IF (DEBUG) THEN &lt;asp:TextBox ID="TextBox1" runat="server"&gt;You're in debug mode&lt;/asp:TextBox&gt; #END IF </code></pre>
<pre><code>&lt;form runat="server"&gt; &lt;% #if DEBUG %&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;You're in debug mode&lt;/asp:TextBox&gt; &lt;% #else %&gt; &lt;asp:TextBox ID="TextBox2" runat="server"&gt;Mmm... No, I think you're not in debug mode&lt;/asp:TextBox&gt; &lt;% #endif %&gt; &lt;/form&gt; </...
<p>It would be easy enough to roll your own. You might miss some of the cooler non-compiling features of Compilation Constants but you'd definitely have the ability to add markup based on a global parameter of some sort.</p>
49,648
<p>We have a medium sized .js file that we include in our web framework that I am porting over to SharePoint. However, I'm not sure how to go about this or what the best practice is. This is for a framework solution that will be used by other client projects, so it's best for it to be self contained and deploy-able, ra...
<p>Embeded resource is the best way and you don't need to use the ScriptManager to render it out (as AJAX is not configured OoB on SharePoint), you can just render it as any other client script resource (through the ClientScriptManager).</p> <p>Best idea is the have an if ContainsScriptManager else UsClientScriptManag...
<p>You could just toss it into a doc library.</p> <p>If you are packaging your web part into a sharepoint solution, you could include it as a Module (VSEWSS item). Your manifest file would get something like:</p> <pre><code>&lt;TemplateFiles&gt; &lt;TemplateFile Location="LAYOUTS\somescript.js" /&gt; &lt;/Template...
11,429
<p>In C, what is the difference between using <code>++i</code> and <code>i++</code>, and which should be used in the incrementation block of a <code>for</code> loop?</p>
<ul> <li><p><code>++i</code> will increment the value of <code>i</code>, and then return the incremented value.</p> <pre><code> i = 1; j = ++i; (i is 2, j is 2) </code></pre></li> <li><p><code>i++</code> will increment the value of <code>i</code>, but return the original value that <code>i</code> held before being i...
<p><em>a=i++</em> means <em>a</em> contains the current <em>i</em> value.</p> <p><em>a=++i</em> means <em>a</em> contains the incremented <em>i</em> value.</p>
4,449
<p>I thought I had seen a bug report about this on the jQuery site, but now I cannot find it. I'm trying to resize a dialog in IE6. But when the element is resized, the content and title bar don't resize down. They will resize up if the dialog is made larger, however. The result is that the close button ends up being c...
<p>I was able to come up with a solution. If you add the style <strong>overflow: hidden</strong> to the dialog container div element (which has the css class .ui-dialog-container applied to it), then everything resizes correctly. All I did was add a css rule as follows to the flora theme:</p> <pre><code>.ui-dialog .ui...
<p>The css may be a factor. Could you change your example so we can see your stylesheet? I've updated the example so that it doesn't depend on having jQuery locally.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Example of IE6 resize issue&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="?.css" /&...
14,398
<p>Do you think that project iteration length is related to project team size? If so, how? What other key factors do you use to recognize correct iteration length for different projects?</p>
<p>Iteration length is primarily related to the teams ability to communicate and complete a working version of the software. More team members equals more communication channels (<a href="http://en.wikipedia.org/wiki/Brooks%27s_law" rel="nofollow noreferrer">Brooks's Law</a>) which will likely increase your iteration ...
<p>One of the main drivers for short iterations, is easing integration between modules/features/programmers. Obviously, the bigger your team, the more integration you will have. It's a tradeoff: short iterations mean you're integrating often, which is good - BUT if its a big team you'll be spending a LOT of team on int...
13,840
<p>I want to build a parser for a C like language. The interesting aspect about it is that I want to build it in such a way that someone who has access to the source can easily modified it to extend the language (a new expression type of instance) with the extensions being runtime configurable (they can be turned on an...
<p>These are some of the challenges the Perl 6 design effort has faced. You may find it worthwhile looking into some of the solutions they came up with. Or you may find that to be gross overkill.</p>
<p>If I recall my university courses correctly, recursive descent parsers have some limitations that might bite you, especially since you're allowing extensions - somebody elses language extension could cause issues.</p> <p>A proper compiler toolkit - such as the open source <a href="http://www.antlr.org/" rel="nofoll...
28,778
<p>I have this little function</p> <pre><code>function makewindows(){ child1 = window.open ("about:blank"); child1.document.write("&lt;?php echo htmlspecialchars(json_encode($row2['ARTICLE_DESC']), ENT_QUOTES); ?&gt;"); child1.document.close(); } </code></pre> <p>Which whatever I try, simply outputs the php code as ...
<p>Have you recently moved this file out of a PHP parsed file (i.e. .phtml/.php) and into a .js file? Note that any PHP you expect to be executed must be parsed by the PHP parser before delivery to the client. If it was originally in a .php file, then it would have been parsed/ executed, and worked fine.</p> <p>Howeve...
<p><strong>Make sure you are running the page from the webserver</strong> like such: <code>http://localhost/yourpage.php</code> and not directly from the file itself like such: <code>file://yourpage.php</code></p>
48,067
<p>I'd like to take XML in the format below and load each code record into a domain object in my <code>BootStrap.groovy</code>. I want to preserve the formatting of each snippet of code. </p> <h2>XML</h2> <pre><code>&lt;records&gt; &lt;code&gt; &lt;language&gt;Groovy&lt;/language&gt; &lt;snippet&...
<p>roughly something like this:</p> <pre><code>def CODE_XML = ''' &lt;records&gt; &lt;code&gt; &lt;language&gt;Groovy&lt;/language&gt; &lt;snippet&gt; println "This is Groovy" println "A very powerful language" &lt;/snippet&gt; &lt;/code&gt; &lt;code&gt; ...
<p>If you can specity a DTD or similar and your XML parser obeys it, I think you can specify the contents of the snippet element to be CDATA and always get it as-is.</p>
20,831
<p>I'm trying to determine the asymptotic run-time of one of my algorithms, which uses exponents, but I'm not sure of how exponents are calculated programmatically.</p> <p>I'm specifically looking for the pow() algorithm used for double-precision, floating point numbers.</p>
<p>I've had a chance to look at fdlibm's implementation. The comments describe the algorithm used:</p> <pre><code> * n * Method: Let x = 2 * (1+f) * 1. Compute and return log2(x) in two pieces: * log2(x) = w1 + w2, * where w1 has 53-24 = 29 bit trailing zeros. * ...
<p>If I were writing a pow function targeting Intel, I would return exp2(log2(x) * y). Intel's microcode for log2 is surely faster than anything I'd be able to code, even if I could remember my first year calculus and grad school numerical analysis.</p>
19,937
<p>What would be the best method for getting a custom element (that is using J2ME native Graphics) painted on LWUIT elements?</p> <p>The custom element is an implementation from mapping library, that paints it's content (for example Google map) to Graphics object. How would it be possible to paint the result directly ...
<p>I do not think any hacking is necessary. You can subclass the LWTUI Component class and then you can pain whatever you want on to the graphic context of the component. You do not get the native lcdui.Graphics object but an object with a same interface that is easy to use.</p> <p>If you really need to pass a lcdui.G...
<p>Based on the javadoc for LWUIT and J2ME and guessing that the custom J2ME class is a <a href="http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Canvas.html" rel="nofollow noreferrer">Canvas</a> it looks like you would have to:</p> <ul> <li>Subclass <a href="https://lwuit.dev.java.net/javadoc...
4,332
<p>I have been getting clogs and believe that it may be due to a damaged PTFE tube inside my hot end. I have a replacement (it came with my printer), but I can't seem to fit the tube into the nozzle.</p> <p>I also tried to turn the original PTFE tube around, and I can't get the other end to fit into the nozzle either...
<p>Yes, with the proper equipment.</p> <p>Printing wax filament (at 51 seconds): <a href="https://youtu.be/tibkVZB_n9c?t=51s" rel="noreferrer">https://youtu.be/tibkVZB_n9c?t=51s</a></p> <p>There are also options for melting wax, filling a heated reservoir head, and printing with that. I recommend doing this with a co...
<p>Just make a silicone mold of any of your prints and pour you wax in the silicone,you silicone putty is pretty cheap so is wax ,no need to break the bank as printers have become less expensive and can do a pretty good job </p>
633
<p>We have created a web application, using ASP.NET, that allows users to upload documents and attach them to business entities, like customers, contacts and so on. </p> <p>The application runs on the intranet and all files are uploaded through the web application into a shared folder on the server.</p> <p>I would li...
<p>SharePoint does this by exposing FrontPage extensions which Word and Excel know how to deal with.</p> <p>If you want to look at a commercial product for ASP.NET that allows you to edit images with AJAX (no need for installed software), I work for a company that has one (<a href="http://atalasoft.com" rel="nofollow ...
<p>I'm trying to do something with using file:// instead of http:// but it's real sporadic based on the browser. Seems to work fine in IE, okay in Firefox, and goes nowhere in Chrome.</p> <p>Looks like I may just be stuck with downloading, editing, and re-uploading the document.</p>
15,115
<p>I'm creating a generic class and in one of the methods I need to know the Class of the generic type currently in use. The reason is that one of the method's I call expects this as an argument.</p> <p>Example:</p> <pre><code>public class MyGenericClass&lt;T&gt; { public void doSomething() { // Snip... // ...
<p>Still the same problems : Generic informations are erased at runtime, it cannot be recovered. A workaround is to pass the class T in parameter of a static method : </p> <pre><code>public class MyGenericClass&lt;T&gt; { private final Class&lt;T&gt; clazz; public static &lt;U&gt; MyGenericClass&lt;U&gt; cre...
<p>public class DatabaseAccessUtil {</p> <pre><code>EntityManagerFactory entitymanagerfactory; EntityManager entitymanager; public DatabaseAccessUtil() { entitymanagerfactory=Persistence.createEntityManagerFactory("bookmyshow"); entitymanager=entitymanagerfactory.createEntityManager(); } public void save (T...
22,075
<p>This is a specific version of <a href="https://stackoverflow.com/questions/119540/business-logic-database-or-application-layer">this question</a>.<br/> I want to check if I am inserting a duplicate row. Should I check it programmatically in my application layer:</p> <pre><code>if (exists(obj)) { throw new Dupli...
<p>First, you <strong>must</strong> have a primary key or unique constraint on the database to enforce this uniqueness properly - no question.</p> <p>Given that the constraint exists, which way should you code in the application? My preference would be to try the insert and catch the exceptions. Because presumably m...
<p>Once hibernate throws an exception from the session you <a href="http://www.hibernate.org/hib_docs/reference/en/html/transactions-demarcation.html" rel="nofollow noreferrer">must discard the session</a> (see section 11.2.3). So, if you need to check for dups and continue using the same session then you have no choi...
20,188
<p>I am attempting to print the Benchy boat but every attempt so far has been unsuccessful. The print has a sort of slope/blob on the nose of the boat, which emerges after the first 30 layers.</p> <p><a href="https://i.stack.imgur.com/vx2cM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vx2cM.jpg" ...
<p>Looks like curling from to much being extruded and no cooling I had the same problem added part cooling and problem was gone </p>
<p>The lines along the length of the boat also appear to be wobbling, can you confirm this? Have you used this material before? The layers should look straight and equal. <a href="https://i.stack.imgur.com/PvV5g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PvV5g.png" alt="enter image description h...
849
<p>Or if any body knows of an alternative control that does?</p> <p>It would be handy to serve up content to the WebBrowser control that has embedded images &amp; other resources from a database without having a dependency on these resources being hosted on a webserver or to create temporary files on the local file sy...
<p>I don't think that what you are trying to achieve is possible using the DocumentText property. MHTML is a document archive format and although it is stored as text with binary data such as images etc. encoded to base64 strings, there does not seem to be any intelligence built into the DocumentText property of the w...
<p>please refer to this answer <a href="https://stackoverflow.com/questions/4737823/c-filenotfoundexception-on-webbrowser/4738244#4738244">c# filenotfoundexception on webbrowser?</a></p>
27,113
<p>I am working on an ASP.Net application and I want users to be able to take a picture with their local webcam and then upload it to the server. I can, of course, rely on users doing this manually via their locally installed software, save the image as a file and do a normal file upload. However, what I really want to...
<p>The only acceptable and universal way to this for now is Flash/Flex application. Flash player presets literally in every browser in the world and all of them has such capability.</p>
<p>This sounds very suspicious to me. You realize the nefarious applications this could be applied to, right? A web page that when a user browses to it, unknownst to them, their webcam snaps a pic of them. ... I don't like it.</p>
41,574
<p>From googling around it looks like Xcode (3.1 in my case) should be at least trying to give me a sane debug view of STL containers - or at least vectors.</p> <p>However, whenever I go to look at a vector in the debugger I just see M_impl, with M_start and M_finish members (and a couple of others) - but nothing in-b...
<p>You can create <a href="https://web.archive.org/web/20090812202145/http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeDebugging/600-Viewing_Variables_and_Memory/variables_and_memory.html" rel="nofollow noreferrer">Data formatters</a> for different variable types so they show up nicer :-).</p>
<p>Try using the GDB debugger in Project->Edit Scheme... and consider switching your compiler to LLVM GCC 4.2 in the Project Build Settings (under Build Options -> Compiler for C/C++/Objective-C).</p> <p>In XCode 4, I found I needed these settings to view things like a std::vector of V3f where V3f is a templated float...
34,703
<p>I am trying to code a flowchart generator for a language using Ruby. </p> <p>I wanted to know if there were any libraries that I could use to draw various shapes for the various flowchart elements and write out text to those shapes. </p> <p>I would really prefer not having to write code for drawing basic shapes, i...
<p>Write up your flowchart as a directed or undirected graph in <a href="http://www.graphviz.org/About.php" rel="nofollow noreferrer">Graphviz</a>. Graphviz has a language, <a href="http://www.graphviz.org/Documentation.php" rel="nofollow noreferrer">dot</a> that makes it easy to generate graphs. Just generate the do...
<p>I am totally sure, but check out cairo bindings for ruby. Pango for text. I am investigating then currently and came across this page.</p>
3,233
<p>How do you back up your development machine so that in the event of a catastrophic hardware malfunction, you are up and running in the least amount of time possible?</p>
<p>There's an important distinction between backing up your development machine and backing up your work.</p> <p>For a development machine your best bet is an imaging solution that offers as near a "one-click-restore" process as possible. TimeMachine (Mac) and Windows Home Server (Windows) are both excellent for this ...
<p>Maybe just a simple hardware hard disk raid would be a good start. This way if one drive fails, you still have the other drive in the raid. If something other than the drives fail you can pop these drives into another system and get your files quickly.</p>
4,638
<p>Consider this:</p> <pre><code>var query = from r in this._db.Recipes where r.RecipesID == recipeID select new { r.RecipesID, r.RecipesName }; </code></pre> <p>How would i get individual columns in my <code>query</code> object without using a for-loop?</p> <p>Basicly: how do I translate <co...
<p>It's really unclear what you are looking for, as your two samples are compatible. </p> <p>As close as I can figure, what you want is:</p> <pre><code>var rows = query.ToList(); string name = rows[0].RecipesName; </code></pre>
<p>Sorry, misunderstood your question. As others are saying, you can use ToList() to get a List back. An alternative if all you need is the first one, just use:</p> <pre><code> query.First().ColumnName </code></pre> <p>or if you want to avoid an exception on empty list:</p> <pre><code> var obj = query.FirstOrDefau...
22,689
<p>What method do I call to get the name of a class?</p>
<pre><code>In [1]: class Test: ...: pass ...: In [2]: Test.__name__ Out[2]: 'Test' </code></pre>
<p>In [8]: <code>str('2'.__class__)</code><br /> Out[8]: <code>"&lt;type 'str'&gt;"</code><br /></p> <p>In [9]: <code>str(len.__class__)</code><br /> Out[9]: <code>"&lt;type 'builtin_function_or_method'&gt;"</code><br /></p> <p>In [10]: <code>str(4.6.__class__)</code><br /> Out[10]: <code>"&lt;type 'float'&gt;"</code...
10,105
<p>I'm looking for a broad overview of what I need to do and in what order to migrate a W2003 Server to a virtual server environment. Specifically:</p> <p>How does it work in general? Do I need to prepare my disks in any way? What do I install first? The toolkit? Virtual Server? Can I install linux later?</p> <p>etc....
<p>Depending on which virtualisation platform you're migrating to there are tools to perform physical to virtual conversions:</p> <p><a href="http://www.vmware.com/products/converter/" rel="nofollow noreferrer">http://www.vmware.com/products/converter/</a></p> <p>PlateSpin was the product that we were recommended whe...
<p>Depending on which virtualisation platform you're migrating to there are tools to perform physical to virtual conversions:</p> <p><a href="http://www.vmware.com/products/converter/" rel="nofollow noreferrer">http://www.vmware.com/products/converter/</a></p> <p>PlateSpin was the product that we were recommended whe...
31,410
<p>How do I write the getDB() function and use it properly?</p> <p>Here is a code snippet of my App Object:</p> <pre><code>public class MyApp extends UiApplication { private static PersistentObject m_oStore; private static MyBigObjectOfStorage m_oDB; static { store = PersistentStore.getPersisten...
<pre><code>public MyBigObjectOfStorage getDB() { return m_oDB; } </code></pre> <p>As you put it is correct. It will return a <em>copy of the reference</em>, which is kind of in between a copy and a reference.</p> <p>The actual object instance returned by getDB() is the same object referenced by m_oDB. However, you ...
<pre><code>public MyBigObjectOfStorage getDB() { Object o = store.getContents(); if ( o instanceof MyBigObjectOfStorage ) { return (MyBigObjectOfStorage) o; } else { return null; } } </code></pre>
27,167
<p>Can someone explain what exactly the string "0 but true" means in Perl? As far as I understand, it equals zero in an integer comparison, but evaluates to true when used as a boolean. Is this correct? Is this a normal behavior of the language or is this a special string treated as a special case in the interpreter?</...
<p>It's normal behaviour of the language. Quoting the <a href="https://perldoc.perl.org/perlsyn.html#Truth-and-Falsehood" rel="noreferrer"><code>perlsyn</code></a> manpage:</p> <blockquote> <p>The number <code>0</code>, the strings <code>'0'</code> and <code>""</code>, the empty list <code>()</code>, and <code>undef...
<p>When you want to write a function that returns either an integer value, or <em>false</em> or <b>undef</b> (i.e. for the error case) then you have to watch out for the value zero. Returning it is false and shouldn't indicate the error condition, so returning "0 but true" makes the function return value true while st...
15,784
<p>what is a good way to select a random element from a map? C++. It is my understanding that maps don't have random access iterators. The key is a long long and the map is sparsely populated. </p>
<pre><code>map&lt;...&gt; MyMap; iterator item = MyMap.begin(); std::advance( item, random_0_to_n(MyMap.size()) ); </code></pre>
<p>Here is the case when <em>all</em> map items must be access in random order.</p> <ol> <li>Copy the map to a vector.</li> <li>Shuffle vector.</li> </ol> <p>In pseudo-code (It closely reflects the following C++ implementation):</p> <pre><code>import random import time # populate map by some stuff for testing m = d...
19,215
<p>The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&amp;7 and it even works in Chrome??</p> <p>It's a simple asp:LinkButton with an OnClick event</p> <pre><code>&lt;asp:LinkButton ID="DeleteAllPicturesLinkButton" Enabled="False" OnClientClick="javascript:return c...
<p>Check your User Agent string. This same thing happened to me one time and I realized it was because I was testing out some pages as "googlebot". The JavaScript that is generated depends on knowing what the user agent is.</p> <p>From <a href="http://support.mozilla.com/tiki-view_forum_thread.php?locale=tr&amp;commen...
<p>With or without the OnClientClick event it still doesn't work.</p> <p>The _doPostBack event is the auto generated javascript that .NET produces.</p> <pre><code>function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = e...
7,909
<p>I'm trying to come up with a way to estimate the number of English words a translation from Japanese will turn into. Japanese has three main scripts -- <a href="http://en.wikipedia.org/wiki/Kanji" rel="nofollow noreferrer">Kanji</a>, <a href="http://en.wikipedia.org/wiki/Hiragana" rel="nofollow noreferrer">Hiragana<...
<p>Here's what Borland (now Embarcadero) thinks about English to non-English:</p> <p><a href="http://www.podgoretsky.com/ftp/Docs/Delphi/D5/dg/intapps.html" rel="nofollow noreferrer">Length of English string (in characters)</a></p> <pre><code>Expected increase 1-5 100% 6-12 80% 13-20 60% 21-30 40% 3...
<p>It seems simple enough - you just need to find out the ratios.</p> <p>For each script, count the number of script characters and English words in your glossary and work out the ratio.</p> <p>This can be augmented with the Japanese source documents <strong>assuming</strong> you can both detect which script a Japane...
17,506
<p>I am selecting rows from a table, but some of the columns are a text type, but they always have numeric data in them. How can I format them as numbers?</p> <p>e.g. column quantity heading 'Quantity' format 999,999</p> <p>However, since the column in the table is text, the numeric formatting is ignored.</p>
<p>You will need to TO_NUMBER the column in your query.</p>
<p>Thanks Steve,</p> <p>I can now have:</p> <pre> column quantity heading 'Quantity' format 999,999 select TO_NUMBER(quantity) as quantity from Sales </pre> <p>And I get a right justified report.</p>
14,600
<p>For example, I could just git pull and then git checkout HEAD-1. But is there a way of seeing the differences before deciding whether to git pull or not?</p>
<p>Do a <code>git fetch</code> first to update your remote tracking branch. Then use <code>git log ..origin</code> to see what has changed in the "origin" branch. Then you can do a <code>git pull</code> if you are satisfied with the changes.</p>
<p>If you really want to avoid <em>any</em> trace of the remote changes getting into your repo, you can do a local <code>git clone</code>, which will use hardlinks, so will take almost no extra space, and then apply Greg Hewgill’s answer to that. If you are satisfied, you can go back to the original repository and pull...
33,038
<p>This is intended to be a more concrete, easily expressable form of my earlier question.</p> <p>Take a list of words from a dictionary with common letter length.<br> How to reorder this list tto keep as many letters as possible common between adjacent words? </p> <p>Example 1:</p> <pre><code>AGNI, CIVA, DEVA, DEW...
<p>What you're trying to do, is calculate the shortest hamiltonian path in a complete weighted graph, where each word is a vertex, and the weight of each edge is the number of letters that are differenct between those two words.</p> <p>For your example, the graph would have edges weighted as so:</p> <pre> DEVI K...
<p>This can be done with a recursive approach. Pseudo-code:</p> <pre><code>Start with one of the words, call it w FindNext(w, l) // l = list of words without w Get a list l of the words near to w If only one word in list Return that word Else For every word w' in l do FindNext(w', l') //l' = l without w'...
41,392
<p>I've got a (mostly) working plugin developed, but since its function is directly related to the project it processes, how do you develop unit and integration tests for the plugin. The best idea I've had is to create an integration test project for the plugin that uses the plugin during its lifecycle and has tests t...
<p>You need to use the <a href="http://maven.apache.org/shared/maven-plugin-testing-harness/" rel="noreferrer">maven-plugin-testing-harness</a>, </p> <pre> &lt;dependency&gt; &lt;groupId&gt;org.apache.maven.shared&lt;/groupId&gt; &lt;artifactId&gt;maven-plugin-testing-harness&lt;/artifactId&gt; ...
<p>If you'd like to see some real-world examples, the Terracotta Maven plugin (tc-maven-plugin) has some tests with it that you can peruse in the open source forge.</p> <p>The plugin is at: <a href="http://forge.terracotta.org/releases/projects/tc-maven-plugin/" rel="nofollow noreferrer">http://forge.terracotta.org/re...
13,038
<p>I have a text file on my local machine that is generated by a daily Python script run in cron. </p> <p>I would like to add a bit of code to have that file sent securely to my server over SSH.</p>
<p>You can call the <a href="https://en.wikipedia.org/wiki/Secure_copy" rel="noreferrer"><code>scp</code></a> bash command (it copies files over <a href="https://en.wikipedia.org/wiki/Secure_Shell" rel="noreferrer">SSH</a>) with <a href="https://docs.python.org/library/subprocess.html#subprocess.run" rel="noreferrer"><...
<p>Kind of hacky, but the following should work :)</p> <pre><code>import os filePath = "/foo/bar/baz.py" serverPath = "/blah/boo/boom.py" os.system("scp "+filePath+" user@myserver.com:"+serverPath) </code></pre>
9,384
<p>In our embedded system (using a PowerPC processor), we want to disable the processor cache. What steps do we need to take?</p> <p>To clarify a bit, the application in question must have as constant a speed of execution as we can make it. Variability in executing the same code path is not acceptable. This is the rea...
<p>I'm kind of late to the question, and also it's been a while since I did all the low-level processor init code on PPCs, but I seem to remember the cache &amp; MMU being pretty tightly coupled (one had to be enabled to enable the other) and I <em>think</em> in the MMU page tables, you could define the cacheable attri...
<p>Perhaps you don't want to globally disable cache, you only want to disable it for a particular address range?</p> <p>On some processors you can configure TLB (translation lookaside buffer) entries for address ranges such that each range could have caching enabled or disabled. This way you can disable caching for m...
9,899
<p>I'm looking for a reliable, implementation-independent way to clone an entire Document. The Javadocs specifically say that calling cloneNode on a Document is implementation-specific. I've tried passing the Document through a no-op Transformer, but the resulting Node has no owner Document.</p> <p>I could create a ...
<p>As some of the comments point out, there are problems with serializing and re-parsing a document. In addition to memory usage, performance considerations, and normalization, there's also loss of the prolog (DTD or schema), potential loss of comments (which aren't required to be captured), and loss of what may be sig...
<p>Still, how about the quick'n'dirty way: serialize the whole Document into XML string and then parse it back using DOM Parser? </p> <p>I don't see a reason why the serialized version would lack anything. Mind to provide an example?</p> <p>Memory consumption would be significant, but, on the other hand, if you're du...
35,260
<p>On a PLA print where stringing has occurred, what is the best way to remove it during post processing?</p> <p>Should I simply cut it with a hobby knife and sand the surface or are the better techniques to use?</p>
<p>Use a hobby knife with a chisel blade (straight edge perpendicular to handle, beveled on one side only).</p> <p>Apply with beveled edge against workpiece. Raise the handle in small increments while stroking over the flaw until it is entirely removed. This provides pretty good control to prevent gouging.</p> <p>Avoi...
<p>I pull them off by hand and then a few quick passes with a cigarette lighter works for me.</p>
2,107
<p>When I delete any file from an asp.net mvc project (project not in svn or any source control provider) it takes upto 60 seconds for the UI to become responsive again. CPU usage jumps to 80/90%. Has anyone else experienced this and know of any fix or solution?</p>
<p>Do you mean deleting a file from Visual Studio solution? If so, the fix is to empty your Windows recycle bin.</p>
<p>If you're talking about the running website trying to delete a file, then do your file delete in a separate thread.</p> <p>If you're talking about deleting a source file, I have had that problem a few years ago. I don't remember what the fix was, but I don't think it's in the latest Visual Studio (which you're pro...
48,934
<p>I'm currently estimating how to best share data between offices at different geographical locations.<br> My current preference is for using <a href="http://msdn.microsoft.com/en-us/library/ms151198.aspx" rel="nofollow noreferrer">SQL Server Merge Replication</a> and have a main database and handful of subscribers.</...
<p>Definitely stick with SQL Server replication, then decide to go down the path of 'build your own replication framework.' I've seen some applications become horrible messes that way.</p> <p>I've had environments that are setup for snapshot replication in a disconnected model, but the remote sites were read-only. T...
<p>I have already discussed my own experience of SQLServer2005 with #cycnus. My answer is not a real one, just a few arguments to initiate a subject I am very interested in.</p> <ol> <li>Our choice for 'not allways connected' sites is to implement web-based merge replication. Data exchanges happen to be even quicker t...
45,893
<p>I'm trying in vain to write a regular expression to match valid ssh connection strings.</p> <p>I really only need to recognise strings of the format:</p> <ul> <li>user@hostname:/some/path</li> </ul> <p>but it would be nice to also match an implicit home directory:</p> <ul> <li>user@hostname:</li> </ul> <p>I've ...
<p>Your supplied regex doesn't have the hostname section. Try:</p> <pre><code>/^[:alnum:]+\@[:alnum:\.]\:(\/[:alnum:]+)*$/ </code></pre> <p>or</p> <pre><code>/^[A-Za-z][A-Za-z0-9_]*\@[A-Za-z][A-Za-z0-9_\.]*\:(\/[A-Za-z][A-Za-z0-9_]*)*$/ </code></pre> <p>since I don't trust alnum without double brackets.</p> <p>Als...
<p>Bracket expressions go inside their own brackets. You are matching any one of colon, 'a', 'l', 'm', 'n', or 'u'.</p> <p>And like Pax said, you missed the hostname. But the bracket expressions are still wrong.</p>
46,365
<p>I've got a bunch of servers running this Linux app. I'd like for them to be able to generate a GUID with a low probability of collision. I'm sure I could just pull 128 bytes out of /dev/urandom and that would probably be fine, but is there a simple &amp; easy way to generate a GUID that is more equivalent to the W...
<p>This <a href="http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt" rel="noreferrer">Internet Draft</a> describes one type of UUID in great details and I have used a similar approach with great success when I needed a UUID implementation and could not link to an existing library for architectural reasons.</p> ...
<p>There is a Boost version available.</p> <p><a href="http://www.boostpro.com/vault/index.php?action=downloadfile&amp;filename=uuid_v11.zip&amp;directory=&amp;PHPSESSID=69e18b945f686398b963710fd52f143a" rel="nofollow noreferrer">http://www.boostpro.com/vault/index.php?action=downloadfile&amp;filename=uuid_v11.zip&amp...
18,555
<p>I'm developing a basic dip-switch user control as a personal learning exercise. Originally I had it set up where you could declare some custom color properties on the user control, and they would be used on elements inside the control.</p> <p>However, I recenly discovered ToggleButtons, and rebuilt my control to ta...
<p>In the getters of your color properties you need to convert to brushes</p> <pre><code>Public Property SwitchBkgndColor() As Brush Get Return CType(GetValue(SwitchBkgndColorProperty), Brush) End Get Set(ByVal value As Brush) SetValue(SwitchBkgndColorProperty, value) End Set End Prope...
<p>See the answer from <a href="https://stackoverflow.com/questions/358443/custom-usercontrol-property-used-by-child-element#360700">Custom UserControl Property used by child element</a>. The same concept can be applied for your ToggleButton. Create UserControl with no content just a UserControl.Template override and...
47,384
<p>When Joel Spolsky and Jeff Atwood began the disagreement in their podcast over whether programmers should learn C, regardless of their industry and platform of delivery, it sparkled quite an explosive debate within the developer community that probably still rages amongst certain groups today. I have been reading a ...
<p>Of course you should. The greatest way to become overly specialized and single-minded (and, correspondingly, have limited marketable skills) is to only work with a single type of language and eschew all others as "not related to your current task."</p> <p>Every programmer should have some experience with a modern ...
<p>The <strong>CLR</strong> is a <strong>virtual</strong> machine so if that's all you learn, then you only know what's happening at a virtual level.</p> <p>Learning <strong>C</strong> will teach you more about the <strong>physical</strong> machine as far as memory usage goes, which as you mention is what the CLR uses...
15,294
<p>I just noticed that Chromium was installed in AppData in both Vista and XP. If Google does that and if other applications does this, than is that becuase there is some form of protection? Should we write installers that does the same thing as Google?</p>
<p>Windows still lacks a convention for per-user installation.</p> <ul> <li>When an installer asks whether to install for the current user or all users, it really only refers to shortcut placement (Start Menu; Desktop). The actual application files still go in the system-wide <code>%PROGRAMFILES%</code>.</li> <li>Micr...
<p>Just so you people know, Google has created an MSI installer for global system installation and management. It's located here:</p> <p><a href="https://www.google.com/intl/en/chrome/business/browser/" rel="nofollow">https://www.google.com/intl/en/chrome/business/browser/</a></p>
6,989
<p><em>Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost any database which has a JDBC driver that can detect foreign-key associations.</em> </p> <hr> <p>Querying PostgreSQL data dictionary for foreign-keys and relationship between tables is very straightforward, but how c...
<p>Dot is part of the <a href="http://www.graphviz.org/" rel="noreferrer">graphviz</a> package, which is a pretty damn cool/useful tool. Of course, you'll need something to generate the dot files for graphviz. I've used <a href="http://schemaspy.sourceforge.net/" rel="noreferrer">SchemaSpy</a> once or twice in the past...
<p><a href="http://en.wikipedia.org/wiki/DOT_language" rel="nofollow noreferrer">Dot</a> is multiplatform and may be useful.</p>
22,498
<p>I have an xml file where I need to comment out a whole piece of text with Ant.</p> <p>There's this Ant task</p> <pre><code>&lt;replace file="${src.dir}/Version.as" token="@revisionPrana" value="${revision}"/&gt; </code></pre> <p>that I use to replace words, but in my case I need to replace a whole block...
<p>If you can identify what is to be replaced through a regular expression, I recommend using the optional task <strong>replaceregexp</strong>. Here's the doc: <a href="http://ant.apache.org/manual/Tasks/replaceregexp.html" rel="nofollow noreferrer">http://ant.apache.org/manual/Tasks/replaceregexp.html</a> You can call...
<p>If it is an XML file, then you could also call an XSLT transform</p>
28,417
<p>I have a war file that I have to deploy as root on glassfish. Deploying the application with "/" as its context root happens successfully. But when I try to run that application by <a href="http://localhost/" rel="nofollow noreferrer">http://localhost/</a>, it throws a 503 saying the requested service() is not curre...
<p>Deploying to "/" is correct for placing a webapp in the root context. The other way to depoy to the root is setting your webapp as the "default-web-module" in your "virtual-server" entry. The 503 error is a problem with your servlet. Assuming glassfish v2, you need to turn up your logging levels in your glassfish d...
<p>I can't guarantee this, but try undeploying, then renaming the ROOT folder and then deploying again.</p>
10,626
<p>Is there a way to <em>always</em> have LF line endings in Visual Studio? I can never seem to find it!</p>
<p>There'a an add-in for Visual Studio 2008 that converts the end of line format when a file is saved. You can download it here: <a href="http://grebulon.com/software/stripem.php" rel="noreferrer">http://grebulon.com/software/stripem.php</a></p>
<p>There's a plugin to VS called Strip'Em where you can choose which kind of new line type you want to auto convert all the line endings to when saving.</p> <p>(You can choose between LF, CRLF, CR.)</p>
6,702
<p>I've seen quite a few developer job postings recently that include a sentence that reads more or less like this: "Must have experience with N-Tier architecture", or "Must be able to develop N-Tier apps".</p> <p>This leads me to ask, what is N-Tier architecture? How does one gain experience with it?</p>
<p><a href="http://en.wikipedia.org/wiki/Multitier_architecture" rel="noreferrer">Wikipedia</a>:</p> <blockquote> <p>In software engineering, multi-tier architecture (often referred to as n-tier architecture) is a client-server architecture in which, the presentation, the application processing and the dat...
<p>A tier is a group of computers having similar functionality and serving the same need. Tiers exist for security and scalability reasons. A typical modern web application is a 3-tiered one (and is also called &quot;thin client&quot;):</p> <p><strong>Tier 1</strong> (Client tier). Code, running in your browser and in ...
40,234
<p>I have some HTML that looks like this:</p> <pre><code>&lt;ul class="faq"&gt; &lt;li class="open"&gt; &lt;a class="question" href=""&gt;This is my question?&lt;/a&gt; &lt;p&gt;Of course you can, it will be awesome. &lt;/p&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Using CSS I'm setting the...
<p>Try using: </p> <pre><code>$(this).siblings('p').css() </code></pre>
<blockquote> <p>I want to use jQuery to display or hide the 'p' tag when the anchor is clicked</p> </blockquote> <p>Since you mentioned that you'd like to toggle the 'p' tag when the anchor is clicked, I'd do:</p> <pre><code> $("a.question").click(function (event) { $(this).siblings('p').show(); //toggle the...
30,853
<p>What web site structure(s)/architecture(s) would the community swear by, with a narrowing down in the direction towards more of a small facebook style project?</p> <p>I understand the question to be rather broad/subjective; but being relatively new to the area of web development, I find just looking at and learning...
<p>I guess it depends on the technology you select. For web projects in general I've always employed (Web-)MVC for the past two years or so. The advantage being a clear seperation of frontend and backend in order to create a managable code base.</p> <p>But that's as vague as a recommendation could be. :)</p> <p>Aside...
<p>Possibly a bit heavy for your immediate needs, but have you seen the <a href="http://oreilly.com/catalog/9780596000356/" rel="nofollow noreferrer">Polar bear</a>*? Well worth a browse in the library to see if it's what you require.</p> <p>*<a href="http://oreilly.com/catalog/9780596000356/" rel="nofollow noreferre...
6,833
<p>Recently, my Ender 3D Pro has been unable to print any large models successfully with PLA as the filament starts to expand inside the Teflon tube, causing a clog after about an hour of printing. I am starting to suspect that the problem is heat creep.</p> <ul> <li>This occurs with the two brands of PLA filament that...
<p>Since you mentioned &quot;Check if the Teflon tube is touching the nozzle&quot;, it sounds like you've disassembled the tube from the couplings and put it back together. This is error-prone and in my experience the main/only likely cause of clogging in Creality hotends. Heat creep is unlikely unless you're operating...
<p>This sounds like heat creep may be the problem. For preventing heat creep to occur you should do the opposite, print at lower temperature, tweak retraction length and increase cooling of the cold end.</p> <p>A Peltier element is not very effective cooler, use a bigger fan, or a fan with a higher flow rate. Note that...
2,075
<p>I'm using the ssOption control (Sheridan 3d Option control) in VB6.</p> <p>In Windows 98 the text area background color is the same color as the background color around the Option Circle, and that color is the default form color. So the Option button appears to be transparent. </p> <p>There is no Background color...
<p>SSOption sets it background to the Windows Button Face on Windows XP. This the same background you get when you make a new form. You will need to use a frame or another type of enclosure that has a background of button face if you want to use it on a multi-colored form. Otherwise use VB6's Option button. </p> <p>Th...
<p>Threed32.ocx is ancient - it was designed for VB4. I would replace it with the built-in VB6 option control.</p>
41,377
<p>Does anyone know if silverlight plugs into chrome, or when they plan to support it?</p>
<p>This guy have had partial success with silverlight in chrome, but it does not seem to be supported:</p> <p><a href="http://wildermuth.com/2008/09/02/Silverlight_2_and_Google_Chrome" rel="nofollow noreferrer">http://wildermuth.com/2008/09/02/Silverlight_2_and_Google_Chrome</a></p> <p>From The Microsoft Silverlight ...
<p>Silverlight already works with web-kit, and since Google's Chrome is based on web-kit, it shouldn't be too much effort to get it working.</p> <p>Indeed, <a href="http://bits.samiq.net/2008/09/silverlight-and-flash-running-on-google.html" rel="nofollow noreferrer">this</a> gentleman seems to have had some success.</...
7,322
<p>In Python, you can do this:</p> <pre><code>import webbrowser webbrowser.open_new("http://example.com/") </code></pre> <p>It will open the passed in url in the default browser</p> <p>Is there a ruby equivalent?</p>
<h2>Cross-platform solution:</h2> <p>First, install the <a href="http://www.copiousfreetime.org/projects/launchy/" rel="noreferrer">Launchy</a> gem:</p> <pre><code>$ gem install launchy </code></pre> <p>Then, you can run this:</p> <pre><code>require 'launchy' Launchy.open("http://stackoverflow.com") </code></pre>
<p>If it's windows and it's IE, try this: <a href="http://rubyonwindows.blogspot.com/search/label/watir" rel="nofollow noreferrer">http://rubyonwindows.blogspot.com/search/label/watir</a> also check out Selenium ruby: <a href="http://selenium.rubyforge.org/getting-started.html" rel="nofollow noreferrer">http://selenium...
18,424
<p>So, in Java, the first line of your constructor HAS to be a call to super... be it implicitly calling super(), or explicitly calling another constructor. What I want to know is, why can't I put a try block around that?</p> <p>My specific case is that I have a mock class for a test. There is no default constructor...
<p>Unfortunately, compilers can't work on theoretical principles, and even though you may know that it is safe in your case, if they allowed it, it would have to be safe for all cases.</p> <p>In other words, the compiler isn't stopping just you, it's stopping everyone, including all those that don't know that it is un...
<p>One way to get around it is by calling a private static function. The try-catch can then be placed in the function body.</p> <pre><code>public class Test { public Test() { this(Test.getObjectThatMightThrowException()); } public Test(Object o) { //... } private static final Object getObjectTha...
2,728
<p>Is it necessary to pay $99 before I can watch the video to submit an iPhone application to the App Store, or it is available free of cost anywhere?</p>
<p>You can join the developer program and watch the video without paying. It's on Video → App Store and Distribution after you've logged in:</p> <ul> <li><a href="https://developer.apple.com/videos/app-store-and-distribution/" rel="nofollow noreferrer">https://developer.apple.com/videos/app-store-and-distribution/</a>...
<p>$99 is for registration for the developer where you can debug your iphone application on your mobile when you are developing as we had done tone of iphone application though business account and that is more than $99 but it will help you more once you register with $99 - thanks</p>
39,705
<p>The system I work on here was written before .net 2.0 and didn't have the benefit of generics. It was eventually updated to 2.0, but none of the code was refactored due to time constraints. There are a number of places where the code uses ArraysLists etc. that store things as objects. </p> <p>From performance pe...
<p>Technically the performance of generics is, as you say, better. However, unless performance is hugely important AND you've already optimised in other areas you're likely to get MUCH better improvements by spending your time elsewhere.</p> <p>I would suggest: </p> <ul> <li>use generics going forward.</li> <li>if yo...
<p>The biggest gains, you will find in Maintenance phases. Generics are much easier to deal with and update, without having to deal with conversion and casting issues. If this is code that you continually visit, then by all means take the effort. If this is code that hasn't been touched in years, I wouldn't reall...
12,047
<p>I need advice on how to handle relatively large set of flags in my SQL2k8 table.</p> <p>Two question, bear with me please :)</p> <p>Let's say I have 20 flags I'd like to store for one record.</p> <p>For example:</p> <p>CanRead = 0x1 CanWrite = 0x2 CanModify = 0x4 ... and so on to the final flag 2^20</p> <p>Now,...
<p><strong>Don't to that.</strong> It's like saving a CSV string into a memo field and defeating the purpose of a database.</p> <p>Use a boolean (bit) value for every flag. In this specific sample you're finding everything that can read and can write or modify:</p> <pre><code>WHERE CanRead AND (CanWrite OR CanModify)...
<p>Nope, that won't work.</p> <p>I'm sending just one mask to the procedure</p> <p>Something like @filter which in C# i fill with @filter = CanModify | CanWrite</p> <p>So, the procedure gets the OR-ed value as a filter.</p> <p>Oh and by the way, it is NOT a permission model, I'm using that just as an example.</p> ...
19,172
<p>I need a cross platform method of determining the MAC address of a computer at run time. For windows the 'wmi' module can be used and the only method under Linux I could find was to run ifconfig and run a regex across its output. I don't like using a package that only works on one OS, and parsing the output of ano...
<p>Python 2.5 includes an uuid implementation which (in at least one version) needs the mac address. You can import the mac finding function into your own code easily:</p> <pre><code>from uuid import getnode as get_mac mac = get_mac() </code></pre> <p>The return value is the mac address as 48 bit integer.</p>
<p>For Linux you can retrieve the MAC address using a SIOCGIFHWADDR ioctl.</p> <pre><code>struct ifreq ifr; uint8_t macaddr[6]; if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP)) &lt; 0) return -1; strcpy(ifr.ifr_name, "eth0"); if (ioctl(s, SIOCGIFHWADDR, (void *)&amp;ifr) == 0) { if (ifr.ifr_hwad...
19,251
<pre><code>public class Address { public string ZipCode {get; set;} } public class Customer { public Address Address {get; set;} } </code></pre> <p>how can I access eitther "ZipCode" or "Address.ZipCode" with reflection? For example: </p> <pre><code>Typeof(Customer).GetProperty("ZipCode")? </code></pre>
<p>You'd need something like:</p> <pre><code>PropertyInfo addressProperty = typeof(Customer).GetProperty("Address"); ProportyInfo zipCodeProperty = addressProperty.PropertyType.GetProperty("ZipCode"); object address = addressProperty.GetValue(customer, null); object zipCode = zipCodeProperty.GetValue(address, null); ...
<p>adabyron,</p> <p>I created a version of your code for when you only need to grab the types, and if you don't have an actual object instance.</p> <pre><code> public static Type FollowPropertyPath&lt;T&gt;(string path) { if (path == null) throw new ArgumentNullException("path"); Type currentT...
47,819
<p>I have written an ASP.NET composite control which includes some Javascript which communicates with a web service.</p> <p>I have packaged the classes for the control and the service into a DLL to make it nice and easy for people to use it in other projects.</p> <p>The problem I'm having is that as well as referenci...
<p>Try something like this. I don't know if it will work though. I got this idea from ELMAH, which creates a handler for a page that doesn't physically exist and then serves it up from the assembly.</p> <pre><code>&lt;configuration&gt; &lt;system.web&gt; &lt;httpHandlers&gt; &lt;add verb="*" path="*W...
<p>Short answer is no. The ASMX is the entry point for any web service. There are alternatives if you use WCF, but that's not entirely the same thing.</p>
42,007
<p>We are migrating our works repository so I want to do a cull of all the unreferenced files that exist in the source tree before moving it into the nice fresh (empty) repository.</p> <p>So far I have gone through by hand and found all the unreferenced files that I know about but I want to find out if I have caught t...
<p>You've tagged this post with <strong>c++</strong>, so I'm assuming that's the language in question. If that's the only thing that's in the repository then it shouldn't be too hard to grep all files in the repository for each filename to give you a good starting point. If the repository contains other files (metadata...
<p>A static source code analysis tool like lint might do the job. They will tell you if a piece of code will never be called.</p>
7,465
<p>I am seeting up Apache server with TortoiseSVN for local source code repository. Currently on trial purpose I am setting only two users. Is it possible for administrator to set up some thing so that file get compulsory locked once its checkout (copy to working directory) by some one.</p> <p>Abhijit Dhopate</p>
<p>The main reason you might want to do this on subversion is for binary files (i.e. images, etc.) that are difficult or impossible to 'merge'. In those cases, each user can request a lock on a file. There is also a svn property (needs-lock) that can be applied to files that makes them read-only on checkout, and read-w...
<p>Wouldn't that defeat one of the purposes of a concurrent versioning system like SubVersion? Generally, you'll check out a block of files, but the server doesn't know whether anyone is editing those files. Why not allow another user access to those files and deal with the results if a conflict emerges?</p>
12,915
<p>If I have 2 query sources how do I find ones that are in one that are not in the other?</p> <p>example of join to find items in both:</p> <pre><code>var results = from item1 in qs1.Items join item2 in qs2 on item1.field1 equals item2.field2 select item1; </code></pre> <p>So what would the linq code be to re...
<p>Darren Kopp's <a href="https://stackoverflow.com/questions/50702/linq-how-do-you-do-a-query-for-items-in-one-query-source-that-are-not-in-anothe/50724#50724">answer</a>:</p> <pre><code>var excluded = items1.Except(items2); </code></pre> <p>is the best solution from a performance perspective.</p> <p><em>(NB: This ...
<p>Here's a more simple version of the same thing, you don't need to nest the query:</p> <pre><code>List&lt;string&gt; items1 = new List&lt;string&gt;(); items1.Add("cake"); items1.Add("cookie"); items1.Add("pizza"); List&lt;string&gt; items2 = new List&lt;string&gt;(); items2.Add("pasta"); items2.Add("pizza"); var ...
7,346
<p>What is the best way to randomize an array of strings with .NET? My array contains about 500 strings and I'd like to create a new <code>Array</code> with the same strings but in a random order.</p> <p>Please include a C# example in your answer.</p>
<p>If you're on .NET 3.5, you can use the following IEnumerable coolness:</p> <pre><code>Random rnd=new Random(); string[] MyRandomArray = MyArray.OrderBy(x =&gt; rnd.Next()).ToArray(); </code></pre> <p>Edit: and here's the corresponding VB.NET code:</p> <pre><code>Dim rnd As New System.Random Dim MyRandomArray = M...
<p>Here's a simple way using OLINQ:</p> <pre><code>// Input array List&lt;String&gt; lst = new List&lt;string&gt;(); for (int i = 0; i &lt; 500; i += 1) lst.Add(i.ToString()); // Output array List&lt;String&gt; lstRandom = new List&lt;string&gt;(); // Randomize Random rnd = new Random(); lstRandom.AddRange(from s in...
13,413
<p>Looking at this loop that copies one c-string to another:</p> <pre><code>void strcpyr(char *s, char *t) { while(*s++=*t++)// Why does this work? ; } </code></pre> <p>Why do we not check for the '\0' character in the while loop, like this?</p> <pre><code>while((*s++=*r++)!='\0').. </code></pre> <p>How...
<p>The statement *s++=*t++ not only assigns the next character from t to s but also returns the current value of *t as the result of the expression. The while loop terminates on any false value, including '\0'.</p> <p>Think of it this way. If you did:</p> <pre><code>char c = *s++ = *t++; </code></pre> <p>in addition...
<p>I think you mean to write this:</p> <pre><code>void strcpyr(char *s, char *t) { while (*s++ = *t++); } </code></pre> <p>The loop terminates when the value pointed to by "t" is zero. For C (and C++) loops and conditionals, any integer that is non-zero is true.</p>
30,687
<p>Is there a Generics Friendly way of using Collection.EMPTY_LIST in my Java Program.</p> <p>I know I could just declare one myself, but I'm just curious to know if there's a way in the JDK to do this.</p> <p>Something like <code>users = Collections&lt;User&gt;.EMPTY_LIST;</code></p>
<p>By doing the following:</p> <pre><code>List&lt;User&gt; users = Collections.emptyList(); </code></pre> <p>The type of the returned list from <code>Collections.emptyList();</code> will be <em>inferred</em> as a <code>String</code> due to the left-hand-side of the assignment. However, if you prefer to not have this...
<pre><code>List&lt;User&gt; users = Collections.emptyList(); </code></pre>
20,434
<p>I have inherited a project that has class libraries written in VB.NET, some of these have ".settings" files and the others have a ".dll.config" file to store connection strings. What is the difference between these 2 methods?</p> <p>EDIT: In what scenarios would I prefer one over the other?</p>
<p>They're basically the same thing - or strongly related, anyway. A settings file gives you strongly-typed access to entries in an app.config file, and keeps them in sync. When you compile, the app.config file is copied to the bin folder with the name of your assembly.</p> <p>Note that, if you modify the .config fi...
<p>I think that .settings is application wide, while the .dll.config files are specific to the assembly they are named for.</p>
39,308
<p>I'm using a <code>DateTime</code> in C# to display times. What date portion does everyone use when constructing a time?</p> <p>E.g. the following is not valid because there is no zero-th month or zero-th day:</p> <pre><code>// 4:37:58 PM DateTime time = new DateTime(0, 0, 0, 16, 47, 58); </code></pre> <p>Do I use...
<p>what about DateTime.MinValue?</p>
<p>Use a TimeSpan, and make it UTC if you have TimeZone issues.</p>
48,705
<p>I'd like to be able to hook into a 3rd party application to see what SQL Statements are being executed. Specifically, it is a VB6 application running on SQL Server 2005.</p> <p>For example, when the application fills out a grid, I'd like to be able to see exactly what query produced that data.</p>
<p>If you have the appropriate rights (sysadmin or ALTER TRACE permission) on the DB you could watch using SQL Profiler.</p>
<p>Reviewing it on the server as other answers indicate is most likely the best way to go. However, if that's not available, you can also turn on <a href="http://technet.microsoft.com/en-us/library/ms403323(SQL.90).aspx" rel="nofollow noreferrer">ODBC logging</a> which may be helpful.</p>
13,633
<p>I have an application written in flash (actually it is written in Haxe and run under SHWX but it doesn't matter here). I have a pretty complex task that consumes a lot of CPU power and sometimes executes for more that 15 seconds. If that happens, I've got an error saying 'A script has executed for longer than the de...
<p>Another way is to link a <a href="http://swfmill.org/" rel="nofollow noreferrer">swfmill</a>-based swf via -swf-lib switch and set this ScriptLimits tag there, haxe will re-use it then.</p>
<p>I suggest breaking your function into smaller chunks and spreading them over multiple frames. This way you can display an progress animation and the Flash application won't become unresponsive. So for example if you have to loop over 1000 items, you do 100 in one frame, then another hundred in the next frame, etc, u...
11,673
<p>I am trying to use page methods in my asp.net page. I have enable page methods set to true on the script manager, the webmethod attribute defined on the method, the function is public static string, I know the function works because when I run it from my code behind it generates the expected result, but when I call...
<p>In your PagesMethods call, remove the parentheses from the callback and error functions:</p> <pre><code>PageMethods.getAdCodeInfo(value, onSuccess, onError) </code></pre> <p><code>onSuccess</code> and <code>onError</code> are basically variables that point to the functions. So you don't need parentheses for varia...
<p>OK, stupid me. Here is some code. </p> <pre><code> function getName() { var ddlAdCodes=$get('&lt;%=ddlAdCodes.ClientID %&gt;'); var value=ddlAdCodes.options[ddlAdCodes.selectedIndex].value; //alert(value); PageMethods.getAdCodeInfo(value,onSuccess(),onError()); } function onSuccess(result) { ...
27,564
<p>What is best way to allow user to pick date from a mobile device from usability prospective?</p>
<p>I'd detest any form of drop-down, select-list when using a mobile app.</p> <p>Unfortunately, three separate boxes (for day, month and year) would be equally painful on a MIDP-profile device.</p> <p>I'd almost suggest using one text box, and do a <code>DateTime.TryParse(String, out DateTime)</code> to get the resul...
<p>Are you building WAP page in asp.net? You have a DatePicker control in the mobile toolset. On devices that supports it this will render as a regular date picker (as in regular asp.net) while on more limited devices it will render as a series of selectors where you first select the year, then the month and finally th...
40,456
<p>I am able to create and execute a DTS package that copies tables from a remote Oracle database to a local SQL server, but want to setup the connection to the Oracle database as a linked server.</p> <p>The DTS package currently uses the <em>Microsoft OLE DB Provider for Oracle</em> with the following properties:</p>...
<p>I was able to setup a linked server to a remote Oracle database, which ended up being a multi-step process:</p> <ol> <li>Install Oracle ODBC drivers on SQL Server.</li> <li>Create System DSN to Oracle database on SQL Server.</li> <li>Create linked server on SQL server using System DSN.</li> </ol> <p><strong>Step 1...
<p>I had the same problem. I was on the phone with Microsoft for hours, and they did not have a solution. None of those "connection timeout" settings helped me. </p> <p>To resolve it, I created a DTS job that runs a proc which only updates the time on one row, in one column, every two minutes. Then I setup a replic...
39,595
<p>I'm looking for a good TraceListener for .Net that supports rolling over the log file based on size limits. </p> <p><strong>Constraints</strong></p> <ul> <li>Uses .Net built in Trace logging</li> <li>Independent class or binary that's not part of some gigantic library</li> <li>Allows rolling over a log file based...
<p>You could use <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.logging.filelogtracelistener.aspx" rel="noreferrer">Microsoft.VisualBasic.Logging.FileLogTraceListener</a>, which comes built-in with the .NET Framework. Don't let the VisualBasic in the namespace scare you, you'll just have to refe...
<p>Consider <a href="http://msdn.microsoft.com/en-us/library/ff664700%28PandP.50%29.aspx" rel="nofollow">Enterprise Library Logging Application Block</a></p> <p>Make sure to install only the Logging block, since EntLib installer checks all blocks by default.</p>
18,944
<p>I would like to either prevent or handle a <code>StackOverflowException</code> that I am getting from a call to the <code>XslCompiledTransform.Transform</code> method within an <code>Xsl Editor</code> I am writing. The problem seems to be that the user can write an <code>Xsl script</code> that is infinitely recursiv...
<p>From Microsoft:</p> <blockquote> <p>Starting with the .NET Framework version 2.0, a StackOverflowException object cannot be caught by a try-catch block and the corresponding process is terminated by default. Consequently, users are advised to write their code to detect and prevent a stack overflow. ...
<p>You can read up this property every few calls, <code>Environment.StackTrace</code> , and if the stacktrace exceded a specific threshold that you preset, you can return the function.</p> <p>You should also try to replace some recursive functions with loops.</p>
25,345
<p>The university I work at uses Oracle for the database system. We currently have programs we run at night to download what we need into some local Access tables for our testing needs. Access is getting to small for this now and we need something bigger. Also, the nightly jobs require constant maintance to keep workin...
<p>I don't think there is really anything that is going to do this. If you could setup a local Oracle database, then most likely you could as oracle has various means of keeping two databases "in sync", provided they are both Oracle.</p> <p>If you must use mysql, then likely you are going to just have to write somethi...
<p>Could you just copy the Oracle tables and then set them up as linked tables in MS Access? This way the front-end stays the same plus you keep everything in Oracle (less moving parts than exporting and importing).</p>
4,117
<p>The Oracle community has a several support sites (<a href="http://www.11ghelp.com/map/sitemap-110.html" rel="nofollow noreferrer">here</a> and <a href="http://www.oracleabc.com/oracledocs/11gErrors/" rel="nofollow noreferrer">here</a>) that have lists of errors. The first site even has suggestions for how to fix th...
<p>No, every component is permitted to define its own. The only restrictions are that error values must have the high bit set, and the bits in the middle are <em>supposed</em> to identify the component. </p> <p><a href="http://en.wikipedia.org/wiki/HRESULT" rel="nofollow noreferrer">Wikipedia</a> has an article showi...
<p><a href="http://msdn.microsoft.com/en-us/library/aa705941(VS.85).aspx" rel="nofollow noreferrer">Here</a> is ms's general com ex list; pretty short but its something. When I was working with OWC, I typically found them scattered on different sites or in separate blog entries. (Yay Google) </p>
38,982
<p>I'm using C# on Framework 3.5. I'm looking to quickly group a Generic List&lt;> by two properties. For the sake of this example lets say I have a List of an Order type with properties of CustomerId, ProductId, and ProductCount. How would I get the sum of ProductCounts grouped by CustomerId and ProductId using a lamb...
<pre><code>var sums = Orders.GroupBy(x =&gt; new { x.CustomerID, x.ProductID }) .Select(group =&gt; group.Sum(x =&gt; x.ProductCount)); </code></pre>
<p>var New1 = EmpList.GroupBy(z => z.Age).OrderBy(Employee => Employee.Key);</p> <p>dataGridView1.DataSource = New1;</p>
47,471
<p>When I create a TFS report of a query with the Excel integration features (we are using Excel 2003), Excel resets formatting of all cells after clicking the "Refresh" button in the TFS Toolbar.</p> <p>Our team likes to print this report and drag it into our weekly meeting as it accurately lists all our open tasks. ...
<p>I ended up doing this:</p> <ul> <li><code>tfpt.exe</code> (<a href="http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx" rel="nofollow noreferrer">Team Foundation Power Tools</a>) </li> <li>query for xml: <code>tfpt query /format:xml</code> (add your query name here etc.)</li> <li>convert that to a html table wit...
<p>My guess is that since Microsoft is playing up this feature in the VS 2010 CTP, it's not currently supported.</p> <p>Your best bet may be to create a sheet with all of the appropriate formatting and then cut and paste from the <em>live</em> excel sheet into the formatted sheet.</p>
35,904
<p>I am building a web application which uses an externally built class to handle much of the work and rules for the site. Most pages will require access to this class to get the information it needs to display. In the past I would put such a class in a session variable, so it's easily accessible when required and no...
<p>Before deciding on where to store your class, you have to answer two questions:</p> <ol> <li>How long this class should live?</li> <li>In what scope should it be visible?</li> </ol> <p>Examples that answer both questions: request, user session, application.</p> <p>If this class is stateless (no data and only logi...
<p>Without knowing any frameworks you use, it does not seem smart idea to put a class into the session store - it will be copied once per user - unless it has data that is unique to that user.</p> <p>The best advice I can give would be to have a singleton class (you can google it - it is a design pattern) and then jus...
43,627
<p>I have a class that defines the names of various session attributes, e.g.</p> <pre><code>class Constants { public static final String ATTR_CURRENT_USER = "current.user"; } </code></pre> <p>I would like to use these constants within a JSP to test for the presence of these attributes, something like:</p> <pre><...
<p>It's not working in your example because the <code>ATTR_CURRENT_USER</code> constant is not visible to the JSTL tags, which expect properties to be exposed by getter functions. I haven't tried it, but the cleanest way to expose your constants appears to be the <a href="http://jakarta.apache.org/taglibs/sandbox/doc/u...
<p>First, your syntax had an extra "]" which was causing an error. </p> <p>To fix that, and to set a variable you would do this:</p> <pre><code>&lt;c:set var="nullUser" scope="session" value="${sessionScope[Constants.ATTR_CURRENT_USER] eq null}" /&gt; &lt;c:if test="${nullUser}"&gt; &lt;h2&gt;First T...
14,867
<p>I'm considering using Flash but I'm pretty addicted to autocomplete and Step-at-a-time debugging.</p>
<p>By using Eclipse with the ActionScript plugin you get full code hinting in the same format that you do with intellisense. </p> <p>Or you can use <a href="http://www.flashdevelop.org/community/" rel="nofollow noreferrer">FlashDevelop</a> that has both intellisense and can <a href="http://www.flashdevelop.org/communi...
<p>If you mean ActionScript I once heard that <a href="http://www.primalscript.com/" rel="nofollow noreferrer">PrimalScript</a> will do Intellisense. Never tested it though. As for debugging, MAYBE, <a href="http://www.primalscope.com/" rel="nofollow noreferrer">PrimalScope</a> will have that too. I'd recommend you try...
7,168
<p>I've got a situation where I have a DLL I'm creating that uses another third party DLL, but I would prefer to be able to build the third party DLL into my DLL instead of having to keep them both together if possible.</p> <p>This with is C# and .NET 3.5.</p> <p>The way I would like to do this is by storing the thir...
<p>Once you've embedded the third-party assembly as a resource, add code to subscribe to the <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx" rel="noreferrer"><code>AppDomain.AssemblyResolve</code></a> event of the current domain during application start-up. This event fires whene...
<p>Instead of writing the assembly to disk you can try to do Assembly.Load(byte[] rawAssembly) where you create rawAssembly from the embedded resource.</p>
12,226
<p>Is it legal to add support for a 3rd party file format in my application by reverse engineer a unencrypted binary file format from another application, and reading the contents?</p>
<p>Depends on your location. In the EU it is specifically permitted (article 6 EU software convention) to "reverse engineer file formats for the purpose of interoperability"</p> <p>In general it's hard to prevent someone reading a file format, there have been examples where you are prohibeted from writing a file becau...
<p>If you have to violate the terms of an EULA to do so, it is illegal. Although most states have laws expressly permitting reverse engineering, it is my understanding that that is not an 'inalienable right', but one you can waive contractually. (In other words, permitting reverse engineering does not prevent you from ...
14,743
<p>I am working on creating an immutable class.<br> I have marked all the properties as read-only. </p> <p>I have a list of items in the class.<br> Although if the property is read-only the list can be modified. </p> <p>Exposing the IEnumerable of the list makes it immutable.<br> I wanted to know what is the basic r...
<p>I think you're on the right track -</p> <ul> <li>all information injected into the class should be supplied in the constructor</li> <li>all properties should be getters only</li> <li>if a collection (or Array) is passed into the constructor, it should be copied to keep the caller from modifying it later</li> <li>if...
<p>Using <a href="https://learn.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.readonlycollection-1?view=netframework-4.8" rel="nofollow noreferrer">ReadOnlyCollection</a> will restrict client from modifying it.</p>
45,896
<blockquote> <p><strong>Possible duplicate</strong><br> <a href="https://stackoverflow.com/questions/197182/windows-forms-application-like-google-chrome-with-multiple-processes">Windows Forms application like Google Chrome with multiple processes</a><br> <a href="https://stackoverflow.com/questions/628744/chrome-...
<p>That doesn't sound like such a good idea. The winforms common controls are for the most part not thread-safe, and giving each control it's own process seems icky.</p> <p>If you want to try this, perhaps give each <em>form</em> it's own process, or even just it's own thread. Or perhaps if you have a tab control th...
<p>The reason that chrome gives each tab its own process is sandboxing. If one tab behaves errantly it is less likely to take down the whole browser. Is there a similar need in your app? </p> <p>Also, note that browser tabs don't need to share information. What's on a tab is on a tab and no other tab needs to care abo...
24,631
<p>Each of these variables has an integer value. But this syntax is not valid for some reason:</p> <pre><code>&lt;xsl:when test="$nextAnswerListItemPos &lt; $nextQuestionStemPos" &gt; </code></pre>
<p>You have to use <code>&amp;lt;</code> instead of <code>&lt;</code> and <code>&amp;gt;</code> instead of <code>&gt;</code>, because those are reserved characters.</p>
<p>Also, in XSLT 2.0, you can use the operators "gt" (greater than), "lt" (less than), and "eq" (equal). Using these instead of the entities makes your code a bit cleaner.</p>
41,062
<p>Open source implementation will be preferred.</p>
<p>Obviously, it isn't an easy task, PDF formatting is much richer than HTML's one (plus you must extract images and link them, etc.).<br> Simple text extraction is much simpler (although not trivial...).<br> I see in the sidebar of your question a similar question: <a href="https://stackoverflow.com/questions/276434/c...
<p>Only ones I know of have to be paid for.</p> <p><a href="http://bfo.co.uk/" rel="nofollow noreferrer">BFO</a><br> <a href="http://www.jpedal.org/" rel="nofollow noreferrer">JPedal</a></p>
46,815
<p>I've been using IntelliJ IDEA at the day job for Java development for a few weeks now. I'm really impressed with it and I'm looking to extend it for other programming languages that I tinker with, starting with Python. I found this plug-in, <a href="https://pythonid.dev.java.net/" rel="nofollow noreferrer">pythonid...
<p>I've tried Pythonid before and found it very limited. There's a <a href="http://plugins.intellij.net/plugin/?id=631" rel="nofollow noreferrer">new Python plugin</a> from JetBrains, the people that make IDEA, which looks pretty nice, though it's <a href="http://www.jetbrains.net/confluence/display/PYH/Release+Notes" ...
<p>I've tried Pythonid before and found it very limited. There's a <a href="http://plugins.intellij.net/plugin/?id=631" rel="nofollow noreferrer">new Python plugin</a> from JetBrains, the people that make IDEA, which looks pretty nice, though it's <a href="http://www.jetbrains.net/confluence/display/PYH/Release+Notes" ...
49,326
<p>I have a site I made really fast that uses floats to display different sections of content. The floated content and the content that has an additional margin both appear fine in FF/IE, but on safari one of the divs is completely hidden. I've tried switching to <code>padding</code> and <code>position:relative</code>,...
<p>I believe the error lies in the mark up that the color picker is generating. I saved the page and removed that code for the color picker and it renders fine in IE/FF/SF. </p>
<p>Sorry I should have mentioned that as well. I tried floating that content right and additionally tried floating it left and setting the position with the thinking that both divs would start out at left:0 where setting the margin of the right would move it over.</p> <p>Thanks</p>
7,300
<p>I am seeing strange behaviour with the flash.media.Sound class in Flex 3.</p> <pre><code>var sound:Sound = new Sound(); try{ sound.load(new URLRequest("directory/file.mp3")) } catch(e:IOError){ ... } </code></pre> <p>However this isn't helping. I'm getting a stream error, and it actually sees to be in the Sound c...
<p><a href="http://livedocs.adobe.com/flex/3/langref/flash/errors/IOError.html" rel="noreferrer">IOError</a> = target file cannot be found (or for some other reason cannot be read). Check your file's path.</p> <p>Edit: I just realized this may not be your problem, you're just trying to catch the IO error? If so, you c...
<p>You will need to add a listener since the URLRequest is not instantaneous. It will be <strong>very</strong> fast if you're loading from disk, but you will still need the Event-listener. There's a good example of how to set this up (Complete with IOErrorEvent handling) in the <a href="http://livedocs.adobe.com/flash...
10,645
<p>This is a follow-up to my <a href="https://stackoverflow.com/questions/372695/is-there-a-standard-c-function-object-for-taking-apart-a-stdpair">question from yesterday</a>. I have Scott Meyers' warning about write-only code on my mind. I like the idea in principle of using standard algorithms to access the keys or...
<p>Clarity always beats clever. Do what you can read later.</p> <p>You're not alone in thinking that the standard code is a little obtuse. The next C++ standard will introduce <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions" rel="noreferrer">lambda functions</a> so you can write more...
<p>Go with option #1, see Scott Meyers, <a href="https://rads.stackoverflow.com/amzn/click/com/0201749629" rel="nofollow noreferrer" rel="nofollow noreferrer">Effective STL</a> Item #43, page 181.</p>
49,233
<p>I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either:</p> <ul> <li>learn the ins and out of C in Visual Studio</...
<p>well you can use visual studio just fine take a look at here man <a href="http://www.daniweb.com/forums/thread16256.html" rel="noreferrer">http://www.daniweb.com/forums/thread16256.html</a></p> <p>Go to View Menu select Solution Explorer or CTRL+ ALT +L</p> <p>Then Select The project that your are developing and r...
<p>Visual Studio or Express do consider .c files as C code, but the compiler will keep giving warnings, and irritating suggestions which you do not require, in the debugger. Gives an indication that Visual C++, as the name suggests is optimized for C++ development for the Windows Operating system, which was originally ...
4,823
<p>I tried this in mysql:</p> <pre><code>mysql&gt; alter table region drop column country_id; </code></pre> <p>And got this:</p> <pre><code>ERROR 1025 (HY000): Error on rename of './product/#sql-14ae_81' to './product/region' (errno: 150) </code></pre> <p>Any ideas? Foreign key stuff?</p>
<p>You usually get this error if your tables use the InnoDB engine. In that case you would have to drop the foreign key, and then do the alter table and drop the column.</p> <p>But the tricky part is that you can't drop the foreign key using the column name, but instead you would have to find the name used to index it...
<p>averageRatings= FOREACH groupedRatings <strong>GENERATE group AS</strong> movieID, AVG(ratings.rating) AS avgRating, COUNT(ratings.rating) AS numRatings;</p> <p>If you are using any command like above you must use group in small letters. This may solve your problem it solved mine. At least in PIG script.</p>
19,378
<p>My basic question is, in .NET, how do I clone WebControls?</p> <p>I would like to build a custom tag, which can produce multiple copies of its children. Ultimately I intend to build a tag similar to in JSP/Struts.</p> <p>But the first hurdle I have is the ability to duplicate/clone the contents of a control.</p> ...
<p>What's wrong with using a Repeater and binding a dud data source. It'll duplicate the templated controls and handle the ID creation and all.</p>
<p>The way to do this in ASP.NET is using templates. There are samples in MSDN for this, just look for templated controls / ITemplate.</p>
19,514
<p>I need to scramble the names and logins of all the users in a UAT database we have. (because of the data protection act)</p> <p>However, there is a catch.</p> <p>The testers still need to be able to login using the hashed login names</p> <p>so if a user login is "Jesse.J.James" then the hash should be something l...
<p>You do not need to hash the data. You should just randomize it so it has no relation to the original data.</p> <p>For example, update all the login names, and replace each letter with another random letter.</p>
<p>Why not use a test data generator for the data that could identify an individual?</p> <p><a href="https://stackoverflow.com/questions/16317/creating-test-data-in-a-database#16336">Creating test data in a database</a></p>
20,842