instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>We've converted our solution from .NET 2.0 to .NET 3.5. All projects converted just fine except for the Website Project, which still doesn't understand what I mean when using 'var' and the like.</p> <p>I've looked in the property pages for the web project, and the Target Framework is set to '.NET Framework 3.5'.</p...
<p>Add the following to web.config:</p> <pre><code> &lt;system.codedom&gt; &lt;compilers&gt; &lt;compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt; ...
<p>By default, a new web app in 3.5 has the following References:</p> <ul> <li>System System.Configuration</li> <li>System.Core </li> <li>System.Data</li> <li>System.Data.DataSetExtensions</li> <li>System.Drawing</li> <li>System.EnterpriseServices</li> <li>System.Web</li> <li>System.WebExtensions</li> <li>System.Web.M...
35,183
<p>Are there any issues which might make MS's T4 Template code-generation system unsuitable for generating C++ code?</p>
<p>It can generate any text you want, including C++ code. </p>
<p><em>A bit lengthy answer yet I think some might find it interesting</em></p> <p>I would say T4 is excellent to generate C++ with</p> <p>Some might retort that C++ already has tools to do MetaProgramming with like:</p> <p><strong>The Preprocessor</strong></p> <p>Using the preprocessor and higher-order macros you can ...
37,765
<p>I have this:</p> <pre><code>If String.IsNullOrEmpty(editTransactionRow.pay_id.ToString()) = False Then stTransactionPaymentID = editTransactionRow.pay_id 'Check for null value End If </code></pre> <p>Now, when <code>editTransactionRow.pay_id</code> is Null Visual Basic throws an exception. Is there something w...
<p>The equivalent of <code>null</code> in VB is <code>Nothing</code> so your check wants to be:</p> <pre><code>If editTransactionRow.pay_id IsNot Nothing Then stTransactionPaymentID = editTransactionRow.pay_id End If </code></pre> <p>Or possibly, if you are actually wanting to check for a SQL null value:</p> <pr...
<pre><code>If Not editTransactionRow.pay_id AndAlso String.IsNullOrEmpty(editTransactionRow.pay_id.ToString()) = False Then stTransactionPaymentID = editTransactionRow.pay_id 'Check for null value End If </code></pre>
49,538
<p>To start, I know there are two "kinds" of JSON serialization currently built into ASP.Net: you can either use the JavaScriptSerializer class to serialize your object to JSON or the new DataContractJsonSerializer class to convert a object to JSON.</p> <p>If you use the JavaScriptSerializer() method, you must mark yo...
<p>No, there isn't.</p>
<p>Assuming UTF-8 you are saving 40 bits over the wire by this technique, its not worth the sleep lost.</p>
17,060
<p>Pretty much what the title says. Is there a way to add files to a vsnet project from inside Vim? I work in a group of devs, and all of our code has solutions and projects as you would expect. I would like to use Vim, and was hoping for a way to maintain those project files when I added or removed files without havin...
<p>The project and solution files are in xml and are hand-edittable. (I often have to during an SVN merge.) However, HUGE DISCLAIMER AHOY, adding stuff from scratch is a lot more dubious than an svn merge. I get to see the lines and just move them in (or not) here or there. To be confident that you're not destroyin...
<p>The problem is that you're trying to fit Vim into the role of an IDE, which it is not and has never claimed to be. You can edit just about anything under the sun, but when you start asking it to manage files and relationships like I think you're wanting, you're asking for a major headache.</p>
27,373
<p>Can anyone recommend a cheap and good RTF control for .Net 1.1 Windows development. It needs to be able to do print/preview and some basic text formatting, fonts etc but nothing too advanced.</p> <p>Cheers</p> <p>Andreas</p>
<p>Assuming feed_id = 0 is the manually entered stuff this does the trick: </p> <pre><code>select p.* from programs p left join ( select max(id) id1 from programs where feed_id &lt;&gt; 0 group by feed_id order by max(id) desc limit 10 ) t on id1 = id where id1 is not null or feed_id = 0 order by...
<p>You probably want a <a href="http://dev.mysql.com/doc/refman/5.0/en/union.html" rel="nofollow noreferrer">union</a>. Something like this should work:</p> <pre><code> (SELECT url, feed_id, timestamp FROM rss_items GROUP BY feed_id ORDER BY timestamp DESC LIMIT 10) UNION (SELECT ...
14,422
<p>In PL/SQL, I would like to pass in a "source" schema as a parameter to a stored procedure. For instance:</p> <pre><code>BEGIN CURSOR my_cursor IS SELECT my_field FROM &lt;schema&gt;.my_table ... </code></pre> <p>I want the 'schema' value to come from an input parameter into the stored procedure. Does a...
<p>In addition to what Mark Brady said, another dynamic SQL option is to use a REF CURSOR. Since your sample code includes a cursor this would be the most relevant.</p> <pre><code>PROCEDURE select_from_schema( the_schema VARCHAR2) IS TYPE my_cursor_type IS REF CURSOR; my_cursor my_cursor_type; BEGIN OPEN my_cu...
<p>This has to be done with dynamic sql. </p> <p>Either the DBMS_SQL package or the Execute Immediate statement.</p> <p>You can't use variables in the FROM clause.</p> <p>A potential solution may be to </p> <p>ALTER SESSION SET Current_Schema = '' &lt;-- the schema you want.</p> <p>That command changes the default...
35,217
<p>I have three related tables "A(id, val)", "B(id, val)", and a link table with a value "AB(aid, bid, val)"</p> <p>I am querying against B to bring back A values, for example:</p> <pre><code>SELECT A.* FROM A INNER JOIN AB ON A.id = AB.aid INNER JOIN B ON AB.bid = B.id WHERE B.val = 'foo'; </code></pre> <p>Every A...
<p>I think you need to do another join to get ab's max val for each a.id first.</p> <p>Something like this:</p> <pre><code>select a.* from a left join ( select aid, max(val) as val from ab group by aid ) abmax on abmax.aid=a.id inner join ab on ab.aid=abmax.aid and ab.val=abmax.val inner join b on b.id=...
<p>I am not sure which sql you are using but in MS SQL I create a table-valued database function to return the max values from table A then join this to table B. I find this much easier to understand than complex joins when I look back on my queries at a later stage. </p>
27,181
<p>Right now I write expressions in the <code>*scratch*</code> buffer and test them by evaluating with <kbd>C-x</kbd> <kbd>C-e</kbd>. I would really appreciate having an interactive interpreter like SLIME or irb, in which I could test Emacs Lisp expressions.</p>
<p>It's easy to evaluate Lisp expressions in Inferior Emacs-Lisp Mode:</p> <pre><code>M-x ielm </code></pre> <p>You can read more about this feature in the <a href="http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Lisp-Interaction" rel="noreferrer">Emacs manual section on "Lisp Interaction"</a> </p>
<p>In the <code>*scratch*</code> buffer, just type C-j to evaluate the expression before point.</p>
17,503
<p>I have an XML schema that represents a product in a DB, and I am trying to figure out the best way to store the product image references as XML nodes. There will be a primary image, and then alternate images, each of them with sequences (display order). Would this be an appropriate format, or are there better approa...
<p>Since XML elements have a natural order (that is, the order in which they appear in the XML file), it's probably redundant to include the <code>sequence</code> attribute. You can still talk about the order of the elements and there is still a "first" one for the primary product image.</p> <p>So perhaps:</p> <pre><...
<p>To extend Greg's design a little: it might be appropriate to make the image size the element name rather than making <code>size</code> an attribute, i.e.:</p> <pre><code>&lt;imageset&gt; &lt;thumbnail width=""... /&gt; &lt;medium width="".../&gt; &lt;large width="".../&gt; &lt;/imageset&gt; </code></pre> ...
35,199
<p>I'm writing a game which is taking user input and rendering it on-screen. The engine I'm using for this is entirely unicode-friendly, so I'd like to keep that if at all possible. The problem is that the rendering loop looks like this:</p> <pre><code>"string".each_byte do |c| render_this_letter(c) end </code><...
<p>Neither of the above will work.</p> <pre class="lang-css prettyprint-override"><code>div#col2 { width: 160px; float: left; position: relative; } div#col1 { width:100%; margin-left: 160px; } </code></pre> <p>That's assuming that Column 2 should appear as a left sidebar, with col 1 as the main c...
<p>You should use the "float" CSS property for doing this. Check out for a <a href="http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/" rel="nofollow noreferrer">simple implementation here</a>. And you can find a bit more detailed <a href="http://www.lissaexplains.com/css3.shtml" rel="nofo...
17,414
<p>Has anyone tried the <a href="http://en.wikipedia.org/wiki/NetBeans#Other_NetBeans_IDE_Bundles" rel="nofollow noreferrer">NetBeans 6.5 Python IDE</a>?</p> <p>What are your opinions? Is it better/worse than <a href="http://en.wikipedia.org/wiki/PyDev" rel="nofollow noreferrer">PyDev</a>? Do you like it? How does it ...
<p>I will share some of the feelings from using it for quite a while now. Things that are roughly the same quality as in Eclipse+Pydev+mercurial:</p> <ol> <li>editor, code-completion</li> <li>debugger features</li> </ol> <p>Things that are better:</p> <ol> <li>autoimport</li> <li>color schemes (Norway today rocks)</...
<p>After looking at this, I decided to go ahead with PyDev than NetBeans.</p> <p>However best wishes to NetBeans team for a faster and better Python support. Cant wait for that :)</p>
48,487
<p>I've been asked to find a way to connect from a Linux system to one of several Windows servers. What we need to do ideally is connect to whatever Windows server is causing the trouble, kill a process, and restart the process. Ideally, it would be something that could be put into a script that could be run from the...
<p>I use <a href="http://www.cygwin.com/" rel="nofollow noreferrer">Cygwin</a> with OpenSSH server on the Windows box (<a href="http://sshwindows.sourceforge.net/" rel="nofollow noreferrer">but it is available without Cygwin in an installer</a>), and can log in over SSH from the Linux box to do stuff with a command lin...
<p>I use <a href="http://www.cygwin.com/" rel="nofollow noreferrer">Cygwin</a> with OpenSSH server on the Windows box (<a href="http://sshwindows.sourceforge.net/" rel="nofollow noreferrer">but it is available without Cygwin in an installer</a>), and can log in over SSH from the Linux box to do stuff with a command lin...
37,255
<p>Having to upgrade a database schema makes installing a new release of software a lot trickier. What are the best practices for doing this?</p> <p>I'm looking for a checklist or timeline of action items, such as</p> <ul> <li>8:30 shut down apps</li> <li>8:45 modify schema</li> <li>9:15 install new apps</li> <li>9:...
<p>I have a lot of experience with this. My application is highly iterative, and schema changes happen frequently. I do a production release roughly every 2 to 3 weeks, with 50-100 items cleared from my FogBugz list for each one. Every release we've done over the last few years has required schema changes to support...
<p>This is a topic that I was just talking about at work. Mainly the problem is that unless database migrations is handled for you nicely by your framework, eg rails and their migration scripts, then it is left up to you. </p> <p>The current way that we do it has apparent flaws, and I am open to other suggestions. </p...
5,123
<p>We have a web app that allows users to upload documents, create their own documents, and so on. Uploaded files are stored on Amazon S3, created information is stored in a MySQL database. What I'm looking for is some sort of search engine, where I feed it all of our text documents, each with a unique ID, and it build...
<p>Take a look at <a href="http://lucene.apache.org/solr/" rel="noreferrer">Solr</a>. It's based on Lucene, so it's very fast, and it's really easy to use from any platform.</p>
<p>I imagine that <a href="http://google.com" rel="nofollow noreferrer">Google</a> will have a solution that meets your needs. Start here: <a href="http://www.google.com/enterprise/" rel="nofollow noreferrer">Google Enterprise</a></p>
14,361
<p>When converting from PNG to JPG using the MagickWand API, how do I set the background to white for transparent pixels?</p>
<pre><code>if(current_wand &amp;&amp; IsMagickWand(current_wand)){ status=MagickReadImage(current_wand, "test.png"); if (status == MagickFalse) { ThrowWandException(current_wand); } PixelWand *color = NewPixelWand(); PixelSetColor(color, "white"); MagickSetImageBackgroundColor(current_wa...
<p>Use MagickMergeImageLayers </p>
48,749
<p>I'm quite new to 3D-printing. I need to build a curved piece with a hole pattern and I was wondering whether it was possible to print such a hole pattern accurately, with such a thin (3 mm) thickness of the piece. In the past, when I tried printing thinner pieces with holes, the piece warped and holes were not print...
<p>People like PLA for dimensional accuracy. It's disadvantage is it becomes brittle, which can be an issue especially with thin prints if the application tends to bend it (applying force). Working with settings and with a 0.4 mm nozzle, typical for most printers using PLA, you can print walls as thin as 1 mm, but st...
<p>That depends on the printer, the print material and your experience level (and maybe print orientation, but that depends on the load case), but, the depicted part should be printed very well at a thickness of 3 mm (that is not really &quot;thin&quot;). PLA will be easier than higher temp materials like ABS and PETG,...
1,863
<p>I've been tasked with <em>improving the performance of an ASP.NET 2.0 application</em>.<br> The page I'm currently focused on has many problems but one that I'm having trouble digging into is the render time of the page. Using Trace.axd the duration between Begin Render and End Render is 1.4 seconds. From MSDN I ...
<p>Download ANTS PROFILER, this will give you a perfect overview of the lines causing the slowdown.</p> <p>Also when it's about rendering make sure you don't use to much string concats (like string += "value") but use StringBuilders to improve performance.</p>
<p>It may not help if the problem is inside one of your controls - as you expect - but if the page is poorly designed and that's causing render to be slow, <a href="http://developer.yahoo.com/yslow/" rel="nofollow noreferrer">YSlow</a> should help clean that up.</p>
3,632
<p>I've been looking at the <a href="http://www.getdropbox.com/install?os=mac" rel="noreferrer">DropBox</a> Mac client and I'm currently researching implementing a similar interface for a different service. </p> <p>How exactly do they interface with finder like this? I highly doubt these objects represented in the fo...
<p>Dropbox is not powered by either MacFUSE or WebDAV, although those might be perfectly fine solutions for what you're trying to accomplish.</p> <p>If it were powered by those things, it wouldn't work when you weren't connected, as both of those rely on the server to store the actual information and Dropbox does not....
<p>To me it feels like a heavily modified revision control system. It has all the features: updates files based on deltas, options to recover or restore old revisions of files. It almost feels like they are using git (<a href="http://www.sfgoth.com/~mitch/linux/gitfs/" rel="nofollow noreferrer">GitFS</a>?), or some fil...
22,441
<p>How come the following doesn't work?</p> <pre><code>CREATE FUNCTION Test (@top integer) RETURNS TABLE AS RETURN SELECT TOP @top * FROM SomeTable GO </code></pre> <p>I just want to be able to be able to specify the number of results to be returned. [SQL Server 2000.]</p> <p>Thanks!</p>
<p>For MS SQL 2000, you can use:</p> <pre><code>CREATE FUNCTION Test (@top integer) RETURNS TABLE AS SET ROWCOUNT @top RETURN SELECT * FROM SomeTable </code></pre>
<p>Oops a variable TOP is not available in SQL Server 2000. Nor is Dynamic SQL supported in any version.</p>
36,093
<p>Here's the problem: </p> <p>I have to modify an existing Excel spreadsheet using .NET. The spreadsheet is hugely complex, and I just have to add data in some predefined areas.</p> <p>I'm investigating my options, and Excel Automation/InterOp is out of the question, as I'm implementing an ASP.NET website, and Excel...
<p>Check out <a href="http://myxls.in2bits.org" rel="nofollow noreferrer">MyXls</a> a .NET solution for reading and writing binary XLS files.</p>
<p>You have still few solutions. 1) Third party component for excel files. ( i think this is most pain-les &amp; reliable solution ) 2) Using html-table.</p> <hr> <p>1) Simply look at internet :) 2) The excel works pretty fine with html-tables. If you generate this html:</p> <pre><code>&lt;html&gt;&lt;body&gt; &lt;t...
37,327
<p>I occasionally see the list slice syntax used in Python code like this:</p> <pre><code>newList = oldList[:] </code></pre> <p>Surely this is just the same as:</p> <pre><code>newList = oldList </code></pre> <p>Or am I missing something?</p>
<p>Like NXC said, Python variable names actually point to an object, and not a specific spot in memory.</p> <p><code>newList = oldList</code> would create two different variables that point to the same object, therefore, changing <code>oldList</code> would also change <code>newList</code>.</p> <p>However, when you do...
<p><strong>Shallow Copy:</strong> (copies chunks of memory from one location to another)</p> <pre><code>a = ['one','two','three'] b = a[:] b[1] = 2 print id(a), a #Output: 1077248300 ['one', 'two', 'three'] print id(b), b #Output: 1077248908 ['one', 2, 'three'] </code></pre> <p><strong>Deep Copy:</strong> (Copies ...
41,904
<p>I have a Windows Form app written in C#. Its job is to send messages to a list of users. While those messages are being sent, I'd like to display status of the operation for each user. What I am doing (for each user) is creating a Label control and adding it to Panel. This works without a problem for a small set ...
<p>Given the size, I would consider displaying your status in a RichTextBox. </p> <p>What is happening is that you are generating too many handles and the Framework can't handle them all.</p>
<p>Too many controls! Make a single control to contain all those status messages. How about a multi-line textbox?</p>
16,493
<p>Most wiki software I've presents lots of "features" on their pages. This is fine for desktop users, but is annoying when using an iPhone or other mobile device. <br /><br />I'd prefer pages that just had the content, along with maybe an Edit button and a Search button. The editors are also often too fancy for mob...
<p>There isn't really a right answer. This is what coding standards within the company are for. If you can keep it consistent across the whole company then it will be easy to read. I personally like</p> <pre><code>if ( a == b) { doSomething(); } else { doSomething(); } </code></pre> <p>but this is a hol...
<p>Our boss makes us put { } after a decision statement no matter what, even if it's a single statement. It's really annoying to add two extra lines. The only exception is ternary operators.</p> <p>I guess it's a good thing I have my code monitor in portrait orientation at 1200x1600.</p>
3,229
<p>Is there a way to make running junit test to stop after a test fails?</p>
<p>I know that in Ant, the junit task has options "haltonerror" and "haltonfailure" that controls this behavior.</p>
<p>I know that in Ant, the junit task has options "haltonerror" and "haltonfailure" that controls this behavior.</p>
22,868
<p>Have been trying out the new Dynamic Data site create tool that shipped with .NET 3.5. The tool uses LINQ Datasources to get the data from the database using a .dmbl context file for a reference. I am interseted in customizing a data grid but I need to show data from more than one table. Does anyone know how to do...
<p>If the tables are connected by a foreign key, you can easily reference both tables as they will be joined by linq automatically (you can see easily if you look in your dbml and there is an arrow connecting the tables) - if not, see if you can add one.</p> <p>To do that, you can just use something like this:</p> <p...
<p>You cannot put more than one object/datasource on a datagrid. You will have to build a single ConceptObject that combines the exposed properties of the part Entities. Try to use DB -> L2S Entities -> ConceptObject. You must be very contrived if the DB model matches the ConceptObject field-for-field.</p>
9,175
<p>This afternoon, upon noticing a broken build and the fact that some files looked like very old versions (about 2 weeks old), I checked the svn log. Apparently just this afternoon, 1 of the developers did an "svn copy" of a directory from an older revision to the same directory. Thus it appears that the latest vers...
<p>According to <a href="http://svnbook.red-bean.com/" rel="nofollow noreferrer">the SVN book</a>,</p> <pre><code>svn merge -c -1234 </code></pre> <p>should do the trick.</p> <p>There's a whole <a href="http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo" rel="nofol...
<p>Probably, but make a backup first.</p> <p>Actually, I'm left wondering why you don't have a daily backup that you can just restore from already... Your SVN repository is surely important enough for that?</p>
47,226
<p><em>First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc.</em></p> <p>I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable.</p> <p>...
<p>Hmm, protocol handlers look interesting.</p> <p>As <a href="https://stackoverflow.com/questions/37804/link-to-samba-shares-in-html#38258">Mark</a> said, in Windows protocol handlers can be dealt with at the OS level</p> <p>Protocol handlers can also be done at the browser level (which is preferred, as it is cross ...
<p>To make the links work cross platform you could look at the User Agent either in a CGI script or in JavaScript and update your URLs appropriately.</p> <p>Alternatively, if you want to consolidate SMB shares you could try using <a href="http://en.wikipedia.org/wiki/Distributed_File_System_(Microsoft)" rel="nofollow ...
5,860
<p>I am writing a diagnostic page for SiteScope and one area we need to test is if the connection to the file/media assets are accesible from the web server. One way I think I can do this is load the image via code behind and test to see if the IIS status message is 200. </p> <p>So basically I should be able to navi...
<p>Just use HEAD. No need to download the entire image if you don't need it. Here some boilerplate code.</p> <pre><code>HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("url"); request.Method = "HEAD"; bool exists; try { request.GetResponse(); exists = true; } catch { exists = false; } </co...
<p>I'd look into an HttpWebRequest instead - I think the previous answer will actually download data, whereas you should be able to get the response without data from HttpWebRequest.</p> <p><a href="http://msdn.microsoft.com/en-us/library/456dfw4f.aspx" rel="nofollow noreferrer"><a href="http://msdn.microsoft.com/en-u...
23,340
<p>I am using a simple <a href="http://framework.zend.com/manual/en/zend.auth.html" rel="noreferrer">Zend_Auth</a> setup to authenticate users for one of my applications, using a check in the preDispatch() method in a <a href="http://framework.zend.com/manual/en/zend.controller.plugins.html" rel="noreferrer">controller...
<p>I'm adding my own answer here, so its more obvious what I'm trying to find out. The current idea I have settled on would perform as follows:</p> <pre><code>my $html=&lt;&lt;'EOF' &lt;script&gt; //&lt;!--&lt;![CDATA[ foo //]]&gt;--&gt; &lt;/script&gt; EOF #/# this line is here for the syntax highlighter my $obj = pa...
<p>The only thing similar I can think of is in ASP.NET's register script block functions. They all have an overload that takes a bool for whether script tags should be added or not.</p> <p>Here's a link to the docs for one:</p> <p><a href="http://msdn.microsoft.com/en-us/library/bahh2fef.aspx" rel="nofollow noreferr...
36,034
<p>Except perhaps at bigger (or better) shops, the development UI is done by the developers. In your experience, how much has this impacted the final product, and how much time should we spend getting the development UI right?</p>
<p>The interface you're building and showing to your customers is basically all they will ever see. You can sit down with them and talk for hours about what the product is supposed to do, but the number one best method to have the users spot problems or missing functionality, is to show them the interface as it will lo...
<p>The interface you're building and showing to your customers is basically all they will ever see. You can sit down with them and talk for hours about what the product is supposed to do, but the number one best method to have the users spot problems or missing functionality, is to show them the interface as it will lo...
37,350
<p>I've just inherited some old Struts code.</p> <p>If Struts (1.3) follows the MVC pattern, how do the Action classes fill the View with variables to render in HTML ?</p> <p>So far, I've seen the Action classes push variables in <code>(1)</code> the HTTP request with</p> <pre><code>request.setAttribute("name", user...
<p>My Struts days are long over, but as far as I remember we used to place one view-specific bean (which would work as a holder for fine-graner beans or collections of beans) into the request scope within our Action.perform() implementation. This view-specific bean would then be rendered by the view.</p>
<p>My Struts days are long over, but as far as I remember we used to place one view-specific bean (which would work as a holder for fine-graner beans or collections of beans) into the request scope within our Action.perform() implementation. This view-specific bean would then be rendered by the view.</p>
10,806
<p>I'm currently using <code>std::ofstream</code> as follows:</p> <pre><code>std::ofstream outFile; outFile.open(output_file); </code></pre> <p>Then I attempt to pass a <code>std::stringstream</code> object to <code>outFile</code> as follows:</p> <pre><code>GetHolesResults(..., std::ofstream &amp;outFile){ float x...
<p>You can do this, which doesn't need to create the string. It makes the output stream read out the contents of the stream on the right side (usable with any streams).</p> <pre class="lang-cpp prettyprint-override"><code>outFile &lt;&lt; ss.rdbuf(); </code></pre>
<p>When passing a stringstream rdbuf to a stream newlines are not translated. The input text can contain <code>\n</code> so find replace won't work. The old code wrote to an fstream and switching it to a stringstream losses the endl translation. </p>
42,051
<p>I'm building some custom tools to work against a JIRA install, and the exposed SOAP API is great, except that none of the arguments are named.</p> <p>For example, the prototype for getIssue is:</p> <pre><code>RemoteIssue getIssue (string in0, string in1); </code></pre> <p>All of the SOAP RPC methods follow this c...
<p>Found the javadoc:</p> <p><a href="http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/index.html?com/atlassian/jira/rpc/soap/JiraSoapService.html" rel="noreferrer">http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/index.html?com/atlassian/jira/rpc/soap/JiraSoapService.html...
<p>The javadoc link you found is the correct one. You should also know that not everything is exposed via the SOAP or RPC interfaces, but you can do just about anything using the REST interface. Unfortunately, the REST interface isn't well documented, but you can use an HTML traffic inspector tool (like Fiddler for IE)...
35,225
<p>I have a client running a 1/2 dozen or so orchestrations running on Biztalk 2004 (that I wrote) that they use to exchange cXML documents (mostly too send orders) with their suppliers. It has a ASP.NET 1.1 front end. It uses the SQL adapter to store the parsed cXML. I gets &amp; sends the documents via HTTPS. </p> <...
<p>Based on your description of the problem, I'm betting that you're using IE as your test browser. The Response.Flush() <em>is</em> outputting HTML, but it will not display right away because IE doesn't know how to render a table incrementally. Instead, IE waits for the entire table to output before it draws it to the...
<p>Try outputting it as a table to the browser - I bet you get a "Script Timed Out" error.</p> <p>Best bet would be to up the timeout interval. You can do that with a bit of code at the start of the script or you can do that as a global server setting. I would recommend the former.</p>
40,861
<p>Subversion has a superb client on Windows (Tortoise, of course). Everything I've tried on Linux just - well - sucks in comparison....</p>
<p><em>Disclaimer: A long long time ago I was one of the developers for RabbitVCS (previously known as NautilusSvn).</em></p> <p>If you use Nautilus then you might be interested in <a href="http://rabbitvcs.org/" rel="noreferrer">RabbitVCS</a> (mentioned earlier by Trevor Bramble). It's an unadulterated clone of Torto...
<p>Since you're using Ubuntu, and not Kubuntu, I assume you're using GNOME. You might be interested in <a href="http://www.harecoded.com/nautilus-subversion-integration-tool-execute-svn-commands-with-gnome-scripts-96355" rel="nofollow noreferrer">Nautilus Subversion Integration</a> described on that link.</p>
11,208
<p>I have to do a college project using C++ that requires a GUI. I want to use Perl/Tk for the GUI, but I am not sure how to link the C++ to the Perl. The project requires being able to pass variables back and forth. Could anyone point me in the direction of some good tutorials/books for linking the two, or any ideas o...
<p>I'm <a href="http://www.perlfoundation.org/leon_timmermans_embedding_perl_into_c_applications" rel="nofollow noreferrer">working</a> on a <a href="http://code.google.com/p/libperl/" rel="nofollow noreferrer">library</a> to make that as simple as possible, but it's still an alpha version.</p>
<p>if its a small project, its probably not worth the investment to spend lots of time getting the two languages to talk. you might consider using a more appropriate tool. C# will talk to C++ with a lot less pain.</p>
26,038
<p>If I've created a label in TFS, assigning it to several files, my coworkers cannot change the versions of files (nor add other files) to that label. We get this error:</p> <pre><code>TF14077: The owner of a label cannot be changed. </code></pre> <p>Researching the problem, I found <a href="http://tinyurl.com/6zuw...
<p>Would shelve sets be a better solution for what you are doing? IIRC there is a fairly rich API for working with shelve sets such as committing them as part of a build (or other) process.</p> <p>I found labels in TFS to be very limited when I used it.</p>
<p>Would shelve sets be a better solution for what you are doing? IIRC there is a fairly rich API for working with shelve sets such as committing them as part of a build (or other) process.</p> <p>I found labels in TFS to be very limited when I used it.</p>
28,030
<p>I'm trying to extract the polygons from placemarks in a KML file. So far so good:</p> <pre><code>Imports &lt;xmlns:g='http://earth.google.com/kml/2.0'&gt; Imports System.Xml.Linq Partial Class Test_ImportPolygons Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System...
<p>What I was missing was that <code>Placemark.&lt;g:Polygon&gt;</code> is a collection of XElements, not a single XElement. This works:</p> <pre><code> For Each Placemark As XElement In Kml.&lt;g:Document&gt;.&lt;g:Folder&gt;.&lt;g:Placemark&gt; Dim Name As String = Placemark.&lt;g:name&gt;.Value D...
<p>I missed the Enumeration also. When using .Value it is possible to receive a null exception. Try the equivelent of this instead:</p> <pre><code>(string)Placemark.&lt;g:name&gt; </code></pre> <p>Sorry not sure of the VB syntax,,,it has been a while since I have coded in VB.</p>
18,516
<p>I'm trying to get a handle on if there's a good time to use standard linq keywords or linq extension methods with lambda expressions. They seems to do the same thing, just are written differently. Is it purely a matter of style?</p> <pre><code>var query = from p in Products where p.Name.Contains("foo") or...
<p>Honestly, sometimes it can be situational once you start using Funcs and Actions. Say you are using these three funcs:</p> <pre><code> Func&lt;DataClasses.User, String&gt; userName = user =&gt; user.UserName; Func&lt;DataClasses.User, Boolean&gt; userIDOverTen = user =&gt; user.UserID &lt; 10; Func&lt;DataCla...
<p>I like to use the query syntax when its really a query, ie a lazy expression which evaluates on demand. </p> <p>A method that looks like regular method calls (method syntax or the lambda syntax) doesn't look lazy enough, so I use that as a convention. For eg,</p> <pre><code>var query = from p in Products ...
35,356
<p>I'm trying to send the output to the console (or colouredconsole) ... which I'm hoping would (also?) go to the Visual Studio's <code>Output</code> window for any ASP.NET web site/app/mvc app.</p> <p>It doesn't by default, but if I change the target to 'file' then it works for sure.</p> <p>Can NLog output to the <cod...
<p>You can use this configuration file (nlog.config in the app path):</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;nlog xmlns=&quot;http://www.nlog-project.org/schemas/NLog.xsd&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt; &lt;targets&gt; ...
<p>Adding to Scott P's answer, you can add a filter for when the environment is not &quot;Development&quot; to prevent any slowdowns in Staging/Production etc.</p> <pre><code>&lt;logger name=&quot;*&quot; minlevel=&quot;Trace&quot; writeTo=&quot;debugger&quot;&gt; &lt;filters defaultAction=&quot;Ignore&quot;&gt; ...
31,453
<p>I'm making a program that fits the wizard concept ideally; the user is walked through the steps to create a character for a game.</p> <p>However, I'm realizing that the limitations of the wizard are making it difficult to design "elegant" logic flow. For example, because all pages of the wizard are initalized at th...
<p>Here is a simple example. This way you can make your "wizard" work like a finite state machine where states are different pages that are initialized on demand. Also, the data is shared between pages.</p> <pre><code>import wx import wx.lib.newevent (PageChangeEvent, EVT_PAGE_CHANGE) = wx.lib.newevent.NewEvent() ...
<p>You could try using a workflow engine like <a href="http://www.vivtek.com/wftk/" rel="nofollow noreferrer">WFTK</a>. In this particular case author has done some work on wx-based apps using WFTK and can probably direct you to examples.</p>
27,713
<p>On larger and/or long running projects, I tend to reference many assemblies and namespaces, and often I end up removing some functionality later on or moving it into a different project.</p> <p>I just wonder, is there a way to check every project (heck, every .cs file) in my whole Visual Studio solution and get a l...
<p><a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">Resharper</a> will do this for you and you can set it up in the Clean Code option that you can run solution wide ;o)</p>
<p>Yeah, i don't think there is one. I just delete some i don't think are needed then build :/</p> <p>BTW. that will keep using errors. You can use the <a href="http://www.visualstudiogallery.com/ExtensionDetails.aspx?ExtensionID=df3f0c30-3d37-4e06-9ef8-3bff3508be31" rel="nofollow noreferrer">Visual Studio Power comma...
12,189
<p>I've received some documentation from one of our suppliers for a webservice they're publishing and they're very specific that on one of their WebMethods that an argument has the out modifier(? not sure if that's the right descriptor) for instance consider the following WebMethod signature:</p> <pre><code>[WebMethod...
<p>I don't know what the protocol is for providing answers to your own questions, but the article referenced by Steven Behnke provided some clues for me to deduce a solution to this bizarre situation. And rather than leave everyone else to figure out what the implications are, I thought I share my findings.</p> <p>So, ...
<p>Maybe this will help:</p> <p><a href="http://kbalertz.com/322624/Proxy-Class-First-Parameter-Service-Method-Returns-Return-Value-Reference.aspx" rel="nofollow noreferrer">http://kbalertz.com/322624/Proxy-Class-First-Parameter-Service-Method-Returns-Return-Value-Reference.aspx</a></p> <p>My favorite part is:</p> <...
49,742
<p>I have the following HTML <code>&lt;select&gt;</code> element:</p> <pre><code>&lt;select id="leaveCode" name="leaveCode"&gt; &lt;option value="10"&gt;Annual Leave&lt;/option&gt; &lt;option value="11"&gt;Medical Leave&lt;/option&gt; &lt;option value="14"&gt;Long Service&lt;/option&gt; &lt;option value="17"&g...
<p>You can use this function:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function selectElement(id, valueToSelect) { let element = document.getElementById(id); ...
<p>I'm afraid I'm unable to test this at the moment, but in the past, I believe I had to give each option tag an ID, and then I did something like:</p> <pre><code>document.getElementById("optionID").select(); </code></pre> <p>If that doesn't work, maybe it'll get you closer to a solution :P</p>
10,438
<p>I'm trying to convert an HTML table to Excel in Javascript using new <code>ActiveXObject("Excel.application")</code>. Bascially I loop through table cells and insert the value to the corresponding cell in excel:</p> <pre><code>//for each table cell oSheet.Cells(x,y).value = cell.innerText; </code></pre> <p>The pro...
<p>In Vbscript, we use to resolve this by</p> <pre><code> If IsDate ( Cell.Value ) Then Cell.Value = DateValue ( Cell.Value ) End If </code></pre> <p>Maybe, In java script also you need to play with same approach.</p>
<p>I've tried your code but at end of the process, I re-applied format to the columns containing dates. It works fine, no matter what local language you have configurated yor machine.</p> <p>Being my excel object defined as 'template', as soon as I got it data filled, I applied (just for example):</p> <pre><code>temp...
49,811
<p>I look around and see some great snippets of code for defining rules, validation, business objects (entities) and the like, but I have to admit to having never seen a great and well-written business layer in its entirety.</p> <p>I'm left knowing what I don't like, but not knowing what a great one is.</p> <p>Can an...
<blockquote> <p>I’ve never encountered a well written business layer.</p> </blockquote> <p>Here is <a href="http://thedailywtf.com/Articles/The-Mythical-Business-Layer.aspx" rel="noreferrer">Alex Papadimoulis's take on this</a>:</p> <blockquote> <p><em>[...] If you think about it, virtually every line of code in ...
<p>Possibly because in reality we are never able to fully decouple the business logic from the "process", the inputs, outputs, interface and that ultimately people find it hard to deal with the abstract let alone relating it back to reality. </p>
24,376
<p>Hi I'm very new to sql but have been passed a job in which I need to query the db(MS SQL 2005) I need to return all workers where a HeadID is given.(tables below) So I need to get all the managers that match the HeadID and then all the workers that match those managers by ManagerID. How would I do this? Any help or ...
<p>A simple way would be to do something like this:</p> <pre><code>select * from tb_Worker join tb_Manager on tb_Worker.ManagerID = tb_Manager.ManagerID join tb_Head on tb_Manager.HeadID = Head.HeadID where tb_Head.HeadID = &lt;given value&gt; </code></pre> <p>Tune your table names and select columns as appropr...
<p>Sounds like you want to use a recursive CTE. The <a href="http://msdn.microsoft.com/en-us/library/ms186243.aspx" rel="nofollow noreferrer">books online article</a> talks about your kind of scenario. Here's a sample set of code that I just used in a different stackoverflow article...</p> <pre><code>CREATE TABLE db...
49,375
<p>When using webforms the appropriate place to assign master pages to a page dynamically seems to be the pages PreInit event: </p> <pre><code>this.Master.MasterPageFile = "~/leaf.Master" </code></pre> <p>If nessasary, master pages in a hierarchy of nested master pages may be set here too:</p> <pre><code>this.Master...
<p>It isn't entirely clear what you mean by "higher up in the hierarchy," but if you mean, "in one place, rather than in every controller I create," I can think of two options:</p> <ol> <li><p>Create an abstract controller supertype and subclass your concrete controllers from that.</p></li> <li><p><a href="http://webl...
<p>There is no facility for this in MVC today.</p>
26,833
<p>i want ask some question about asp.net mvc</p> <ol> <li>Is static constructor will init every user request?</li> <li>Is static data share for every user?</li> </ol>
<p>This answer is completely generic and not only for ASP.NET MVC.</p> <ol> <li><p>Static constructors will run at most once per application domain. It's guaranteed that it's run before any static or instance member access for that class. So no, it won't be called for every request.</p></li> <li><p>Yes, static data is...
<p>If I understand your question correctly:</p> <ol> <li>Yes, you have a global.aspx that contain eventhandlers for what you are looking for.</li> <li>Application cache would give you what you are looking for. Application.Cache or something I can't type from memory...</li> </ol> <p>Cheers and merry christmas (if appl...
49,835
<p>I want to download this open source application, and they are using Git. What do I need to download the code base?</p> <p><b>Update</b> How do I change the working directory when I am using Git Bash? (I want to download the repo at a certain directory, using pwd tells me I will be downloading the repo where I don...
<p>Download <a href="http://code.google.com/p/msysgit/" rel="noreferrer">Git on Msys</a>. Then:</p> <pre><code>git clone git://project.url.here </code></pre>
<p>To change working directory in GitMSYS's Git Bash you can just use <code>cd</code></p> <p>cd /path/do/directory</p> <p>Note that:</p> <ul> <li>Directory separators use the forward-slash (<code>/</code>) instead of backslash.</li> <li>Drives are specified with a lower case letter and no colon, e.g. "<code>C:\stuff...
13,542
<p>If I pass a ClientID to a javascript function as a parameter without including the single quotes around it, it gets passed as a reference to the control itself which can then be used without first calling getElementByID.</p> <p>I can't find this behaviour documented anywhere, is this a browser specific thing or a ....
<p>Add quotes around your ID value when you generate the JS code e.g: string.Format("showvalue(<strong>'</strong>{0}<strong>'</strong>)", TextBox1.ClientID)</p> <p>Without quotes, showValue gets an instance of the global variable with your ClientID name that usually is the DOM element your control rendered.</p>
<p>If you pass it with single quotes and use getElementByID it should work in all browsers, that's the "normal" way.</p> <p>I'm not sure why this method works as you say. Does it also work in Firefox?</p>
44,686
<p>Forgive me if this verges on being a "discussion" question, but I really would appreciate a yes/no answer, with an appropriate explanation. </p> <p>Suppose you have to design and implement a control API for a robot, say the next generation Mars Rover. Do you architect this API according to RESTful principles, ...
<p>I think REST would make more sense than traditional RPC. Even the <a href="http://msdn.microsoft.com/en-us/library/bb466255.aspx" rel="noreferrer">Micorosft Robotics Studio runtime application model</a> uses REST.</p> <p>The robot can consist of different resources that are identified by URI, including one for each...
<p>REST principles ensure that your application scales well, and plays well with intermediaries across the internet, (proxies, caching, etc). If your "virtual machine" network is large scale then a RESTful architecture could be advantageous. If you are building a small-scale network, then REST would not be as compellin...
22,470
<p>I am looking for a backend solution for an application written in Ruby on Rails or Merb to handle data with several billions of records. I have a feeling that I'm supposed to go with a distributed model and at the moment I looked at </p> <p><a href="http://hadoop.apache.org/hbase/" rel="nofollow noreferrer">HBase</...
<p>Depending on your actual data usage, MySQL or Postgres should be able to handle a couple of billion records on the right hardware. If you have a particular high volume of requests, both of these databases can be replicated across multiple servers (and read replication is quite easy to setup (compared to multiple mas...
<p>The backend will depend on the data and how the data will be accessed.</p> <p>But for the ORM, I'd most likely use DataMapper and write a custom DataObjects adapter to get to whatever backend you choose.</p>
32,944
<p>How do I transfer the users of a vBulletin forum to a new installation of IceBB?</p>
<p>This problem occurs when leaving a page in Firefox before all scripts have finished loading. So I assume that it is safe to ignore the error.</p> <p>You don't see this error in the Firefox error console, but you can make it visible by binding an alert to the window.onerror event. Then you will be able to see the al...
<p>I'm sure this is long resolved.. but to anyone who stumbles across this page: this error is triggered by firefox when an external script fails to load (it's easy to find the code that triggers this in the source code). We were catching these errors on our site and it turned out that we were returning 404s for the sc...
23,399
<p>I have a Python application in a strange state. I don't want to do live debugging of the process. Can I dump it to a file and examine its state later? I know I've restored corefiles of C programs in gdb later, but I don't know how to examine a Python application in a useful way from gdb.</p> <p>(This is a variat...
<p>There is no builtin way other than aborting (with os.abort(), causing the coredump if resource limits allow it) -- although you can certainly build your own 'dump' function that dumps relevant information about the data you care about. There are no ready-made tools for it.</p> <p>As for handling the corefile of a P...
<p><a href="https://stackoverflow.com/questions/141351/how-do-i-find-what-is-using-memory-in-a-python-process-in-a-production-system#142571">This answer</a> suggests making your program core dump and then continuing execution on another sufficiently similar box.</p>
17,139
<p>Is it possible to send a UDP broadcast packet to a different subnet through a router? I'm writing an app to discover certain devices on the network, and the PC might be on a different subnet than the devices it's looking for.</p>
<p>Yes, and no.</p> <p>It's actually do-able, so long as the intervening routers don't have <code>no ip directed-broadcasts</code> or similar configured. However these days that's the default because allowing normal broadcasts to traverse routers is a DoS problem.</p> <p>If you really want to broadcast across subnet...
<p>Greetings Jon,</p> <p>Cisco routers usually contain a UDP IP Helper address mode that you can use to cross the subnet. </p>
49,652
<p>Here's the deal. </p> <p>My WinApp is running, right? in let's say process 'A'.It creates a file and keeps the handle (keeps the file open for writing, this is a must).<br> Then it starts other msbuild process, let's call it 'B'. This process is started with the <a href="http://msdn.microsoft.com/en-us/library/sys...
<p>It looks like <code>System.Diagnostic.Process.Start</code> calls <a href="http://msdn.microsoft.com/en-us/library/ms682425.aspx" rel="nofollow noreferrer">CreateProcess</a> with the <code>bInheritHandles</code> argument set to <code>true</code>.</p> <p>You could try setting <code>UseShellExecute</code> to true in <...
<p>It is possible to force a file handle closed without closing the process is using the handle, though this might cause the application to crash. In other words, doing what you wannt to do may cause 'B' to crash. That said, what you are asking for is definitely possible, since the application, <a href="http://forum....
49,527
<p>I have a WinForms C# application using a MS SQL Server Express database. The application is deployed on the PCs of our customers and they don't have computer related knowledge. </p> <p>The application updates the database regularly and I see a lot of fragmentation on the index files. How do I keep the database heal...
<p>Use the DBCC REINDEX option if you can afford to take the table offline for a short while, alternatively DBCC INDEXDEFRAG. The IndexDefrag option has been depracted though. You can also use the ALTER INDEX statement in SQL 2005/2008.</p>
<p>Also make sure that your database FILE is less prone to fragmentation. This is admittedly very tough to do, since you don't know what the layout of your customers' drives are, but I suggest starting your .MDB file off at a reasonably large initial size to prevent online rebuilds, which suck time and resources, and ...
29,623
<p>I'm looking for suggestions on possible IPC mechanisms that I can implement in my self-made OS for an AVR32 board. </p> <p>My current choice is implementing the massage passing mechanism described in the books written by Tanenbaum. </p> <p>Is this a good choice? Are there easier way to implement IPC?</p> <p>Thank...
<p>My suggestion is to review the message passing primitives that QNX RTOS (www.qnx.com) supports before making any decisions. I spent several years programming a complex multi-process system in that environment, and it stands out as the best message-based O/S I have ever encountered.</p> <p>Some specific points that...
<p>Perhaps the <a href="http://www.zeromq.org/" rel="nofollow noreferrer">ZeroMQ</a> project can be an alternative for you?</p>
32,714
<p>I would like to edit XHTML files using Emacs' <a href="http://www.emacswiki.org/emacs/NxmlMode" rel="nofollow noreferrer">nxml-mode</a> which can use <a href="http://infohost.nmt.edu/tcc/help/pubs/rnc/" rel="nofollow noreferrer">rnc</a> schemas for on the fly validation. This is all built in to newer Emacs versions....
<p>You put a Unique constraint on contentID, tagID.</p> <p>For SQL Server</p> <pre><code>ALTER TABLE ContentTag ADD CONSTRAINT IX_ContentID_TagID_Unique UNIQUE NONCLUSTERED ( contentID, tagID ) GO </code></pre>
<p>Consider this problem:</p> <p>Table A has 2 child tables ( B &amp; C )</p> <p>The PK of B and C is an identity, and they both have a FK back to Table A.</p> <p>I have a table D, which is a join table on B and C </p> <p>Table D has PK of an identity and FK's back to B and C.</p> <p>A ..... two rows ... A1 and A2...
36,283
<p>How do I end a Tkinter program? Let's say I have this code:</p> <pre><code>from Tkinter import * def quit(): # code to exit root = Tk() Button(root, text="Quit", command=quit).pack() root.mainloop() </code></pre> <p>How should I define the <code>quit</code> function to exit my application?</p>
<p><strong>You should use <code>destroy()</code> to close a Tkinter window.</strong></p> <pre class="lang-py prettyprint-override"><code>from Tkinter import * #use tkinter instead of Tkinter (small, not capital T) if it doesn't work #as it was changed to tkinter in newer Python versions root = Tk() Button(root, text=...
<p>There is a simple one-line answer:</p> <p>Write - <code>exit()</code> in the command</p> <p>That's it!</p>
13,610
<p>I got my first printer, a <a href="https://www.amazon.de/dp/B075FQRNY3/ref=pe_3044161_189395811_TE_SCE_3p_dp_1" rel="nofollow noreferrer">Geeetech Prusa i3</a>, and for the price I paid (160$) I am so blown away. As I saved so much money, I treated myself to a legit copy of Simplify3D, which I am happy with.</p> <p...
<p>A nozzle with a nozzle <strong>width</strong> of 0.3 mm cannot print a 0.3 mm layer <strong>height</strong>. You <em>could</em> do that but you <em>should</em> not as you ultimately pay the price in the form of a less aesthetic finish. The general rule of thumb is to maximize the layer height at 75 % of the nozzle w...
<p>I fixed it!</p> <p>The problem wasn't the temperature, it was the spring that puts the pressure on the little wheel against the gear. That was too strong, so the entry of the extruder was to tight. The gear worked fine and the settings worked well, I just had to adjust the spring a bit to carefully lower the pressu...
1,063
<p>I think I might be missing something here. Here is the relevant part of the trigger:</p> <pre><code> CURSOR columnNames (inTableName IN VARCHAR2) IS SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME = inTableName; /* Removed for brevity */ OPEN columnNames('TEMP'); </code></pre> <p>And her...
<p>To clarify the cause of the issue. As you state </p> <p><strong>OPEN columnNames('TEMP');</strong> </p> <p>worked while </p> <p><strong>FOR columnName IN columnNames LOOP</strong></p> <p>did not. The FOR statement would work fine if it also included the parameter like so:</p> <p><strong>FOR columnName IN column...
<p>Works fine for me.</p> <pre><code>create or replace procedure so_test_procedure as CURSOR columnNames (inTableName IN VARCHAR2) IS SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME = inTableName; BEGIN OPEN columnNames('TEMP'); CLOSE columnNames; END; procedure so_test_procedure Compiled. ex...
6,546
<p>I have used getopt in Python and was hoping there would be something similar in Java.</p> <p>Please give a reason why your answer is better than the others.</p>
<p><a href="http://commons.apache.org/cli/" rel="nofollow noreferrer">Commons CLI</a></p>
<p><a href="https://github.com/kohsuke/args4j" rel="nofollow noreferrer">https://github.com/kohsuke/args4j</a> -- has pretty good features PLUS MIT license</p>
25,474
<p>What is prefered way of setting html title (in head) for view when using master pages?</p> <p>One way is by using Page.Title in .aspx file, but that requires in master page which can mess with HTML code. So, lets assume no server side controls, only pure html. Any better ideas? </p> <p>UPDATE: I would like to set...
<p>In our master pages, we created both an "init" ContentPlaceHolder, and a "title" ContentPlaceHolder. If someone wants to programatically set Page.Title, they can set it in CSharp in the init placeholder, or they can override the "title" placeholder using tags. </p> <p><strong>Master Page</strong></p> <pre><code>&...
<p>There is a Title property of the @Page directive for content pages.</p>
42,318
<p>I'm currently working on a project for medical image processing, that needs a huge amount of memory. Is there anything I can do to avoid heap fragmentation and to speed up access of image data that has already been loaded into memory?</p> <p>The application has been written in C++ and runs on Windows XP.</p> <p><s...
<p>If you are doing medical image processing it is likely that you are allocating big blocks at a time (512x512, 2-byte per pixel images). Fragmentation will bite you if you allocate smaller objects <em>between</em> the allocations of image buffers.</p> <p>Writing a custom allocator is not necessarily hard for this pa...
<p>If you can isolate exactly those places where you're likely to allocate large blocks, you can (on Windows) directly call VirtualAlloc instead of going through the memory manager. This will avoid fragmentation within the normal memory manager.</p> <p>This is an easy solution and it doesn't require you to use a custo...
18,177
<p>I printed out this calibration shape from <a href="https://www.thingiverse.com/thing:2656594" rel="nofollow noreferrer">Thingiverse</a> with an unexpectedly catastrophic failure. It looks like there are <em>a lot</em> of things wrong here.</p> <p><img src="https://i.stack.imgur.com/V7QlZ.jpg" alt="Front View"> <im...
<p>The oozing is due to hot-end getting hot before the bed leveling procedure: if you move the hot-end warm up command <strong>after</strong> the <code>G29</code> line you avoid that oozing</p> <pre><code>; Ender 3 Custom Start G-code M104 S{material_print_temperature_layer_0} ; Set Extruder temperature M140 S{materia...
<p>The best solution would be to heat the bed, but not the nozzle at startup. If you level with a cold bed, your ABL mesh is going to be off, since the aluminum heated bed plate expands considerably once the heat is applied. </p> <p>You could also issue a retract command before leveling, and then add a counteracting...
1,143
<p>In jQuery, is there a function/plugin which I can use to match a given regular expression in a string?</p> <p>For example, in an email input box, I get an email address, and want to see if it is in the correct format. What jQuery function should I use to see if my validating regular expression matches the input?</p...
<p>I believe this does it:</p> <p><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="noreferrer">http://bassistance.de/jquery-plugins/jquery-plugin-validation/</a></p> <p>It's got built-in patterns for stuff like URLs and e-mail addresses, and I think you can have it use your own as well.</...
<p>From jquery.validate.js (by joern), contributed by Scott Gonzalez: <a href="http://projects.scottsplayground.com/email_address_validation/" rel="nofollow">http://projects.scottsplayground.com/email_address_validation/</a></p> <pre><code>/^((([a-z]|\d|[!#\$%&amp;'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uF...
44,913
<p>Mending a bug in our SAP BW web application, I need to call two javascript functions from the web framework library upon page load. The problem is that each of these functions reloads the page as a side-effect. In addition, I don't have access to modify these functions.</p> <p>Any great ideas on how to execute a pi...
<p>A cookie would work just fine. Or you could modify the query string each time with a "mode=x" or "load=x" parameter.</p> <p>This would present a problem if the user tries to bookmark the final page, though. If that's an option, the cookie solution is fine. I would guess they need cookies enabled to get that far in ...
<p>Use a cookie or set a hidden field value. My vote would be for the field value.</p>
13,972
<p>I'm new to log4net, so hopefully this is a really easy question for someone?!</p> <p>I've got log4net working with the RollingLogFileAppender for my web application. I'm using logging to try and find where some performance issues are coming from. In order to do this, it'd be useful to include the ASP.NET SessionI...
<p><strong>UPDATE (2014-06-12):</strong> Starting from log4net 1.2.11 you can use <code>%aspnet-request{ASP.NET_SessionId}</code> in conversion pattern for this purpose.</p> <p>References: <a href="https://issues.apache.org/jira/browse/LOG4NET-87" rel="noreferrer">https://issues.apache.org/jira/browse/LOG4NET-87</a> <...
<p>You can try:</p> <pre><code>&lt;conversionPattern value="%date %-5level %logger ${COMPUTERNAME} [%property{SessionID}] - %message%newline" /&gt; </code></pre> <p>...in your Web.config, and in Global.asax.cs:</p> <pre><code>protected void Session_Start(object sender, EventArgs e) { log4net.ThreadContext.Pr...
47,308
<p>Is there a fix or a workaround for the memory leak in getpwnam?</p>
<p><code>getpwnam()</code> <strong>does not</strong> suffer of memory leak. Subsequent calls, indeed, will overwrite its static internal buffer. </p> <p>Such kind of functions are instead <em>non-reentrant</em> and therefore <em>non-thread safe</em>. Paul suggested the use of <code>getpwnam_r()</code> which is the ree...
<p>To fix this just do:</p> <pre><code>sudo sed -i s/compat/files/g /etc/nsswitch.conf </code></pre> <p>It appears that this is caused because of a bug in libnss_compat. More info at <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=273051" rel="nofollow">bugs.debian.org</a>.</p>
22,866
<p>I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like "latest news" "upcoming events"...).</p> <p>So the question is: Portlets, tiles or some other technology?</p>
<p>If you are using Spring MVC, then I would recommend using Portlets. In Spring, portlets are just lightweight controllers since they are only responsible for a fragment of the whole page, and are very easy to write. If you are using Spring 2.5, then you can enjoy all the benefits of the new annotation support, and th...
<p><a href="http://tapestry.apache.org" rel="nofollow noreferrer">Tapestry</a> is a Java web app framework with an emphasis on easily creating reusable components.</p> <p>I have used sitemesh, and it is good for wrapping a set of pages in standard headers and footers, but Tapestry is better for creating components whi...
9,721
<p>I am restricted to C (cannot use C++). I wish C had stricter type checking.</p> <p>Is there a way to get compile errors on the commented lines? If it helps, the enum values cannot overlap.</p> <hr> <pre><code>enum hundred { VALUE_HUNDRED_A = 100, VALUE_HUNDRED_B }; enum thousand { VALUE_THOUSAND_A = ...
<p>In C, enum types are indistinguishable from integers. Very annoying.</p> <p>The only way forward I can think of is a kludgy workaround using structs instead of enums. Structs are generative, so the hundreds and thousands are distinct. If the calling convention is sensible (AMD64) there will be no run-time overhe...
<p>I would argue that the problem isn't as much that C doesn't support strict type checking, as it's that it really doesn't support true user-defined types.</p> <p>My guess is that most C compilers would translate both of your enums into simple ints or shorts or whatever, and would not do anything beyond that.</p> <p...
47,615
<p>In Ruby, given an array in one of the following forms...</p> <pre><code>[apple, 1, banana, 2] [[apple, 1], [banana, 2]] </code></pre> <p>...what is the best way to convert this into a hash in the form of...</p> <pre><code>{apple =&gt; 1, banana =&gt; 2} </code></pre>
<p><strong>NOTE</strong>: For a concise and efficient solution, please see <a href="https://stackoverflow.com/a/20831486/332936">Marc-André Lafortune's answer</a> below.</p> <p>This answer was originally offered as an alternative to approaches using flatten, which were the most highly upvoted at the time of writing. I...
<p>If the numeric values are seq indexes, then we could have simpler ways... Here's my code submission, My Ruby is a bit rusty</p> <pre><code> input = ["cat", 1, "dog", 2, "wombat", 3] hash = Hash.new input.each_with_index {|item, index| if (index%2 == 0) hash[item] = input[index+1] } hash #=&gt;...
6,067
<p>If host my WCF services in IIS7 or WPAS, is it possible to load up two or more services into the same AppDomain so that they can share static variables?</p>
<p>Sure you can expose as many Endpoints within a <strong>Web Application</strong> as you want (even of different WCF Services). This should not be limited to either IIS or WPAS.</p> <p>Doing so will enable you to access <strong>any kind of shared data</strong>. Even though I would normally advise against using static...
<p>Yes you can do it in both IIS and WPAS. But the only way of doing that is compiling both services in the same assembly, AFAIK.</p>
43,237
<p>I am working on a project that is going to use CouchDB for flexible storage of documents. The requirements of my system are a neat match for CouchDB for storage.</p> <p>BUT</p> <p>My question really boils down to this: Should I keeop using ActiveRecord and MySQL as well ... there are a raft of handy Plugins that a...
<p>It is not uncommon to have to deal with several persistent stores in a single application. A very common approach is to use a relational database that stores paths pointing to files that are stored in a file system.</p> <p>So you might think as CouchDB as a special "file system" for a special part of your data mode...
<p>You can use both; Some models can still be ActiveRecord, and others can be CouchDB.</p>
25,948
<p>I was looking out for a free plugin for developing/debugging JSP pages in eclipse.<br> Any suggestions? </p>
<p>The <a href="http://wiki.eclipse.org/Category:Eclipse_Web_Tools_Platform_Project" rel="noreferrer">Eclipse Web Tools Platform Project</a> includes a JSP debugger. I have only ever needed to use it with Tomcat so I cannot say how well it works with other servlet containers.</p>
<p>The former BEA Workshop is now <a href="http://www.oracle.com/technology/software/products/ias/bea_main.html#devtools" rel="nofollow noreferrer">Oracle Workshop</a>. It is the best JSP editor with WYSIWYG support and it is free. It is not specific to WebLogic. Basic JSP editing is server neutral anyway. However, it ...
7,064
<p>We have a custom-built Flash-based video player that I maintain, and it needs to support preroll ads and ideally both progressive video playback and streaming depending on a server switch.</p> <p>I've been working with the flvPlayback component but am finding myself a little out of my depth. Are there any good tuto...
<p>I would definitely have a look at the JW Flash Media Player:</p> <p><a href="http://www.jeroenwijering.com/?item=JW_FLV_Player" rel="nofollow noreferrer">http://www.jeroenwijering.com/?item=JW_FLV_Player</a></p> <p>It's Open Source, and I found the Source quite clean and easy to understand, it also supports playli...
<p>I don't really like the flvPlayback-component, it's hard to handle both implementation wise and somewhat tricky to skin nicely and it's also quite bloated. So I'd opt to use either the JW Flash Media Player as recommended by Michael above or rolling my own entirely. </p>
2,926
<p>Assuming such a query exists, I would greatly appreciate the help.</p> <p>I'm trying to develop a permissions script that will grant "select" and "references" permissions on the user tables and views in a database. My hope is that executing the "grant" commands on each element in such a set will make it easier to ...
<pre><code>select * from information_schema.tables WHERE OBJECTPROPERTY(OBJECT_ID(table_name),'IsMSShipped') =0 </code></pre> <p>Will exclude dt_properties and system tables</p> <p>add </p> <pre><code>where table_type = 'view' </code></pre> <p>if you just want the view</p>
<pre><code>select * from information_schema.tables where table_type = 'view' </code></pre>
5,324
<p>From time to time I see an enum like the following:</p> <pre><code>[Flags] public enum Options { None = 0, Option1 = 1, Option2 = 2, Option3 = 4, Option4 = 8 } </code></pre> <p>I don't understand what exactly the <code>[Flags]</code> attribute does.</p> <p>Anyone have a good explanation or...
<p>The <code>[Flags]</code> attribute should be used whenever the enumerable represents a collection of possible values, rather than a single value. Such collections are often used with bitwise operators, for example:</p> <pre><code>var allowedColors = MyColor.Red | MyColor.Green | MyColor.Blue; </code></pre> <p>Note...
<ul> <li><p>Flags are used when an enumerable value represents a collection of enum members.</p> </li> <li><p>here we use bitwise operators, | and &amp;</p> </li> <li><p>Example</p> <pre><code> [Flags] public enum Sides { Left=0, Right=1, Top=2, Bottom=3 } Sides leftRight = Sides....
2,987
<p>Background: I am developing a site in Asp.net 2.0 . Up until now i was handling both the design and development of the site. I used css for the design part. Now the company wants to outsource the design work to a web designer. </p> <p>Question: How exactly are a designer and developer supposed to coordinate What...
<p>Mayn people may not like my answer, but in my experience it works best if the designer gives you the stylesheet together with a template for the HTML/XML page. Then you incorporate your ASP.NET into that template.</p> <p>You can see this as one of the few cases where function follows form ;-)</p>
<p>Make sure the designer doesn't put anything that he thinks is fancy and well animated. Many a times, it becomes a big pain to simulate such effects in ASP.net unless you are a pro with CSS or Javascript.</p> <p>Coordination between designer and developer is a must according to me, so I would prefer to sit close to ...
17,861
<p>This code does not seem to compile, I just need to write something to a small log text file (a new row to end of file).</p> <pre><code>&lt;%@ Import Namespace="System.IO" %&gt; void Page_Load( object sender, EventArgs e ){ FileSystem myFileSystem = new FileSystem(); myFileSystem.WriteAllText(logFile, hash...
<p>I can't see any class called FileSystem in <a href="http://msdn.microsoft.com/en-us/library/system.io.aspx" rel="nofollow noreferrer">the <code>System.IO</code> namespace</a>. Is this something new in .NET 4.0 which you're trying to use?</p> <p>Note that the <a href="http://msdn.microsoft.com/en-us/library/system.i...
<p>This one seem to compile:</p> <pre><code>File myFileSystem = new File(); myFileSystem.AppendAllText(logFile, hash, false); </code></pre>
35,065
<p>I have a problem that I would like have solved via a SQL query. This is going to be used as a PoC (proof of concept).</p> <p>The problem:</p> <p>Product offerings are made up of one or many product instances, a product instance can belong to many product offerings. This can be realised like this in a table:</p> <...
<p>Okay, I think I have it. This meets the constraints you provided. There might be a way to simplify this further, but it ate my brain a little:</p> <pre><code>select distinct PO from POPI x where PO not in ( select PO from POPI where PI not in (10,11,12) ) and PI not in ( select PI ...
<p>IMHO impossible via pure SQL without some stored-procedure code. But... i'm not sure.</p> <p><b>Added:</b> On the other hand, I'm getting an idea about a recursive query (in MSSQL 2005 there is such a thing, which allows you to join a query with it's own results until there are no more rows returned) which might "g...
49,510
<p>Im trying to put an html embed code for a flash video into the <code>rss feed</code>, which will then be parser by a parser <code>(magpie)</code> on my other site. How should I encode the embed code on one side, and then decode it on the other so I can insert clean html into the <code>DB</code> on the receiving serv...
<p>Since RSS is XML, you might want to check out CDATA, which I believe is valid in the various RSS specs.</p> <p>&lt;summary>&lt;![CDATA[Data Here]]></p> <p>Here's the w3schools entry on it: <a href="http://www.w3schools.com/XML/xml_cdata.asp" rel="nofollow noreferrer">http://www.w3schools.com/XML/xml_cdata.asp</a><...
<p>htmlencode/htmldecode should do the trick.</p>
13,810
<p>More specifically, when the exception contains custom objects which may or may not themselves be serializable.</p> <p>Take this example:</p> <pre><code>public class MyException : Exception { private readonly string resourceName; private readonly IList&lt;string&gt; validationErrors; public MyException...
<h2>Base implementation, without custom properties</h2> <p><strong><em>SerializableExceptionWithoutCustomProperties.cs:</em></strong></p> <pre><code>namespace SerializableExceptions { using System; using System.Runtime.Serialization; [Serializable] // Important: This attribute is NOT inherited from E...
<p>I have to think that wanting to serialize an exception is a strong indication that you're taking the wrong approach to something. What's the ultimate goal, here? If you're passing the exception between two processes, or between separate runs of the same process, then most of the properties of the exception aren't go...
12,009
<p>I have a simple query like this:</p> <pre><code>select * from mytable where id &gt; 8 </code></pre> <p>I want to make the 8 a variable. There's some syntax like </p> <pre><code>declare @myvar int myvar = 8 </code></pre> <p>but I don't know the exact syntax.</p> <p>What is it?</p> <p>Thanks!</p>
<p>It's:</p> <pre><code>DECLARE @MyVariable INT SET @MyVariable = 8 </code></pre>
<pre><code>declare @myvar int select @myvar = 8 </code></pre>
27,560
<p>I am getting the following error when trying to <code>Save as Document Object</code> while trying to implement a word automation in C#:</p> <blockquote> <pre><code>System.Runtime.InteropServices.COMException </code></pre> <p>(0x80020005): Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMA...
<p>'Tis painful. I remember getting that working with the Word/Excel Interop. Not to be flippant, but one of the parameters has an incorrect type. Hopefully the following helps, but I did a number of these types of definitions.</p> <pre><code>static object s_missing = System.Reflection.Missing.Value; static object s_t...
<p>You cannot pass null into any of the interop function call - use Missing.Value instead (as suggested by Kenny)</p>
38,226
<p>When it comes to code launches how do you handle developer access to the server? Do they have RDP access to the machines to deploy code and make changes? Are they only given ftps access to the servers docroots and any .NET configuration changes are handled by the sysadmins? Do the developers even have access to t...
<p>The best setups I have worked with has a 3 level hierarchy:</p> <ul> <li>DEV - Developers have complete access to these server(s).</li> <li>STAGE - This is for developers and QA.</li> <li>LIVE - Only sysadmins and build engineers touch these.</li> </ul> <p>This will also depend on the company's budget and mindset....
<p>I have full and complete access to every production server my company houses. But we are an extremely small company and I do a lot of the sysadmin work as well as all the development work.</p>
34,535
<p>I'm working on writing a kernel, and I have a few friends working with me on the project. We've been using DJGPP to compile the project for a while, but we're having some cross-platform compatibility issues with compiling this way that have left my main Partnet on the project unable to compile on Windows XP. (DJGPP'...
<p>You are probably passing the wrong object type to nasm with the -f option.</p> <p>I'll bet you're passing -f coff.</p> <p>You will need to pass -f win32.</p>
<p>Are you using NASM compiled for DOS or for Windows? I did not look, but it is possible that there is a difference. Also, if your NASM is too old, it might not be able to generate something MinGW can understand.</p> <p>A quick Google search found a <a href="http://osdir.com/ml/video.x264.devel/2005-03/msg00033.html"...
32,107
<p>What are the steps to estimating using function points?</p> <p>Is there a quick-reference guide of some sort out there?</p>
<p>I took a conference session on Function Point Analysis a few years back. There is a lot too it. You can check out the <a href="http://www.softwaremetrics.com/freemanual.htm" rel="noreferrer">Free Function Point Training Manual</a> online, the <a href="http://www.softwaremetrics.com/fpafund.html" rel="noreferrer">F...
<p>I recommend you take a look at COSMIC Function points. <a href="https://cosmic-sizing.org" rel="nofollow noreferrer">https://cosmic-sizing.org</a>. COSMIC Function points are also an ISO standard for measuring software size. They are an evolved improvement over IFPUG.</p> <p>You can quickly estimate size by counti...
10,389
<p>We have an "engine" that loads dlls dynamically (whatever is located in a certain directory) and calls Workflow classes from them by way of reflection.</p> <p>We now have some new Workflows that require access to a database, so I figured that I would put a config file in the dll directory.</p> <p>But for some reas...
<p>If your code sample for reading the AppSettings is in your DLL, then it will attempt to read the config file for the application and not the config file for the DLL. This is because you're using Reflection to execute the code. </p>
<p>If I recall correctly, the app.config will be loaded from your application directory, so if you are loading dlls from some other directory, you'll want the keys they need in your application's config file.</p>
18,727
<p>(I'll begin by making it clear, I am not a .NET developer and am not tied to any other environment.)</p> <p>Recently, I heard that the London Stock Exchange went down for an entire day. I've also heard that the software was written in .NET. Up to this point they would experience performance hits on busy days. Peopl...
<p>Honestly, I think it boils down to code optimization, apart from just the infrastructure.</p> <p>In <a href="https://blog.stackoverflow.com/2008/08/podcast-19/">StackOverflow Podcast 19</a>, Jeff discussed about how they had to tweak SQL Server to handle the kinds of loads StackOverflow has; notice that it was not ....
<p>It really bothers me when people say .NET is a platform of choice because 'its scalable', its no more or less scalable than any other platform: PHP, ColdFusion, JSP or native compiled apps with C++/Delphi etc... Scalability isn't a feature of the framework, it's a feature of the application design.</p> <p>MySpace ...
7,850
<p>What is the syntax to concatenate text into a binding expression for an asp.net webpage (aspx).</p> <p>For example if I had a hyperlink that was being bound like this:</p> <pre><code>&lt;asp:HyperLink id="lnkID" NavigateUrl='&lt;%# Bind("Link") %&gt;' Target="_blank" Text="View" runat="ser...
<p>Use Eval instead.</p> <pre><code>Text='&lt;%# Eval("ID", "{0} View") %&gt;' </code></pre> <p>Eval is also better if the value is not going to be updated, where Bind allows two way data binding.</p>
<p>You could use the following:</p> <pre><code>CommandArgument='&lt;%#String.Format("{0}|{1}", Eval("ArgZero"), Eval("ArgOn"))%&gt;' </code></pre>
47,094
<p>I have a C# application where i want to implement a logic for a programm which will open the word document and go to a certain place in the page and create a Table and put values in that. Can any one tell me how to implement this. I am using Visual studio 2005 </p>
<p>Here is code to copy datagridview to a word table:</p> <p>Reference is Microsoft.Office.Interop.Word C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office12\Microsoft.Office.Interop.Word.dll</p> <pre><code>using word = Microsoft.Office.Interop.Word; public static void E...
<p>If you don't want to use Word Automation, e.g. you don't have Word installed on the computer running your program, you should have a look at <a href="http://www.aspose.com/categories/file-format-components/aspose.words-for-.net-and-java/default.aspx" rel="nofollow noreferrer" title="Aspose.Words">Aspose.Words</a>.</...
35,951
<p>Besides the unit testing benefits, what I heard regarding MVP pattern was that the reusability of the presentation layer. So, you would design one presentation layer and use it for WinForms (rich) and Web.</p> <p>I am currently working on a windows forms application in .NET with possibility of creating a web UI in...
<p>The value of MVC/MVP really lies in two different separations.</p> <p>Separation between your presentation layer and your models (however you decide to implement them) is one of the more important principals software design for anything but simple systems. If you have any business logic or nonvisual logic in your a...
<p>MVC is good pattern to use even if you will end up using it just for one frontend. It helps you design application with cleany seperated parts. This brings several benefits.</p> <p>It eases up the automated testing of parts, for instance you can call your models directly, without the need of gui.</p> <p>Since ther...
22,716
<p>Is there any IDE for coding mono on windows platform?</p>
<p>MonoDevelop has now released a installer for Windows. You no longer need to build it from source. It is available from <a href="http://monodevelop.com/Download/Windows_Preview" rel="noreferrer">the MonoDevelop website</a></p> <p>However on windows it runs on the .NET Framework, not Mono - it uses the .NET debugger ...
<p>Use Delphi Prism 2010</p>
21,099
<p>I work on a large project in Delphi 5. Today, after merging two branches of the app together, one of the hundreds of units, UnitMain (the main form's unit, would you guess) stopped recognizing the Application global.</p> <p>This is a rather bizarre problem - I could get the program to compile by defining Applicatio...
<p>I think it is most likely that you have two symbols called "Application" in scope, and the one from the Forms unit isn't the active one. Make sure the Forms unit in the uses list comes after any prior unit that contains a symbol called Application.</p> <p>But, you need to provide more information. The exact error m...
<p>What units are in the uses clause at the top of the file? Application comes from the "Forms" unit.</p> <p>eg.</p> <pre><code>unit MyUnit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms; </code></pre>
31,043
<p>I'm using the MVP pattern in a windows form app. I need to change a radio button on the view. I can do this by exposing a Boolean property on the view, but should I be using events to manipulate the view instead?</p>
<p>It's a matter of purity vs being pragmatic... and a bit of personal style. Shouldn't matter... events are just more work than normal methods but more decoupled. <strong>Personally</strong> </p> <ul> <li>I like to keep views decoupled or unaware of the presenters, hence <em>Views communicate to the presenter by rai...
<p>Typically the controller changes the view through properties and subscribes to events raised by the view to know about changes. Here's a <a href="http://haacked.com/archive/2006/08/09/ASP.NETSupervisingControllerModelViewPresenterFromSchematicToUnitTestsToCode.aspx" rel="nofollow noreferrer">nice example of MVP</a>,...
30,526
<p>I have the need/desire to learn to program against Win32 in C++. I am a little confused as to what Win32 even is, as I have no experience on the platform. </p> <p>What would you recommend to get me started programming and debugging C++ programs on Win32?</p>
<p>Answering your (original) questions one by one:</p> <hr> <p><strong>1/ Will anyone tell me what Win32 is?</strong></p> <p>Win32 is the application programming interface (API) for Windows. Specifically, it's for 32-bit Windows and beyond since the old API was for the primarily 16-bit versions of Windows, Windows ...
<p>Formally the Windows API is Microsoft's core set of application programming interfaces. For someone in a hurry! Get Microsoft Visual Studio. Start it up and choose Files->New Project and select Visual C++ and Win32 Console Application. This will get you started quickly and debugging is easy.</p>
44,605