instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>How do I write the results from a mysql query to file? I just need something quick. Output can be CSV, XML, HTML, etc.</p>
<pre><code>SELECT a,b,a+b FROM test_table INTO OUTFILE '/tmp/result.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' </code></pre> <p>(the docs show INTO OUTFILE up in the SELECT .. portion which may work as well, but I've never tried it that way) <a href="http://dev.mysql.com...
<p>if you have phpMyAdmin installed, it is a nobrainer: Run the query (haven't got a copy loaded, so I can't tell you the details, but it really is easy) and check neer bottom for export options. CSV will be listed, but I think you can also have SQL if you like :)</p> <p>phpMyAdmin will give CSV in Excels dialect, whi...
5,071
<p>ValidateEvents is a great ASP.net function, but the Yellow Screen of Death is not so nice. I found a way how to handle the HttpRequestValidationException gracefully <a href="http://www.romsteady.net/blog/2007/06/how-to-catch-httprequestvalidationexcep.html" rel="nofollow noreferrer">here</a>, but that does not work...
<p>Found it and <a href="http://www.stum.de/2008/09/08/gracefully-handling-httprequestvalidationexception-with-aspnet-ajax/" rel="nofollow noreferrer">blogged about it</a>. Basically, the EndRequestHandler and the args.set_errorHandled are our friends here.</p> <pre><code>&lt;script type="text/javascript" language="ja...
<p>hmmmm, it seems you would need to find some sort of JavaScript to check for html input or a client side validator. </p>
7,017
<p>We are starting with Sharepoint development with a team of three and are currently setting up our development environments. We would like to avoid installing a Server 2008 for each developer, thus a single terminal server has been setup, using Remote Windows to start a VS2008 instance on each developer's machine. No...
<p>So you're all going to remote in an fire up Visual Studio and be compiling stuff and restarting IIS, etc?</p> <p>You're going to be stamping on each other's toes.</p> <p>A wiser choice nowadays is to use Hyper-V (or some other virtualisation).</p> <p>We use Windows Server 2008 on our laptops, and use Hyper-V to r...
<p>The contributors are right that there are lots of stumbling blocks to multi-developer single server environments. </p> <p>Number one developers will be trying to attach to the same Web Application process w2ps.exe so creating separate Web Applications on different ports is a must unless you are prepared to share t...
41,894
<p>I am looking for a tool which will take an XML instance document and output a corresponding XSD schema.</p> <p>I certainly recognize that the generated XSD schema will be limited when compared to creating a schema by hand (it probably won't handle optional or repeating elements, or data constraints), but it could a...
<p>the <a href="https://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.110).aspx" rel="noreferrer">Microsoft XSD inference tool</a> is a good, free solution. Many XML editing tools, such as XmlSpy (mentioned by @Garth Gilmour) or OxygenXML Editor also have that feature. They're rather expensive, though. BizTalk Server ...
<p>Altova XmlSpy does this well - you can find an overview <a href="http://www.altova.com/products/xmlspy/dtd_editor.html" rel="nofollow noreferrer">here</a></p>
10,049
<p>What is the best way to create a 'global event' in flex/actionscript - preferably using a static class?</p> <p>I want to raise an event to indicate that a stylesheet is loaded in order to show components that require that stylesheet. So I want each portion of the application that requires a style from the styleshee...
<p>Service Pack 1 added the following feature:</p> <p>If you "anyfile.js" and "anyfile-vsdoc.js" in the same directory, then any references to "anyfile.js" will automagically be converted to a reference to "anyfile-vsdoc.js" behind the scenes.</p> <p>Add an empty file next to your plugin with "-vsdoc" appended to the...
<p>It could be that third party JavaScript plugin you're using has some errors in it.<br> I would check the code in <a href="http://www.jslint.com/" rel="nofollow noreferrer">JSLint</a> and directed this question to the author of the plugin.<br> As for the question itself: I don't think you can exclude it if it's a par...
36,250
<p>We are currently building an application which needs to compile C# code. Can we redistribute <code>csc.exe</code> in our package. I thought that it comes with the .Net framework installation but from looking in Microsoft Web site I see that there is a difference between .Net framework and the .Net SDK</p> <p>What a...
<p>csc.exe is definitely part of the framework itself, not just the SDK.</p> <p>However, you may not need to call out to csc.exe in the first place - there's <a href="http://msdn.microsoft.com/en-us/library/microsoft.csharp.csharpcodeprovider.aspx" rel="nofollow noreferrer">CSharpCodeProvider</a> which lets you compil...
<p>csc.exe is available with the base installation of the framework.</p>
48,007
<p>I have a XML with a structure similar to this:</p> <pre><code>&lt;category&gt; &lt;subCategoryList&gt; &lt;category&gt; &lt;/category&gt; &lt;category&gt; &lt;!--and so on --&gt; &lt;/category&gt; &lt;/subCategoryList&gt; &lt;/category&gt; </code></pre> <p>I have a Category ...
<p><a href="http://www.roseindia.net/tutorials/xPath/java-xpath.shtml" rel="noreferrer">This link</a> has everything you need. In shorts:</p> <pre><code> public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException { DocumentBuilder...
<p>This will work for you:</p> <pre><code>NodeList nodes = (NodeList) xpath.evaluate("//category//subCategoryList/category", inputSource, XPathConstants.NODESET); </code></pre> <p>Then you can parse the children of category as you wish.</p>
44,275
<p>I have a QTreeWidget with a column filled with some numbers, how can I sort them?</p> <p>If I use setSortingEnabled(true); I can sort correctly only strings, so my column is sorted:</p> <p>1 10 100 2 20 200</p> <p>but this is not the thing I want! Suggestions?</p>
<p>You can sort overriding the &lt; operator and changing sort condiction like this.</p> <pre><code>class TreeWidgetItem : public QTreeWidgetItem { public: TreeWidgetItem(QTreeWidget* parent):QTreeWidgetItem(parent){} private: bool operator&lt;(const QTreeWidgetItem &amp;other)const { int column = treeWid...
<p>numbers sort by numeric value, but strings sort the opposite way (i.e. <code>"19999" &lt; "2"</code>).</p> <p>More specifically, strings are compared character by character from left to right until one one or the other characters differ, at which point the comparision is stopped. For instance, <code>19</code> and <...
47,416
<p>In php, I often need to map a variable using an array ... but I can not seem to be able to do this in a one liner. c.f. example:</p> <pre><code>// the following results in an error: echo array('a','b','c')[$key]; // this works, using an unnecessary variable: $variable = array('a','b','c'); echo $variable[$key]; </...
<p>I wouldn't bother about that extra variable, really. If you want, though, you could also remove it from memory after you've used it:</p> <pre><code>$variable = array('a','b','c'); echo $variable[$key]; unset($variable); </code></pre> <p>Or, you could write a small function:</p> <pre><code>function indexonce(&amp;...
<p>Or something like this, if you need the array value in a variable</p> <pre><code>$variable = array('a','b','c'); $variable = $variable[$key]; </code></pre>
3,413
<p>Is there any elegant way in the Android API for detecting new media when it is written to the device? I’m mainly interested in photos taken by the camera, video taken by the camera and audio recorded from the mic.</p> <p>My current thinking is to periodically scan each media content provider and filter based on las...
<p>There's a special broadcast Intent that should get called every time an application writes anything new to the Media Store:</p> <pre><code>Intent.ACTION_MEDIA_SCANNER_SCAN_FILE </code></pre> <p>The Broadcast Intent includes the path to the new file, accessible through the <code>Intent.getDataString()</code> method...
<p>Aha!</p> <p>A <a href="http://code.google.com/android/reference/android/database/ContentObserver.html" rel="nofollow noreferrer">content observer</a> is what i need!</p> <p><a href="http://mylifewithandroid.blogspot.com/2008/03/observing-content.html" rel="nofollow noreferrer">Here's where i found out about it</a>...
28,550
<p>What is the fastest method of parsing an XML file in C#? I'm using .Net 2.0 </p>
<p>If you're using .Net 2 then the XmlReader and XmlDocument are about it.</p> <p>If you can use .Net 3.5 then the new Linq to Xml methods are a big improvement.</p>
<p>I haven't benched-marked it myself, but when I've asked about it in the past I've been told that XmlDocument is supposed to be faster. I have my doubts, though, since XmlDocument would need to create a DOM while XmlReader does not.</p>
6,340
<p>I work for a software / design firm and I recently found out that our "in house" CMS is actually <a href="http://modxcms.com/" rel="noreferrer">MODx</a> that has been re-skinned by one of our designers. MODx is licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html" rel="noreferrer">GPL Ver 2.</a>. I w...
<p>For in-house use, you'd be fine.</p> <p>For selling to clients, you'd have to give the source code to them if they ask for it, and make sure that they know that they are entitled to the source code.</p> <p>As Harper Shelby suggests, you should talk to your management chain first, then your company's lawyers. If the...
<p>How do people who have been around the company for a while behave? For example, are they careful to make sure that the terms of the GPL are satisfied? Or are they acting like they are pulling a fast one over on their clients or the softwares (pre)developers? Do they act like they are experts on law and don't need to...
49,719
<p>I keep seeing code that does checks like this</p> <pre><code>if (IsGood == false) { DoSomething(); } </code></pre> <p>or this</p> <pre><code>if (IsGood == true) { DoSomething(); } </code></pre> <p>I hate this syntax, and always use the following syntax.</p> <pre><code>if (IsGood) { DoSomething(); } </c...
<p>I follow the same syntax as you, it's less verbose.</p> <p>People (more beginner) prefer to use <code>== true</code> just to be sure that it's what they want. They are used to use operator in their conditional... they found it more readable. But once you got more advanced, you found it irritating because it's too v...
<p>Coding in C#/C++/Java/etc... I always prefer</p> <p><code> if (something == true)<br/> if (something == false) </code></p> <p>over</p> <p><code> if (something)<br/> if (!something) </code></p> <p>because the exclamation point is just difficult to see at a glance unless I used a large font (but then I'd see less ...
46,443
<p>I'm looking for a "safe" eval function, to implement spreadsheet-like calculations (using numpy/scipy).</p> <p>The functionality to do this (the <a href="http://docs.python.org/lib/module-rexec.html" rel="nofollow noreferrer">rexec module</a>) has been removed from Python since 2.3 due to apparently unfixable secur...
<p>Depends on your definition of safe I suppose. A lot of the security depends on what you pass in and what you are allowed to pass in the context. For instance, if a file is passed in, I can open arbitrary files:</p> <pre><code>&gt;&gt;&gt; names['f'] = open('foo', 'w+') &gt;&gt;&gt; safe_eval.safe_eval("baz = type(f...
<p>Daniel, <a href="http://jinja.pocoo.org/2/documentation/intro" rel="nofollow noreferrer">Jinja</a> implements a sandboxe environment that may or may not be useful to you. From what I remember, it doesn't yet "comprehend" list comprehensions. </p> <p><a href="http://jinja.pocoo.org/2/documentation/sandbox" rel="nofo...
4,802
<p>I'm creating a KVC/KVO-compliant mutable array on one of my objects the recommended way:</p> <pre><code>@interface Factory { NSMutableArray *widgets; } - (NSArray *)widgets; - (void)insertObject:(id)obj inWidgetsAtIndex:(NSUInteger)idx; - (void)removeObjectFromWidgetsAtIndex:(NSUInteger)idx; @end </code></pre> ...
<p>Your <code>widgets</code> accessor should be fine, although you should be aware that none of the objects in that array are locked. So, you could run into problems trying to concurrently run code like</p> <pre><code>[[[myFactory widgets] objectAtIndex:7] setName:@"mildred"]; </code></pre> <p>and</p> <pre><code>[my...
<p>You will need locking on all reading and writing methods. If your insert and remove are also locking (like you said) then the accessor method should be fine like that.</p>
42,899
<p>Is SQL Server 2008 a good option to use as an image store for an e-commerce website? It would be used to store product images of various sizes and angles. A web server would output those images, reading the table by a clustered ID. The total image size would be around 10 GB, but will need to scale. I see a lot of be...
<p>10 Gb is not quite a huge amount of data, so you can probably use the database to store it and have no big issues, but of course it's best performance wise to use the filesystem, and safety-management wise it's better to use the DB (backups and consistency). </p> <p>Happily, Sql Server 2008 allows you to have your ...
<p>For something like an e-commerce web site, I would be moe likely to go with storing the image in a blob store on the database. While you don't want to engage in premature optimization, just the benefit of having my images be easily organized alongside my data, as well as very portable, is one automatic benefit for ...
43,491
<p>I am looking for an example of a FxCop Rule that inspects the properties of controls created. </p> <p>Has anyone seen one? Or know how to respond to a property set in the FxCop SDK?</p> <p>Rich.</p>
<p>My solutionwas to iterate through the instruction list provided for each member been checked.</p> <p>If its was of type Microsoft.FxCop.SDK.Method then a prefix of _set identified a property set.</p> <p>The only issue i have is this doesn't allow me to identify properties that have been left at the designer defaul...
<p>My solutionwas to iterate through the instruction list provided for each member been checked.</p> <p>If its was of type Microsoft.FxCop.SDK.Method then a prefix of _set identified a property set.</p> <p>The only issue i have is this doesn't allow me to identify properties that have been left at the designer defaul...
44,307
<p>Our ASP.NET application must be able to export web content to PDF and Word documents.</p> <p>In the past, we've used <a href="http://www.aspose.com/" rel="noreferrer">Aspose's</a> libraries to accomplish this, but we've found them to be a little too low-level in terms of document construction. e.g. We've found ours...
<p><a href="http://itextsharp.sourceforge.net/tutorial/index.html" rel="noreferrer">ITextSharp</a> is a pretty easy PDF tool to use with .Net (it's a port of the iText java project). Free, open source and pretty high level so this is the code for bullet points:</p> <pre><code>List overview = new List(false, 10); //fal...
<p>I do not believe that they do the automagically but I have good luck with SyncFusions tool sets.</p>
11,223
<p>One of our next projects is supposed to be a MS Windows based game (written in C#, with a winform GUI and an integrated DirectX display-control) for a customer who wants to give away prizes to the best players. This project is meant to run for a couple of years, with championships, ladders, tournaments, player vs. p...
<p>Just an idea what if the 'cheater' runs your software in a virtual machine (like vmware) and makes screenshots of that window? I doubt you can defend against that.</p> <p>You obviously can't defend against the 'analog gap', e.g. the cheater's system makes external screenshots with a high quality camera - I guess it...
<p>You should look into what goes into Punkbuster, Valve Anti-Cheat, and some other anti-cheat stuff for some pointers.</p> <p>Edit: What I mean is, look into <em>how</em> they do it; how they detect that stuff.</p>
17,302
<p>If you have a lot of Stored Procedures and you change the name of a column of a table, is there a way to check which Stored Procedures won't work any longer?</p> <hr> <p><strong>Update</strong>: I've read some of the answers and it's clear to me that there's is no easy way to do this. Would it be easier to move aw...
<p>While this will take the most work, the best way to ensure that everything works is to <strong>write integration tests</strong>.</p> <p>Integration tests are just like unit tests, except in this case they would integrate with the database. It would take some effort, but you could easily write tests that <em>exerci...
<p>I'm sure there are more elegant ways to address this, but if the database isn't too complex, here's a quick and dirty way:</p> <p>Select all the sprocs and script to a query window.</p> <p>Search for the old column name.</p>
37,317
<p>I was just wondering if there are any good work-arounds for Deserializing private fields/properties using XmlSerializer.Deserialize() ?</p> <p>Currently, I Deserialize my XML to a simple disposable type with all public properties, then I load the complex type that has private properties like this:</p> <pre><code>C...
<p>MySQL doesn't support milliseconds in any of the time / date columns, or return it in <code>NOW()</code> so unfortunately, no.</p> <p>If you have a string in a date / time + microseconds format you can use <code>SELECT MICROSECOND('1997-12-31 23:59:59.000010');</code> to extract the microseconds.</p>
<p>Just wanted to share it since I recently needed milliseconds for a MySQL project as well.</p> <p>You can write a UDF - <a href="http://dev.mysql.com/doc/refman/5.5/en/adding-udf.html" rel="nofollow noreferrer">User Defined Function</a> - to get you the system time down to a fairly small fraction of a second:</p> <...
40,163
<p>The Query Optimizer is estimating that the results of a join will have only one row, when the actual number of rows is 2000. This is causing later joins on the dataset to have an estimated result of one row, when some of them go as high as 30,000.</p> <p>With a count of 1, the QO is choosing a loop join/index seek ...
<p>Although the statistics were up to date, the scan percentage wasn't high enough to provide accurate information. I ran this on each of the base tables that was having a problem to update all the statistics on a table by scanning all the rows, not just a default percentage.</p> <pre><code>UPDATE STATISTICS &lt;table...
<p>can't you prod the QO with a well-placed query hint?</p>
11,864
<p>Do languages become more verbose as they mature? It feels like each new version of VB.net gains more syntax. Is it possible to trim down some fat like the keyword "Dim"? C# also feels like it is getting more syntax since version 1.</p>
<p>C# has certainly gained more syntax, but in a way which makes it <em>less</em> verbose.</p> <p>Virtually every feature in C# 3.0 allows you to do more with less code.</p>
<p>Doing so will only make your code harder to read.</p>
45,694
<p>While the J2EE module reference feature allows your to create common Java library projects, I can't find a neat way to do this for web content.</p> <p>I have common JSPs, CSS files, JavaScript libraries and even descriptor fragments that I would like to use across a number of Dynamic Web Projects, so that these ar...
<p>I've been wrestling with the same problem for a long time, and finally stumbled onto a good solution: "Linked Folders". This is an Eclipse feature that works similarly to symlinks -- it allows you to map a single physical folder into multiple projects. The nice thing about this solution is that it doesn't require ...
<p>haha,i give u a late surprise</p> <p>i'm Chinese,my english is poor, but i can help u .</p> <p>Olaf Kock is right ,but his answer not perfect.</p> <p>Here is the perfect answer. u have to refer the follow url, it can hep u.</p> <p><a href="http://www.chapter31.com/2008/05/22/setting-up-svnexternals-with-subclips...
45,340
<p>I need to use JavaScript in a form for mobile web application.</p> <p>I need some information about it, related to browser compatibility as well as way to use JavaScript in mobile web applications (syntax).</p>
<p>It's a nightmare. It's like working with web-browsers in the 90's but with the manager expectations of tomorrow.</p> <p>I strongly recommend you determine your target platforms in terms of regions, software, and actual hardware since the market is much more fragmented than the web and a large number of mobile devic...
<p>You may know Patrick H. Lauke, who wrotes the <a href="http://www.quirksmode.org/" rel="nofollow">quirksmode blog</a>. He started to work with mobile phones in the not so recent past.</p> <p>He is publishing his work on the same website in the same wonderful quality of his.</p> <p>Browsers in the new mobile phones...
40,919
<p>What is the best way to convert from Pascal Case (upper Camel Case) to a sentence.</p> <p>For example starting with</p> <pre><code>"AwaitingFeedback" </code></pre> <p>and converting that to</p> <pre><code>"Awaiting feedback" </code></pre> <p>C# preferable but I could convert it from Java or similar.</p>
<pre><code>public static string ToSentenceCase(this string str) { return Regex.Replace(str, "[a-z][A-Z]", m =&gt; m.Value[0] + " " + char.ToLower(m.Value[1])); } </code></pre> <p>In versions of visual studio after 2015, you can do</p> <pre><code>public static string ToSentenceCase(this string str) { return Re...
<p>Mostly <a href="https://stackoverflow.com/questions/272633/add-spaces-before-capital-letters#272929">already answered here</a></p> <p>Small chage to the accepted answer, to convert the second and subsequent Capitalised letters to lower case, so change</p> <pre><code>if (char.IsUpper(text[i])) n...
41,848
<p>My application has a need to let the user choose a date from a list of dates conforming to a certain pattern. For instance, they may need to choose a monday from a list Monday's for a month. Is there a way to get a <code>UIDatePicker</code> to limit date choices to a certain subset or should I just use a <code>UIPic...
<p>You cannot limit which dates are selectable in a <code>UIDatePicker</code>. You could change the date when the value changed event is sent, but since the user cannot tell which dates are "good" and which are not, it's a bad UI choice to do so.</p> <p>Use a <code>UIPickerView</code> of your own making instead.</p>
<p><code>UIDatePicker</code> has <code>minimumDate</code> and <code>maximumDate</code> properties for this purpose. No need to use <code>UIPickerView</code> just for this reason.</p>
8,096
<p>I've seen some variable declare in VB.net in several way like:</p> <pre><code>print("dim _Foo as string"); </code></pre> <p>and print("dim m_Foo as string"); and print("dim foo as string");</p> <p>I will like to know what's the standard for VB.net coding.</p>
<p>It all depends on the scope. In the case of:</p> <pre><code>Private Dim m_Foo As String </code></pre> <p>That implies that m_Foo is a member of a class. This also implies the same thing:</p> <pre><code>Private Dim _Foo As String </code></pre> <p>It's a matter of preference.</p> <p>On the other hand, something...
<p>It really depends on the naming conventions as agreed in your working environment. There are definitely guidelines available : <a href="http://www.akadia.com/services/naming_conventions.html" rel="nofollow noreferrer">Naming Conventions for .NET / C# Projects</a> - Which is basically what we follow.</p> <p>For exam...
43,451
<p>I have a JAX-RPC (Java) web service that needs to return a complex polymorphic value. To be more specific, the class structure is something like this:</p> <pre><code>abstract class Child { } class Question extends Child { private String name; // other fields, getters, and setters } class Section extends ...
<p>I think your idea for the autocomplete extender is the best solution. I've had this problem as well (sounds similar--a project you are taking over from somebody else). The push-back often comes from the user side. They are used to being able to select from a list of items. Unfortunately as the database grows, this b...
<p>I had to deal with the same issue. But I ended up using a combobox with paging support and auto complete. Currently this combobox happens to be from Telerik. Its a comboBox for auto complete since you can't type into a droplist.</p>
30,735
<p>I am working on a PHP application that intends to ease company workflow and project management, let's say something like <a href="http://www.basecamphq.com/" rel="noreferrer">Basecamp</a> and <a href="http://goplan.org" rel="noreferrer">GoPlan</a>.</p> <p>I am not sure on what the best approach is, database-wise. S...
<p>I usually add ClientID to all tables and go with one database. But since the database is usually hard to scale I will also make it possible to run on different database instances for some or all clients.</p> <p>That way you can have a bunch of small clients in one database and the big ones on separate servers.</p> ...
<p>You can start with a single database and partition it as the application grows. If you do this, there a few things I would recommend:</p> <p>1) Design the database in a way that it can be easily partitioned. For example, if customers are going to share data, make sure that data is easily replicated across each data...
31,898
<p>I want to redirect from an action in one controller to an action in a second controller. Normally I would use RedirectToAction("actionName", "controllerName", objects); The method I want to redirect to has two overloads:</p> <ul> <li>One for HttpVerbs.Get that is used for direct linking</li> <li>One for HttpVerbs.P...
<p>You can not use RedirectToAction (or anything else) to cause the browser to redirect with a HTTP POST. You may be able to hack it with some JavaScript but it would be ugly.</p> <p>If you can provide some more details about the target action that you would like to redirect the user to we can provide better answers ...
<p>Since you have your object filled out, you might consider returning same View from the first action instead of redirecting.</p>
40,461
<p>Can you recommend a Java library for reading, parsing, validating and mapping rows in a comma separated value (CSV) file to Java value objects (JavaBeans)?</p>
<p>We have used <a href="http://opencsv.sourceforge.net/" rel="noreferrer">http://opencsv.sourceforge.net/</a> with good success</p> <p>I also came across another question with good links: <a href="https://stackoverflow.com/questions/123/csv-file-to-xml">Java lib or app to convert CSV to XML file?</a></p>
<p>I've had good success both parsing and writing CSV files from Java with <a href="http://opencsv.sourceforge.net/" rel="nofollow noreferrer">OpenCSV</a>. If you want to read or write Excel compatible spreadsheet with Java, the <a href="http://poi.apache.org/" rel="nofollow noreferrer">POI</a> library from Apache is ...
24,479
<p>How can I construct a MSBuild ItemGroup to exclude .svn directories and all files within (recursively). I've got:</p> <pre><code>&lt;ItemGroup&gt; &lt;LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude=".svn" /&gt; &lt;/ItemGroup&gt; </code></pre> <p>At the moment, but this does not exclude anythin...
<p>Thanks for your help, managed to sort it as follows:</p> <pre><code>&lt;ItemGroup&gt; &lt;LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude="$(LibrariesReleaseDir)\**\.svn\**" /&gt; &lt;/ItemGroup&gt; </code></pre> <p>Turns out the pattern matching basically runs on files, so yo...
<p>I've run into some glitches using the Include/Exclude approach, so here's something that's worked for me instead: </p> <pre><code>&lt;ItemGroup&gt; &lt;MyFiles Include=".\PathToYourStuff\**" /&gt; &lt;MyFiles Remove=".\PathToYourStuff\**\.svn\**" /&gt; &lt;/ItemGroup&gt; </code></pre>
9,775
<p>I need to zip and password-protect a file. Is there a good (free) library for this?</p> <p>This needs to be opened by a third party, so the password protection needs to work with standard tools.</p>
<p>UPDATE 2020: There are other choices now, notably <a href="http://www.lingala.net/zip4j/" rel="nofollow noreferrer">Zip4J</a>.</p> <hr> <p>After much searching, I've found three approaches:</p> <p>A freely available set of source code, suitable for a single file zip. However, there is no license. Usage is AesZipO...
<blockquote> <p>Is there a good (free) library for this?</p> </blockquote> <p>java.util.zip will do the zipping, but it won't do the passwords. And no, I don't know of any free ones that will. <a href="http://www.chilkatsoft.com/java-zip.asp" rel="nofollow noreferrer">The cheapest</a> I've seen is $150 for a develop...
20,090
<p>Whenever I run rspec tests for my Rails application it takes forever and a day of overhead before it actually starts running tests. Why is rspec so slow? Is there a way to speed up Rails' initial load or single out the part of my Rails app I need (e.g. ActiveRecord stuff only) so it doesn't load absolutely everyth...
<p>You should be able to to speed up your <code>script/spec</code> calls by running <code>script/spec_server</code> in a separate terminal window, then adding the additional <code>-X</code> parameter to your spec calls.</p>
<p>If you are on a Windows environment then there is probably little you can do as Rails seems to startup really slowly under Windows. I had the same experience on Windows and had to move my setup to a Linux VM to make it really zippy (I was also using autotest).</p>
9,231
<p>I am looking for a way to quickly compare the state of a database table with the results of a Web service call.</p> <p>I need to make sure that all records returned by the Web service call exist in the database, and any records in the database that are no longer in the Web service response are removed from the tabl...
<p>One of the first movers was the "Customer base system". </p> <p>The common authority for all customers in the company.</p> <p>EDIT:<br> regarding the comment:<br> It did indeed open up for more SOA. It's about 3-5years ago (before me) and currently it was publicly known last year that the SOA helped the company sw...
<p>Let me see if I can get this conversation going. My company implemented a wrapper around the most common Active Directory look-up needs. I imagine this might be one of the most common things to do first in Microsoft/.NET shops.</p> <p>Anybody implement a library of utility services? Write a facade to some SAP modul...
38,081
<p>I have the following string:</p> <pre><code>&lt;SEM&gt;electric&lt;/SEM&gt; cu &lt;SEM&gt;hello&lt;/SEM&gt; rent &lt;SEM&gt;is&lt;I&gt;love&lt;/I&gt;, &lt;PARTITION /&gt;mind </code></pre> <p>I want to find the last "SEM" start tag before the "PARTITION" tag. not the SEM end tag but the start tag. The result shoul...
<p>Use <a href="http://msdn.microsoft.com/en-us/library/system.string.indexof.aspx" rel="noreferrer">String.IndexOf</a> to find PARTITION and <a href="http://msdn.microsoft.com/en-us/library/system.string.lastindexof.aspx" rel="noreferrer">String.LastIndexOf</a> to find SEM?</p> <pre><code>int partitionIndex = text.In...
<p>Have you tried this:</p> <pre><code>&lt;EM&gt;.*&lt;PARTITION\s*/&gt; </code></pre> <p>Your regular expression was matching anything but "&lt;" after the "EM" tag. Therefore it would stop matching when it hit the closing "EM" tag.</p>
40,916
<p>CVS and Subversion both have a handy merge feature so that when you update a source file that you have modified, it merges in changes that others have made on the same file.</p> <p>However, if your changes and the other ones are incompatible - generally if you have both changed the same parts of the code - it will ...
<p>For SVN: In commandline tool, there is the option <strong>-x</strong> which you can set to "<strong>b</strong>" or "<strong>w</strong>" to ignore space changes resp. all spaces.<br> You can also supply a third party tool for doing the merges. So if you have a merger which ignores whitespaces, you can use this one. ...
<p>TortoiseMerge doesn't have any CLA (Command Line Arguments) to ignore the whitespace and ignore the case. After searching a lot it seems that it can be achieved still by tweaking the registry values.</p> <pre><code>/* DisableWhitespaceDifferences and DisableCaseDifferences. * The settings for TortoiseMerge is stor...
23,494
<p>In .NET, under which circumstances should I use <code>GC.SuppressFinalize()</code>?</p> <p>What advantage(s) does using this method give me?</p>
<p><code>SuppressFinalize</code> should only be called by a class that has a finalizer. It's informing the Garbage Collector (GC) that <code>this</code> object was cleaned up fully.</p> <p>The recommended <code>IDisposable</code> pattern when you have a finalizer is:</p> <pre><code>public class MyClass : IDisposable ...
<p>That method must be called on the <code>Dispose</code> method of objects that implements the <code>IDisposable</code>, in this way the GC wouldn't call the finalizer another time if someones calls the <code>Dispose</code> method.</p> <p>See: <a href="https://learn.microsoft.com/en-us/dotnet/api/system.gc.suppressfi...
18,213
<p>I am looking for any good sources for geometric algorithms specifically; </p> <p>The simple stuff like when two lines cross and so on is easy enough (and easy to find), but I would like to find somewhere with algorithms for the more tricky things, such as finding the shape formed by expanding a given polygon by som...
<p><a href="http://www.cgal.org/" rel="noreferrer">Computational Geometry Algorithms Library</a> is decent.</p>
<p>I've gotten good use from the generically named <a href="https://rads.stackoverflow.com/amzn/click/com/0135309247" rel="nofollow noreferrer" rel="nofollow noreferrer">Computer Graphics, C Version</a> by Hearn and Baker.</p>
15,407
<p>What is the best way to close an ASPX page from the code-behind? </p> <p>I have a button event handler that I want to close the page after the user has clicked an ASP.NET button on the page. I have tried to programmatically add a JavaScript method that contains a <code>window.close()</code> command to the <code>O...
<p>You would typically do something like:</p> <pre class="lang-cs prettyprint-override"><code>protected void btnClose_Click(object sender, EventArgs e) { ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true); } </code></pre> <p>However, keep in mind that different things will happ...
<p>For closing a asp.net windows application,</p> <ul> <li>Just drag a button into the design page</li> <li><p>Then write the below given code inside its click event</p> <pre><code> " this.close(); " </code></pre></li> </ul> <p>ie:</p> <pre><code> private void button2_Click(object sender, EventArgs e) {...
49,128
<pre><code>&lt;div&gt; &lt;span&gt;left&lt;/span&gt; &lt;span&gt;right&lt;/span&gt; &lt;!-- new line break, so no more content on that line --&gt; &lt;table&gt; ... &lt;/table&gt; &lt;/div&gt; </code></pre> <p>How can I position those spans (they can be changed to any element) so that depending on how big the table i...
<pre><code>&lt;style type="text/css"&gt; #wrapper, #top, #tableArea { width: 100%; padding: 10px; margin: 0px auto; } #top { padding: 0px; } #leftBox, #rightBox { margin: 0px; float: left; display: inline; ...
<pre><code>&lt;div&gt; &lt;div style="float:left"&gt;a&lt;/div&gt;&lt;div style="float:right"&gt;b&lt;/div&gt; &lt;br style="clear: both"&gt; aaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;br /&gt; aaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;br /&gt; aaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;br /&gt; &lt;/div&gt; </code></pre> <p>Doesn't place them relative...
28,230
<p>I just found out that by converting PNG32 to PNG8 via Photoshop will fix the PNG transparency bug in IE&lt;=6. </p> <p>So I had this thought that instead of serving PNG32 to all browser, why not serve PNG8 if the client is using IE&lt;=6. </p> <p>I'm not really an expert when it comes to htaccess/httpd directives ...
<p>I haven't actually tried this, but I think it should work:</p> <pre><code>RewriteEngine on RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4.0\ \(compatible;\ MSIE\ [1-6]\. RewriteCond %{REQUEST_FILENAME} ^(.+)(\.png)$ RewriteCond %18%2 -f RewriteRule ^(.+)\.png$ $18.png [L,QSA] </code></pre> <p>The first line turns mod...
<p>Put this in your .htaccess</p> <pre><code>RewriteEngine on RewriteRule ^/(.*)\.png$ /$18.png [L,QSA] </code></pre> <p>Should work.</p>
35,726
<p>I've been using SVN a lot as a single user on a single computer</p> <p>Now I'd like to share my stuff across multiple computers</p> <p>So far I've been checking out from <code>file://c:/myproject</code></p> <p>I'd like to checkout from <code>svn://mycomputer/myproject</code></p> <p>How can I map the first into t...
<p>The repository is laid out identically. In order to use the svn protocol to access the repository, you need to set up svnserv, and point it to the repository you're using. This will allow both accesses - file:// locally, and svn:// remotely (or locally). A colleague swears by <a href="http://www.visualsvn.com/server...
<p>Little known fact: If you're a single user and your repository lies on a *nix-based PC which you can SSH to, you won't even need a server.</p> <p>Just use the command:</p> <pre><code>scn checkout svn+ssh://USERNAME@mycomputer/ABSOLUTE/PATH/TO/REPOSITORY </code></pre> <p>This will prompt you for your SSH password ...
39,457
<p>If we implement a stack using arrays in C++, what is the best way to reduce the chance of an overflow condition? Also while keeping in mind the time-space trade off?</p>
<p>Just resize your array when you get close to the "overflow condition", i.e. when the next element wouldn't fit any longer. Or use a <code>std::vector</code>, which you can resize easily. </p> <p>Not sure, but you are aware of the <code>std::stack</code> class, which implements a stack which resizes automatically in...
<p>While this answer does not precisely give tips for implementation, it answers how you can often protect yourself from certain bugs like buffer-overflows. GCC has a flag for this:</p> <blockquote> <p><code>-fmudflap -fmudflapth -fmudflapir</code> For front-ends that support it (C and C++), instrument ...
40,249
<p>Is it possible to write a stored procedure (in tsql or other variants) with dynamic parameters like sp_executesql?</p> <p>i.e. the number and type of parameters in not known in advance and should be built dynamically on client side. just the way you can pass any number of parameters with any type to sp_executesql....
<p>you could pass the array as a string with some delimiters like val1$datatype1$;val2$datatype2... use a loop to build the string. a bit old school but easy to do on client and server side.</p> <p>a piece of XML would be even better, you could transform it on the server with the XML functions (they are a bit cumbers...
<p>I suppose you could, but you'd have to provide a parser on the DB server side to interpret those parameters and values. You would also have to either forego the benefits of runtime compilation, or do that yourself somehow as well.</p> <p>You'd also probably have an awfully long list of optional INPUT parameters......
27,754
<p>I have a self referencing Categories table. Each Category has a CategoryID, ParentCategoryID, CategoryName, etc. And each category can have any number of sub categories, and each of those sub categories can have any number of sub categories, and so and and so forth. So basically the tree can be X levels deep.</p> <...
<p>I don't think linq-to-sql has a good answer to this problem. Since you are using sql server 2005 you can use CTEs to do hierarchical queries. Either a stored procedure or an inline query (using DataContext.ExecuteQuery) will do the trick. </p>
<p>The performant approach is to create an insert/modify/delete trigger which maintains an entirely different table which contains node-ancestor pairs for all ancestors of all nodes. This way, the lookup is O(N).</p> <p>To use it for getting all products belonging to a node and all of its descendants, you can just sel...
6,470
<p>I'm just getting started working with foreign keys for the first time and I'm wondering if there's a standard naming scheme to use for them?</p> <p>Given these tables:</p> <pre><code>task (id, userid, title) note (id, taskid, userid, note); user (id, name) </code></pre> <p>Where Tasks have Notes, Tasks are owned ...
<p>The standard convention in SQL Server is:</p> <pre><code>FK_ForeignKeyTable_PrimaryKeyTable </code></pre> <p>So, for example, the key between notes and tasks would be:</p> <pre><code>FK_note_task </code></pre> <p>And the key between tasks and users would be:</p> <pre><code>FK_task_user </code></pre> <p>This gi...
<p>If you aren't referencing your FK's that often and using MySQL (and InnoDB) then you can just let MySQL name the FK for you.</p> <p>At a later time you can <a href="https://stackoverflow.com/a/25336979/1048805">find the FK name you need by running a query</a>. </p>
24,315
<p>There is even a <a href="http://www.networksorcery.com/enp/protocol/ip-ip.htm" rel="nofollow noreferrer">standard</a> for IP in IP encapsulation. What is the use case here? I can understand stuff like TCP over DNS, where IP might be unavailable, but if you can do IP in IP, couldn't you simply do regular IP?</p>
<p>Obvious example: Your gateway drops packets to host A, but you can send packets to host B, and host B cand send to host A. So you tunnel to B which then forwards to A. IP in IP simply allows you to tunnel in an application-independent manner, unlike application level proxies, and you preserve TTL.</p>
<p>Its a case of tunnelling. You can have two remote offices connected through a link terminating on a gateway at each end. These gateways only allow traffic from the peer gateway. A host sitting on the LAN behind the gateway cannot directly reach another host in the remote office. It needs its gateway to encapsulate t...
47,026
<p>Have any bridge libraries been developed for PHP that provide access to the jQuery framework? Ideally it would be nice to have something fairly extensible so that creating jQuery-based content using PHP code would be fairly easy and customizeable. Does such a thing exist yet?</p>
<ol> <li><a href="http://ajaxian.com/archives/pquery-php-and-jquery" rel="nofollow noreferrer">pquery</a></li> <li><a href="http://ajaxian.com/archives/jqpie-jquery-php-interface-extension" rel="nofollow noreferrer">jqpie</a></li> <li><a href="http://jquery.hohli.com/" rel="nofollow noreferrer">jquery-php</a> </li> </...
<p>So far I've found one that seems to fit the description. I haven't tried it out yet, so if anyone has any feedback or experience with this or other ones don't hesitate to post!</p> <p><a href="http://ajaxian.com/archives/pquery-php-and-jquery" rel="nofollow noreferrer">PQuery</a></p>
21,070
<p>I'm using event delegation to listen for events lower in the DOM, but it's not working for an onchange event on a select box. Does the onchange event propagate or bubble up the DOM?</p> <p>Googling has failed in finding a conclusive answer.</p>
<p><a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents-h3" rel="noreferrer">According to specification</a>, <code>change</code>, <code>submit</code>, <code>reset</code> should bubble and <code>focus</code> and <code>blur</code> should not bubble.</p> <p>This behavior is implem...
<p>Not sure if I get the question, but if you mean this, then NO.</p> <pre><code>&lt;div id="foo"&gt; &lt;select onchange="alert('hi');"&gt; &lt;option&gt;Hello&lt;/option&gt; &lt;option&gt;World&lt;/option&gt; &lt;/select&gt; &lt;/foo&gt; </code></pre> <p>Where the div id="foo" would have an onchange eve...
33,212
<p>I'm wanting to use google maps and see a million ways to do it on the web. Some are javascript methods and some are asp.net server components with which I have hit and miss luck. What's the easiest and most reliable way using c# and asp.net?</p> <p>I have my location data including geocodes in a database. I want to...
<p>The Google Maps API is accessed via JavaScript (any server controls are just abstracting this away from you). In the case you described, you would need to dynamically output the required JavaScript to tell the maps API what to display.</p> <p>See <a href="http://dotnet.sys-con.com/node/171162" rel="nofollow norefer...
<p>Check out this example: <a href="http://blog.aggregatedintelligence.com/2009/02/aspnet-data-driven-google-map-example.html" rel="nofollow noreferrer">Data driven Google Maps in ASP.Net</a></p> <p>I used ASP.Net Ajax to create a web-service that is callable from JavaScript. The web-service talks to the database and ...
47,072
<p>Does anybody have a keybinding scheme similar to VS 2005 available for Eclipse?</p> <p>How to import it into preferences of Eclipse (I see only export button).</p>
<p><strong>How to Install Visual Studio Key Bindings in Eclipse (Helios onwards)</strong></p> <p>For anyone finding this post, if you need step by step instructions and you're using Eclipse Indigo PDT , the following should help you:</p> <p>(Note: you will be prompted to restart Eclipse after installing)</p> <ol> <l...
<p>Eclipse Ganymede has a built-in keybinding scheme for Visual Studio. Have you tried that?</p>
24,465
<p>So .NET 3.0/3.5 provides us with lots of new ways to query, sort, and manipulate data, thanks to all the neat functions supplied with LINQ. Sometimes, I need to compare user-defined types that don't have a built-in comparison operator. In many cases, the comparison is really simple -- something like foo1.key ?= fo...
<p>My <a href="http://pobox.com/~skeet/csharp/miscutil" rel="noreferrer">MiscUtil</a> library contains a ProjectionComparer to build an IComparer&lt;T> from a projection delegate. It would be the work of 10 minutes to make a ProjectionEqualityComparer to do the same thing.</p> <p>EDIT: Here's the code for ProjectionEq...
<p>Like the other answers but more concise c# 7:</p> <pre><code>public class LambdaComparer&lt;T&gt; : IEqualityComparer&lt;T&gt; { private readonly Func&lt;T, T, bool&gt; lambdaComparer; private readonly Func&lt;T, int&gt; lambdaHash; public LambdaComparer(Func&lt;T, T, bool&gt; lambdaComparer) : this(lambdaCom...
22,798
<p>We currently use LoadRunner for performance testing our web apps, but we also have some server side processes we need to test.</p> <h2>Background:</h2> <p>We call these processes our "engines". One engine receives messages by polling an IBM WebSpere MQ queue for messages. It takes a message off the queue, processe...
<p>There is an add-in for LoadRunner in the incuded software to interface with MQ series and put the messages directly on the queue. Web services are fully supported also, and VBScript is supported too,perhaps using QTPro for the script and a GUI user in LoadRunner? Colin.</p>
<p>For #1, as an alternative to a Web Services script, you could try recording a Windows Sockets script. I've used LoadRunner to record winsock scripts to test some (Java) APIs. What I did was write a really simple Java API client and then execute that from a Windows batch file. The batch file would then be referenced ...
49,562
<p>I have a basic CRUD form that uses PageMethods to update the user details, however the Validators don't fire off, I think I need to manually initialize the validators and check whether the validation has passed in my javascript save method. Any ideas on how to do this?</p>
<p>Ok so I finally solved this: You need to call <code>Page_ClientValidate()</code> in your Save javascript method and If it returns true continue with the save, the <code>Page_ClientValidate()</code> initiates the client side validators, See code below:</p> <pre><code> function Save() { var clientVal...
<p>what are you using for development? VS 2008 supposedly has better JS debugging, haven't tried it yet. </p> <p>For Ajax you can use the Sys.Debug obj</p>
6,759
<p>A recent <a href="https://stackoverflow.com/questions/372354/string-immutability">question about string literals</a> in .NET caught my eye. I know that string literals are <a href="http://en.wikipedia.org/wiki/String_intern_pool" rel="noreferrer">interned</a> so that different strings with the same value refer to th...
<p>Strings in .NET are reference types, so they are always on the heap (even when they are interned). You can verify this using a debugger such as WinDbg. </p> <p>If you have the class below</p> <pre><code> class SomeType { public void Foo() { string s = "hello world"; Console.WriteLine(s); ...
<p>Interned String's in java are located in a separate Pool called the String Pool. This pool is maintained by the String class and resides on the normal Heap (not the Perm pool as mentioned above, that is used for storing the class data).</p> <p>As I understand it not all Strings are interned, but calling myString.in...
48,697
<p>I'm trying to choose a tool for creating UML diagrams of all flavours. Usability is a major criteria for me, but I'd still take more power with a steeper learning curve and be happy. Free (as in beer) would be nice, but I'd be willing to pay if the tool's worth it. What should I be using?</p>
<p>Some context: Recently for graduate school I researched UML tools for usability and UML comprehension in general for an independent project. I also model/architect for a living.</p> <p>The previous posts have too many answers and not enough questions. A common misunderstanding is that UML is about creating diagra...
<p>You might want to check out <a href="http://argouml.tigris.org/" rel="nofollow noreferrer">ArgoUML</a>. It's not the best tool I've ever used, but it's one of the better free ones I've seen. It's a little slow because it's written in Java, but it let's you do some basic UML diagrams with relative ease.</p>
3,619
<p>I've put together a flashlight mount for a camera coldshoe in OpenSCAD. I originally modeled it in FreeCAD and it was easy to round the edges of the clamp with a fillet and that makes it a little easier to get the light in and out of the mount.</p> <p>I'm not sure how to do it in OpenSCAD. Naively, I'm sure I coul...
<p>I'm far from a wizard with OpenSCAD, but enjoy using the program, learning something new every time. In your case, it's likely that you can use the <a href="https://github.com/Irev-Dev/Round-Anything" rel="nofollow noreferrer">roundanything library</a> to accomplish your objective.</p> <p>The library will present va...
<p>I ended up taking a third option I suppose. I decided I was cutting the gap wrong. I was using <code>difference</code> to take a rectangle out of the ring.</p> <p>I decided I'd simplify that and take out an extruded triangle.</p> <pre><code>ringRadius = radius + thickness; verticalOffset = tan(gapAngle / 2) * ring...
1,865
<p>When I created the project I'm trying to deploy I selected that I wanted to target .NET Framework 2.0. After deploying the project I try to brows to it and get and error page that shows:</p> <pre><code>&lt;compilation debug="true"&gt; &lt;assemblies&gt; &lt;add assembly="System.Web.Entity, Version=3.5.0...
<p>You are referencing assemblies of the .NET Framework 3.5, are you using EntityDataSources??</p> <p>Remove those 3.5 references...</p> <p>You also need the AJAX Extensions (System.Web.Extensions) for .NET 2.0 on the server.</p>
<p>remove those references from your project and redeploy. if your project started as 3.5 it will still have references to some of those assemblies</p>
22,983
<p>I am looking for a clear definition of what a "tokenizer", "parser" and "lexer" are and how they are related to each other (e.g., does a parser use a tokenizer or vice versa)? I need to create a program will go through c/h source files to extract data declaration and definitions. </p> <p>I have been looking for exa...
<p>A tokenizer breaks a stream of text into tokens, usually by looking for whitespace (tabs, spaces, new lines).</p> <p>A lexer is basically a tokenizer, but it usually attaches extra context to the tokens -- this token is a number, that token is a string literal, this other token is an equality operator.</p> <p>A pa...
<p>(<em>adding to the given answers</em>) </p> <ul> <li>Tokenizer will <em>also</em> remove any comments, and only return <strong>tokens</strong> to the Lexer.</li> <li>Lexer will <em>also</em> define scopes for those tokens (variables/functions)</li> <li>Parser then will build the code/program structure</li> </ul>
49,859
<p>What would be the best way to design a threaded commenting system so that it doesn't hammer the database?</p>
<p><strong>SELECT ... START WITH ... CONNECT BY</strong></p> <p>Oracle has an extension to SELECT that allows easy tree-based retrieval.</p> <p>This query will traverse a table where the nesting relationship is stored in <strong>parent</strong> and <strong>child</strong> columns.</p> <pre><code>select * from my_tabl...
<p>What I normally do in this case is to have a single thread that is responsible for putting the data into the database, and have all auxiliary threads report to that thread, which then queues up the data, and writes it either serially, or in batches (depending on the requirements, and how much database activity I'm w...
5,706
<p>What's the best way to embed Ruby as a scripting language in C++? Using ruby.h? SWIG? Something else? What I need is to expose some C++ objects to Ruby and have the Ruby interpreter evaluate scripts that access these objects. I don't care about extending Ruby or accessing it in C++.</p> <p>I've found this <a href="...
<p>swig is probablly the way to go..... but ruby doesnt embed too well......</p> <p>if you want a language that embeds nicely into C++, try lua</p>
<p>I've been working on Rarity (<a href="https://github.com/Plaristote/Rarity" rel="nofollow">https://github.com/Plaristote/Rarity</a>), which does two things:</p> <ul> <li>Generates Ruby bindings from a YML description of your C++ API</li> <li>Allows interaction with Ruby script in the most C++ fashion there is</li> ...
29,610
<p>I am using <a href="http://code.google.com/p/js2-mode/" rel="noreferrer">js2-mode</a> to edit Javascript in Emacs, but I can't seem to get it to stop using tabs instead of spaces for indentation. My other modes work fine, just having issues w/ js2.</p>
<p>Do you have</p> <pre> (setq-default indent-tabs-mode nil) </pre> <p>in your .emacs? It works fine for me in emacs 23.0.60.1 when I do that. js2-mode uses the standard emacs function indent-to, which respects indent-tabs-mode, to do its indenting.</p>
<p>Add this to your <code>.emacs</code> file somewhere after you load js2 mode:</p> <pre><code>(setq js2-mode-hook '(lambda () (progn (set-variable 'indent-tabs-mode nil)))) </code></pre>
6,786
<p>I have a header </p> <pre><code>&lt;h1&gt;My Header&lt;/h1&gt; </code></pre> <p>It has a height of <code>150px</code> and a <code>font-size</code> of say <code>1.3em;</code> How can I make the header text vertically centered with CSS. I would rather not wrap it in a container DIV (wrapping divs really defeat the w...
<p>See <a href="https://stackoverflow.com/questions/15798/how-do-i-validate-xml-against-a-dtd-file-in-python">this question</a> - the accepted answer is to use <a href="http://codespeak.net/lxml/validation.html" rel="nofollow noreferrer">lxml validation</a>.</p>
<p>I believe you need to switch from expat to xmlproc.<br> See: <a href="http://code.activestate.com/recipes/220472/" rel="nofollow noreferrer">http://code.activestate.com/recipes/220472/</a></p>
38,264
<p>When I dump a Sybase database, it doesn't seem to matter whether there's data in the tables or not, the file size is the same. I've been told that this is down to the fact that my dump file is binary and not logical, so the file of the dump file is based on the allocated size of the database. I know that Oracle can ...
<p>Since somewhere around version 12 you have been able to perform compressed dumps in ASE.</p> <p><a href="http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sag2/html/sag2/sag2473.htm" rel="nofollow noreferrer">The syntax is:</a> dump database database_name to file_name [ with compression=co...
<p>Whilst the link (The syntax is) above is obviously correct as it points to sybase documentation, the comments are misleading.</p> <p>The syntax in simple format is:</p> <p>dump database {database_name} to "compress::{#compression_level}::{stripe_device}" go</p> <p>eg: dump database mydb to "compress::1::/sybase_d...
25,337
<p>Most C++ naming conventions dictate the use of <code>camelCaseIdentifiers</code>: names that start with an uppercase letter for classes (<code>Person</code>, <code>Booking</code>) and names that start with a lowercase letter for fields and variables (<code>getPrice()</code>, <code>isValid()</code>, <code>largestValu...
<p>One way it to adopt the C++ <code>naming_convention</code>, this is what most code examples in the literature do nowadays.</p> <p>I slowly see these conventions move into production code but it's a battle against MFC naming conventions that still prevail in many places.</p> <p>Other style differences that fight ag...
<p>You should embrace the difference.</p> <p>When people see the use of remove_copy_if, they will immediately know that this is an algorithm. This is actually a positive feature as algorithms come with certain guarantees (or lack of).</p> <p>We also use the naming convention for our own custom algorithms.</p>
45,613
<p>I'm looking for a way to limit the maximum number of running processes in Windows Server 2003.</p> <p>Is there a registry key somewhere that controls it? If so, which one is it?</p>
<p>if you are talking about processes as in the items listed in task manager, then there is no way to do it natively, and you can do it with a program, <strong><em>but there should be no real valid reason to do so.</em></strong> </p> <p>If you are talking about making your application only ever launch one EXE no matte...
<p>Domestic retail Windows has no intrinsic way of limiting the number of processes (other than exhausting available resources)</p> <p>Windows Starter Editions achieved process capping with a modified version of Windows- Starter ed. is only available in emerging markets however.</p>
17,979
<p>What are the best Java example sites? I'm looking for places that you go when you have a specific question and you want a little Java code snippet to solve it with.</p>
<p><a href="http://www.java2s.com/" rel="noreferrer">java2s</a> is the best according to me. because - 1) Like mrlinx said "almost always has a sample on common stuff" 2) Stuffs are nicely organized by category, so, you can easily find out what you are looking for. 3) You can find codes for latest version of JDK</p>
<p>I like <a href="http://snippets.dzone.com/tag/java" rel="nofollow noreferrer">DZone Snippets</a> from <img src="https://i.stack.imgur.com/IDNzd.png" alt="DZone"></p> <p>It is a public source code repository. </p> <p>You can build up your personal collection of code snippets, and categorize them with tags / keyword...
11,529
<p>I remember some rules from a time ago (pre-32bit Intel processors), when was quite frequent (at least for me) having to analyze the assembly output generated by C/C++ compilers (in my case, Borland/Turbo at that time) to find performance bottlenecks, and to safely mix assembly routines with C/C++ code. Things like u...
<p>You are asking about "application binary interface" (ABI) and calling conventions. These are typically set by operating systems and libraries, and enforced by compilers and linkers. Google for "ABI" or "calling convention." Some starting points from <a href="http://en.wikipedia.org/wiki/Calling_convention" rel="nore...
<p>Well, today if optimisation is turned on, there arn't any. But GCC allows you to declare that your assembly instruction should use particular variable regardless if it's in register or not, or even to force GCC tu put that variable into a register usable with your instruction. You can also declare which registers yo...
31,971
<p>A lot of people in the .NET space have picked up Castle Windsor and are implementing it in their projects, and for the past year I've been struggling to figure out why IoC containers seem to be treated as general "best practice"? I've read a LOT of abstracts and brief explanations on the why's of Windsor and the lik...
<p>Seems like you want the answer to <a href="https://stackoverflow.com/questions/124871/what-is-castle-windsor-and-why-should-i-care">this question</a></p> <p>Obviously if the system is as difficult to setup as you say, then its not going to be worth much when you come to maintaining it. That's a significant thing to...
<p>I suggest that you listen to episode 2 of the Software Engineering Radio podcast. It is a whole episode on dependency injection. Dependency Injection is the most widely known usage of Inversion of Control frameworks. I would also recommend listening to DotNetRocks episode 362 which has John Kovacs. <a href="http://p...
38,934
<p>I'm using the following code to loop through a directory to print out the names of the files. However, not all of the files are displayed. I have tried using <strong>clearstatcache</strong> with no effect.</p> <pre><code> $str = ''; $ignore = array('.', '..'); $dh = @opendir( $path ); if ($dh === FA...
<p>Your <code>break</code> keywords messes up your code:<br> Your loop very likely first encounters the '.' directory and than breaks out of your while loop.</p> <p>try replacing it with a <code>continue</code> and you should be fine.</p>
<pre><code>if (in_array($file, $ignore, TRUE)) { break; } </code></pre> <p>Surely that should be <code>continue</code> not <code>break</code>?</p>
23,260
<p>I have learned quite a bit browsing through <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c">Hidden Features of C#</a> and was surprised when I couldn't find something similar for VB.NET.</p> <p>So what are some of its hidden or lesser known features?</p>
<p>The <code>Exception When</code> clause is largely unknown.</p> <p>Consider this:</p> <pre><code>Public Sub Login(host as string, user as String, password as string, _ Optional bRetry as Boolean = False) Try ssh.Connect(host, user, password) Catch ex as TimeoutException When Not bRetr...
<p><strong>The Me Keyword</strong></p> <p>The "Me" Keyword is unique in VB.Net. I know it is rather common but there is a difference between "Me" and the C# equivalent "this". The difference is "this" is read only and "Me" is not. This is valuable in constructors where you have an instance of a variable you want the v...
12,767
<p>Does anyone know of a really simple way of capitalizing just the first letter of a string, regardless of the capitalization of the rest of the string?</p> <p>For example:</p> <pre><code>asimpletest -&gt; Asimpletest aSimpleTest -&gt; ASimpleTest </code></pre> <p>I would like to be able to do all string lengths as...
<p>@<a href="https://stackoverflow.com/a/352494/2285236">saua</a> is right, and </p> <pre><code>s = s[:1].upper() + s[1:] </code></pre> <p>will work for any string.</p>
<pre><code>str = str[:].upper() </code></pre> <p>this is the easiest way to do it in my opinion</p>
45,899
<p>One doubt in MSSQL. There are two tables in a databases.</p> <p>Table 1 named Property contain fields PRPT_Id(int),PRPT_Name(varchar), PRPT_Status(bit) </p> <p>Table 2 named PropertyImages contain fields PIMG_Id(int),PIMG_ImageName(varchar),PRPT_Id(int),PIMG_Status(bit)</p> <p>These two tables follow a one-to-man...
<p>Assuming that FirstImage means the one with the lowest Id, then this should be at least close enough to test to completion:</p> <blockquote> <p>SELECT<br> PRPT_Id,<br> PRPT_Name,<br> ISNULL(pi1.ImageName, '') AS FirstImageName,<br> COUNT(1) AS ImageCount </p> <p>FROM Pr...
<blockquote> <p>the name of the first image in the image table corresponding to the PRPT_Id with PIMG_Status true</p> </blockquote> <p>You may want to define "first" in this context. Tables aren't really ordered so, unless you keep your own ordering, the term first needs to mean "first one found".</p> <p>Assuming t...
48,413
<p>After upgrading a few gems via terminal on my mac, I have created a new rails project backed up by a mysql database. Upon starting the app, the regular welcome aboard page appears. </p> <p>Here's the problem - I tried clicking the link entitled "About your application's environment", I receive the following output ...
<p>The issue is that the MySQL gem builds native extensions and needs system-specific information about where to find certain libraries. You have to provide this on the command line.</p> <p>Check out <a href="http://forums.mysql.com/read.php?116,204740,204740" rel="nofollow noreferrer" title="Mysql Gem Install Instru...
<p>Try forcing build of the 32-bit version only (assuming you're on Intel Mac, the <code>-V</code> with gem should give you more verbose output)</p> <pre><code>sudo env ARCHFLAGS="-arch i386" gem install -V mysql -- --with-mysql-config=/usr/local/sql32/bin/mysql_config </code></pre> <p>More information in this blog p...
46,139
<p>I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during one of these calls, an exception is generated as you would expect...
<p>I check the Error property of the event args in the service method completed event handler. I haven't had issues with the event handler not being called. In the case where the server goes down, the call takes a few seconds then comes back with a ProtocolException in the Error property.</p> <p>Assuming you have tr...
<p>You can forget about <strong>Application_UnhandledException</strong> on asyn client callbacks, reason why:</p> <p>Application_UnhandledException only exceptions fired on the UI thread can be caught by Application.UnhandledExceptions</p> <p>This means... not called at all for a WCF async call :-).</p> <p><strong>C...
12,020
<p>I'm trying to find the correct names for these 2 "types" of coding expressions in LINQ so that I can refer to them correctly. I want to say that the first is called "Fluent Style"?</p> <pre><code>var selectVar = arrayVar.Select( (a,i) =&gt; new { Line = a }); var selectVar = from s in arrayVar select new ...
<ul> <li>First - calling an extension method. This style of coding is called "<a href="http://www.martinfowler.com/bliki/FluentInterface.html" rel="nofollow noreferrer">fluent interface</a>" as you mentioned.</li> <li>Second method is called <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query" rel="nofollo...
<p>The first isn't even really LINQ, it's a lambda expression, with a type invariant object created. </p> <pre><code>(a) =&gt; new { blah = b} </code></pre> <p>The second is a LINQ query filling an on the fly class that has a property Line.<br> There is no hashrocket operator in this one, so this one is just plain o...
6,813
<p>What are others ASP.NET Security Best Practices?</p> <p>So far identified are listed here:</p> <ul> <li><p>Always generate new encryption keys and admin passwords whenever you are moving an application to production.</p></li> <li><p>Never store passwords directly or in encrypted form. Always stored one way hashed ...
<p>I found Microsoft's <a href="https://download.microsoft.com/documents/uk/msdn/security/The%20Developer%20Highway%20Code.pdf" rel="nofollow noreferrer">Developer Highway Code</a> to be a useful security checklist.</p>
<p>While displaying content from database on the page, you may use <strong>HttpServerUtility.HtmlEncode</strong> to encode output to avoid Cross site scripting (XSS) attacks.</p>
37,707
<p>I am currently working for a company that has a website running mysql/php (all tables are also using the MYISAM table type).</p> <p>We would like to implement replication, but I have read in the mysql docs and elsewhere on the internet that this will lock the tables when doing the writes to the binary log (which th...
<p>If you change your table types to innodb, row level locking is used. Also, your replication will be more stable, as updates will be transactional. MyISAM replication is a long-term pain.</p> <p>Be sure that your servers are version-matched, and ALWAYS be sure to shut down the master before shutting down the slave...
<p>The solution with the myisam table type is not 'better'. However, you can get by with it.</p> <p>The best you can do, is make sure your slave and master run on the same hardware (FPU differences can create replication errors), as well as making sure you are running the same version numbers on your MySQL servers.</...
27,994
<p>I have a simple lambda expression which runs fine as a UNIT test and also runs fine when I copy the code into the Main method of my application. However, when I run the same piece of code within a callback method (via JMS courier) I get the above error. Has anyone encountered this?</p> <p>Example code failing:</p> ...
<p>You will normally get this sort of error when a ModuleBuilder has already been 'compiled', or a TypeBuilder has already been 'compiled'.</p> <p>I would check where such things happen. Also, a stack trace may be handy in this case.</p>
<p>There is a bug report <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=338242" rel="nofollow noreferrer">here</a>, not sure though if it is the same issue that you experience. Apparently this has been fixed in .NET 3.5 SP1.</p>
24,000
<p>I have <code>buy.php</code> with a <strong>form</strong> where you enter <em>items, quantity, shipping data, etc.</em> </p> <p>When you click the <strong>Submit button</strong>, it posts back to <code>buy.php</code> <code>($_SERVER['PHP_SELF'])</code> and does some data validation. </p> <p>If there are fields mis...
<p>You could do a redirect to buy.php after saving to the session object, which then does a server redirect to check.php, it would mean when the user clicks back, they're going back to the GET request not the POST request</p>
<p>Yes - I agree with above. I ALWAYS do a <code>redir</code> away from the last post, so clicking back bounces them back without that error OR re-submissions. it also avoids complications. u can always tag the <code>redir</code> link page with a <code>?m</code> or <code>&amp;m</code> (i.e.: <code>page.php?m</code>) an...
7,962
<p>I'm looking for a cost effective tool for managing an web app on Ec2. Rightscale seems to the big dog and charges for it. Scalr looks like a more cost effective solution but it's hard to find out any real customer experiences..</p> <p>The key aspects I'm looking for is a load balancer (http and https) and a way to ...
<p>I am a Scalr user, a Scalr.net subscriber, and have become a Scalr enthusiast. I cannot possibly afford Rightscale.</p> <p>Scalr can do what you ask.</p> <p>Scalr has three images (each with 32/64 bit versions), plus a base (generic) image:</p> <p>1) A load balancer image, running nginx. A highly available setu...
<p><a href="http://broadcast.oreilly.com/2008/12/why-i-dont-like-cloud-auto-scaling.html" rel="nofollow noreferrer">Some people say that automatic scaling won't solve the problem</a></p>
47,848
<p>I'm trying to open a file and create a list with each line read from the file.</p> <pre><code> i=0 List=[""] for Line in inFile: List[i]=Line.split(",") i+=1 print List </code></pre> <p>But this sample code gives me an error because of the <code>i+=1</code> saying that <code>index is out of ...
<p>It's a lot easier than that:</p> <pre><code>List = open("filename.txt").readlines() </code></pre> <p>This returns a list of each line in the file.</p>
<p>I am not sure about Python but most languages have push/append function for arrays.</p>
42,528
<p>There is <a href="https://stackoverflow.com/questions/134698/catching-exceptions-as-expected-program-execution-flow-control">an interesting post over here</a> about this, in relation to cross-application flow of control. </p> <p>Well, recently, I've come across an interesting problem. Generating the nth value in a ...
<p>In this case I would be looking at your Walk_r method, you should have something that returns a value, throwing an exception to indicate success, is NOT a common practice, and at minimum is going to be VERY confusing to anyone that sees the code. Not to mention the overhead associated with exceptions.</p>
<p>It's not a very good idea to throw exceptions as a part of an algorithm, especially in .net. In some languages/platforms, exceptions are pretty efficient when thrown, and they usually are, when an iterable gets exhausted for instance.</p>
21,029
<p>I have got a python script which is creating an ODBC connection. The ODBC connection is generated with a connection string. In this connection string I have to include the username and password for this connection. </p> <p>Is there an easy way to obscure this password in the file (just that nobody can read the pas...
<p><a href="https://docs.python.org/3/library/base64.html" rel="noreferrer">Base64 encoding</a> is in the standard library and will do to stop shoulder surfers:</p> <pre><code>&gt;&gt;&gt; import base64 &gt;&gt;&gt; print(base64.b64encode("password".encode("utf-8"))) cGFzc3dvcmQ= &gt;&gt;&gt; print(base64.b64decode("...
<pre><code>import base64 print(base64.b64encode(&quot;password&quot;.encode(&quot;utf-8&quot;))) print(base64.b64decode(b'cGFzc3dvcmQ='.decode(&quot;utf-8&quot;))) </code></pre>
19,099
<p>Is there a free and open source extension of JTextArea that would support "vi mode"?</p>
<p>Maybe you can find useful info here: <a href="http://jvi.sourceforge.net/" rel="nofollow noreferrer">http://jvi.sourceforge.net/</a>.</p>
<p>AFAIK, no. This is such an obscure request, I think you'd have to code it yourself.</p>
32,033
<p>My scenario should be simple... the type I want to convert <em>FROM</em> is <em>ALWAYS</em> 'string'. What I want to convert to... could be many things - ints, DateTimes, ... strings, etc.</p> <p>This would be easy:</p> <pre><code>string valueToConvertFrom = "123"; int blah = Convert.ToInt32(valueToConvertFrom); ...
<p>the clean way to do it is using the a TypeConverter. you can get an instance of a type converter by calling the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.typedescriptor.getconverter.aspx" rel="noreferrer">TypeDescriptor.GetConverter</a> and then using the instance of the type converter ...
<p>String class implements IConvertible, this code simply SHOULD work. Which version of .NET are you aiming?</p> <pre><code>object o = Convert.ChangeType( str, convertToType ); </code></pre> <p>Besides, most of the types you mentioned implement Parse method, so your best shot might be something like this.</p> <pre><...
40,319
<p>Anyone doing any work using "offline" forms? We have an application that requires inputting data from outside our company. I was thinking about sending a form out via email, allowing the form to be filled out then sent back. Obviously a web application would be the best solution, but management doesn't seem ready...
<p>Have you considered InfoPath? These can be created and distributed through email. And then the data can be collated automatically.</p> <p>Also, consider using Google Spreadsheets with Google Forms. It's free and infrastructure is outsourced.</p> <p>PDF forms can work as well.</p>
<p>Another possibility is to use <a href="http://www.microsoft.com/Sharepoint/default.mspx" rel="nofollow noreferrer">Microsoft SharePoint</a>. If your company uses Microsoft Office for the people filling the forms you referring to, you could deploy an Office based solution and gather information with <a href="http://w...
4,065
<p>I have a Lotus Domino server with a truly astounding number of Domino databases on it, arranged in various folders. </p> <p>Is there some means of exporting a list of all these databases, with their titles and creators' names, in a spreadsheet format of some kind? I have the Domino Admin and Domino Designer softwar...
<p>You'd think there'd be a way in the Domino Admin, but there's no way to export the list. So, your best bet I think is to use the Domain Catalog database. To build it, go into the server configuration doc > Server Tasks > and turn on the Domain Catalog. Then the catalog.nsf database will be built and will contain ...
<p>Inherited some legacy server, didn't we ?</p> <p>If the server was sensibly maintained in the past, you already have the following things :</p> <ul> <li>a catalog.nsf database, which is exactly what you want, only better</li> <li>the <code>catalog</code> server task up and running.</li> </ul> <p>The catalog task ...
36,144
<p>I have a column in my database (a flag) with type varchar(1) that is populated either Y or NULL (this is how it is, not in my control).</p> <p>In SQL Server, doing an ascending order by query, NULL is ordered at the top. Should this behaviour be consistent for Oracle and DB2? </p> <p>If, instead I have a COALESCE ...
<p>I know for a fact that DB2 Express and DB2 (at least up to v8) does <strong>not</strong> support the <code>NULLS FIRST</code> clause.</p> <p>If you want a portable solution, you may have to opt for something like:</p> <pre><code>select * from tbl where fld is null union all select * from tbl where fld is not n...
<p>In oracle you can do this:</p> <pre><code>ORDER BY value NULLS FIRST </code></pre> <p>or </p> <pre><code>ORDER BY value NULLS LAST </code></pre> <p>Try it in SQL Server</p>
41,292
<p>When a controller renders a view based on a model you can get the properties from the ViewData collection using the indexer (ie. ViewData["Property"]). However, I have a shared user control that I tried to call using the following:</p> <pre><code>return View("Message", new { DisplayMessage = "This is a test" }); <...
<p>The method </p> <pre><code>ViewData.Eval("DisplayMessage") </code></pre> <p>should work for you.</p>
<p>Of course after I create this question I immediately find the answer after a few more searches on Google</p> <p><a href="http://forums.asp.net/t/1197059.aspx" rel="nofollow noreferrer">http://forums.asp.net/t/1197059.aspx</a></p> <p>Apparently this happens because of the wrapper class. Even so, it seems like any ...
3,934
<p>What is the bare minimum I need to put in web.config to get WCF working with REST? I have annotated my methods with [WebGet], but they are not getting the message.</p>
<p>I discovered that you can add the following to the ServiceHost directive in the *.svc file, and it will automatically setup WebHttpBinding and WebHttpBehavior for you:</p> <pre><code>Factory="System.ServiceModel.Activation.WebServiceHostFactory" </code></pre> <p>Note that the namespace is a little different from w...
<p>You need to ensure that you have an address for your service host e.g</p> <pre><code>&lt;services&gt; &lt;service name="SomeLib.SomeService"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:8080/somebase"/&gt; &lt;/baseAddresses&gt; &...
16,910
<p>What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand description?</p>
<p>A JIT compiler runs <strong>after</strong> the program has started and compiles the code (usually bytecode or some kind of VM instructions) on the fly (or just-in-time, as it's called) into a form that's usually faster, typically the host CPU's native instruction set. A JIT has access to dynamic runtime information ...
<p>JIT refers to execution engine in few of JVM implementations, one that is faster but requires more memory,is a just-in-time compiler. In this scheme, the bytecodes of a method are compiled to native machine code the first time the method is invoked. The native machine code for the method is then cached, so it can be...
12,118
<p>I have an iframe and couple of tables on my aspx page. Now when the page loads these tables are hidden. The iframe is used to upload file to database. Depending on the result of the event I have to show a particular table on my main page (these tables basically have "Retry","next" buttons...depending on whether or n...
<p>mmm you said you're on aspx page, I suppose that the iframe do a postback, so for this it reload the page. If you can't avoid the postback, you've to set a flag on the main page just before posting back, and check against that while you're loading...</p> <p>...something like:</p> <pre><code>mainpage.waitTillPostB...
<p>I am not sure what your problem is, but perhaps your approach should be a little different. Try putting code into the iframe what would call functions of the parent. These functions would display the proper table:</p> <pre><code>&lt;!-- in the main page ---&gt; function showTable1() {} &lt;!-- in the iframe --&gt;...
23,776
<p>I want to load a different properties file based upon one variable.</p> <p>Basically, if doing a dev build use this properties file, if doing a test build use this other properties file, and if doing a production build use yet a third properties file.</p>
<p><strong>Step 1</strong>: Define a property in your NAnt script to track the environment you're building for (local, test, production, etc.).</p> <pre><code>&lt;property name="environment" value="local" /&gt; </code></pre> <p><strong>Step 2</strong>: If you don't already have a configuration or initialization targe...
<p>The way I've done this kind of thing is to include seperate build files depending on the type of build using the <a href="http://nant.sourceforge.net/release/latest/help/tasks/nant.html" rel="nofollow noreferrer">nant task</a>. A possible alternative might be to use the <a href="http://nantcontrib.sourceforge.net/re...
10,247
<p>Let's say we have defined a CSS class that is being applied to various elements on a page.</p> <pre><code>colourful { color: #DD00DD; background-color: #330033; } </code></pre> <p>People have complained about the colour, that they don't like pink/purple. So you want to give them the ability to change the s...
<p>I would actually implement this server-side; just store the user's preferred colours in their session (via cookies or whatever is nice and easy for you) and generate the CSS dynamically, i.e.</p> <pre><code>colourful { color: ${userPrefs.colourfulColour}; background-color: ${userPrefs.colourfulBackgroundColour}...
<p>Something like</p> <pre><code>function changeColourful(colorRGB, backgroundColorRGB) {changeColor (document, colorRGB, backgroundColorRGB)} function changeColor (node, color, changeToColor) { for(var ii = 0 ; ii &lt; node.childNodes.length; ii++) { if(node.childNodes[ii].childNodes.length &gt; 0) ...
33,356
<p>I am trying to call a COM object from PHP using the COM interop extension. One function requires an OLE_COLOR as an argument? Is there any way to pass this kind of value from PHP?</p> <p>I have tried passing a simple integer value with no success.</p> <pre><code>$this-&gt;oBuilder-&gt;Font-&gt;Color = 255; </code>...
<p>PHP can define the constants the COM exposes automatic.</p> <p>set_ini('<a href="http://php.net/manual/en/com.configuration.php#ini.com.autoregister-typelib" rel="nofollow noreferrer">com.autoregister-typelib</a>', true);</p> <p>or by hand </p> <p><a href="http://php.net/manual/en/function.com-load-typelib.php" r...
<p>When I've called COM functions from PHP, I just passed them in the call. So my old code has:</p> <pre> $myComObject = new COM("MY_COM_OBJECT"); $myComObject->Myfunction( myVar1, myVar2, 'my string var'); </pre>
27,546
<p>I just changed my nozzle on my Anet A8 after it was fully used up. When I started printing with my new 0.4&nbsp;mm nozzle (same as before) my <a href="https://imgur.com/a/2x42LTB" rel="nofollow noreferrer">extrusion</a> was VERY bad and inconsistent, even so bad I couldn't continue printing because it would pull the...
<p>Your good extrusion look also a little bad , and the bad extrusion looks like a big feeding problem. for this you need:</p> <p>Feeding.- try to tight the presure of the feeder thread, the one that press the filament on the extruder.</p> <p>Bed Adhesion.- Use between 32° and 38°C if you are using masking tape, on h...
<p>In the nozzle assembled properly? As I assumed that there were no other changes during the nozzle exchange process, then there is a risk of a gap inside throat and nozzle that just builds up and blocks the extrusion.</p> <p>Please see <a href="https://3dprinting.stackexchange.com/a/5830/9730">this answer</a> for an...
890
<p>I am using the <code>MonthCalendar</code> controls in a Windows Forms application. I want to gray out the dates older than the control's MinDate (or give the user some visual clue about which dates are not valid for selection). The control has no property for getting the behaviour I expect. I have tried the <code>Ul...
<p>The MonthControl seems to already do what you're looking for. Setting the minDate property removes the invalid days/years from the calendar so they can't be selected. Works in .NET 2.0 and 3.5.</p> <p>Keep in mind, I'm using Windows Server 2008, so the visual styles for .NET controls may be different than on your ...
<p>Without creating your own control or custom drawing, it can't be done.</p>
49,582