instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm developing a multilanguage software. As far as the application code goes, localizability is not an issue. We can use language specific resources and have all kinds of tools that work well with them.</p>
<p>But what is the best approach in defining a multilanguage database schema? Let's say we have a lot of tabl... | <p>What do you think about having a related translation table for each translatable table?</p>
<blockquote>
<p>CREATE TABLE T_PRODUCT (pr_id int, PRICE NUMBER(18, 2))</p>
<p>CREATE TABLE T_PRODUCT_tr (pr_id INT FK, languagecode varchar, pr_name text, pr_descr text)</p>
</blockquote>
<p>This way if you have multiple tra... | <p>"Which one is best" is based on the project situation. The first one is easy to select and maintain, and also the performance is best since it don't need to join tables when select entity. If you confirmed that your poject is just only support 2 or 3 languages, and it will not increase, you can use it.</p>
<p>The s... | 40,904 |
<p>Where should I put the .html files in a wicket Application?</p>
<p>my current project layout is as follows:</p>
<pre><code>src/myproject
--classes+ duplicated html files
web
--numerous .html files - previewed
web/img
--resource files such as css/png/js files
</code></pre>
<p>i want to avoid putting the html fil... | <p><a href="https://stackoverflow.com/questions/273721/should-i-put-html-and-java-files-in-the-same-package-folder-in-apache-wicket">Should I put html and java files in the same package (folder) in Apache Wicket?</a></p>
| <p>I would suggest using <a href="http://maven.apache.org" rel="nofollow noreferrer">Maven</a> to build your application. Never depend on an IDE to build your application. IDE's might differ between developers. When you want to use a CI server you need to fall back to scripting if you don't use a build system.</p>
<p>... | 45,075 |
<p>I'm working to set up Panda on an Amazon EC2 instance.
I set up my account and tools last night and had no problem using SSH to interact with my own personal instance, but right now I'm not being allowed permission into Panda's EC2 instance.
<a href="http://pandastream.com/docs/getting_started" rel="noreferrer">Gett... | <blockquote>
<p>I've chmoded my keypair to 600 in order to get into my personal instance last night,</p>
</blockquote>
<p>And this is the way it is supposed to be. </p>
<p>From the <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html" rel="noreferrer">EC2 documentation</a> we ha... | <p>Just a note for anyone who stumbles upon this:</p>
<p>If you are trying to SSH with a key that has been shared with you, for example:</p>
<p><code>ssh -i /path/to/keyfile.pem user@some-host</code></p>
<p>Where <code>keyfile.pem</code> is the private/public key shared with you and you're using it to connect, <stro... | 24,668 |
<p>I have strange problem with sharepoint and ajax functionality. We have an UpdatePanel placed inside webpart. When partial postback occurs, page title gets missing.</p>
<p>We have found that temporary partial solution is to write title element into one line and not use any spaces or controls inside it..not even a li... | <p>I don't have a reference to the newsgroup post, but this is a known problem with publishing pages, as drax mentioned. The workaround I have used in the past is to hard code the title on the page - the metadata title being lost is part of the bug. </p>
<p>When hardcoding wasn't possible, I have used javascript to ... | <p>this looks like pure sharepoint's problem..also it looks like just sites based on publishing page layout are affected.</p>
<p>I debugged response in firebug and for some reason it returns setting for page title, so response from server contains not just update panel information, but also empty page title.</p>
<p>I... | 42,146 |
<p>I need to set a dependency property on a control (Slider.Value) in my code without it triggering a ValueChanged event (since I set the value, not the user). What is the best way to handle this situation in WPF? </p>
<p>For clarification, what I am trying to do is hook up WPF sliders to a WinForms User Control. Curr... | <p>Here's a simply workaround/hack. Add a boolean to keep track whether you changed the setting, let's say "IsChangedByMe". When you change the dependency property in code, set the bool to true. In the ValueChanged event, if IsChangedByMe is true, don't do anything.</p>
| <p>One possible solution is to derive from Slider and override <em>OnValueChanged(...)</em>. When you did not want to raise the event you should do nothing, otherwise you should call the base implementation.</p>
| 18,628 |
<p>I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward.</p>
<pre><code><asp:ListView runat="server" ID="ArticleList">
<LayoutTemplate>
<div class="ContentContainer"... | <p>The trick is to subscribe to the databinding event of the itemplaceholder in the ItemTemplate. </p>
<p>The complete solution:</p>
<pre><code>public class FibonacciControl : CompositeControl
{
public FibonacciControl()
{
// ....
}
protected override void CreateChildControls()
{
... | <p>Setup a class like:</p>
<pre><code>public delegate void InstantiateTemplateDelegate(Control container);
public class GenericTemplateImplementation : ITemplate
{
private InstantiateTemplateDelegate instantiateTemplate;
public void InstantiateIn(Control container)
{
this.instantiateTemplate(cont... | 11,814 |
<p>I was thinking about how to create a program that would only be valid for X period of time, (within a C# app).</p>
<p>What I was thinking was that you would have the current date as a constant inside the program and it would check to see if it is X days older than that. Naturally I do not want to store the date, o... | <p>Precompilation directives are your key here. You could create a constant in your application and have it set when you compile.</p>
<p>Make sure you obfuscate your code, however. Someone could disassemble it easily and tamper with the constant. Another solution is to have your software "phone home" to register itsel... | <p>The problem with .Net is that it would be easy to decompile and change the date you want to use has constant. You might need to think to something else.</p>
<p>You could write it in the registry but then the people will edit this value.</p>
<p>They aren't a perfect solution but to have an account that validate wit... | 41,509 |
<p>I'm trying to work out a way of passing the web current http context to a service class (or initialising the class with a reference to it). I am doing this to abstract the rest of the app away from needing to know anything about the http context. </p>
<p>I also want the service to be testable using TDD, probably us... | <p>This is why HttpContextBase and HttpContextWrapper were introduced. You probably want to use HttpContextBase and when passing the real context in, use <code>new HttpContextWrapper( httpContext )</code>, although, I think that what is available to you in the controller is already of type HttpContextBase. I would cr... | <p>What we do is spin one of these up <a href="http://haacked.com/archive/2007/06/19/unit-tests-web-code-without-a-web-server-using-httpsimulator.aspx" rel="nofollow noreferrer">http://haacked.com/archive/2007/06/19/unit-tests-web-code-without-a-web-server-using-httpsimulator.aspx</a></p>
<p>Easy as pie, just instanci... | 43,281 |
<p>What's your opinion for the best possible way to build asp.net multilingual localized web application (only UI localization of string resources). Especially this two things:</p>
<ol>
<li>How to store resources? Xml files, resx files or something else?</li>
<li>How to handle URL's? I don't want to keep language para... | <p>Have you looked into the localization support in ASP.NET? It uses resource assemblies and sets the default resource based on the browser's settings. You can also override the setting by setting the culture and uiculture settings for the thread handling the request.</p>
<p>If you don't like using the resource asse... | <p>Use Data Driven ASP.NET Localization Resource Provider as described in <a href="http://www.west-wind.com/presentations/wwdbresourceprovider/" rel="nofollow">http://www.west-wind.com/presentations/wwdbresourceprovider/</a> </p>
| 32,095 |
<p>Does anyone know a way to find out programatically which physical disk holds a given partition?
Manually, I can find this info using Start->Run->diskmgmt.msc , where I can see that (on my computer) that partitions C: and D: are on disk 1, E: & F: on disk 0.</p>
<p>This is for optimizing some file crunching oper... | <p>You can obtain this information using WMI from System.Management namespace by quering <a href="http://msdn.microsoft.com/en-us/library/aa394132(VS.85).aspx" rel="nofollow noreferrer">Win32_DiskDrive</a> class.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms257340(VS.80).aspx" rel="nofollow noreferrer">He... | <p>Are you sure the partition is associated with only one disk? It could be striped/spanned/etc across multiple physical disks.</p>
| 38,459 |
<p>By default, objects (tables, stored procedures, etc) are set up with the dbo owner/schema (I think ms sql 2000 calls it owner, while ms sql 2005 calls it schema)</p>
<p>The owner/schema is really a role or user in the database. I've always left the default of dbo, but I've recently seen some examples in microsoft ... | <p>The use of schemas is exceptionally beneficial when you have security concerns.</p>
<p>If you have multiple applications that access the database, you might not want to give the Logistics department access to Human Resources records. So you put all of your Human Resources tables into an hr schema and only allow acc... | <p><a href="http://www.sqlteam.com/article/understanding-the-difference-between-owners-and-schemas-in-sql-server" rel="nofollow noreferrer">This article</a> explains it well, including the changes from SQL Server 2000 to 2005.</p>
| 31,744 |
<p>I have control over the HttpServer but not over the ApplicationServer or the Java Applications sitting there but I need to block direct access to certain pages on those applications. Precisely, I don't want users automating access to forms issuing direct GET/POST HTTP requests to the appropriate servlet. </p>
<p>So... | <p>I'm not sure if I can solve this in one go, but we can go back and forth as necessary.</p>
<p>First, I want to repeat what I think you are saying and make sure I'm clear. You want to disallow requests to servlet1 and servlet2 is the request doesn't have the proper referer and it <strong>does</strong> have a query ... | <p>I'm guessing you're trying to prevent screen scraping?</p>
<p>In my honest opinion it's a tough one to solve and trying to fix by checking the value of HTTP_REFERER is just a sticking plaster. Anyone going to the bother of automating submissions is going to be savvy enough to send the correct referer from their 'au... | 2,560 |
<p>Is there a way to define styles for a combination of classes? For example, I'd like my HTML to look like this, but the output to render in the appropriate color:</p>
<pre><code><span class="red">Red Text</span><br/>
<span class="green">Green Text</span><br/>
<span class="red ... | <p>You can select on multiple classes:</p>
<pre><code>span.red.green { color: yellow; }
</code></pre>
<p>That will apply to any span element with red and green classes. Which may not be what you want, since it will also apply to, say:</p>
<pre><code><span class="red green blue">white</span>
</code></pre>... | <p>maybe something like this</p>
<pre><code>.red
{
color: red;
}
.red_green
{
color: #AS8324;
}
</code></pre>
<p>and you can use your html code</p>
<pre><code><span class="red">Red Text</span><br/>
<span class="green">Green Text</span><br/>
<span class="red_green">Yellow Te... | 47,039 |
<p>everybody; I have this problem in asp.net, I have a page where I insert and modify data, before saving I make a validation if it passes I save the data but if not I raise an exception and show it, the function goes like this;</p>
<pre><code>protected void btnSave_Click(object sender, EventArgs e)
{
try
{
...
if(Val... | <p>If JSLiteral is a server side control and it's using view state. Then you'd need to clear the state of the control, when the save is succesful. </p>
<p>You could disable the viewstate for the control like JSLiteral.EnableViewState =false;</p>
| <p>Is the message saved in the viewstate of the literal?</p>
<p>Explicitly set the literal text to nothing if the data is valid.</p>
| 43,899 |
<p>I want to create cursor rsrc files on the Mac from png files. The application that uses the cursors requires it to be in a .rsrc format and I cannot change that. Does anybody know of any way I can create the cursor .rsrc files from png images.</p>
| <p>You can use <a href="http://www.versiontracker.com/dyn/moreinfo/macosx/23349" rel="nofollow noreferrer" title="Rezilla">Rezilla</a> to edit resource files on Mac OS X, it has a CURS (and crsr) editor among others. It's a PowerPC binary but it runs well under rosetta on intel.</p>
<p>Also, you don't create a CURS re... | <p>Its been a long time since I've thought about MacOS resource forks. Are you using the classic MacOS (i.e. before MacOS X)?</p>
<p>As I recall, <A HREF="http://developer.apple.com/documentation/macos8/DevTools/ResEditReference/reseditreference.html" rel="nofollow noreferrer">ResEdit</A> was the application most ofte... | 9,760 |
<p>Im having a problem with a final part of my assignment. We get in a stream of bits, etc etc, in the stream is an integer with the number of 1's in the text portion. I get that integer and its 24 which is correct, now i loop through the text data i get and i try to count all the 1's in there. But my proc is always re... | <p>'shr bh,1' should probably be 'shr dh,1', no?</p>
| <p>Just to give you an alternative and shorter implementation of your inner-loop:</p>
<pre><code> mov cx, 8
mov dh, byte ptr [bx+si]
@@innerLoop:
add dh, dh
adc ax, 0
loop @@innerLoop
</code></pre>
<p>Here we don't test the bits at all. Instead the add dh,... | 28,750 |
<p>I have a following xslt code :</p>
<pre><code><xsl:template match="table_terms_and_abbr">
<informaltable frame='none' colsep='none' rowsep='none'>
<tgroup cols='2' align='left'>
<colspec colnum="1" colwidth='1*'/>
<colspec colnum="2" colwidth='1*'/>
... | <blockquote>
<p>I know how to pass the attributes to the template i.e:</p>
<pre><code><xsl:with-param name="is_make_first_bold" select = "1" as="xs:integer"/>
</code></pre>
<p>but how to pass free text ? </p>
</blockquote>
<p>Pass the text as the content of an <code>xsl:with-param</code> element.</p>
<p... | <p>You can pass the additional string data as a parameter:</p>
<p> <xsl:with-param name="pNeededText" select="'--123Abc'"/></p>
<p>and in the called template define this parameter:</p>
<p> <xsl:param name="pNeededText" as="xs:string"></p>
<p>Or, you co... | 38,303 |
<p>Simple question:</p>
<ul>
<li>What Python GUI API's are out there and what are the advantages of any given API?</li>
</ul>
<p>I'm not looking for a religious war here, I'm just wanting to get a good handle on all that is out there in terms of Python GUI APIs.</p>
| <p><a href="http://wiki.python.org/moin/GuiProgramming" rel="noreferrer">Here's a good list.</a></p>
| <p>I've been working with <a href="http://www.wxpython.org" rel="nofollow noreferrer">wxPython</a> for a few years now and I like it quite a bit. The best thing about wxPython is that the UI feels native on the different platforms it runs on (excellent on Windows and Linux though not as good on OS/X).</p>
<p>The API l... | 11,955 |
<p>I'm interested in reading about the various ways other developers and architects deal with the customization of certain areas of their applications for certain sites. Call outs to customer implemented pre and post processing, events doing the same, allowing business logic methods to be overridden, using strategies ... | <p>MS is working on two different frameworks for this in .NET: the Managed Extensibility Framework and System.Addin. </p>
<p>Probably the most commonly used way applications expose extensibility is through Dependency Injection/Inversion of Control mixed with runtime type resolution. That means, you let an external ... | <p>For the products I work with, customizations that are built either by the Services group for a given customer, or sometimes by the customers themselves, get shared to the rest of the team (for stuff we've made) and often get "productized" in later releases.</p>
<p>We support a [nearly] full-access API which can be ... | 33,239 |
<p>We determined in a <a href="https://stackoverflow.com/questions/303810/variable-dynamic-option-lists-in-html-select-using-ie">previous question</a> that many features of HTML SELECTs are not supported in IE. Is there an alternative widget that you would recommend from your experience that meets the following requir... | <p>At last check IE6+ does support #3 and #5, and you can (mis)use OPTGROUP to work around most of the other items.</p>
<p>You can do this by having an optgroup with no options inside it, like this:</p>
<pre><code><optgroup label="--"></optgroup>
</code></pre>
<p>You can make the label anything you want,... | <p>I am writing such a widget. I plan to implement optgroup in my next version, which will be in a few days hopefully, since ive been making good progress.</p>
<p><a href="http://programmingdrunk.com/current-projects/dropdownReplacement/" rel="nofollow noreferrer">demo page</a></p>
<p><a href="https://code.google.com... | 39,376 |
<p>Evil or not evil?</p>
<pre><code>public static void Raise(this EventHandler handler, object sender, EventArgs args)
{
if (handler != null)
{
handler(sender, args);
}
}
// Usage:
MyButtonClicked.Raise(this, EventArgs.Empty);
// This works too! Evil?
EventHandler handler = null;
handler.Raise(this, E... | <p>Not evil. I wish events worked this way by default. Can someone explain why an event with no subscribers is null?</p>
| <p>Throwing an exception when there are no handlers is not really preferable by the most. If it does not have an handlers it is better to be empty rather than null.</p>
| 30,823 |
<p>I want to set up a Subversion server installation on Windows Server 2003 64-bit and I'm considering using <a href="http://www.visualsvn.com/server/" rel="noreferrer">VisualSVN Server</a>. Does this work OK in a 64-bit environment? Are there any issues or gotchas I should be aware of before installing the software?</... | <p>Ive been using VisualSVN Server on W2K3 x64 on one of our MS SQL 2005 boxes with no problems at all for over a month now. I followed the <a href="http://www.visualsvn.com/server/doc/server-config/" rel="nofollow noreferrer">installation guide</a> and have had no issue at all with either the server code or the integr... | <p>I have a lot of experience with SVN servers on windows.</p>
<p>VisualSVN works fine.</p>
<p>However it is x86. If you want your server to run as 64bit process you can do the following(Maybe you can create a hack to work with VisualSVN - Didn't try yet):</p>
<blockquote>
<p><strong>Update1: This is an obsolete m... | 29,640 |
<p>I have a table which contains 3 nvarchar(255) columns and a combination of these 3 columns must be unique. Normally I would create a Unique constraint, but in this case, I am hitting the 900 byte limit. Since I have to support SQL Server 2000, I can not use Include columns to get around this situation.</p>
| <p>If I understand you correctly, you could use a trigger and on the Insert or Update check to see if the combination of the values is unique prior to making the change. You could also do the same via a stored procedure.</p>
| <p>You could hash the 3 columns, using MD5 or SHA1, and create a unqiue constraint on the hashed value.</p>
<p>How easy it is to implement depends on where you INSERTs/UPDATEs come from.</p>
<p>If they only come from your application, then it should be relatively easy to implement.</p>
<p>If they come from multiple ... | 24,204 |
<p>I've heard that there are some things one cannot do as a computer programmer, but I don't know what they are. One thing that occurred to me recently was: wouldn't it be nice to have a class that could make a copy of the source of the program it runs, modify that program and add a method to the class that it is, and ... | <p>Start by looking at <a href="http://en.wikipedia.org/wiki/Quines" rel="nofollow noreferrer">quines</a>, then at Macro-Assemblers and then <a href="http://www.google.com/search?q=lex+yacc" rel="nofollow noreferrer">lex & yacc</a>, and <a href="http://www.google.com/search?q=flex+bison" rel="nofollow noreferrer">f... | <p>This is one of the fundamental questions of Artificial Intelligence. Personally I hope it is not possible - otherwise soon I'll be out of a job!!! :)</p>
| 31,230 |
<p>I have the following markup, and I want to make the <code>All</code> radio button checked.</p>
<pre><code><ul>
<li><input type="radio" value="All" name="Foo"/>All</li>
<li><input type="radio" value="New" name="Foo"/>New</li>
<li><input type="radio" valu... | <p>The following HTML file shows how you can do this:</p>
<pre><code><html>
<head>
<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function(event){
$("input[nam... | <p>I was beating my head against a wall similar to this and just want to point out that in jQuery 1.3 the syntax used in the accepted answer is the ONLY syntax that will work. The questioner uses the @ syntax for the expression which does not work at all in jQuery. Hopefully this helps the next guy to come across this ... | 18,871 |
<p>Currently we have a project with a standard subversion repository layout of:</p>
<p>./trunk<br>
./branches<br>
./tags</p>
<p>However, as we're moving down the road of OSGi and a modular project, we've ended up with:</p>
<p>./trunk/bundle/main<br>
./trunk/bundle/modulea<br>
./trunk/bundle/moduleb
./tags/bundle/mai... | <p>The Subversion book contains two sections on this:</p>
<ul>
<li><a href="http://svnbook.red-bean.com/en/1.4/svn.branchmerge.maint.html#svn.branchmerge.maint.layout" rel="nofollow noreferrer">Repository Layout</a></li>
<li><a href="http://svnbook.red-bean.com/en/1.4/svn.reposadmin.planning.html#svn.reposadmin.projec... | <p>I've answered a similar question in a StackOverflow <a href="https://stackoverflow.com/questions/16829/structure-of-projects-in-version-control#16915">Version Control Structure question</a>. It actually fits even better here since we do heavy OSGi development and have lots of bundles. I must echo Anders Sandvig comm... | 3,519 |
<p>My Visual Studio (2008) Editor has stopped to underline Errors (this nifty wavy red lines). I can't really tell when, but it can be related to the installation of .Net Framework 3.5 SP 1 or the MVC Beta (which I guess is unlikely). Furthermore have I installed and uninstalled both CodeRush and Resharper for evaluati... | <p>Have you checked <kbd>Tools</kbd>→<kbd>Options...</kbd>→<kbd>Text Editor</kbd>→<kbd>C#</kbd>→<kbd>Advanced</kbd>→<kbd>Underline errors in the editor</kbd>?</p>
<p>I usually like to reset my settings after messing around with plugins, as they tend to mess with settings: <kbd>Tools</kbd>→<kbd>Import and Export Settin... | <p>Just go to settings and search for errors and <a href="https://i.stack.imgur.com/vS9eO.png" rel="nofollow noreferrer">Image in Error Squiggles</a>. You can see the Error squiggles (Modified: Workspace - Right now you can't see it because I modified it). Just click on modified and you will see the disabled option. If... | 33,599 |
<p><a href="https://e3d-online.com/blogs/news/are-abrasives-killing-your-nozzle" rel="nofollow noreferrer">E3D-Online</a> and <a href="http://makezine.com/2015/09/11/carbon-fiber-filament-ruins-nozzles/" rel="nofollow noreferrer">Make Magazine</a> have written about the potential damage printing carbon fiber and glow i... | <p>I believe the little experiment made by E3D - the same link you provide - answers your question very well. Several points about wear can be found in this article. After printing only 250 grams of ColorFabb XT-CF20 (carbon fiber filament):</p>
<ul>
<li>The nozzle diameter had increased markedly</li>
<li>The inner wa... | <p>You can check for shortened nozzle length using a set of feeler gauges to measure the gap from bed to nozzle. <a href="https://en.wikipedia.org/wiki/Feeler_gauge" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Feeler_gauge</a></p>
| 163 |
<p>I have some design diagrams only on paper. Scanning them to bitmaps is easy, but I've had no luck getting useful vectors out of them. I've tried vectorizers in programs like gimp, and a few online services. Generally, I end up with enormous numbers of spurious vectors (from dust, dotted lines, text on the diagram, ... | <p>There is the capable but somewhat expensive <a href="http://www.scan2cad.com/" rel="nofollow" title="Scan2CAD">Scan2CAD</a>.</p>
<p>Otherwise, if you're happy with outlines and not centre lines, scan b&w, aggressively clean up macules, mask off text, and then vectorize in potrace, autotrace, etc. Alternatively,... | <p>I would recommend using something like <a href="http://www.getpaint.net/index.html" rel="nofollow noreferrer">Paint.NET</a> to "fix" the images before attempting to convert them to CAD.</p>
<p>To my knowledge, most of the Image-to-CAD applications are going to use the grayscale intensity of each pixel to get the Z-... | 221 |
<p>I am printing a mechanical part for my printer. </p>
<p>It's a new mount for my extruders and I have been attempting to use BVOH as a support filament so that when my print is done it will cut down on the need to finish the part and possible mistakes. </p>
<p>My problem is I can get the BVOH to adhere to the bed w... | <p>Can you tell by looking at the de-adhesion what isn't sticking? </p>
<p>It may be that printing the ASA at higher temperature is melting the BVOH enough that it doesn't stick, being molten. If so, then it may be possible to print the first layer of ASA at a cooler temperature, slower if necessary to still succeed... | <p>Here's how I got it to work. I set the heat bed to 110°C and disabled the underlayer of the raft layer. I set the BVOH and the ASA to 235°C after the 4th layer I set the heatbed to 90°C and after the 6th layer I set the bed down to 60°C so that the BVOH hardened and adhered to the bed making sure that nothing curle... | 1,306 |
<p>I have problem with return statment >.< I want to store all magazine names into</p>
<pre><code>ArrayList<String> ListNameMagazine = new ArrayList<String>();
</code></pre>
<p>I have a DB; in the DB there is a table <code>name_magazine</code> and the data in <code>name_magazine</code> is</p>
<blockqu... | <p>Your problem is that <strong>return</strong> returns only one thing, and it will <em>return immediately and the function will exit</em>! You are retuning the name of a magazine <strong>just_try</strong>.</p>
<pre><code>while (rs.next()) {
//System.out.println("Result:"+rs.getString(1));
just_try = rs.getS... | <p>xan: Your method returns a String, while you try to return a list.</p>
<p>The signature must be changed to </p>
<pre><code>public List<String> getResult(String sql) throws SQLException;
</code></pre>
| 42,594 |
<p>I need to activate a JButton ActionListener within a JDialog so I can do some unit testing using JUnit.</p>
<p>Basically I have this:</p>
<pre><code> public class MyDialog extends JDialog {
public static int APPLY_OPTION= 1;
protected int buttonpressed;
protected JButton okButton;
public MyDial... | <p><code>AbstractButton.doClick</code></p>
<p>Your tests might run faster if you use the form that takes an argument and give it a shorter delay. The call blocks for the delay.</p>
| <p>I created a getter for the JButton and used the doClick. Example:</p>
<pre><code>@Test
@DisplayName("ActionListener test")
void testActionListener(){
HelpWindow helpWindow = new HelpWindow("menu");
assertDoesNotThrow(() -> helpWindow.getReturnButton().doClick());
}
</code></pre>
| 42,648 |
<p>We are currently using unit tests to test our project. We have the majority of functionality covered but I think our tests are too brittle. </p>
<p>I was wondering if there are any specific things we can be doing to make the unit tests more flexible so they don't break for the wrong reasons.</p>
<p>A couple answ... | <p>This is a somewhat simplistic answer, but shows the right mindset:</p>
<ul>
<li>A test should break if the behaviour changes in a way that you care about.</li>
<li>A test should continue to work if the behaviour changes in a way that you don't care about.</li>
</ul>
<p>So as far as is possible - without going <em>... | <blockquote>
<p>So what are legitimate reasons for
mocking? I think that may be one of
our main problems, but when your
application is mostly a dynamic,
database-driven site, how do you get
away from mocking?</p>
</blockquote>
<p>Reasons for mocking an object comprise</p>
<ul>
<li>object is or uses an ext... | 34,372 |
<p>This is a bit of a lazyweb question but you get the rep so :-)</p>
<p>I have a Java class that returns instances of itself to allow chaining
(e.g. ClassObject.doStuff().doStuff())</p>
<p>For instance:</p>
<pre><code>public class Chainer
{
public Chainer doStuff()
{
/* Do stuff ... */
return... | <p>Have you tried the straight-forward</p>
<pre><code>public class Chainer
{
public Chainer doStuff()
{
/* Do stuff ... */
return this;
}
}
public class ChainerExtender extends Chainer
{
@Override
public ChainerExtender doStuff()
{
/* Do stuff ... */
super.doStuff()... | <p>Could you just post a complete example leading to the error message you see ?</p>
<p>I just compiled and execute the following without a hitch:</p>
<pre><code>public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
ChainerExtender c = new ChainerExtender... | 28,290 |
<p>This was something originally discussed during a presentation given by Charles Brian Quinn of the <a href="http://www.bignerdranch.com/" rel="noreferrer">Big Nerd Ranch</a> at <a href="http://www.actsasconference.com" rel="noreferrer">acts_as_conference</a>. He was discussing what he had learned from instructing a ... | <p>It strictly depends on what are you trying to teach. Sometimes, when showing a programming example, you have to declare a few things just for the snippet to be "complete", and those few things are not the core of what you are showing. </p>
<p>For example, if you want to show how to throw an exception, I believe it ... | <p>I am new to programming, and more or less self taught. I read a lot of example code online and at the beginning found myself replacing foo and bar &c. with more relevant names, such as the firstnumber and secondnumber examples above.</p>
<p>I now prefer x,y,z,i... because foo and bar seem to spark linguistic im... | 29,027 |
<p>Pretty simple scenario. I have a web service that receives a byte array that is to be saved as a particular file type on disk. What is the most efficient way to do this in C#?</p>
| <p>That would be <a href="http://msdn.microsoft.com/en-us/library/system.io.file.writeallbytes.aspx" rel="noreferrer"><code>File.WriteAllBytes()</code></a>.</p>
| <p>Perhaps the System.IO.BinaryWriter and BinaryReader classes would help.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.io.binarywriter.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.io.binarywriter.aspx</a></p>
<p>"Writes primitive types in binary to a stream and sup... | 15,656 |
<p>On my Monoprice Mini Select v2 there is poor adhesion when the print head goes to put down a new layer on the bed as seen in the photo. Does anyone have a fix for this?</p>
<p><a href="https://i.stack.imgur.com/NVbXE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NVbXE.jpg" alt="enter image desc... | <p>You could try a higher bed temp, but also check to make sure bed is levelled all round as this can sometimes cause this to happen </p>
| <p>Things you need to check or do: </p>
<ol>
<li>Use adhesion layers </li>
<li>Set lower speeds at first layer.</li>
<li>Increase bed temperature (try 5 degrees steps)</li>
<li>Clean the bed</li>
<li>Check if the bed is completely leveled up. </li>
<li>Increase the thickness of the first layer. </li>
</ol>
| 1,634 |
<p>I am trying to enable Full-text indexing in SQL Server 2005 Express. I am running this on my laptop with Vista Ultimate.</p>
<p>I understand that the standard version of SQL Server Express does not have full-text indexing. I have already downloaded and installed "Microsoft SQL Server 2005 Express Edition with Advan... | <pre><code>sp_fulltext_database 'enable'
CREATE FULLTEXT CATALOG [myFullText]
WITH ACCENT_SENSITIVITY = ON
CREATE FULLTEXT INDEX ON [dbo].[tblName] KEY INDEX [PK_something] ON [myFullText] WITH CHANGE_TRACKING AUTO
ALTER FULLTEXT INDEX ON [dbo].[otherTable] ADD ([Text])
ALTER FULLTEXT INDEX ON [dbo].[teyOtherTable] E... | <p>Use sql server management studio.</p>
<p>Login as admin to your windows account.</p>
<p>Then select database and right click on database in sql server management studio and select Define Full Text Index and you are guided throughout the process by management studio.</p>
| 2,607 |
<p>I am planning on getting a 3D printer soon and I was just wondering, what do you do with 3D prints that either failed or were prototypes that you no longer want?<br>
I tried looking online but the closest I got was effects on environment, turning prints back into filament, or restarting a failed print half-way, none... | <p>The "obvious" answer is re-grinding the prints and making more filament. Unfortunately, this isn't yet a very economical or simple operation. A decent filament extruder capable of holding acceptable diameter tolerances is around $1000, and even then they can be pretty fidgety to operate. You have to have a LOT of vo... | <p>If you have a few friends you could pitch in and use a recycling service like <a href="https://www.terracycle.com/en-US/zero_waste_boxes/3d-printing-materials" rel="nofollow noreferrer">Terracycle</a> where you can send your failed prints, rafts and scraps. No affiliation with Terracycle, it's just a service that I ... | 304 |
<p>I want to write a program that would print every combination of a set of variables to a text file, creating a word list. Each answer should be written on a separate line and write all of the results for 1 digit, 2 digits, and 3 digits to a single text file.</p>
<p>Is there a simple way I can write a python program ... | <p>A naïve solution which solves the problem and is general enough for any application you might have is this:</p>
<pre><code>def combinations(words, length):
if length == 0:
return []
result = [[word] for word in words]
while length > 1:
new_result = []
for combo in result:
... | <p>It shouldn't be too hard in most languages. Does the following pseudo-code help?</p>
<pre><code>for(int i=0; i < 2^digits; i++)
{
WriteLine(ToBinaryString(i));
}
</code></pre>
| 29,896 |
<p>So I made some timers for a quiz. The thing is, I just realized when I put </p>
<pre><code>javascript: alert("blah");
</code></pre>
<p>in the address, the popup alert box <strong>pauses</strong> my timer. Which is very unwanted in a quiz.</p>
<p>I don't think there is any way to stop this behaviour... but I'll as... | <p>Apparently the preview rendering differs from the posted rendering. This paragraph is here to make sure the next two lines show up as code.</p>
<pre><code>// Preserve native alert() if you need it for something special
window.nativeAlert = window.alert;
window.alert = function(msg) {
// Do something with msg h... | <p>The server session could be set to expire at say 1 hour. The javascript could be used as only a display tool for the user to know how much time is left. If he decides to cheat by pausing the timer, then he might be suprised when posting his test that his session has timed out.</p>
| 24,116 |
<p>Using NHibernate from C# and only HQL (not SQL) in a way that is compatible with MS SQL Server 2005/2008 (and preferably Oracle).</p>
<p>Is there a way to write the order by clause so that nulls will sort at the end of the query results while the non-null results will be sorted in ascending order?</p>
<p>Based on ... | <p>The point is to separate algorithms into classes that can be plugged in at runtime. For instance, let's say you have an application that includes a clock. There are many different ways that you can draw a clock, but for the most part the underlying functionality is the same. So you can create a clock display interfa... | <p>Strategy pattern works on simple idea i.e. "Favor Composition over Inheritance" so that strategy/algorithm can be changed at run time. To illustrate let's take an example where in we need to encrypt different messages based on its type e.g. MailMessage, ChatMessage etc.</p>
<pre><code>class CEncryptor
{
virtual... | 20,709 |
<pre><code><xsl:for-each select="./node [position() &lt;= (count(*) div 2)]">
<li>foo</li>
</xsl:for-each>
<xsl:for-each select="./node [count(*) div 2 &lt; position()]">
<li>bar</li>
</xsl:for-each>
</code></pre>
<p>My list has 12 nodes, but the second l... | <p>When you do <code>count(*)</code>, the current node is the <code>node</code> element being processed. You want either <code>count(current()/node)</code> or <code>last()</code> (preferable), or just calculate the midpoint to a variable for better performance and clearer code:</p>
<pre><code><xsl:variable name="no... | <p>I'm not at all sure, but it seems to me that <code>count(*)</code> is not doing what you think it is. That counts the number of children of the current node, not the size of the current node list. Could you print it out to check that it's 8 or 9 instead of 12?</p>
<p>Use <code>last()</code> to get the context siz... | 5,425 |
<p>How do you set the Windows time zone on the local machine programmatically in C#? Using an interactive tool is not an option because the remote units have no user interface or users. The remote machine is running .NET 2.0 and Windows XP Embedded and a local app that communicates with a central server (via web serv... | <p><a href="http://msdn.microsoft.com/en-us/library/ms724944.aspx" rel="nofollow noreferrer">SetTimeZoneInformation</a> should do what you need. You'll need to use <a href="http://pinvoke.net/default.aspx/kernel32/SetTimeZoneInformation.html" rel="nofollow noreferrer">P/Invoke</a> to get at it.</p>
<p>Note also that y... | <p>Try this...</p>
<p>First, you need to find, in the registry, the <strong>key</strong> that represents the zone you want ("Central Standard Time" is an example). Those are located here:</p>
<blockquote>
<p>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version\Time Zones</p>
</blockquote>
<p>So, with t... | 5,272 |
<p>I have an XML reader on this XML string:</p>
<pre><code><?xml version="1.0" encoding="UTF-8" ?>
<story id="1224488641nL21535800" date="20 Oct 2008" time="07:44">
<title>PRESS DIGEST - PORTUGAL - Oct 20</title>
<text>
<p> LISBON, Oct 20 (Reuters) - Following are some of the mai... | <p>I found a <em>very</em> unsatisfactory solution.</p>
<p>Change the class like this (ugh!)</p>
<pre><code>// ...
[XmlElement("HACK - this should never match anything")]
public string text;
// ...
</code></pre>
<p>And change the calling code like this (yuck!)</p>
<pre><code>XmlSerializer ser = new XmlSerializer(ty... | <p>Looks to me that the XML is incorrect.
Since you use HTML tags within the text tag the HTML tags are interpreted as XML.
You should use CDATA to correctly interpret the data or escape < and >.</p>
| 26,807 |
<p>Problem, there's no method:</p>
<pre><code>bool ChangePassword(string newPassword);
</code></pre>
<p>You have to know the current password (which is probably hashed and forgotten).</p>
| <p>This is an easy one that I wasted too much time on. Hopefully this post saves someone else the pain of slapping their forehead as hard as I did.</p>
<p>Solution, reset the password randomly and pass that into the change method.</p>
<pre><code>MembershipUser u = Membership.GetUser();
u.ChangePassword(u.ResetPasswor... | <p>You are not able to change the password if the requiresQuestionAndAnswer="true"</p>
<p>I got the work around for this </p>
<p>Created two membership providers in web.config </p>
<p>
</p>
<p>i am using the AspNetSqlMembershipProviderReset provider for reseting the pass... | 36,545 |
<p>On occasion, I find myself wanting to search the text of changelist descriptions in Perforce. There doesn't appear to be a way to do this in P4V. I can do it by redirecting the output of the changes command to a file...</p>
<pre><code>p4 changes -l > p4changes.txt
</code></pre>
<p>...(the -l switch tells it t... | <p>When the submitted changelist pane has focus, a CTRL+F lets you do an arbitrary text search, which includes changelist descriptions.</p>
<p>The only limitation is that it searches just those changelists that have been fetched from the server, so you may need to up the number retrieved. This is done via the "Number... | <p>If you still love your command line, you can write a small perl script that:</p>
<ul>
<li>changes the record separator $/ to
double newline "\n\n" so it filters
the input into full records of the
ztagged p4 output. </li>
<li>scans
the '/^... desc/..//' part with
regular expressions from the args.</li>
</ul>
<p>usa... | 16,236 |
<p>I am working on localization for an app where custom patterns are used to format the date-time.</p>
<p>one example is:
dd-MM HH:mm</p>
<p>I need to get localized versions of this custom format for dates, so that I get the date using numbers, and the time, basically using the local order (dd MM or MM dd) and the l... | <p>Look at the DateTimeFormatInfo class (CultureInfo.DateTimeFormat property), in particular the properties DateSeparator, TimeSeparator, ShortDatePattern.</p>
| <p>The <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx" rel="nofollow noreferrer">CultureInfo</a> class would be a good place to start looking.</p>
| 40,459 |
<p>One problem I have with open-source is not often the product or documentation, but the level of community involvement and support. Response time for some questions on official forums can take more than a week, which can honestly make a big difference when choosing a platform for commercial services use. However, I f... | <p>I've usually found that relying on community support for anything mission critical is asking for trouble. So I usually stay away from open source unless it's something that I'm confident we can support in-house or there is a commercial support service available for it.</p>
| <p>The only real way to evaluate the community is to try it, participate in the community. Most communities will have good support networks available in one manner or another. Also many individuals are starting to offer support services for the various frameworks as well, for those looking for a more dedicated resour... | 22,274 |
<p>I've got a problem here with an MSI deployment that I'm working on (using <a href="http://en.wikipedia.org/wiki/InstallShield" rel="nofollow noreferrer">InstallShield</a>). We have a program running in the background that needs to run per-user, and it needs to start automatically without user intervention.</p>
<p>T... | <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/aa369780(VS.85).aspx" rel="noreferrer">LogonUser</a> property of Windows Installer as a condition to the action launching the EXE.</p>
| <p>AHA! I knew there had to be a cleaner solution... the code I was working on was starting to look something like this:</p>
<pre class="lang-vb prettyprint-override"><code>On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strCompu... | 4,953 |
<p>I am trying to implement AJAX in my Google App Engine application, and so I am looking for a good AJAX framework that will help me. Anyone has any idea?</p>
<p>I am thinking about Google Web Toolkit, how good it is in terms of creating AJAX for Google App Engine?</p>
| <p>As Google Web Toolkit is a <a href="http://code.google.com/support/bin/answer.py?answer=54830&topic=10208" rel="nofollow noreferrer">subset of Java</a> it works best when you Java at the backend too. Since Google App Engine is currently <a href="http://code.google.com/appengine/kb/general.html#language" rel="no... | <p>If you want to be able to invoke method calls from JavaScript to Python, <a href="http://json-rpc.org/wiki/python-json-rpc" rel="nofollow noreferrer">JSON-RPC</a> works well with Google App Engine. See Google's article, "<a href="http://code.google.com/appengine/articles/rpc.html" rel="nofollow noreferrer">Using AJ... | 7,757 |
<p>Is it possible to define a spring-managed EJB3 hibernate listener?</p>
<p>I have this definition in my <strong>persistence.xml</strong>:</p>
<pre><code><properties>
<property name="hibernate.ejb.interceptor"
value="my.class.HibernateAuditInterceptor" />
<property name="hibernate.ej... | <p><a href="http://blog.krecan.net/2009/01/24/spring-managed-hibernate-interceptor-in-jpa/" rel="nofollow noreferrer">http://blog.krecan.net/2009/01/24/spring-managed-hibernate-interceptor-in-jpa/</a></p>
| <p>The problem is that those properties are just strings. Even if you define your SessionFactory as a Spring bean, any properties you pass to it through the hibernateProperties setter are just strings:</p>
<pre><code><bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
... | 32,248 |
<p>I have a couple old services that I want to completely uninstall. How can I do this?</p>
| <p>Use the <em>SC</em> command, like this (you need to be on a command prompt to execute the commands in this post):</p>
<pre><code>SC STOP shortservicename
SC DELETE shortservicename
</code></pre>
<hr>
<p><strong>Note:</strong> You need to run the command prompt as an administrator, not just logged in as the admini... | <p>For me my service that I created had to be uninstalled in Control Panel > Programs and Features</p>
| 10,169 |
<p>For reasons unknown, the VB6 compiler often likes to reorder the contents of .vbp files and the control descriptor block at the top of .frm files (The code that describes the properties of controls on the form. Code that you don't see in the IDE but you do see in a text editor and <em>when doing diffs against the p... | <p>I don't think there's much you can do about this. I've noticed the same problem: the IDE likes to rearrange things for seemingly no apparent reason. Some things I've noticed:</p>
<ul>
<li><p>When you use the SSTab control, VB
likes to rearrange properties for
tabs, especially the TabEnabled
property.</p></li>
<li><... | <p>I have noticed that re-opening the form and saving again often restores a consistent order.</p>
| 20,242 |
<p>I've been writing a little application that will let people upload & download files to me. I've added a web service to this applciation to provide the upload/download functionality that way but I'm not too sure on how well my implementation is going to cope with large files.</p>
<p>At the moment the definition... | <p><a href="https://stackoverflow.com/q/132618/16800">Stephen Denne</a> has a Metro implementation that satisfies your requirement. My answer is provided below after a short explination as to why that is the case.</p>
<p>Most Web Service implementations that are built using HTTP as the message protocol are REST compli... | <p>One way to do it is to add a <strong>uploadFileChunk</strong>(byte[] chunkData, int size, int offset, int totalSize) method (or something like that) that uploads parts of the file and the servers writes it the to disk. </p>
| 16,076 |
<p>What are the best continuous integration frameworks/projects for Perl and why?</p>
| <p>The only one I've seen in action is <a href="http://sourceforge.net/projects/smolder" rel="noreferrer">Smolder</a> (it is used for <a href="http://smolder.plusthree.com/app/public_projects/report_details/5562" rel="noreferrer">parrot</a>). It is TAP based and therefore integrates well with standard perl testing stru... | <p>Pjam - is a new <a href="https://github.com/thaljef/Pinto" rel="nofollow">pinto</a> based build server for perl applications. This is the perl specific build server,
because of using <strong>pinto</strong> under the hood it gives you very control on your builds:</p>
<ul>
<li>comparing builds</li>
<li>roll back proj... | 12,728 |
<p>Does anyone know how to transform a enum value to a human readable value?</p>
<p>For example:</p>
<blockquote>
<p>ThisIsValueA should be "This is Value A".</p>
</blockquote>
| <p>Converting this from a vb code snippet that a certain Ian Horwill left at a <a href="http://secretgeek.net/progr_purga.asp" rel="noreferrer">blog post long ago</a>... i've since used this in production successfully.</p>
<pre><code> /// <summary>
/// Add spaces to separate the capitalized words in the s... | <p>I found it best to define your enum values with an under score so ThisIsValueA would be This_Is_Value_A then you can just do a enumValue.toString().Replace("_"," ") where enumValue is your varible.</p>
| 3,455 |
<p>I have two medium-sized web applications that I'm merging into one. They are both localized with <code>GetText</code> and have large amout of common strings, so merging them manually would be extremely annoying. What is the fastest way to merge the two <code>PO</code> files?</p>
| <p><code>msgcat</code> is meant for just this thing: it concatenates and merges PO files. <code>msgmerge</code> is for merging PO files with an updated POT file.</p>
| <p>"WinMerge" can be very helpful</p>
| 46,416 |
<p>I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait?</p>
<p>Trivial example:</p>
<pre><code>Call ExternalLongRunningProcess
Call DoOtherStuff
</code></pre>
<p>How do I delay 'DoOtherStuff'?</p>
| <p>VB.Net: I would use a <a href="http://msdn.microsoft.com/en-us/library/kzy257t0.aspx" rel="noreferrer">WaitOne</a> event handle.</p>
<p>VB 6.0: I've seen a DoEvents Loop.</p>
<pre><code>Do
If isSomeCheckCondition() Then Exit Do
DoEvents
Loop
</code></pre>
<p>Finally, You could just sleep:</p>
<pre><cod... | <p><code>System.Threading.Thread.Sleep(500)</code></p>
| 12,075 |
<p>I'm currently performing a migration operation from a legacy database. I need to perform migration of millions of originating rows, breaking the original content apart into multiple destination parent / child rows. </p>
<p>As it's not a simple 1 to 1 migration and the the resulting rows are parent / children row ba... | <p>This is my standard approach:</p>
<ul>
<li>create your new data model</li>
<li>pull the data into the new DB unchanged</li>
<li>write (and run) a SQL script to perform the migration</li>
<li>test</li>
<li>(optional) drop the tables with the legacy data</li>
</ul>
<p>You can get a long way towards migrating the dat... | <p>Thanks for the suggestion but I'd prefer to produce a programmatic solution. I'm currently using Nant / CruiseControl to automate the tests and need something I can recreate on the fly based on the current live legacy content.</p>
| 31,071 |
<p>I am aware that you can lock an object in c# using lock but can you give up the lock and wait for something else to notify you that it's changed like you can in java with wait and notify?</p>
<p>It seems to me that synchronised and lock in java and c# respectively are synonomous.</p>
| <p>The equivalent functionality (including the normal locking) is in the <a href="http://msdn.microsoft.com/en-us/library/system.threading.monitor.aspx" rel="noreferrer">Monitor</a> class. </p>
<pre><code>foo.notify() => Monitor.Pulse(foo)
foo.notifyAll() => Monitor.PulseAll(foo)
foo.wait() => Monitor.Wait(f... | <p>I think Wait Handles may work for you. See if <a href="http://msdn.microsoft.com/en-us/library/ms173179.aspx" rel="nofollow noreferrer">this</a> helps.</p>
| 25,683 |
<p>A lambda expression which takes a function (of one argument) and a number, and applies the function to twice the number.</p>
| <p>Applying the function to twice the number:</p>
<pre><code>(lambda (f x) (f (* 2 x)))
</code></pre>
<p>Applying the function to the number twice (which is what you may have intended to ask):</p>
<pre><code>(lambda (f x) (f (f x)))
</code></pre>
| <p>Here is another way to approach it:</p>
<p>Write a Contract, Purpose, and Header:</p>
<pre><code>;; apply-double : function -> number -> any
;; to apply a given function to double a given number
(define (apply-double fun num) ...)
</code></pre>
<p>Write some Tests:</p>
<pre><code>(= (apply-double identity ... | 28,260 |
<p>I would like to know which dependency described in my pom.xml brings a transitive dependency in my target directory.</p>
<p>To be more precise, I have the library "poi-2.5.1-final-20040804.jar" in my WEB-INF/lib directory and I would like to know which dependency in my pom.xml brings that.</p>
| <p>To add to @David Crow, here's <a href="http://maven.apache.org/plugins/maven-dependency-plugin/examples/filtering-the-dependency-tree.html" rel="noreferrer">a dependency:tree example</a> from the Maven site:</p>
<pre><code>mvn dependency:tree -Dincludes=velocity:velocity
</code></pre>
<p>might output</p>
<pre><co... | <p>The dependency information is also included in the Project Information/Dependencies report if you have maven generate a site for the project, using mvn site.</p>
| 5,432 |
<p>If you want to create a custom attribute for MS test (say [Repeat(3)]
how would you do that?</p>
| <p>I don't think you will like the answer: there is no supported way. However, there is a codeplex project <a href="http://www.codeplex.com/MSTestExtensions" rel="nofollow noreferrer">MSTestExtensions</a> implementing a work around and a <a href="http://callumhibbert.blogspot.com/2008/01/extending-mstest.html" rel="nof... | <p>looking more, here is one possible place to start:
<a href="http://blog.dotnetwiki.org/IntroducingYUnitAMicroscopicUnitTestFrameworkForTeamTest.aspx" rel="nofollow noreferrer">Peli's blog</a></p>
<p>I'm still looking for other good resources or examples.</p>
| 13,977 |
<p>When overriding the MembershipProvider and calling it directly, is there a way to fill the NameValueCollection config parameter of the Initialize method without manually looking through the config file for the settings? </p>
<p>Obviously this Initialize is being called by asp.net and the config is being filled som... | <p>tvanfosson- Thanks for the help. (if I had the 15 points necessary I would vote you up) </p>
<p>From your link I was able to figure it out. It turns out the second parameter to the Initialize proceedure was the list of parameters from the provider and could be reached in the following way:</p>
<pre><code>string ... | <p>In any case you shouldn't create instance of MembershipProvider. It is creating and initializating by standard asp.net infrastructure. You can access to it by code like this one:</p>
<p>var customerMembership = Membership.Provider; </p>
| 29,000 |
<p>I switched locally from subversion 1.4 to 1.5, our server still runs 1.4. Since then every merge takes ages to perform. What took only a couple of seconds is now in the area of 5-10 minutes (or more). There is no difference between the command line client and tortoise (so we talk about the windows versions).</p>
<p... | <p>Upgrading to 1.5.3 (when it is out) will significantly speed up your merges.</p>
| <p>We've had problems when trying to add large numbers of files to repositories through the client which I assume created orphaned processes on the server when we killed the crashed client. We had to kill the server processes too and restart the subversion service (we run SVN as a windows service). Our SVN machine is d... | 2,876 |
<p>We are looking to improve our marketing email list by preventing fake emails from entering in the first place. We want to confirm that an email address exists (and that there is actually a mailbox for that email address). </p>
<p>Does anyone know of any services or components to validate an email address? </p>
| <p>It would be quite trivial to do this yourself.</p>
<ol>
<li><p>Create a webform where the user can type in their email address. You could protect it with a captcha to prevent bots from hitting it.</p></li>
<li><p>On submission, save the email address to a database along with a GUID, DateTime timestamp and IsActivat... | <p>There are several levels of email validation and I've got source to do them all. However, I despise your line of business and would never share them with you...</p>
<p>Just to clarify - I don't despise you, Jeff... Just your line of business.</p>
| 36,201 |
<p>I remember from C days that we were encouraged to use</p>
<pre><code>i > -1
</code></pre>
<p>instead of</p>
<pre><code>i >= 0
</code></pre>
<p>because of performance.</p>
<p>Does this still apply in the C# .NET world? What are the performance implications of using one over the other with today's compilers... | <p>No, there are no performance issues associated with comparison operators. And any good compiler would optimize something this trivial anyway.</p>
<p>I'm not sure where you got the suggestion to use "i > -1" rather than "i >= 0". On the x86 architecture, it makes no difference which you use: either case takes exac... | <p>For greater than zero, it must make two checks. It checks if the negative bit is off and it checks if the zero bit is off.</p>
<p>For greater than or equal to zero, it only has to check if the negative bit is off, because we don't care if the zero bit is on or off.</p>
| 28,613 |
<p>There's a feature that I'd like to see in issue tracking software that just doesn't seem to be all that common, and that is the ability to divide a ticket (bug, feature request, etc) into sub-tasks and view them in a hierarchical fashion, perhaps with some kind of progress bar style report of progress on a particula... | <p><a href="http://www.atlassian.com/software/jira/" rel="noreferrer">JIRA</a></p>
<p><img src="https://i.stack.imgur.com/J8my8.png" alt="subtasks"></p>
| <p><strong>JIRA integrated with Pivotal Tracker.</strong></p>
<p><em>JIRA</em> allows for tickets. It gives JQL filter ability for search. Gives ability to share tickets between groups. Gives ability for workflow diagrams, history, transitions, comments, etc. Gives ability to view reporters, assignees, implementers. F... | 16,968 |
<p>I want to find (not generate) 2 text strings such that, after removing all non letters and ucasing, one string can be translated to the other by simple substitution.</p>
<p>The motivation for this comes from a project I known of that is testing methods for attacking cyphers via probability distributions. I'd like t... | <p>There are 26! different substitution ciphers. That works out to a bit over 88 bits of choice:</p>
<pre><code>>>> math.log(factorial(26), 2)
88.381953327016262
</code></pre>
<p>The entropy of English text is something like 2 bits per character at least. So it seems to me you can't reasonably expect to find... | <p>I think you're asking a bit much to generate a substitution that is also "coherent". That is an AI problem for the encryption algorithm to figure out what text is coherent. Also, the longer your text is the more complicated it will be to create a "coherent" result... quickly approaching a point where you need a "k... | 45,115 |
<p>Folks,</p>
<p>I am pulling all my Flash (pure AS3 project, not Flash CS3) content from a Drupal back-end for SEO purposes. This works great, except the HTML rendering built into the TextField object leaves a lot to be desired. Could anyone recommend any libraries that would allow me to display HTML elements? At ... | <p>you might also want to try:
<a href="http://code.google.com/p/htmlwrapper/" rel="nofollow noreferrer">http://code.google.com/p/htmlwrapper/</a></p>
<p>I haven't used it but it looks like it does what you want.</p>
| <p>Try using this Flex iFrame, which is modeled after it's HTML iframe counterpart. I haven't used this solution in my Flex applications yet, but it looks promising.</p>
<p><a href="http://deitte.com/archives/2006/08/finally_updated.htm" rel="nofollow noreferrer">http://deitte.com/archives/2006/08/finally_updated.htm... | 32,531 |
<p>I typically use URL rewriting to pass content IDs to my website, so this</p>
<pre><code> Foo.1.aspx
</code></pre>
<p>rewrites to</p>
<pre><code> Foo.aspx?id=1
</code></pre>
<p>For a specific application I need to pass in multiple IDs to a single page, so I've rewritten things to accept this:</p>
<pre><code> Fo... | <p>Commas are allowed in the filename part of a URL, but are reserved characters in the domain*, as far as I know.</p>
<p>What version of IE are you using? I've come across the odd report of IE5.5 truncating URLs on a comma (<a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=326072" rel="noreferrer">li... | <p>The right way to <em>accept</em> multiple ids is like this:</p>
<pre><code>Foo.aspx?id=1;id=2;id=3;id=4;id=5
</code></pre>
<p>Note that's just what the target is. When re-writing urls, you can set your own rules to a certain extent for what you want the source to look like.</p>
<p>I had to learn this on StackOve... | 24,199 |
<p>Could somebody please point me in the right direction for learning how to do networking in C#/.net 3.5? Code samples and explanations are welcome. Basically I am looking for how to do asynchronous/multithreaded server/client models.</p>
<p>I am fairly comfortable with the basics in how to accomplish this in C++ wit... | <p>If WCF meets your needs, it's worth looking at. <a href="http://www.zeroc.com" rel="noreferrer">ZeroC </a> and other alternative higher level libraries exist. Otherwise there are several different ways to work closer to the socket level if that's what you need.</p>
<h3>TcpClient/UdpClient</h3>
<p>These provide a r... | <p>It depends on what you want to focus on. </p>
<p>If you want to focus on functionality and leave the plumbing to the framework, then start with Windows Communication Foundation. </p>
<p>If you're looking to build your own plumbing, then use <code>System.Net.Sockets.Socket</code> class. </p>
| 25,875 |
<p>I'm trying to make semantic urls for search pages, but if someone use a search finished in dot, the .net engine return a 404. </p>
<p>The request don't even get to the routing engine, so i think its something related to security or something like that. </p>
<p>For example, the stackoverflow routes also don't work... | <p>If you are using .NET 4.0 and IIS 7+, you can set this flag in the system.web section of your web.config and it will be allowed:</p>
<pre><code><httpRuntime relaxedUrlToFileSystemMapping="true" />
</code></pre>
<p>I've tested it and it works. <a href="http://haacked.com/archive/2010/04/29/allowing-reserved-f... | <p>In windows, file names cannot end with a '.'
I think all problems stem from there, ie IIS doesn't know what to do with it, so it never gets as far as the ASP.NET error handler and gets handles by the default IIS 404 page.</p>
<p>Most search engines (<a href="http://www.google.com/support/bin/answer.py?hl=en&ans... | 37,592 |
<p>Kindly point towards theory/material to read for understanding colors and what makes a good color combinations. Mind it that I am not interested in say "Color combinations for web application" etc. More of the lines of say "Colors and humans".</p>
<p>Material free to read is what i am looking for.</p>
<p>Thanks</p... | <p>In addition to the links I'd like to post my way of selecting pleasant colors:</p>
<ol>
<li><p><em>NEVER</em> ever use pure colors. Even if you want a pure color, don't!. If you want a strong bright green for example don't use 00ff00. Use something like 10e013 instead.</p></li>
<li><p>If you have one color that you... | <p>Some theory here:</p>
<p><a href="http://www.worqx.com/color/index.htm" rel="nofollow noreferrer">http://www.worqx.com/color/index.htm</a></p>
| 49,019 |
<p>I have a project to build a voting desktop application for a class in Java. While security isn't the focus of the project, I would like to be as realistic as I can. What are some of the primary tools to integrate security into a Java application.</p>
<p>Edit: I'm not primarily worried about physical security, we ar... | <p>It really depends on what kind of security you are looking to integrate. Do you want security to ensure that the user isn't running any debuggers or such to flip bits in your application to change the votes? Do you want to ensure that the user doesn't install logging software to keep track of who voted for who? D... | <p>I believe that physical security is more important for voting booth system rather than you know, code security.<br>
These machine by their very nature shouldn't be connected to any kind of public networks, especially not the the internet. But having a good physical security to prevent any sort of physical tampering ... | 4,900 |
<p>Having programmed through emacs and vi for years and years at this point, I have heard that using an IDE is a very good way of becoming more efficient.</p>
<p>To that end, I have decided to try using Eclipse for a lot of coding and seeing how I get on.</p>
<p>Are there any suggestions for easing the transition ove... | <p>Eclipse is the best IDE I've used, even considering its quite large footprint and sluggishness on slow computers (like my work machine... Pentium III!).</p>
<p>Rather than trying to 'ease the transition', I think it's better to jump right in and let yourself be overwhelmed by the bells and whistles and truly useful... | <p>Read the doc...
And see what shortcuts/keybindings equivalents are with your familiar ones. Learn the new ones... </p>
| 12,344 |
<p>I would like to check which type of RAM my computer uses before I order an upgrade. I'm fairly sure its DDR2 but I would like to double check this.</p>
<p>Is there any way to check this in Windows XP without opening the case up and looking? </p>
<p><em>EDIT</em>
The content police seem to have gotten the wrong en... | <p><a href="http://www.cpuid.com/cpuz.php" rel="noreferrer">CPU-Z</a> can tell you. On the SPD tab you can view the DIMM specific information</p>
| <p>Find out the motherboard/chipset from the device manager, google it, know what it takes.</p>
<p>As Greg Hewgill says, you'd need to script that some how (to make this a valid question on SO) - but you'd have to do that part yourself =)</p>
| 17,864 |
<p>A colleague is looking to generate UML class diagrams from heaps of Python source code.
He's primarily interested in the inheritance relationships, and mildly interested in compositional relationships, and doesn't care much about class attributes that are just Python primitives.</p>
<p>The source code is pretty st... | <p>You may have heard of <a href="http://www.pylint.org/" rel="noreferrer">Pylint</a> that helps statically checking Python code. Few people know that it comes with a tool named <a href="http://www.logilab.org/blogentry/6883" rel="noreferrer">Pyreverse</a> that draws UML diagrams from the Python code it reads. Pyrevers... | <p>If you use Eclipse, maybe <a href="http://sourceforge.net/projects/eclipse-pyuml" rel="nofollow noreferrer">PyUML</a>. Haven't used it, though.</p>
| 32,512 |
<p>First, I know there are methods off of the generic <code>List<></code> class already in the framework do iterate over the <code>List<></code>.</p>
<p>But as an example, what is the correct syntax to write a ForEach method to iterate over each object of a <code>List<></code>, and do a <code>Console... | <pre><code>public void Each<T>(IEnumerable<T> items, Action<T> action)
{
foreach (var item in items)
action(item);
}
</code></pre>
<p>... and call it thusly:</p>
<pre><code>Each(myList, i => Console.WriteLine(i));
</code></pre>
| <p>You can traverse each string in the list and even you can search in the whole generic using a single statement this makes searching easier.</p>
<pre><code>public static void main(string[] args)
{
List names = new List();
names.Add(“Saurabh”);
names.Add("Garima");
names.Add(“Vivek”);
names.Add(“Sandeep”);
string s... | 44,046 |
<p>As the question says, how do I add a new option to a DropDownList using jQuery?</p>
<p>Thanks</p>
| <p>Without using any extra plugins,</p>
<pre><code>var myOptions = {
val1 : 'text1',
val2 : 'text2'
};
var mySelect = $('#mySelect');
$.each(myOptions, function(val, text) {
mySelect.append(
$('<option></option>').val(val).html(text)
);
});
</code></pre>
<p>If you had lots of optio... | <p>try this Function: </p>
<pre><code>function addtoselect(param,value){
$('#mySelectBox').append('&lt;option value='+value+'&gt;'+param+'&lt;/option&gt;');
}
</code></pre>
| 40,955 |
<p>I have this situation.
I have a real stored in a varbinary field in a sql 2005 database.
As I can't convert a varbinary to a real in sql 2005, I'm trying to do that in vb.net.</p>
<p>That field gets stored as a byte() array in a DataTable.</p>
<p>Now I would like to read that byte() into a double, or decimal varia... | <p>It really depends on how it's stored, but <a href="http://msdn.microsoft.com/en-us/library/system.bitconverter.todouble.aspx" rel="nofollow noreferrer">BitConverter.ToDouble</a> may be your friend. That's assuming it's in IEE754 format. Where are you getting the data from in the first place?</p>
| <pre><code>Public Function GetDateFromBytes(ByRef value() As Byte, _
ByRef startindex As Int32) As Date
'create a aray of Ints
Dim IntValues() As Int32 = {BitConverter.ToInt32(value, startindex), _
BitConverter.ToInt32(value, (startindex + ... | 28,576 |
<p>What's the best way to return a random line in a text file using C? It has to use the standard I/O library (<code><stdio.h></code>) because it's for Nintendo DS homebrew.</p>
<p><strong>Clarifications:</strong></p>
<ul>
<li>Using a header in the file to store the number of lines won't work for what I want to... | <p>Read each line, and use a random number to choose whether to keep that line or ignore it. For the first line, you want odds of 1:1 to keep; for the second, you want odds of 1:2, etc.</p>
<pre><code>count = 0;
while (fgets(line, length, stream) != NULL)
{
count++;
if ((rand() * count) / RAND_MAX == 0)
... | <p>Use a combination of Adam's random offset into the file approach and Mark's probability approach. Adam's method can get you randomly to a section of the file. Then you use Mark's approach to avoid preferring the larger strings. Mark's algorithm will prefer the first few strings from wherever it starts,</p>
| 28,744 |
<p>We are working on an <a href="http://en.wikipedia.org/wiki/S60_%28software_platform%29" rel="noreferrer">S60</a> version and this platform has a nice Python API..</p>
<p>However, there is nothing official about Python on Android, but since <a href="http://en.wikipedia.org/wiki/Jython" rel="noreferrer">Jython</a> ex... | <p>One way is to use <a href="http://kivy.org/" rel="noreferrer">Kivy</a>:</p>
<blockquote>
<p>Open source Python library for rapid development of applications
that make use of innovative user interfaces, such as multi-touch apps.</p>
</blockquote>
<p></p>
<blockquote>
<p>Kivy runs on Linux, Windows, OS X, And... | <p>One more option seems to be <a href="http://pyqt.sourceforge.net/Docs/pyqtdeploy/index.html" rel="noreferrer">pyqtdeploy</a> which citing the docs is:</p>
<blockquote>
<p>a tool that, in conjunction with other tools provided with Qt, enables
the deployment of PyQt4 and PyQt5 applications written with Python
v... | 12,723 |
<p>Is it possible to have transport security without authentication? I'm well aware of it's flaws but atm I can't install a certificate a the client side.
It seems I can set WSHttpBinding.SecurityMode to Transport and the ClientCredentialType to HttpClientCredentialType.None, but when I try to call the service I get th... | <p>You can have HTTPS communication without authentication, but you cannot have HTTPS communication without certificates, since HTTPS encryption uses certificates.</p>
<p>There are a few things to check:</p>
<ol>
<li>Can you access the WSDL or another resource on the site over HTTPS in a browser?</li>
<li>Do you get ... | <p>I had the error you describe even though the security mode was set to transport and client credential type was set to none.</p>
<p>This was due to the fact that my web service URLs had been created by the Visual Studio 2010 service reference creator as <em><a href="http://www.myservice.com:80/myservice.as... | 23,005 |
<p>I've been trying to come up with a way to create a 3 column web design where the center column has a constant width and is always centered. The columns to the left and right are variable. This is trivial in tables, but not correct semantically. </p>
<p>I haven't been able to get this working properly in all curr... | <p>Use <a href="http://matthewjamestaylor.com/blog/perfect-3-column.htm" rel="nofollow noreferrer">this technique</a>, and simply specify a fixed width for the centre column.</p>
| <p>I think you'd need to start off with initial (fixed) widths for both sidebar columns and then, when the page loads, use javascript to get the window width and calculate the new width of the sidebars.</p>
<p>sidebar width = (window width - center column width) / 2</p>
<p>You could then reapply the javascript if the... | 9,875 |
<p>I have a series of datetime objects and would like to calculate the average delta between them.</p>
<p>For example, if the input was <code>(2008-10-01 12:15:00, 2008-10-01 12:25:00, 2008-10-01 12:35:00)</code>, then the average delta would be exactly 00:10:00, or 10 minutes.</p>
<p>Any suggestions on how to calcul... | <p>As far as algorithms go, that's an easy one. Just find the max and min datetimes, take the difference, and divide by the number of datetimes you looked at.</p>
<p>If you have an array a of datetimes, you can do:</p>
<pre><code>mx = max(a)
mn = min(a)
avg = (mx-mn)/(len(a)-1)
</code></pre>
<p>to get back the aver... | <p>small clarification</p>
<pre><code>from datetime import timedelta
def avg(a):
numdeltas = len(a) - 1
sumdeltas = timedelta(seconds=0)
i = 1
while i < len(a):
delta = abs(a[i] - a[i-1])
try:
sumdeltas += delta
except:
raise
i += 1
avg =... | 21,680 |
<p>Is there any Excel report framework available? We need to export some of the reports into Excel format. Our application is java application hence anything supporting java would be great. I have tried Apache POI API, however that is not good enough. Any framework based on Windows API would be better.</p>
| <p><a href="http://www.microsoft.com/sql/technologies/reporting/default.mspx" rel="nofollow noreferrer">SQL Server Reporting Services</a> has options to export to Excel.</p>
| <p>Try <a href="http://xlsgen.arstdesign.com/" rel="nofollow noreferrer">xlsgen</a>, supports Java (but can only run under Windows).</p>
| 11,651 |
<p>Does anyone know any resources (books/websites/whatever) related to parsing. I'm not so much interested in specific technologies such as yacc, XML or regular expressions, but something more general about best practices, stream vs. pull, error reporting and recovery, gotchas to look out for etc.</p>
| <p>There a nice book on parsing techniques <a href="http://www.cs.vu.nl/~dick/PTAPG.html" rel="nofollow noreferrer">Parsing Techniques, a Practical Guige</a>. You should be able to find some interesting bits. There is complete chapter on error handling.</p>
| <p>This may not be exactly what you meant, but a very good, and slightly relevant, book;
<a href="http://www.pragprog.com/titles/gwd/data-crunching" rel="nofollow noreferrer">Data Crunching: Solve Everyday Problems using Java, Python, and More</a></p>
| 48,163 |
<p>I have a very specific html table construct that seems to reveal a Gecko bug.</p>
<p>Here's a distilled version of the problem. Observe the following table in a gecko-based browser (FF, for example): (you'll have to copy and paste this into a new file)</p>
<pre><code><style>
table.example{
border-colla... | <p>Strange... definitely a painting bug. If you right-click to get the context menu to appear over <em>part</em> of where the line should be, then when you dismiss the context menu, the line has been redrawn underneath.</p>
<p>Edit: Workaround - if you put <code>style="border-color: ...;"</code> on the <code><td r... | <p>i have also found this bug but it's not on my PC but another. If i resize the browser window after a certain resolution the lines will disappear. once i maximise the window the all pop back.
you can fix this permanently by setting border-collapse:separate; this gives each boreder of each cell its own width. It's not... | 33,462 |
<p>I wrote a Java program to add and retrieve data from an MS Access. At present it goes sequentially through ~200K insert queries in ~3 minutes, which I think is slow. I plan to rewrite it using threads with 3-4 threads handling different parts of the hundred thousands records. I have a compound question:</p>
<ul>
<l... | <p>First, don't use Access. Move your data anywhere else -- SQL/Server -- MySQL -- anything. The DB engine inside access (called Jet) is pitifully slow. It's not a real database; it's for personal projects that involve small amounts of data. It doesn't scale at all.</p>
<p>Second, threads rarely help.</p>
<p>The ... | <p>On modern multi-core machines, using multiple threads to populate a database can make a difference. It depends on the database and its hardware. Try it and see.</p>
| 14,494 |
<p>I am using VirtualPc 2007 more and more, the one annoyance is "Alt-Tab".</p>
<p>What I want is to be able to use alt-tab to iterate through all of the applications in the host pc and virtual(s) as if they were one long list. Is there a setting or program to do this?</p>
| <p>No. If the VPC is in full screen mode, alt+tab works only within the context of the VPC. If the VPC Screen is not focused, you will get the collection of applications that are in the Host (including the instance of VPC)</p>
| <p>Sadly, no. This is possible in Parallels on the Mac, in what they call "Coherence" mode. But Virtual PC does not support that kind of integration.</p>
| 10,805 |
<p>How do you track outbound links for your web site, since the request is logged on the destination server, not yours? </p>
| <p>You can add a quick JQuery script to the page that will track external links and can either redirect them to a file on your server that will track the link and then forward to it, or add an ajax request that will submit on click for external links, and track them that way.</p>
<p>See:</p>
<ul>
<li><a href="http://ww... | <p>Some newer options that work without any hacks as explained in <a href="https://css-tricks.com/send-an-http-request-on-page-exit/" rel="nofollow noreferrer">https://css-tricks.com/send-an-http-request-on-page-exit/</a> are <code>Fetch</code> with the <code>keepalive</code>-flag or <code>navigator.sendBeacon</code>.<... | 24,355 |
<p>Generate the Fibonacci sequence in the fewest amount of characters possible. Any language is OK, except for one that you define with one operator, <code>f</code>, which prints the Fibonacci numbers.</p>
<p>Starting point: <strong><s>25</s> 14 characters</strong> in <strong>Haskell</strong>:</p>
<p><s> <code>f=0:1... | <h1>RePeNt, <strike>9</strike>, 8 chars</h1>
<pre><code>1↓[2?+1]
</code></pre>
<p>Or 10 chars with printing:</p>
<pre><code>1↓[2?+↓£1]
</code></pre>
<p>Run using:</p>
<pre><code>RePeNt "1↓[2?+1]"
</code></pre>
<p>RePeNt is a stack based toy language I wrote (and am still improving) in which all operators/function... | <p><strong>Euphoria: 44 characters</strong></p>
<pre><code>object f=1&1 loop do f&=f[$]+f[$-1]until 0
</code></pre>
<p>Keeps on generating until RAM or doubles run out.</p>
| 28,816 |
<p>If I have a vector of pairs:</p>
<pre><code>std::vector<std::pair<int, int> > vec;
</code></pre>
<p>Is there and easy way to sort the list in <strong>increasing</strong> order based on the second element of the pair?</p>
<p>I know I can write a little function object that will do the work, but is there a... | <p><strong>EDIT</strong>: using c++14, the best solution is very easy to write thanks to lambdas that can now have parameters of type <code>auto</code>. <strong>This is my current favorite solution</strong></p>
<pre><code>std::sort(v.begin(), v.end(), [](auto &left, auto &right) {
return left.second < ri... | <p>Try swapping the elements of the pairs so you can use <code>std::sort()</code> as normal.</p>
| 35,375 |
<p>I'm designing a user interface for a large touchscreen device running Linux. What would be the best toolkit/developer kit/SDK to use? The only requirement is that its able to run on a semi-low performace device, and that there is a Linux version.</p>
<p>Nice-to-haves would be build in support for effects/animatio... | <p>Try QTopia (<a href="http://trolltech.com/products/qtopia" rel="nofollow noreferrer">http://trolltech.com/products/qtopia</a>)
It's from the same stable as the popular Qt desktop toolkit.</p>
| <p>QTopia is indeed a good option; others are <a href="http://www.directfb.org/" rel="nofollow noreferrer">DirectFB</a>, and of course X11 generally running <a href="http://matchbox-project.org/" rel="nofollow noreferrer">Matchbox</a>.</p>
| 10,346 |
<p>I've got a Monoprice Mini Select (15365) and it takes FOREVER for me to manually spin the dial to get the printhead to raise all the way up so that I can perform maintenance (clear blockages in the nozzle or apply new tape to the bed, etc).</p>
<p>So, I was thinking about writing a snippet of gcode that I could jus... | <p>Yes, on machines which will execute "standard" gcode, this will do what you request. Some good resources are <a href="http://reprap.org/wiki/G-code">http://reprap.org/wiki/G-code</a> and <a href="https://en.wikipedia.org/wiki/G-code">https://en.wikipedia.org/wiki/G-code</a></p>
| <p>It really depends on whether you currently have something half printed on the bed when you need to do maintenance.
For example, you may have a blockage mid-print or need to reprime the nozzle. </p>
<p>So with that in mind, personally I would separate the line that does the move into two different lines. </p>
<p>M... | 494 |
<p>My table has the following schema:</p>
<p>id, parent_id, text</p>
<p>Given the following data I would like to return an xml hierarchy:</p>
<p>Data: (1,null,'x'), (2,1,'y'), (3,1,'z'), (4,2,'a')</p>
<p>XML:<br>
[row text="x"]<br>
[row text="y"]<br>
[row text="a"/]<br>
[/row]<br>
[row text="z"/]<br>
[/row] <... | <p>If you have a finite depth the there's a quickie that looks like this:</p>
<pre><code>SELECT T.*, T2.*, T3.* /*, ...*/ FROM myTable T
INNER JOIN myTable T2 ON T2.parent_id=T.id
INNER JOIN myTable T3 ON T3.parent_id=T2.id
/* ... */
WHERE T.parent_id IS NULL
FOR XML AUTO
</code></pre>
<p>I'm not sure but it might b... | <p>This requires a "transitive closure". You need to process the data recursively to find all children under a given parent.</p>
<p>Roughly the algorithm looks like this.</p>
<pre><code>for top in cursor( nodes where each parent==null ):
build_tree( top )
def build_tree( parent ):
emit opening tag
for ... | 33,252 |
<h2>Intro:</h2>
<p>I successfully implemented a WCF Service hosted in a Windows Service a few days ago. The community here at StackOverflow helped me with <a href="https://stackoverflow.com/questions/167852/wsdl-url-for-a-wcf-service-basichttpbinding-hosted-inside-a-windows-service">the WSDL exposure here</a>. I thank... | <p>Your endpoint looks fine, although I'm curious about what's in localBinding...</p>
<p>Sounds like the easiest option is to just change the endpoint configuration on the named pipes client to match your service endpoint. The client shouldn't care as long as it's the only endpoint in the clients config file. Otherwis... | <p>the mex endpoint is necessary during development as it provides an http location where the wsdl is built. the wsdl describes to the client how to communicate with the server through named pipes, or TCP/IP, or anything else. once the client app has built the proxy to the named pipes binding and set up the configura... | 22,363 |
<p>I have been having an issue with certain portions of the walls of certain prints becoming separated from the rest of the model. It happens with smooth vertical edges. </p>
<p>Specifically, this model, <a href="https://www.thingiverse.com/thing:2517008" rel="nofollow noreferrer"> ID Badge Holder</a>, on the edges w... | <p>I have faced the same issue if it concerns just gaps between the walls (to the point you could put a nail in between the outer and inner perimeters, so clearly the perimeters were not bonding), for me this was fixed with proper tension of the belts of my Prusa i3 clone, and for my other (CoreXY) printer reducing the... | <p>When printing someone else's model, your print is at the mercy of their design. Designing for multiple printers is hard work, and even if something is printable on 90% of printers, you may be in the 10%. Sometimes designs use walls too thin for other printers. On this design, the lanyard wall looks a bit thin but wo... | 919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.