instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I am using <code>getch()</code> and my app crashes instantly. Including when doing:</p> <pre><code>int main() { getch(); } </code></pre> <p>I can't find the link but supposedly the problem is that it needs to turn off buffering or something strange along those lines, and I still want <code>cout</code> to work ...
<p>Have you looked in <code>&lt;curses.h&gt;</code> to see what the <code>getch()</code> function does?</p> <p>Hint: OSX and Linux are not the same as Windows.</p> <p>Specifically, as a macro in <code>&lt;curses.h&gt;</code>, we find:</p> <pre><code>#define getch() wgetch(stdscr) </code></pre> <p>Now, there appears...
<p>The <code>getch</code> function is not available on Unix-like systems, but you can replace it with console commands through your compiler with the <code>system</code> function.</p> <p>Usage: </p> <p>In Windows you can use <code>system("pause");</code></p> <p>In Unix-like systems (such as OSX) you can use <code>sy...
33,520
<p>What are the current best practices in the Rails world for displaying a calendar month view with event items bound to the days in the month (like in Backpack or Google Calendar, for example)?</p> <p>I don't need anything like fancy stuff like drag and drop support. I'm just looking for code to let me get a list of...
<p>Here's a Rails plugin that can display multiple, overlapping events across calendar days.</p> <p><a href="http://github.com/elevation/event_calendar" rel="nofollow noreferrer"><a href="http://github.com/elevation/event_calendar" rel="nofollow noreferrer">http://github.com/elevation/event_calendar</a></a></p> <p>Sc...
<p>Take a look at the calendar view in Redmine.</p>
30,763
<p>It's common knowledge that using System.Diagnostics.Process.Start is the way to launch a url from a C# applicaiton:</p> <p>System.Diagnostics.Process.Start("<a href="http://www.mywebsite.com" rel="nofollow noreferrer">http://www.mywebsite.com</a>");</p> <p>However, if this url is invalid the application seems to h...
<p>Try an approach as below.</p> <pre><code>try { var url = new Uri("http://www.example.com/"); Process.Start(url.AbsoluteUri); } catch (UriFormatException) { // URL is not parsable } </code></pre> <p>This does not ensure that the resource exist, but it does ensure the URL is wellformed. You might also w...
<p>Check the <strong>Uri.IsWellFormedUriString</strong> static method. It's cheaper than catching exception.</p>
15,779
<p>Is it possible to do a "C like" fork in java, using an new independent jvm process ?</p> <p>How?</p>
<p>Funnily, I am just working on this: a Java process running other Java processes. I used the article <a href="https://www.java-tips.org/java-se-tips-100019/88888889-java-util/426-from-runtimeexec-to-processbuilder.html" rel="nofollow noreferrer">From Runtime.exec() to ProcessBuilder</a> as a solid base, and <a href="...
<p>The <a href="https://jcp.org/en/jsr/detail?id=121" rel="nofollow">Application Isolation API (JSR 121)</a> introduces <code>Isolate</code> which addresses this use case.</p>
36,599
<p>I had a problem with my Z limit switch bracket falling just short of the bottom edge of the z stage. </p> <p>I'm trying to make the bracket thicker so it's pushed more towards the left. </p> <p>1) how do I measure the thickness of the bracket in the stl 2) HOw would I make it thicker if it is indeed too thin</p> ...
<p>Assuming your filament dimension settings are correct and your extruder is correctly calibrated...</p> <p><strong>Your extruder temperature may be too low.</strong> While 184C can be hot enough, it is very near the bottom of the range for PLA and it appears your filament isn't melting quickly enough to keep up wit...
<p>Looks to me like you have your slicer set to 3mm filament when you're using 1.75mm filament. Confirm that your slicer has its filament setting set to 1.75mm and not 3mm (this obviously assumes you are using 1.75mm filament..)</p> <p>Failing this:</p> <ul> <li>Test extruder steps/mm</li> <li>Ensure nozzle diameter ...
408
<p>When working with CSS inside of XML such as</p> <pre><code>&lt;span class="IwuvAS3"&gt;&lt;/span&gt; </code></pre> <p>when parsed in flash, if I don't use CDATA like the following:</p> <pre><code>&lt;![CDATA[&lt;span class="IwuvAS3"&gt;&lt;/span&gt;]]&gt; </code></pre> <p>then the parsed data drops down a line f...
<p>Set the TextField's <strong>condenseWhite</strong> property to true - so only &lt; br/> tags will generate linebreaks.</p>
<p>You could escape the "&lt;" characters (and &amp;, ", >, ', among others) as entities instead.</p>
22,439
<p>We basically have 2 sites ( Java /JSP / Apache Webserver) : something.ca &amp; something.com </p> <p>The .ca is canadian content, and the .com is american content.</p> <p>We need users to be redirected based on the ip addreess. We want US users to get the .com site and Canadian users get the .ca site. </p> <p>Wha...
<p>In my web surfing experience, most websites - UPS.com for example - ask the user to select their country site rather than trying to figure it out themselves. They remember the selection in a cookie. Much depends on how voluntary your use case requires this redirection to be. </p> <p>On the implementation side, I'd ...
<p>There are a lot of <a href="http://www.google.com/search?q=ip+location+lookup+api" rel="nofollow noreferrer">IP geolocation APIs</a> out there - I don't know if there's anything good out there that you don't have to pay for:</p>
28,545
<p>I have a servlet that is used for many different actions, used in the <a href="http://java.sun.com/blueprints/patterns/FrontController.html" rel="noreferrer">Front Controller pattern</a>. Does anyone know if it is possible to tell if the data posted back to it is enctype="multipart/form-data"? I can't read the req...
<p>Yes, the <code>Content-type</code> header in the user agent's request should include <code>multipart/form-data</code> as described in (at least) the HTML4 spec:</p> <p><a href="http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2" rel="noreferrer">http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2...
<p><a href="https://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getParts()" rel="nofollow noreferrer">https://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getParts()</a></p> <p>java.util.Collection getParts()</p> <p>Throws: ServletException - if this request is n...
9,194
<p>If I invoke a method which does something illegal, the debugger will stop at the line of code, in that method, which threw the exception</p> <p>If I use reflection to call a method via Invoke and that method throws an exception, the debugger stops on line where the method was called via reflection and not in the f...
<p>Check the "Thrown" box for the particular exception -- the debugger will stop where the exception is thrown, before it's caught (and translated) by the Invoke layer.</p>
<p>Are you using a debug version of the assembly? If not, the debugger cannot locate the source of the exception.</p>
30,713
<p>I thought jQuery Intellisense was supposed to be improved with SP1. I even downloaded an annotated version of jQuery 1.2.6, but intellisense will not work in a separate jscript file. I have the jQuery library referenced first on my web page in the &lt;head> tag. Am I doing anything wrong?</p>
<p>At the top of your external JavaScript file, add the following:</p> <pre><code>/// &lt;reference path="jQuery.js"/&gt; </code></pre> <p>Make sure the path is correct, relative to the file's position in the folder structure, etc.</p> <p>Also, any references need to be at the top of the file, before <em>any</em> ot...
<p>Make sure you're not using a minimized jQuery file.</p> <p>Use <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>J</kbd> to make it work after adding JavaScript files to the project.</p>
8,446
<p>My company runs a webmail service, and we were trying to diagnose a problem with Word downloads not opening automatically - the same *.doc file download from Yahoo Mail would open, but one from ours would not.</p> <p>In the course of investigating the headers we saw this coming from Yahoo:</p> <pre><code>content-d...
<p>I think the correct answer to this is in rfc 2231:</p> <p>Asterisks ("*") are reused to provide the indicator that language and character set information is present and encoding is being used. A single quote ("'") is used to delimit the character set and language information at the beginning of the paramet...
<p>What Mime-Type are you using?</p> <p>The asterisk is required as per RFC 2183 (<a href="http://www.ietf.org/rfc/rfc2183.txt" rel="nofollow noreferrer">http://www.ietf.org/rfc/rfc2183.txt</a>):</p> <p>In the extended BNF notation of [RFC 822], the Content-Disposition header field is defined as follows:</p> <pre...
22,615
<p>I have an absolutely positioned <code>div</code> that I want to show when the user clicks a link. The <code>onclick</code> of the link calls a js function that sets the display of the div to block (also tried: "", <code>inline</code>, <code>table-cell</code>, <code>inline-table</code>, etc). This works great in IE7,...
<p>Since setting the properties with javascript never seemed to work, but setting using Firebug's inspect did, I started to suspect that the javascript ID selector was broken - maybe there were multiple items in the DOM with the same ID? The source didn't show that there were, but looping through all divs using javasc...
<p>There is an annoying display error on Firefox 3.5 but not on IE7 or Firefox 2.0.9</p> <p>I have 3 DIV's position absolute - the first with plain text; the second with a CSS menu (sucklefish type with UL and LI) and the third ditto. The third will not display at all even though the coding has been checked and found...
3,159
<p>the other day a colleague of mine stated that using static classes can cause performance issues on multi-core systems, because the static instance cannot be shared between the processor caches. Is that right? Are there some benchmarks around proofing this statement? This statement was made in the context of .Net dev...
<p>I would push your colleague for data or <em>at least</em> references.</p> <p>The thing is, if you've got shared data, you've got shared data. Whether that's exposed through static classes, a singleton, whatever, isn't terribly important. If you don't need the shared data in the first place, I expect you wouldn't ha...
<p>Even if it were true, I suspect you have plenty of better ways to improve performance. When it gets down to changing static to instance, for processor caching, you'll know you are really pushing the envelope.</p>
47,334
<p>I'm reading through head first design patterns at the moment and while the book is excellent I also would like to see how these are actually used in the real world.</p> <p>If you know of a good example of design pattern usage (preferably in a OSS program so we can have a look :) then please list it below.</p>
<p>An ah-ha moment for me for the observer pattern was to realize how closely associated it is with events. Consider a Windows program that needs to acheive loosely communications between two forms. That can easily be accomplished with the observer pattern.</p> <p>The code below shows how Form2 fires an event and any ...
<p>Composite is used extensively in UI. Components can be leaf components e.g. buttons and labels or composites e.g. panels, that can contain other leaf or composite components. From the point of view of the client, all components are treated the same, which greatly simplifies the client code.</p>
5,682
<p>I have a quandary. My web application (C#, .Net 3.0, etc) has Themes, CSS sheets and, of course, inline style definitions. Now that's alot of chefs adding stuff to the soup. All of this results, not surprisingly, in my pages having bizarre styling on occasion.</p> <p>I am sure that all these styles are applied i...
<p>IMHO, Firebug is going to be your best bet. It will tell you which file the style came from and you can click on the filename to be transported instantly to the relevant line in the file. </p> <p>Note: You can hit <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>C</kbd> on any page to select and inspect an element with the ...
<p>The key to solving a complex CSS issue is to work out what is causing the weird appearance. The easiest way to find is to selectively comment out stylesheets until you find the one where commenting it out fixes the problem. Then enable the stylesheet and selectively comment out rules until you find the one causing t...
7,796
<p>I have been struggling with versioning software for a while now. I'm not talking about a naming convention, I'm talking about how to actually apply a version in a build system all the way through to a release.</p> <p>I generally use major.minor.maintenance-[release type] i.e. 1.0.2-rc1</p> <p>The problem is managi...
<p>Microsoft uses <code>&lt;major&gt;.&lt;minor&gt;.&lt;patch&gt;-&lt;build number&gt;</code> (or a variation).</p> <p>I like using <code>&lt;major&gt;.&lt;minor&gt;.&lt;buildnumber&gt;</code></p>
<p>We also use <code>&lt;major&gt;.&lt;minor&gt;.&lt;buildnumber&gt;</code> and we manage this with CruiseControl/(.Net) on our build server. And use Wix and CruiseControl Config to manage the Major minor numbers - still increment those by hand - but the build number happens automatically when on the build server. You...
32,918
<p>I have a question at <a href="https://stackoverflow.com/questions/150038/how-to-wire-a-middle-tier-of-objects-to-a-data-tier-consisting-of-a-dataset#151255">SO</a> asking how to wire a middle tier to a DataSet.</p> <p>I put up an answer showing what I had come up with, but I am not happy with the tight coupling. I...
<p>IMO; DataSets are evil. They are, and should only be used as, offline databases. Nothing more, IMO. However, what you do in your Data Access Layer (DAL) should not really impact your Business layer (BL). I'd just use objects (use interfaces) between them (IList) and then use an interface to define your DAL (IReposit...
<p>If you have entity objects, you can use mocks for unit testing your middle tier.</p> <p><a href="http://www.rwendi.com" rel="nofollow noreferrer">RWendi</a></p>
18,499
<p>The following doesn't work, but something like this is what I'm looking for.</p> <pre><code>select * from Products where Description like (@SearchedDescription + %) </code></pre> <p>SSRS uses the @ operator in-front of a parameter to simulate an 'in', and I'm not finding a way to match up a string to a list of str...
<p>There are a few options on how to use a LIKE operator with a parameter. </p> <p>OPTION 1</p> <p>If you add the % to the parameter value, then you can customize how the LIKE filter will be processed. For instance, your query could be:</p> <pre><code> SELECT name FROM master.dbo.sysobjects WHERE name LIKE @Repo...
<p>Have you tried to do:</p> <p><code>select * from Products where Description like (@SearchedDescription + '%')</code> (Putting single quotes around the % sign?)</p>
32,782
<p>I'm trying to generate custom e-mail addresses that get forwarded to a catch-all. I'm wondering how postfix would need to be configured to handle these types of e-mails</p> <p>dropbox@123456.foobar.highrisehq.com</p>
<p>I do believe that it is not totally a smtp server level thing. Like the mails where the ticket id is in the subject line and you have to keep that there, there would mostly be another application that would be checking TO address, doing a database lookup and then doing something useful.</p> <p>I haven't signed up ...
<p>They're most likely piping a wildcard e-mail address into a script.</p>
9,055
<p>I have to lock user accounts in Active Directory programmatically in C#. </p> <p>Unfortunately it doesn't work via the userAccountControl attribute. Every time I set userAccountControl to 528 (=normal account w/ lockout flag), Active Directory won't accept the value and resets it without further notice to 512 (=nor...
<p>Make sure the account you're using to disable the account has sufficient privileges to disable accounts. See <a href="http://msdn.microsoft.com/en-us/library/ms696026(VS.85).aspx" rel="nofollow noreferrer">this example</a> from Microsoft.</p>
<p>This will work once you have the directory entry object.</p> <pre><code>DirectoryEntry de = result.GetDirectoryEntry(); int val = (int)de.Properties["userAccountControl"].Value; de.Properties["userAccountControl"].Value = val | 0x0002; </code></pre>
21,544
<p>I have been using SourceMonitor on my project for a couple of years to keep records of source-code complexity and basic SLOC (including comments) for C# and C++ components. These are used for external reporting to our customer, so I'm not in a position to argue their merits or lack of.</p> <p>I've been working on ...
<p><a href="http://www.ndepend.com/Features.aspx" rel="nofollow noreferrer">NDepend</a></p>
<p>This won't give you function complexity and it's not scriptable (that I know of), but the SlickEdit Gadgets for VS has a great SLOC report tool and you can use from the solution explorer and will give you a detailed report at the file, project or solution level.</p> <p>You can get it here: <a href="http://www.slick...
16,178
<p>After using <a href="http://us.php.net/array_unique" rel="noreferrer"><code>array_unique</code></a>, an array without the duplicate values is removed. However, it appears that the keys are also removed, which leaves gaps in an array with numerical indexes (although is fine for an associative array). If I iterate usi...
<p><code>$foo = array_values($foo);</code> will re-number an array for you</p>
<p>In the few cases I've tried using for instead of foreach, I soon regretted it.</p> <p>It can really always be avoided, you can even use foreach but ignore the values and use the key, almost forgetting that its a foreach instead of for, but avoiding any gaps in your keys and automatically have your bounds taken care...
27,414
<p>My company is currently using Sage MAS as their ERP system. While integrating our shopping cart is not going to be impossible, it uses COM and has it's own challenges.</p> <p>I was wondering if there was a more developer friendly ERP out there. I have looked into Microsoft Dynamics but getting information on ERP sy...
<p>MS Dyanamics is very cool app. V3 was fully Web Serviced V4 i assume even more- all actions are exposed as webservices, there is a big license hit on MS CRM due to "internet" licensing.</p> <p>We use CRMv3 in a totally .NET SOA here and its great.</p> <p>You should have no problems doing the integration - security...
<p>I've done a bit of integration between ASP.NET and Dynamics AX4 - it has a .NET API called Business Connector that gives you access to AX's full internal object model - if AX does it, your web app can do it too. My app had to execute arbitrary AX business logic functions and, apart from the crummy API documentation ...
3,118
<p>I'm looking to add a 14-Day trial limit to my software. The program has been written in Delphi 7.</p> <p>Any help would be much appreciated.</p>
<p>You could try Turbopower OnGuard. This is now opensource.</p> <p><a href="http://sourceforge.net/projects/tponguard/" rel="noreferrer">http://sourceforge.net/projects/tponguard/</a></p>
<p>I would recommend making a trial serial number with timestamp and force user to enter it into software when its installed. You can even automate it by calling server side page after setup is done.</p> <p>Timestamp in trial serial key allows you to extend their trial if needed. </p> <p>In addition you can count b...
35,032
<p>I'm trying to follow code-to-interface on a project. Should I be creating an interface first then implementing that interface for entity classes? I'm thinking this might be taking the interface first approach too far and entities should be ignored. This is what I mean...</p> <pre><code>public interface Address {...
<p>I think creating Interfaces for Entities is probably not necessary.</p> <p>The purpose of creating Interfaces (or at least, one of the purposes) is to make it easier to swap out one concrete implementation in favour of another. This is obviously a good thing for your DAOs, Business Logic etc. </p> <p>But unless yo...
<p>I generally don't make interfaces for data holding beans, that is I don't make interfaces for classes with primitive type values and getters/setters for them. Haven't really ever hit a moment where I would've needed interfaces for anything I usually use them for (polymorphism and mocking, mostly) so I haven't bother...
47,437
<p>The situation is as follows:</p> <p>A series of remote workstations collect field data and ftp the collected field data to a server through ftp. The data is sent as a CSV file which is stored in a unique directory for each workstation in the FTP server.</p> <p>Each workstation sends a new update every 10 minutes, ...
<p>Most modern Linux's will support inotify to let your process know when the contents of a diretory has changed, so you don't even need to poll.</p> <p>Edit: With regard to the comment below from Mark Baker :</p> <p>"Be careful though, as you'll be notified as soon as the file is created, not when it's closed. So yo...
<p>The 30 minute limitation is pretty silly really. Starting processes in linux is not an expensive operation, so if all you're doing is checking for new files there's no good reason not to do it more often than that. We have cron jobs that run every minute and they don't have any noticeable effect on performance. Howe...
25,614
<p>This led on from the question about asking if Apache Maven and IBM Rational ClearCase integrated well. Thought I should write up what I found out - will require various edits, but I shall eventually get round to adding it all I hope.</p> <h2>Environment</h2> <p><strong>ClearCase</strong> - Version 7.0.1.2 of ClearCa...
<p>I have some Maven repositories outside of ClearCase, for some third-parties libraries referential.</p> <p>But I have never used Maven <strong>with</strong> ClearCase since they follow a different logic (Maven needs signed names for files, like myfile-1.2.jar, whereas ClearCase can store only myfile.jar, and record ...
<p>I am not using this SCM, but there is a <a href="http://maven.apache.org/scm/clearcase.html" rel="nofollow noreferrer">Maven2 plugin</a> called SCM that handles Clearcase.</p>
38,166
<p>Is there a way to have a 64 bit enum in C++? Whilst refactoring some code I came across bunch of #defines which would be better as an enum, but being greater than 32 bit causes the compiler to error.</p> <p>For some reason I thought the following might work:</p> <pre><code>enum MY_ENUM : unsigned __int64 { ...
<p>I don't think that's possible with C++98. The underlying representation of enums is up to the compiler. In that case, you are better off using:</p> <pre><code>const __int64 LARGE_VALUE = 0x1000000000000000L; </code></pre> <p>As of C++11, it is possible to use enum classes to specify the base type of the enum:</p> ...
<p>An enum in C++ can be any integral type. You can, for example, have an enum of chars. IE:</p> <pre><code>enum MY_ENUM { CHAR_VALUE = 'c', }; </code></pre> <p>I would <em>assume</em> this includes __int64. Try just</p> <pre><code>enum MY_ENUM { LARGE_VALUE = 0x1000000000000000, }; </code></pre> <p>According...
10,225
<p>When you call <code>RedirectToAction</code> within a controller, it automatically redirects using an HTTP GET. How do I explicitly tell it to use an HTTP POST?</p> <p>I have an action that accepts both GET and POST requests, and I want to be able to <code>RedirectToAction</code> using POST and send it some values...
<p>HTTP doesn't support redirection to a page using POST. When you redirect somewhere, the HTTP "Location" header tells the browser where to go, and the browser makes a GET request for that page. You'll probably have to just write the code for your page to accept GET requests as well as POST requests.</p>
<p>I have just experienced the same problem.</p> <p>The solution was to call the controller action like a function:</p> <pre><code>return await ResendConfirmationEmail(new ResendConfirmationEmailViewModel() { Email = input.Email }); </code></pre> <p>The controller action:</p> <pre><code>[HttpPost] [AllowAnonymous] publ...
15,727
<p>Try clicking on the "Print" button on the following page: (link removed - consensus is that everything was working fine and the problem was my setup) For debugging purposes, I've replaced a chunk of javascript with a simple alert("test"), and even that isn't showing up in IE7 for me. It works totally fine in Safari...
<p>Just tested it on IE7 Vista and it worked fine... Your code looks sound as well, so I think it might be an issue with your setup?</p>
<p>The first answer posted - ie, use <code>href='javascript:void(0);'</code> instead of <code>href='#</code>'. In your case, use <code>href='javascript:yourFunction();'</code> and it should work. IE appears to give precedence to href over onclick (other browsers don't). Also, if you don't have an href, you get a page n...
40,405
<p>In Excel VBA (2003), I've noticed that any <strong>Public</strong> or <strong>Friend</strong> <strong>Sub</strong> method in either a module or <em>ThisWorkbook</em> that doesn't have any arguments will show up as a Macro that can be run by the user. I.e. when the user goes to Tools --> Macro --> Macros... (or Alt+...
<p>Add the following to the top of your module:</p> <pre><code>Option Private Module </code></pre> <p>From <a href="http://msdn.microsoft.com/en-us/library/aa266185(VS.60).aspx" rel="noreferrer">MSDN</a>:</p> <blockquote> <p>When a module contains Option Private Module, the public parts, for example, variables...
<p>My methods have already been listed however, ChrisB made the following statement:</p> <blockquote> <p>Perhaps we should all have Option Private Module at the tops of our code modules as a rule – except where the module contains procedures called by buttons</p> </blockquote> <p>Even Private routines can be called fro...
37,938
<p>Back in the 90s when I first started out with MFC I used to dynamically link my apps and shipped the relevant MFC DLLs. This caused me a few issues (DLL hell!) and I switched to statically linking instead - not just for MFC, but for the CRT and ATL. Other than larger EXE files, statically linking has never caused ...
<p>There are some downsides:</p> <ul> <li>Bigger exe size (esp if you ship multiple exe's)</li> <li>Problems using other DLL's which rely on or assume dynamic linking (eg: 3rd party DLL's which you cannot get as static libraries)</li> <li>Different c-runtimes between DLL's with independent static linkage (no cross-mod...
<p>No, nothing new on that front. Keep it that way.</p>
29,492
<p>We know that Python provides a lot of productivity over any compiled languages. We have programming in C# &amp; need to write the unit test cases in C# itself. If we see the amount of code we write for unit test is approximately ten times more than the original code. </p> <p>Is it ideal choice to write unit test c...
<p>Will's answer is good - you're introducing a new requirement for developers.</p> <p>In addition, what's the tool support like? I haven't tried any of this myself, but I'd want to know:</p> <ul> <li>How easy is it to debug into failing unit tests?</li> <li>How easy is it to run unit tests from the IDE? (e.g. with R...
<p>Very interesting. </p> <p>What would happen if you write all your code with IronPython (not just the unit tests)? Would you end up with approximately 10 times less code? </p> <p>Maybe I should learn IronPython too. </p>
44,178
<p>Is there an HTML editor which automatically changes the end tag when you edit the start tag?</p>
<p><a href="http://www.aptana.com/studio" rel="nofollow noreferrer">Aptana Studio</a> Does. Just set modify pair tag in Window Menu > Preferences > Aptana > Editor > HTML > Typing It is off by default.</p>
<p><a href="http://www.e-texteditor.com" rel="nofollow noreferrer">e-texteditor</a> can do this, though not as automatically as you probably want. Ctrl+doubleclick on the beginning and ending tags, and change them that way.</p>
43,559
<p>I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository.</p> <p>One tool I know of is <a href="http://www.statsvn.org/" rel="noreferrer">statsvn</a> - a Java tool that creates some HTML reports and some code churn metrics. Statsvn reports ...
<p>If you are willing to go the commercial route check out <a href="http://www.atlassian.com/software/fisheye/" rel="noreferrer">FishEye</a> from Atlassian (also see their <a href="http://www.cenqua.com/fisheye/demo" rel="noreferrer">demo site</a> ). FishEye also supports adding <a href="http://confluence.atlassian.co...
<p>try <a href="http://programeter.edicypages.com/" rel="nofollow noreferrer">programeter</a> which analyses Subversion and many other dev. tools. </p>
7,794
<p>In SQL Server 2005, I want a user, called LimitedUser, to only be able to run one proc: GRANT EXEC ON [usp_RunETL] TO [LimitedUser]</p> <p>However, that proc needs to be able to do everything -- UPDATE, DELETE, INSERT, EXEC.. everything. How do I do that without having to give all those permissions to LimitedUser?...
<p>LimitedUser only needs permission to run the sproc. They don't need any other permissions.</p>
<p>You only need to GRANT EXEC to the limited user. As long as the user has permissions to the stored procedure, it ignores/overrides permissions for operations inside of the procedure.</p> <p>I would be very careful doing this though, this sounds like a big potential security hole. Typically you would use multiple pr...
28,908
<p>I am writing a C# client that calls a web service written in Java (by another person). I have added a web reference to my client and I'm able to call methods in the web service ok.</p> <p>The service was changed to return an array of objects, and the client does not properly parse the returned SOAP message.</p> <...
<p>It has been a while, but I seem to remember having trouble with the slight differences in how default namespaces were handled between .Net and Java web services.</p> <p>Double check the generated c# proxy class and any namespaces declared within (especially the defaults xmlns=""), against what the Java service is e...
<p>From your question, it looks like you had the client working at one point, and then the service was changed to return an array. Make sure you re-generate the proxy so the returned SOAP message is deserialized on the client. It wasn't clear you had done this - just making sure.</p>
9,046
<p>Are there any good packages or methods for doing extensive CRUD (create-retrieve-update-delete) interfaces in the Turbogears framework. The FastDataGrid widget is too much of a black box to be useful and CRUDTemplate looks like more trouble than rolling my own. Ideas? Suggestions?</p>
<p>You should really take a look at sprox ( <a href="http://sprox.org/" rel="nofollow noreferrer">http://sprox.org/</a> ).</p> <p>It builds on RESTController, is very straight forward, well documented (imo), generates forms and validation "magically" from your database and leaves you with a minimum of code to write. I...
<p>While <a href="http://docs.turbogears.org/1.0/CRUDTemplate" rel="nofollow noreferrer">CRUDTemplate</a> looks mildly complex, I'd say that you can implement CRUD/ABCD using just about any ORM that you choose. It just depends on how much of it you with to automate (which generally means defining models/schemas ahead o...
15,658
<p>Is there any performance penalty for the following code snippet?</p> <pre><code>for (int i=0; i&lt;someValue; i++) { Object o = someList.get(i); o.doSomething; } </code></pre> <p>Or does this code actually make more sense?</p> <pre><code>Object o; for (int i=0; i&lt;someValue; i++) { o = someList.get(...
<p>In today's compilers, no. I declare objects in the smallest scope I can, because it's a lot more readable for the next guy. </p>
<p>The answer depends partly on what the constructor does and what happens with the object after the loop, since that determines to a large extent how the code is optimized.</p> <p>If the object is large or complex, absolutely declare it outside the loop. Otherwise, the people telling you not to prematurely optimize ...
49,471
<p>How should I describe this part which looks like a threaded flange so that I can research replacements? It is the gold piece in the middle of each photo. It is used to create a bed raiser in the FLSUN Cube 3D printer.</p> <p><a href="https://i.stack.imgur.com/iNRcM.png" rel="noreferrer"><img src="https://i.stack.im...
<p>To the best of my knowledge, it's just called a <strong>lead screw nut</strong> or <strong>lead nut</strong>. The flange and holes for attaching it to a surface are inherent in its role in letting the lead screw move something.</p>
<p>To the best of my knowledge, it's just called a <strong>lead screw nut</strong> or <strong>lead nut</strong>. The flange and holes for attaching it to a surface are inherent in its role in letting the lead screw move something.</p>
1,411
<p>I have a loader.exe with Main() that loads the 'UI' in WPF, the thing is that I want only one instance of the loader.exe, how can I achieve it? </p> <p>Is there a way a user clicks loader.exe it should check if an existing loader.exe is running and does nothing.</p> <p>currently I have </p> <p>loader.exe </p> <p...
<p>We use the following C# code to detect if an application is already running:</p> <pre><code>using System.Threading; string appSpecificGuid = "{007400FE-003D-00A5-AFFE-DA62E35CC1F5}"; bool exclusive; Mutex m = new Mutex(true, appSpecificGuid, out exclusive); if (exclusive) { // run } else { // already r...
<p>This is my simple and useful solution: <a href="http://blogs.microsoft.co.il/blogs/maxim/archive/2010/02/13/single-instance-application-manager.aspx" rel="nofollow noreferrer">http://blogs.microsoft.co.il/blogs/maxim/archive/2010/02/13/single-instance-application-manager.aspx</a></p>
39,233
<p>I have an object in SQL (A) that has a many to many relationships with another object (B). I'm currently building an API layer DLL that will allow the user to assign objects of type B into type A. Right now the user would retrieve a list of entries of type A and a list of entries of type B using different LINQ data ...
<p>I actually found a different sort of solution and now i feel kind of stupid for even asking the question. What I did inside the Service.Outputs.Add() method was really the problem:</p> <pre><code>public void Add(Output output) { OutputCollectionItem oci = new OutputCollectionItem(); oci.item = output; t...
<p>I ran into this same issue, I couldn't come up with an elegant solution. But the only solution I found was to either use "stitching," or to use reflection.</p> <p>Stitching looks something like this.</p> <pre><code>Person existingPerson - DB.GetPerson(1); existingPerson.BirthDate = newPerson.BirthDate; existingPer...
38,947
<p>I use the <code>screen</code> command for command-line multitasking in Linux and I set my scrollback buffer length to a very large value. Is there a key combination to clear the buffer for a certain tab when I don't want it sitting there anymore?</p>
<p><a href="http://osdir.com/ml/gnu.screen.user/2006-01/msg00029.html" rel="noreferrer">This thread</a> has the following suggestion:</p> <blockquote> <p>In the window whose scrollback you want to delete, set the scrollback to zero, then return it to its normal value (in your case, 15000).</p> <p>If you wan...
<p>From the man page:</p> <pre><code>C-a C (clear) Clear the screen. </code></pre>
13,852
<p>Is there any way to change the taskbar icon of a browser in windows?</p> <p>I open alot of browser windows, and I like to group similar websites (in tabs) by window. So I was wondering if there was a way to assign a taskbar icon to them so that you can more easily differentiate between them. </p>
<p>Here's something I put together in under 5 minutes to change the icon on a specific window. You could easily use this code to create a winform that would enumerate the currently open windows and allow you to assign arbitrary icons to them. (C# code below)</p> <pre><code>[DllImport("user32.dll", CharSet=CharSet.Auto...
<p>I believe the taskbar uses the icon resource embedded in the executable. I tried creating multiple shortcuts to Internet Explorer, each with a unique shortcut icon, but they all had the same icon when opened on the taskbar.</p> <p>I think you'd have to run multiple instances of the browser executable, and each woul...
46,538
<p>I want to use regular expressions (Perl compatible) to be able to find a pattern surrounded by two other patterns, but not include the strings matching the surrounding patterns in the match.</p> <p>For example, I want to be able to find occurrences of strings like:</p> <blockquote> <p>Foo Bar Baz</p> </blockquot...
<p>Parentheses define the groupings.</p> <pre><code>"Foo (Bar) Baz" </code></pre> <p>Example</p> <pre><code>~&gt; cat test.pl $a = "The Foo Bar Baz was lass"; $a =~ m/Foo (Bar) Baz/; print $1,"\n"; ~&gt; perl test.pl Bar </code></pre>
<p>Use <a href="http://www.regular-expressions.info/lookaround.html" rel="nofollow noreferrer">lookaround</a>:</p> <pre><code>(?&lt;=Foo\s)Bar(?=\sBaz) </code></pre> <p>This would match any "Bar" that is preceded by "Foo" and followed by "Baz", separated through a single white space. "Foo" and "Baz" would not be part...
23,284
<p>We are considering moving the win32 build of our cross-platform C++ application from MS Visual Studio 2003 to MS Visual Studio 2005. (Yes, very forward-looking of us ;)</p> <p>Should we expect to many code changes to get it compiling and working?</p>
<p>I've just migrated a comparatively large codebase from VS2003 to VS2008 via VS2005 and the majority of issues I found were const/non-const issues like assigning the return value of a function that returns a const char * to char *. Both VS2005 and VS2008 are a lot more picky when it comes to const correctness and if ...
<p>No. I wouldn't expect more than a few.</p> <p>Edit: you should/could try the code with a demo version of vs2005 first.</p>
36,448
<p>I get the correct results (nov and dec data) when I run a query in the Data tab of a report that I built in SQL Server Reporting Services. When I preview the report I get old data from October. It doesn't make any sense to me. I'm not sure whats going on. Note: the data is in Oracle.</p> <p>Here's the date filter...
<p>SSRS caches data locally for use by the designer. The cached data is only updated if the developer previews the report in VS.NET using a different set of parameters, which in your case never happens because the report has no parameters.</p> <p>To allow SSRS to refresh the cached data, navigate to the directory whi...
<p>Is there anything different regarding the dataset's parameters? Do report parameters feed the dataset at all? If so what are they? Is the report a server report? If so what is the time set to on the server? </p>
43,868
<p>I am trying to set up a simple transaction for my Linq-to-Sql actions against my Sql 2000 database. Using TransactionScope it looks like this:</p> <pre><code>using (TransactionScope transaction = new TransactionScope()) { try { Store.DBDataContext dc = new Store.DBDataContext(); Store.P...
<p>Take a look here: </p> <p>Fast transactions with System.Transactions and Microsoft SQL Server 2000 <a href="http://blogs.msdn.com/florinlazar/archive/2005/09/29/475546.aspx" rel="noreferrer">http://blogs.msdn.com/florinlazar/archive/2005/09/29/475546.aspx</a></p> <p>And here:<br> <a href="http://forums.microsoft....
<p>more notice that: - Server Configuration Guide Enable network COM+ access (Windows Server 2003) Start ==> Control Panel ==> Add or Remove Programs ==>Add/Remove Windows Components, Select Application Server, and then click Details. Click Enable network COM+ access, and then click OK. Click Next, and then click Finis...
41,528
<p>So I managed to get a page with Ajax <a href="http://docs.jquery.com/UI/Tabs" rel="nofollow noreferrer">ui.tab</a> and in one of the tab I put <a href="http://projects.bundleweb.com.ar/jWYSIWYG/" rel="nofollow noreferrer">jWYSIWYG</a> textarea plugin. Unfortunately, I can only see normal textarea.</p> <p>However, a...
<p>I expect the problem is that the new html is being inserted into the DOM when the ajax call completes, but isn't being hooked up to anything with jQuery.</p> <p>Normally you attach all your jquery goodness in a document ready or onload event, when the page initially loads. However, your textarea is not on the page ...
<p>Your answer would be best served by posting a link to the HTML file (and any custom JavaScript files of your own) in question. If the file isn't hosted, you can paste the source code at <a href="http://pastebin.com/" rel="nofollow noreferrer">http://pastebin.com/</a>, and post the link here.</p>
17,442
<p>is there an easy way to reset ALL text fields in an asp.net form - like the reset button for html controls?</p>
<p>Depends on your definition of reset. A trivial way to do something like this could be a button with codebehind:</p> <pre><code>Response.Redirect(Request.Url.PathAndQuery, true); </code></pre> <p>Or a variation thereof.</p>
<p>The easiest way to clear all controls in your form on a submit is:</p> <pre><code>form1.Controls.Clear() </code></pre>
34,633
<p>I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.</p> <p>Here's an example of the equations:</p> <pre><code>-44.3940 = a * 50.0 + b * 37.0 + tx -45.3049 = a * 43.0 + b * 39.0 + tx -44.9594 = a * 52.0 + b * 41.0 + tx </code></pre> <p>From this, I'd like to get the...
<p><a href="http://en.wikipedia.org/wiki/Cramers_rule" rel="noreferrer">Cramer's Rule</a> and <a href="http://en.wikipedia.org/wiki/Gaussian_elimination" rel="noreferrer">Gaussian Elimination</a> are two good, general-purpose algorithms (also see <a href="http://en.wikipedia.org/wiki/Simultaneous_linear_equations" rel=...
<p>For general cases, you could use python along with numpy for Gaussian elimination. And then plug in values and get the remaining values.</p>
2,320
<p>I am working with PHP and I am wondering how bad practise it is to combine lots of functions into a class. I am aware of it's not the purpose of classes, but the reason why I would do this is to provide a namespace. How big impact does it make to initiate let's say 10 classes at the execution of a PHP script instead...
<p>If you're using a php version &lt; 5.3 (and you are probably, so you can't use namespaces) than you could use something like:</p> <pre><code>&lt;?php class Foo { public static function aStaticMethod() { // ... } } Foo::aStaticMethod(); ?&gt; </code></pre> <p>(copied from <a href="http://theserverpag...
<p>You may not be aware that PHP, as of recently, has first class namespace support: <a href="http://php.net/language.namespaces" rel="nofollow noreferrer">http://php.net/language.namespaces</a>.</p>
48,666
<p>A common pattern in C++ is to create a class that wraps a lock - the lock is either implicitly taken when object is created, or taken explicitly afterwards. When object goes out of scope, dtor automatically releases the lock. Is it possible to do this in C#? As far as I understand there are no guarantees on when dto...
<p>To amplify Timothy's answer, the lock statement does create a scoped lock using a monitor. Essentially, this translates into something like this:</p> <pre><code>lock(_lockKey) { // Code under lock } // is equivalent to this Monitor.Enter(_lockKey) try { // Code under lock } finally { Monitor.Exit(_loc...
<p>I've been really bothered by the fact that <code>using</code> is up to the developer to remember to do - at best you get a warning, which most people never bother to promote to an error. So, I've been toying with an idea like this - it forces the client to at least TRY to do things correctly. Fortunately and unfor...
32,041
<p>I have returned to php development from <a href="http://www.iinteractive.com/moose/" rel="nofollow noreferrer">Moose</a> and I really miss CLOS like object model for php. Is there some kind of syntaxtic sugar which would allow me to write <strong>less code</strong> in php when dealing with objects?</p> <p>Just to s...
<p>There are no mixins in php yet but there is an RFC for traits which will work roughly the same. <a href="http://wiki.php.net/rfc/traits" rel="nofollow noreferrer">http://wiki.php.net/rfc/traits</a></p> <p>Using overloading for __call can allow you to dispatch methods to other classes and have it look like a mixin.<...
<p>The <a href="http://www.symfony-project.org/book/1_0/17-Extending-Symfony" rel="nofollow noreferrer">Symfony project has a mechanism for mixins</a>, allowing aspect oriented programming like in CLOS. Personally, I don't like this kind of hacking in userland spacee (At least not with PHP). I think you would be better...
19,920
<p>I sometimes need to modify OSS code or other peoples' code (usually C-based, but sometimes C++/Java) and find myself "grep"ing headers for types, function declarations etc. as I follow code flow and try to understand the system. Is there a good tool that exists to aid in code browsing. I'd love to be able to click...
<p>You can't get anything better than <a href="http://www.sourceinsight.com" rel="noreferrer">SourceInsight</a>.</p>
<p>IntelliJ is pretty good as a source browser under Linux. It's got really good support for jumping between source and function declarations. Haven't tried it with C/C++ code, but it works well with Ruby and Java. </p>
9,376
<p>Here's an interesting question. I have a system that attempts to run some initialization code. If it fails, we call the deinitializer to clean everything up.</p> <p>Because we call the deinitializer in exception handling, we run the risk that both initialize and deinitialize will fail, and hypothetically, it now se...
<p>You shouldn't throw in the Finally block. Instead, use the InnerException to add information in the throw.</p> <h2>Update</h2> <p>What you have to do is to catch and rethrow with the &quot;history&quot; of exception, this is done with InnerException. You can edit it when bulding a new exception. This is a code snipp...
<p>You have two possible exception conditions: one in which the first method failed, and one in which both methods failed.</p> <p>You're already defining your own exception class. So create another (or extend the first) with a <code>RelatedException</code> or <code>PriorException</code> property. When you throw the...
48,149
<p>Ok, all these methods of getting data in a Silverlight control are confusing me.</p> <p>I've looked at ADO.Net Data Services, Web Service and Silverlight-enabled WCF services. I'm just not sure when one is appropriate to use over another. What pros/cons do each offer?</p> <p>I've built a web app, and a Silverligh...
<p>From the silverlight perspective, WCF is heavily constrained anyway, so most of the <em>usual</em> benefits of WCF don't apply. However, it is still a fairly nice, consistent programming model.</p> <p>WCF is primarily a SOAP stack, so it is very good at presenting data as rigid operations. ADO.NET Data Services is ...
<p>If you have to choose between a web service and a WCF service, my advice is to go with WCF. It's more modern and more powerful technology. As for ADO.Net Data Services - you can use that if all you need is to retrieve/commit some data from/to a database back on the server.</p>
47,178
<p>This question is based on <a href="https://stackoverflow.com/questions/150514/custom-method-in-model-to-return-an-object">another question of mine</a>(thankfully answered).</p> <p>So if in a model I have this:</p> <pre><code>def self.find_extended person = Person.find(:first) complete_name = person.firstna...
<p>I think the best way to do this is creation of complete_name attribute in your Person class:</p> <pre><code>def complete_name firstname + ', ' + lastname end </code></pre>
<p>You could define:</p> <pre><code>attr_accessor :complete_name </code></pre> <p>in the person model and then just do <code>person.complete_name= person.firstname + ', ' + person.lastname</code></p>
19,166
<p>Our issue is that our project has files being downloaded using wget to the file system. We are using ruby to read the downloaded files for data.<br/> How is it possible to tell if the file is completely downloaded so we don't read a half complete file? </p>
<p>I asked a <a href="https://stackoverflow.com/questions/343391/detect-a-file-in-transit">very similar question</a> and got some good answers... in summary, use some combination of one or more of the following:</p> <ul> <li>download the file to a holding area and finally copy to your input directory;</li> <li>use a m...
<p>The typical approach to this is to download the file to a temporary location and when finished 'move' it to the final destination for processing.</p>
47,162
<p><strong>In brief:</strong></p> <p>Is it ever excusable to have assembly names and class names stored in the database? Does it break the layers of an application for the data layer to have explicit knowledge of the internals of the business layer?</p> <p><strong>Full explanation:</strong></p> <p>I have a boot stra...
<p>I think it's perfectly acceptable to store configuration info including assembly/class names in the database.</p> <p>I wouldn't consider data stored in the database to be part of the data layer.</p>
<p>Sure, I do exactly that for the menus in our application.</p> <p>When the program loads, it scans the database and loads the menu items by class name that the program can support. If a newer version is needed, a place-holder is shown instead.</p>
43,715
<p>I'm a little blockheaded right now…</p> <p>I have a date string in european format <strong>dd.mm.yyyy</strong> and need to transform it to <strong>mm.dd.yyyy</strong> with classic ASP. Any quick ideas?</p>
<p>If its always in that format you could use split</p> <pre><code>d = split(".","dd.mm.yyyy") s = d(1) &amp; "." &amp; d(0) &amp; "." &amp; d(2) </code></pre> <p>this would allow for dates like 1.2.99 as well</p>
<p>I have my own date manipulation functions which I use in all my apps, but it was originally based on this sample:</p> <p><a href="http://www.adopenstatic.com/resources/code/formatdate.asp" rel="nofollow noreferrer">http://www.adopenstatic.com/resources/code/formatdate.asp</a></p>
11,716
<p>I'm working on an application that makes asynchronous calls to the WebService.</p> <p>I added a proxy class to make asynchronous calls. The code compiles and runs properly, however whenever I try to double-click the proxy class in solution explorer (Visual Studio 2008) I am presented with a page</p> <p>To prevent ...
<p>Same problem here..<br> Just decorate your proxy class with the following attribute</p> <p>[System.ComponentModel.DesignerCategoryAttribute("code")]</p> <p>to get rid of the useless design mode.</p>
<p>In the properties for the project. In the Build Tab. Select "Generate Serialization assembly:" to Off.</p>
46,185
<p>I am having problems running my Junit tests via Ant. I can't seem to get Ant to see the properties file it needs to load a dll my project needs. All my tests work using the Junit GUI in Elcipse, so I'm pretty sure it's not a problem with the tests themselves. I think my problem is something classpath-related, but...
<p>Try and use getResource to see which URL is returned in eclipse, and also see if you can get a url to show in the unit test. Maybe you need to pass the name of the actual class file to get that</p> <pre><code>clazz.getResource(clazz.getName()+".class") </code></pre> <p>Check that files are copied before you run un...
<p>The first steps of <code>ant</code> debugging are always:</p> <ol> <li><code>ant -verbose</code></li> <li><code>ant -debug</code></li> </ol> <p>Review the output for those targets that relate to the <code>junit</code> tests.</p> <p>If you find additional information there that solves the problem, great! If not, ...
45,336
<p>I'm looking for any examples anyone might have seen of how to effectively present a list of items (about 1500 in total) so that multiple items can be selected.</p> <p>I've seen a couple of similar questions where the answer suggests an auto-complete, which works to select a single item, but that doesn't allow users...
<p>I can't think of any <strong>usable</strong> web app I use that shows me 1500 things that I have to choose from.</p> <p>My suggestion would be to break the list down somehow (for example, as a sequence of smaller choices, which you can then allow multiples on). What you're asking about sounds like a usability night...
<p>I would create a container <code>div</code> populated with items by typing text in a text input.<br> The text input performs a basic filter on all the available items.<br> The items would appear inside the container as selectable elements, and selected items would be transferred to a separate container (as to be abl...
47,465
<p>I have searched for such a plugin but haven't found any. I need a facility to "tag" my java files. Similar to tagging on stackoverflow.</p> <p>I want to be able to group my files based on projects/tasks I wam working on. Mylyn helps a little but it dynamically changes the context (list of resources associated with ...
<p><a href="http://taggerplugin.sourceforge.net/" rel="nofollow noreferrer">http://taggerplugin.sourceforge.net/</a></p>
<p>There is a plugin called <a href="http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-818.html" rel="nofollow noreferrer">Resource Tagger</a> which may do what you are looking for. Report back on what you find works please.</p>
11,408
<p>StateServer or SQLServer?</p> <ul> <li>What is the best solution for storing ASP.NET session variables?</li> <li>What are the pros and cons of each?</li> <li>Are one better then other in any particular situation?</li> </ul>
<p>Here's some thoughts about pro's/con's. I've also added Microsoft Velocity Distributed Caching solution.</p> <h3>Pros for InProc</h3> <ul> <li>Fastest optional available (it's all in memory/ram)</li> <li>Easy to setup (nothing new required in the .config file .. i think this is the default behavior).</li> <li>Most p...
<p>In my personal experience I had a few problems storing in session variables. I kept loosing the session and I believe it was the anti virus, which, as it was scanning every file in the server, IIS would recompile the site killing the sessions. (I must say I had no power over that server, I was told to host the app t...
27,673
<p>I'm trying to create with Delphi a component inherited from TLabel, with some custom graphics added to it on TLabel.Paint. I want the graphics to be on left side of text, so I overrode GetClientRect:</p> <pre><code>function TMyComponent.GetClientRect: TRect; begin result := inherited GetClientRect; result.Left ...
<p>First excuse-me for my bad English.<br /> I think it is not a good idea change the ClientRect of the component. This property is used for many internal methods and procedures so you can accidentally change the functionality/operation of that component.</p> <p>I think that you can change the point to write the text (...
<p>What methods/functionality are you getting from TLabel that you need this component to do?</p> <p>Would you perhaps be better making a descendent of (say, TImage) and draw your text as part of it's paint method?</p> <p>If it's really got to be a TLabel descendant (with all that this entails) then I think you'll be...
16,221
<p>In my Silverlight application, I can't seem to bring focus to a TextBox control. On the recommendation of various posts, I've set the IsTabStop property to True and I'm using TextBox.Focus(). Though the UserControl_Loaded event is firing, the TextBox control isn't getting focus. I've included my very simple code b...
<p>I found this on silverlight.net, and was able to get it to work for me by adding a call to System.Windows.Browser.HtmlPage.Plugin.Focus() prior to calling RegularTextBox.Focus():</p> <pre><code> private void UserControl_Loaded(object sender, RoutedEventArgs e) { System.Windows.Browser.HtmlPage.Pl...
<p>I forgot one thing...I haven't found a way to force focus to your Silverlight application on the page reliably (it will work on some browsers and not on others). </p> <p>So it may be that the Silverlight app itself doesn't have focus. I usually trick the user into clicking a button or something similar before I sta...
15,162
<p>Is it possible to easily embed ActiveX controls in Java application? Is it worth it. In my next project I should either use existing activex in Java app or have to reimplement everything from scratch, so I'm wondering what will be less hassle.</p>
<p>I don't think there's a way to do this without resorting to a third party library. (Or rolling your own, but you did say "easily".)</p> <p><a href="http://www.eclipse.org/swt" rel="noreferrer">SWT</a> (The "Standard Widget Toolkit") contains support for embedding ActiveX controls. SWT is an alternative to Swing, ...
<p><a href="http://www.codeproject.com/KB/cross-platform/javacom.aspx?msg=1776281" rel="nofollow">http://www.codeproject.com/KB/cross-platform/javacom.aspx?msg=1776281</a> might help if you're willing to do stuff by hand...</p> <p>Doesn't seem quite as flexible though...</p>
29,619
<p>I am trying to put the stuff within parentheses into the value of a src attribute in an img tag:</p> <pre><code>while(&lt;TOCFILE&gt;) { $toc_line = $_; $toc_line =~ s/&lt;inlineFig.*?(\.\.\/pics\/ch09_inline99_*?\.jpg)*?&lt;\/inlineFig&gt;/&lt;img src="${1}" alt="" \/\&gt;/g; $new_toc_file .= $toc_line...
<p>There's an error in your regex so that phrase will never match anything:</p> <pre><code>inline99_*?\.jpg ^^^ </code></pre> <p>I think you forgot <code>\d</code> in front of the star, judging by the example data you are trying to match.</p> <p>You're not even asking that it'll match, as you put a <code>*?...
<p>Fix your pattern, as bart suggested, and consider using the "topic" variable $_ instead of explicitly assigning the data read from the filehandle to another variable.</p> <pre><code>#!/usr/bin/perl use warnings; use strict; my $new_toc_file; { # localizing $_ protects any existing value in the global $_ ...
44,805
<p>In light of Michael Carman's comment, I have decided to rewrite the question. Note that 11 comments appear before this edit, and give credence to Michael's observation that I did not write the question in a way that made it clear what I was asking. <hr/> <em>Question:</em> What is the standard--or <em>cleanest</em>...
<p>Others mentioned how to 'use vars' and 'our' - I just wanted to add that $a and $b are special cases, since they're used internally by the sort routines. Here's the note from the strict.pm docs:</p> <pre><code>Because of their special use by sort(), the variables $a and $b are exempted from this check. </code></p...
<p><strong>EDIT</strong> - this is actually <strong>incorrect</strong>, see the comments. Leaving it here to give other people a chance to learn from my mistake :)</p> <hr> <p>Oh, you're asking if there's a way for a module to declare $k and $v in the CALLER's namespace? You can use Exporter to push up your variabl...
18,133
<p>I am trying to port Marlin to my Qidi Tech 1 printer which previously ran Sailfish 7.8. Everything worked fine on the old board, including the temperature sensors.</p> <p>All cables except for power, LCD, and USB (for flashing) are disconnected. I am still very early on in testing and have yet to plug anything else ...
<p>#define THERMAL_PROTECTION_HOTENDS is for thermal runaway. When the temperature &quot;should&quot; be climbing or falling at a predicable rate, or holding steady once at running temp.</p> <p>#define HEATER_0_MAXTEMP defines the maximum temperature Marlin will allow the extruder to get to before initiating a shutdown...
<p><code>MAXTEMP</code> and <code>MINTEMP</code> are <strong>not</strong> part of the <a href="https://3dprinting.stackexchange.com/questions/8466/what-is-thermal-runaway-protection">Thermal Runaway Protection</a>, but separate, equally needed safety nets: Mintemp is meant to make sure that the printer does not try to ...
1,770
<p>I am trying to add a png image resource in a specific Silverlight project folder. I would like to refer to this image with in my tag? I only seem to get this working when the xaml file containing the image tag is located in the same directory as the png file. </p> <p>For example in the xap file the png file woul...
<p>I have found a blog post discussing <a href="http://blogs.msdn.com/jaimer/archive/2009/02/15/using-uris-in-expression-blend.aspx" rel="nofollow noreferrer">USING URIS IN EXPRESSION BLEND</a> which works for me. </p> <blockquote> <ul> <li><p>pack://application:,,,/Images/happyface.png is wrong. This will wor...
<p>Make sure you use forward slashes, not back slashes. I know that one has bit me in the rear more than once.</p> <p>So, in your example, you should use resource/image1.png</p>
34,327
<p>We have a very important application, but so far no source code. The application was written in COBOL and a compiled version is in our production system and is running.</p> <p>However, we need to migrate to a new server, and new cobol compiler. We're under the impression that we need to recompile the code to get ...
<p>In the short run it would probably be cheaper to arrange to keep the old server. In the semi-long run, you need to make time and budget to reengineer the program, either re-write it or see how much effort it would be to hack the old code into shape doing what the program currently does.</p>
<p>crazy sugestion: COBOL DECOMPILER --> SOURCE --> NEW COBOL COMPILER...?</p> <p>(edit: <a href="http://juggersoft.com/order.htm" rel="nofollow noreferrer">http://juggersoft.com</a> - PAID cobol decompiler)</p>
42,973
<p>I want to fire up a flash presentation inside Powerpoint 2007. I am calling the Win32 ShellExecute() routine. When I run this from a location whose path is a UNC path (\myserver\myfolder\sample.ppt) it does not work.</p> <p>The ShellExecute routine expects 6 arguments, one of which is the path to run it from. I've ...
<p>I initially tried this approach, but found it caused problems:</p> <ul> <li>When the presentation was used from a laptop not connected to the network.</li> <li>If the user did not have access to the UNC.</li> <li>If the flash file was renamed, moved or deleted.</li> </ul> <p>I found a better approach was to embed ...
<p>UNC paths start with a <em>double</em> back-slash. Are you doing that, or was that just a typo in the question?</p>
11,318
<p>I'm looking for a little shell script that will take anything piped into it, and dump it to a file.. for email debugging purposes. Any ideas?</p>
<p>The unix command tee does this.</p> <pre><code>man tee </code></pre>
<p>Huh? I guess, I don't get the question?</p> <p>Can't you just end your pipe into a <code>&gt;&gt; ~file</code></p> <p>For example</p> <pre><code>echo "Foobar" &gt;&gt; /home/mo/dumpfile </code></pre> <p>will append Foobar to the dumpfile (and create dumpfile if necessary). No need for a shell script... Is that w...
10,232
<p>I have a Delphi 7 application that has two views of a document (e.g. a WYSIWYG HTML edit might have a WYSIWYG view and a source view - not my real application). They can be opened in separate windows, or docked into tabs in the main window.</p> <p>If I open a modal dialog from one of the separate forms, the main fo...
<p>I'd use this code... (Basically what Lars said)</p> <pre><code>dialog := TDialogForm.Create( parentForm ); dialog.PopupParent := parentForm; dialog.PopupMode := pmExplicit; dialog.ShowModal(); </code></pre>
<p>First of all, I am not completely sure I follow, you might need to provide some additional details to help us understand what is happening and what the problem is. I guess I am not sure I understand exactly what you're trying to accomplish and what the problem is.</p> <p>Second, you shouldn't need to set the dialog...
4,186
<p>I've been reading Skype4Java (java api for skype) and noticed they use jni to access the skype client.</p> <p>intuitively I'd assume that there already is a standard library in java that has an OS-sensitive jni implementation to access other processes. I set up to look for one, but couldn't find it.</p> <p>Is the...
<p>From Java 1.4 onwards you can use memory mapped files to exchange arbitrary information with another process. See java.nio.MappedByteBuffer for details.</p>
<p>This is not quite what you're looking for, but will probably help a great deal nonetheless: the <a href="https://github.com/twall/jna/" rel="nofollow noreferrer">Java Native Access</a> project on java.net.</p>
19,527
<p>I think this is best asked in the form of a simple example. The following chunk of SQL causes a <em>"DB-Library Error:20049 Severity:4 Message:Data-conversion resulted in overflow"</em> message, but how come? </p> <pre><code>declare @a numeric(18,6), @b numeric(18,6), @c numeric(18,6) select @a = 1.000000, @b = 1....
<p>I ran into the same problem the last time I tried to use Sybase (many years ago). Coming from a SQL Server mindset, I didn't realize that Sybase would attempt to coerce the decimals out -- which, mathematically, is what it <strong>should</strong> do. :)</p> <p>From the <a href="http://manuals.sybase.com/onlinebooks...
<p>Not directly related, but could possibly save someone some time with the Arithmetic overflow errors using Sybase ASE (12.5.0.3).</p> <p>I was setting a few default values in a temporary table which I intended to update later on, and stumbled on to an Arithmetic overflow error.</p> <pre><code>declare @a numeric(6,3...
19,989
<p>Does anybody know how I can close all modal dialogs created by Dojo ? Apparently there used to be a dojo.popup.closeAll function, but this is no longer available in the latest version of the Dojo API that comes with Spring JS.</p>
<p>That's right.... the reason that method isn't there anymore is that from 1.0, whoever opens a popup is in charge of closing it. It's an architecture change I made.</p> <p>Most widgets (like Menu) monitor when they've been blurred, and then close their child popup. So, you could probably get the effect you wanted...
<p>I don't know if this is of any use, but I tend to use only one dialog for each page (since it is modal). All the dialogs' content is xhrGot from the server, and I spend the entire dojo-time within a page's lifecycle recycling again and again the same dialog, merely changing its attributes: its <code>href</code> an...
44,423
<p>I've used NUnit for years and I wanted to try XUnit. So I installed XUnit and ran the executable that allowed you to run XUnit via TD.net. </p> <p>I can't seem to run more than one test at a time. With NUnit + TD.net, I could click on the filename in the solution and run all the tests in the file. I can't seem t...
<p>Make sure you run the installer that comes with XUnit.net. There is a button to click that will install the TestDriven.net support.</p> <p>The problem you are having is described here: <a href="http://www.codeplex.com/xunit/Wiki/View.aspx?title=FaqTestDrivenNet&amp;referringTitle=Home" rel="noreferrer">http://www.c...
<p>Short Answer: Copy the following into a .reg file on your computer, updating the path to where your Xunit dll resides, and then import it into your registry. </p> <p>Windows Registry Editor Version 5.00</p> <blockquote> <p>[HKEY_LOCAL_MACHINE\SOFTWARE\MutantDesign\TestDriven.NET\TestRunners\xunit] @="4" "Assem...
42,455
<p>Basically I want to put "todays" year, month, day into two fields ... something like the following. Tried varients of but cant get it right</p> <blockquote> <p>"INSERT INTO film_out (start_year, start_month, start_day), (end_year, end_month, end_day) VALUES ('$year', '$month', '$day') "</p> </blockquote>
<p>?</p> <pre><code>"INSERT INTO film_out (start_year, start_month, start_day, end_year, end_month, end_day) VALUES ('$year', '$month', '$day', '$year', '$month', '$day')" </code></pre>
<p>Not sure what your column types are so I'm assuming they are numeric...</p> <pre><code>INSERT INTO film_out (start_year, start_month, start_day, end_year, end_month, end_day) VALUES (YEAR(), MONTH(NOW()), DAYOFMONTH() + 1, YEAR(), MONTH(NOW()), DAYOFMONTH() + 1) </code></pre>
49,786
<p>I have a problem with formatting the data when doing an query to an Oracle database.</p> <p>What I want to do is to export some data into the formatbelow into a textfile;</p> <pre><code> 1IN20071001 40005601054910101200 1 65 </code></pre> <ul> <li>First number (1 above) = Company number (posi...
<p>if t.clockindatetime is an oracle DATE then why not use:<br> <code>TO_CHAR(t.clockindatetime, 'YYYYMMDD')</code> for the date part and <code>TO_CHAR(t.clockindatetime, 'HHMISS')</code> for the time part (if you want the hours to be in 24hr format use <code>TO_CHAR(t.clockindatetime, 'HH24MISS')</code> (the hours wil...
<p>Super sweet, you guys saved my weekend! :)</p> <p>Query:</p> <pre><code>SELECT lpad('1',5) || 'IN' || TO_CHAR(t.clockindatetime, 'YYYYMMDD') || lpad(i.employeeid,18) || TO_CHAR(t.clockindatetime, 'HH24MISS') || '00 1' || lpad('h.useralpha6',5) FROM ent_time_card_detail t, max_employe...
42,298
<p>I have a list of email address which I want to distribute evenly by domain.</p> <p>For example:</p> <p>let the list be, </p> <pre><code>a@a.com b@a.com c@a.com a@b.com b@b.com c@c.com </code></pre> <p>The output should be </p> <pre><code>a@a.com a@b.com c@c.com b@a.com b@b.com c@a.com </code></pre> <p>The sour...
<p>Beware of answers that assume that the number of email addresses per domain are the same (or similar).</p> <p>I tried to solve essentially the same problem, and it received a lot of discussion on my blog: <a href="http://www.somethinkodd.com/oddthinking/2007/01/18/wine-gum-selection-puzzle/" rel="nofollow noreferre...
<p>My starting attempt would be a hash map of linked lists, so that once all the domain collisions were grouped, you could iterate though the linked lists one at a time.</p> <p>If that makes any sense.</p> <p>The following code is completely <strong>UNTESTED</strong>, and I know there is a bunch of stuff not right in...
35,887
<p>I have an application that has created a number of custom event log sources to help filter its output. How can I delete the custom sources from the machine WITHOUT writing any code as running a quick program using System.Diagnostics.EventLog.Delete is not possible.</p> <p>I've tried using RegEdit to remove the cust...
<p>I also think you're in the right place... it's stored in the registry, under the name of the event log. I have a custom event log, under which are multiple event sources.</p> <blockquote> <p>HKLM\System\CurrentControlSet\Services\Eventlog\LOGNAME\LOGSOURCE1 HKLM\System\CurrentControlSet\Services\Eventlog\LOGNA...
<p>Perhaps your application is fault-tolerant, meaning that it checks to see if the event log source is already registered and registers the source if it isn't?</p> <p>If this were the case, your application would re-create the source(s) each time it ran, no matter what you did.</p>
15,574
<p>I have a LAMP (PHP) web app which need to interface with programs on an IBM 3270 mainframe (via Microsoft SNA Server). One solution I'm looking at is screen-scraping via 3270. (I'm integrating the present with the past!)</p> <p>Many years ago, I wrote C code which used HLLAPI as the basis for such a task.</p> <o...
<p>I haven't used it but maybe look at <a href="http://x3270.bgp.nu/" rel="noreferrer">http://x3270.bgp.nu/</a> which says has a version:</p> <blockquote> <p>s3270 is a displayless version for writing screen-scraping scripts</p> </blockquote>
<p>While I have no experience with 3270, I would expect that finding and calling on an outside application or library is your best bet. PHP is not an all-purpose tool, hacking into a non-web communications protocols is best left to languages like C or Java that can handle that well. </p>
19,031
<p>I'm working on bringing some old code from 1998 up to the 21st century. One of the first steps in the process is converting the printf statements to <a href="http://qt-project.org/doc/qt-4.8/qstring.html" rel="nofollow noreferrer">QString</a> variables. No matter how many times I look back at printf though, I alwa...
<p>Danny is mostly right.</p> <p>a. unsigned decimal, minimum 4 characters, space padded<br> b. floating point, minimum 16 digits before the decimal (0 padded), 1 digit after the decimal<br> c. hex, minimum 4 characters, 0 padded, letters are printed in upper case<br> d. same as above, but minimum 2 characters<br> e. ...
<p>a. decimal, four significant digits </p> <p>b. Not sure</p> <p>c. hex, minimum 4 characters </p> <p>d. Also hex, minimum 2 characters </p> <p>e. 1 character </p> <p>f. String of characters, minimum 4</p>
2,952
<p>I am looking for an example that renders an interactive earth similar to the one in the <a href="http://www.smule.com/" rel="nofollow noreferrer">Smule</a> products.</p>
<p>Someone just pointed me to this question. I have one!</p> <p>It's called WhirlyGlobe and it's built specifically for this purpose. Runs on ios, uses a combo of Objective-C and C++ and is very Cocoa Touch friendly. Uses delegates for camera motion, multithreaded, all that good stuff.</p> <p>Oh, and it's freely a...
<p>I can't offer any samples, but Dragon Forged Software sells a prepackaged OpenGL ES Globe for the iPhone. <a href="http://dragonforged.com/consult.shtml" rel="nofollow noreferrer">http://dragonforged.com/consult.shtml</a></p>
41,698
<p>I wasn't aware of a difference, but a coworker says there is, although he can't back it up. What's the difference if any?</p>
<p>There is a difference, yes.</p> <p>XML that adheres to the <a href="https://www.w3.org/XML/" rel="noreferrer">XML standard</a> is considered well formed, while xml that adheres to a <a href="https://www.w3schools.com/xml/xml_dtd.asp" rel="noreferrer">DTD</a> is considered valid.</p>
<p>Well, XML that isn't well formed, sort of by definition, isn't XML. Poeple usually refer to valid XML as XML that adheres to a certain schema (XSD or DTD).</p>
16,280
<p>I'm working on a .NET WinForms app that needs to print a FEDEX shipping label. As part of the FedEx api, I can get raw label data for the printer. </p> <p>I just don't know how to send that data to the printer through .NET (I'm using C#). To be clear, the data is already pre formatted into ZPL (Zebra printer lang...
<p>C# doesn't support raw printing, you'll have to use the win32 spooler, as detailed in this KB article <a href="http://support.microsoft.com/?kbid=322091" rel="noreferrer">How to send raw data to a printer by using Visual C# .NET</a>.</p> <p>Hope this helps.</p> <p>-Adam</p>
<p>I've been working with a printer and ZPL for a while now, but with a Ruby app. Sending the ZPL out to the printer via socket works fine.</p> <p>To check that it works, I often telnet to the printer and type <code>^XA^PH^XZ</code> to feed a single label. Hope that helps.</p>
14,988
<p>Assuming that the Application directory is writeable and that HD space is not an issue, are there any downsides to putting the VB6 dependency files (msvbvm60.dll, etc.) in the .EXE's directory?</p> <p>I've got the most up to date dependency files and I'm guessing MS isn't coming out with any new versions of those s...
<p>It has been my experience that files like msvbvm60.dll, the various OCXs, have subtle dependencies that play havoc when you try to install in your own application's directory. Our solution was to track down all the dependencies and made sure that they were part of the install and handled correctly in accordance to M...
<p>There's not really any point. Just use a quality MSI based installer that has self-heal. That way everytime your app runs it will check for and if necessary install and register any required DLLs or other components. You are then protected against anyone mucking around with the files.</p>
34,095
<p>What is a .snk file for? I know it stands for <strong>Strongly Named Key</strong>, but all explanations of what it is and how it works goes over my head.</p> <p>Is there any simple explanation on how a strongly named key is used and how it works?</p>
<p>The .snk file is used to apply a <a href="http://msdn.microsoft.com/en-us/library/wd40t7ad.aspx" rel="noreferrer">strong name to a .NET assembly</a>. such a strong name consists of</p> <blockquote> <p>a simple text name, version number, and culture information (if provided)—plus a public key and a digital signature....
<p>A .snk file is a persisted version of your "Key" produced by the sn utility in the framework utility set. You then use this file to 'digitally sign' your assemblies. It is a 2-part key.. private-public key combination. The public part of the key is published i.e. known to everyone. The private part is known to only ...
15,932
<p>I'm building a mobile application in VB.NET (compact framework), and I'm wondering what the best way to approach the potential offline interactions on the device. Basically, the devices have cellular and 802.11, but may still be offline (where there's poor reception, etc). A driver will scan boxes as they leave his ...
<p>We can't give you a definitive answer because there is no "right" answer that fits all usage scenarios. For example if you're using SQL Server on the back end and SQL CE locally, you could always set up merge replication and have the data engine handle all of this for you. That's pretty clean. Using the offline a...
<p>I haven't used it myself, but have you looked into the "store and forward" capabilities of the CF? It may suit your needs. I believe it uses an Exchange mailbox as a message queue to send SOAP packets to and from the device.</p>
27,738
<p>I need to customize an open-source project. The changes are for a specific organization and will not be useful to the public project. The code changes include disabling features not needed by the organization (affecting 5% of the code), customizing other features for the organization (affecting 20% of the code), and...
<p>The best thing to do is not to fork it. Why not figure out how to improve it so it will do what you want it to do and not lose any existing functionality. If code size is an issue, maybe you can spend some of the time you would spend forking it on improving the existing projects efficiency.</p>
<p>Import a subversion-dump of the original project and start your fork with an own repository as a branch- As the original project improves, you can import the changes and then call 'svn merge' to incorporate these improvements. As long as you and the original project don't do some restructuring (renaming source-files...
16,233
<p>Working with software day-to-day usually means you have to juggle project work, meetings, calls and other interrupts.</p> <p>What single technique, trick, or tool do you find most useful in managing your time?</p> <p>How do you stay focused?</p> <p>What is your single biggest distraction from your work?</p>
<p>I read this rule somewhere, and I use it every day...</p> <ul> <li>If someone asks you to do something - if it takes less than 2 minutes, do it immediately. If it takes longer, put it on your list and come back to it.</li> </ul> <p>This really works for me.</p>
<p>Single most useful? <a href="http://www.nowdothis.com" rel="nofollow noreferrer">http://www.nowdothis.com</a> is AWESOME for focusing on what currrently needs to get done, and has raised my productivity by tons. (Bonus tip: Use Google Chrome to make it its own application and then make the app always be on top of ot...
9,675
<p>Here is a sample from Kernighan &amp; Ritchie's "The C Programming Language":</p> <pre><code>int getline(char s[], int lim) { int c, i = 0; while (--lim &gt; 0; &amp;&amp; (c=getchar()) !=EOF &amp;&amp; c !='\n') { s[i++] = c; } if (c =='\n') { s[i++] = c; } s[i] = '\0'; ...
<p>The functions reads characters from the standard input until either EOF or a newline characters is found. </p> <p>The second check ensures that the only newline character is put into the char array. EOF shouldn't occur in a proper c-string. Also, if the character isn't newline that means that we might have filled u...
<p>You do that just to exit the while loop on new line. Else you would have to check it in while body and use break.</p>
9,746
<p>I converted a Smart Form output into PDF using the function module <code>SX_OBJECT_CONVERT_OTF_PDF</code>.</p> <p>My problem is that when the language is PL (Polish) the PDF file is 10 times bigger comparing to EN language. Why?</p>
<p>This may be that polish uses a specific font (special characters) which is not installed by default on an OS. So the pdf converter includes the complete font into the document in order to render it correctly at the destination.</p> <p>This is just speculation though.</p>
<p>You may try this one: <a href="http://lucattelli.com/blog/?page_id=478" rel="nofollow noreferrer">http://lucattelli.com/blog/?page_id=478</a></p> <p>This FM can take the binary PDF and convert it to BASE 64 and send it as a mail attachment.</p> <p>See if it helps</p>
10,819
<p>I am trying to learn Python and WxPython. I have been a SAS programmer for years. This OOP stuff is slowly coming together but I am still fuzzy on a lot of the concepts. Below is a section of code. I am trying to use a button click to create an instance of another class. Specifically-I have my main panel in one...
<p>I don't know wxWidgets, but based on what I know of Python, I'm guessing that you need to change:</p> <pre><code>self.Bind(wx.EVT_MENU, self.subPanel(None, -1, 'TEST'),id=1) </code></pre> <p>to:</p> <pre><code>self.Bind(wx.EVT_MENU, subPanel(None, -1, 'TEST'),id=1) </code></pre> <p>"subPanel" is a globally defin...
<p>I don't know wxWidgets, but based on what I know of Python, I'm guessing that you need to change:</p> <pre><code>self.Bind(wx.EVT_MENU, self.subPanel(None, -1, 'TEST'),id=1) </code></pre> <p>to:</p> <pre><code>self.Bind(wx.EVT_MENU, subPanel(None, -1, 'TEST'),id=1) </code></pre> <p>"subPanel" is a globally defin...
34,511
<p>I want to build a bot that asks someone a few simple questions and branches based on the answer. I realize parsing meaning from the human responses will be challenging, but how do you setup the program to deal with the "state" of the conversation?</p> <p>It will be a one-to-one conversation between a human and the...
<p>You probably want to look into <a href="http://en.wikipedia.org/wiki/Markov_chain" rel="noreferrer">Markov Chains</a> as the basics for the bot AI. I wrote something a long time ago (the code to which I'm not proud of at all, and needs some mods to run on Python > 1.5) that may be a useful starting place for you: ...
<p>I would suggest looking at Bayesian probabilities. Then just monitor the chat room for a period of time to create your probability tree.</p>
7,874
<p>In the past we declared properties like this:</p> <pre><code>public class MyClass { private int _age; public int Age { get{ return _age; } set{ _age = value; } } } </code></pre> <p>Now we can do:</p> <pre><code>public class MyClass { public int Age {get; set;} } </code><...
<p>The aim of the new automatic properties is to reduce the amount of boilerplate code you need to write when you just have a simple property that doesn't need any special logic in the get or the set. </p> <p>If you want to access the private member that these properties use, that's usually for a few reasons:</p> <ul...
<p>You can't, it's a language feature as opposed to a IDE feature. To be honest i'd prefer then IDE to add the private variable in for you. I agree that it is slightly weird for the class to internally have to use the public entry point to access its own variables. Hence I don't use this new feature that much myself.</...
8,672