instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>How can I determine if I'm running on a 32bit or a 64bit version of matlab?</p> <p>I have some pre-compiled mex-files which need different path's depending on 32/64bit matlab.</p>
<p>Taking up on ScottieT812 and dwj suggestions, I post my own solution to earn some points.</p> <p>The function <code>computer</code> returns the architecture I'm running on. so:</p> <pre><code>switch computer case 'GLNX86' display('32-bit stuff') case 'GLNXA64' display('64-bit stuff') ot...
<p>Does this really work? Which version of matlab are you using?</p> <p>As far as I'm aware the 64 bit platforms end with "64" not 86. From the matlab site <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/computer.html" rel="nofollow noreferrer">http://www.mathworks.com/access/helpdesk/help/techdoc/...
23,926
<p>I need to send an email to someone and want them to be able to simply reply to the email without having to specify the email address.</p> <p>Using sp_send_dbmail sets the reply-to address as the name of the profile that it was sent from.</p> <p>Can this be changed to specify the reply-to so it looks like it came f...
<p>Not in sp send dbmail itself</p> <p>The reply address is just text and can be set up in the profile.</p> <p>Eg I configure bob@bob.com but the email account is private@isp.com</p> <p>Hit reply and it goes to bob@bob.com</p> <p>So, configure your profile used by the sp thus to show this.</p> <p><a href="http://m...
<p>Not in sp send dbmail itself</p> <p>The reply address is just text and can be set up in the profile.</p> <p>Eg I configure bob@bob.com but the email account is private@isp.com</p> <p>Hit reply and it goes to bob@bob.com</p> <p>So, configure your profile used by the sp thus to show this.</p> <p><a href="http://m...
30,238
<p>How do I setup an Ant task to generate a Findbugs report when the source folder has many jars in it?</p> <p>I'm looking for a worked example of the ant task required to output the fancy HTML from a folder containing multiple jars</p>
<blockquote> <p><em>What's the difference between "include" and "require" in Ruby?</em></p> <p><strong>Answer:</strong></p> <p>The include and require methods do very different things.</p> <p>The require method does what include does in most other programming languages: run another file. It als...
<p>Include When you Include a module into your class as shown below, it’s as if you took the code defined within the module and inserted it within the class, where you ‘include’ it. It allows the ‘mixin’ behavior. It’s used to DRY up your code to avoid duplication, for instance, if there were multiple classes that woul...
41,105
<p>Is it possible to validate an xml file against its associated schema using Visual Studio 2005 IDE? </p> <p>I could only see options to create a schema based on the current file, or show the XSLT output</p> <p><img src="https://i.stack.imgur.com/x9mHo.png" alt="alt text"></p>
<p>It's done automatically, errors appear as warnings in the "Error List" and are additionally underlined with the blue squiggle in the source file. </p> <p>Not sure if there is another way to validate the file, but this will do for now.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.xml.schema.xmlschemavalidator.aspx" rel="nofollow noreferrer">XmlSchemaValidator</a></p> <p>Warning: It's not pretty to use.</p>
7,557
<p>For a web application, when creating the user which will connect to the MySQL database, you have the choice of privileges. Assuming that the only actions intended to be done by that user are SELECT/INSERT/UPDATE/DELETE, it seems to make sense to only provide those privileges, however I've never seen that recommended...
<p>I disagree with Bill here and Atomix's line of thinking is more suitable. Unless it can be demonstrated otherwise, Bill's answer highly increases the risk of the database being compromised. </p> <p>Perhaps for very experienced developers there is other security in place, but for other developers giving a script ful...
<p>A web app usually uses just one user to access the DB, rather than a user per actual user account. Applying minimal privileges is good practice. The username and password is going to be coded into your script (does anyone obfuscate this?) so there's room for compromise if your scripts aren't managed properly.</p> ...
43,586
<p>I have a problem where I cannot identify visitors to my intranet page because their browser is configured to use a proxy, even for the local intranet. I always see the proxy IP and no other details about the client. The SOE that my company uses has the proxy set up already for Firefox and Internet Explorer, and I ca...
<p>You could use a cookie with a random, unique ID that's set upon the first entrance, and then used for identification. Could be done either in JavaScript or in PHP.</p>
<p>I am pretty sure there's no universal way to do this otherwise the whole concept of anonymous proxies go down the drain :)</p> <p>My advice would be to ask your IT department to configure the proxy to populate the <code>HTTP-X-FORWARD-FOR</code>, <code>REMOTE-ADDR</code> or some other identifying header.</p>
39,476
<p>I haven't seen any questions relating to GNU autoconf/automake builds, but I'm hoping at least some of you out there are familiar with it. Here goes:</p> <p>I have a project (I'll call it myproject) that includes another project (vendor). The vendor project is a standalone project maintained by someone else. Inc...
<p>Some notes:</p> <ul> <li>you didn't mention how <code>config.h</code> was included - with quotes or angle brackets. See <a href="https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename">this other question</a> for more information on the difference. In short, <...
<p>It turns out there was a very simple solution in my case. The vendor project gathers several header files into one monolithic header file, which is then <code>#include</code>d by the vendor sources. But the make rule that builds the monolithic header accidentally included the generated <code>config.h</code>. The ...
2,897
<p>I have several python projects that share common modules. Until now, I've been ... ahem ... keeping multiple copies of the common code and synchronizing by hand. But I'd clearly prefer to do something else.</p> <p>It looks to me now, as if zc.Buildout maybe what I need. I guess that what I should be doing is puttin...
<p>Do not separate the tests from your code, you need to keep the two closely together. It's not as if tests take up that much disk space or any memory! And tests can be extremely instructive to your library users.</p> <p>For library packages, include a <code>buildout.cfg</code> and <code>bootstrap.py</code> file with...
<p>I'd consider each application and library an egg and use one of the examples already given in terms of laying it out in SVN. Really, the VCS end of things should not be an issue. </p> <p>Then, for testing each application/library or combination, I'd set up a virtualenv and install each package either via setup.py d...
23,610
<p>What is the PHP preg_replace in C#?</p> <p>I have an array of string that I would like to replace by an other array of string. Here is an example in PHP. How can I do something like that in C# without using .Replace("old","new").</p> <pre><code>$patterns[0] = '/=C0/'; $patterns[1] = '/=E9/'; $patterns[2] = '/=C9/'...
<p>Real men use regular expressions, but here is an extension method that adds it to String if you wanted it:</p> <pre><code>public static class ExtensionMethods { public static String PregReplace(this String input, string[] pattern, string[] replacements) { if (replacements.Length != pattern.Length) ...
<p><strong>Edit: Uhg I just realized this question was for 2.0, but I'll leave it in case you do have access to 3.5.</strong></p> <p>Just another take on the Linq thing. Now I used List&lt;Char&gt; instead of Char[] but that's just to make it look a little cleaner. There is no IndexOf method on arrays but there is o...
20,153
<p>I have a complex query with group by and order by clause and I need a sorted row number (1...2...(n-1)...n) returned with every row. Using a ROWNUM (value is assigned to a row after it passes the predicate phase of the query but before the query does any sorting or aggregation) gives me a non-sorted list (4...567......
<p>Is there a reason that you can't just do</p> <pre><code>SELECT rownum, a.* FROM (&lt;&lt;your complex query including GROUP BY and ORDER BY&gt;&gt;) a </code></pre>
<p>Can you use an in-line query? ie</p> <pre><code>SELECT cols, ROWNUM FROM (your query) </code></pre>
19,321
<p>Is there a way to call out from a TSQL stored procedure or function to a webservice?</p>
<p>Yes , you can create like this</p> <pre><code>CREATE PROCEDURE CALLWEBSERVICE(@Para1 ,@Para2) AS BEGIN Declare @Object as Int; Declare @ResponseText as Varchar(8000); Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT; Exec sp_OAMethod @Object, 'open', NULL, 'get', 'http://www.webservicex.com/stockquot...
<p>If you're working with sql 2000 compatibility levels and cannot do clr integration, see <a href="http://www.vishalseth.com/post/2009/12/22/Call-a-webservice-from-TSQL-(Stored-Procedure)-using-MSXML.aspx" rel="nofollow noreferrer">http://www.vishalseth.com/post/2009/12/22/Call-a-webservice-from-TSQL-(Stored-Procedure...
5,348
<p>Any GOOD libraries available to access SVN from .net application (using C#). The only 3 I found so far that I will be trying out is:</p> <ul> <li><a href="http://www.softec.st/en/OpenSource/ClrProjects/SubversionSharp/SubversionSharp.html" rel="noreferrer">SVN#</a></li> <li><a href="http://sharpsvn.open.collab.net/...
<p>SharpSvn was desiged for .Net 2.0 and Subversion 1.5 and later. It integrates all subversion dependencies in a single set of dll that is directly usable from .Net (XCopy deployable). One of the other strong points of SharpSvn is that it hides all memory management and transforms Subversion errors in exceptions, and ...
<ul> <li>what about NSvn which is (if i'm not wrong) also the core of ankhsvn (check out the tigris.org website for more information)</li> </ul>
26,032
<p>I have an HTML document that is using to embed a control. In some cases, IE fails to load the control in the tag and loads my alternative text.</p> <p>Only problem... I don't know why it is failing. It doesn't show up as an error in the exclamation in the lower-left. I overrode the <code>window.onerror</code> ...
<p>It sounds like what you are looking for is IEHost logging. Taken verbatim from the link below, the short form of how to activate it is:</p> <ol> <li>Click Start, click Run, type regedit, and then click OK.</li> <li>Locate and click the following registry key: <em>HKEY_LOCAL_MACHINE\Software\Microsoft.NETFramework<...
<p>Often a failure in the object tag won't show up as an IE error, since the object is running from its own plugin codebase, not the browser's interpreter.</p> <p>Are you loading this file locally? Or is it a hosted page? IE has different permissions for execution of objects. What is the type of the object? A code sni...
37,143
<p>I'm a non-computer science student doing a history thesis that involves determining the frequency of specific terms in a number of texts and then plotting these frequencies over time to determine changes and trends. While I have figured out how to determine word frequencies for a given text file, I am dealing with a...
<p>I would go with the second idea. Here is a simple Perl program that will read a list of words from the first file provided and print a count of each word in the list from the second file provided in tab-separated format. The list of words in the first file should be provided one per line.</p> <pre><code>#!/usr/bi...
<p>I'm guessing that new files get introduced over time, and that's how things change?</p> <p>I reckon your best bet would be to go with something like your option 2. There's not much point pre-processing the files, if all you want to do is count occurrences of keywords. I'd just go through each file once, counting ea...
40,749
<p>I have an asp.net web page written in C#.<br> Using some javascript I popup another .aspx page which has a few controls that are filled in and from which I create a small snippet of text.<br> When the user clicks OK on that dialog box I want to insert that piece of text into a textbox on the page that initial "poppe...
<p>You will have to do something like:</p> <pre><code>parent.opener.document.getElemenyById('ParentTextBox').value = "New Text"; </code></pre>
<p>What you could do is create an ajax modal pop-up instead of a new window. The semantic and aesthetic value is greater not to mention the data-passing is much easier.</p> <p><a href="http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx" rel="nofollow noreferrer">http://www.asp.net/ajax/ajax...
7,892
<p>I am tasked with writing an authentication component for an open source <code>JAVA</code> app. We have an in-house authentication widget that uses <code>https</code>. I have some example <code>php</code> code that accesses the <code>widget</code> which uses <code>cURL</code> to handle the transfer. </p> <p>My qu...
<p>Exception handling omitted:</p> <pre><code>HttpURLConnection con = (HttpURLConnection) new URL("https://www.example.com").openConnection(); con.setRequestMethod("POST"); con.getOutputStream().write("LOGIN".getBytes("UTF-8")); con.getInputStream(); </code></pre>
<p>you can try curl-to-java lib to convert curl php code to java code <a href="https://github.com/jeffreyning/curl-to-java" rel="nofollow noreferrer">https://github.com/jeffreyning/curl-to-java</a> demo like this</p> <pre><code>public Object curl(String url, Object postData, String method) { CurlLib curl = CurlFactor...
14,214
<p>According to select name from system_privilege_map System has been granted:</p> <pre><code>SELECT ANY TABLE </code></pre> <p>...and lots of other * ANY TABLES.</p> <p>Plainly running</p> <pre><code>select * from the_table; select * from the_table; </code></pre> <p>...nets the given response:</p> <blockquote> ...
<p>If the_table is owned by user "some_user" then:</p> <pre><code>select * from some_user.the_table; </code></pre>
<p>You need to do:</p> <pre><code>SELECT * FROM schema_name.the_table; </code></pre> <p>Or use SYNONYMs...</p> <pre><code>CREATE SYNONYM the_table FOR schema_name.the_table; </code></pre>
14,877
<p>I'm using Pylons (a python framework) to serve a simple web application, but it seems to die from time to time, with this in the error log: <code>(2006, 'MySQL server has gone away')</code></p> <p>I did a bit of checking, and saw that this was because the connections to MySQL were not being renewed. This shouldn't ...
<p>I think I fixed it. It's turns out I had a simple config error. My ini file read:</p> <pre><code>sqlalchemy.default.url = [connection string here] sqlalchemy.pool_recycle = 1800 </code></pre> <p>The problem is that my <code>environment.py</code> file declared that the engine would only map keys with the prefix: <c...
<p>You might want to check MySQL's timeout variables:</p> <pre><code>show variables like '%timeout%'; </code></pre> <p>You're probably interested in <code>wait_timeout</code> (less likely but possible: <code>interactive_timeout</code>). On Debian and Ubuntu, the defaults are 28800 (MySQL kills connections after 8 ho...
2,965
<p>Here is the deal. </p> <p>$ gem --version</p> <blockquote> <p>1.1.0</p> </blockquote> <p>$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config</p> <blockquote> <p>Bulk updating Gem source index for: <a href="http://gems.rubyforge.org/" rel="nofollow noreferrer">http://gems.rubyf...
<p>First of all as Orion Edwards said make sure you have rubygems 1.2. Unfortunately, </p> <blockquote> <p>gem update --system</p> </blockquote> <p>did not work for me. </p> <p>Instead I had to:</p> <ol> <li>Manually download <a href="http://rubyforge.org/frs/download.php/38844/rubygems-update-1.2.0.gem" rel="nof...
<p>Do you have different ruby versions on your system? If you're running the Darwin-supplied ruby binary, but installed ruby gems under /usr/local, then you'll get errors like this. Even if you've aliased ruby to point to /usr/local, the gem command may fail if the proper ruby binary is not resolved correctly by your...
6,240
<p>I'm trying to compile a program called ngrep, and when I ran configure, things seemed to go well, but when I run make, I get:</p> <pre><code>ngrep.c: In function ‘process’: ngrep.c:544: error: ‘struct udphdr’ has no member named ‘source’ ngrep.c:545: error: ‘struct udphdr’ has no member named ‘dest’ make: *** [ngre...
<p>Found the problem:</p> <pre><code>#ifdef HAVE_DUMB_UDPHDR printf("%s:%d -", inet_ntoa(ip_packet-&gt;ip_src), ntohs(udp-&gt;source)); printf("&gt; %s:%d", inet_ntoa(ip_packet-&gt;ip_dst), ntohs(udp-&gt;dest)); #else printf("%s:%d -", inet_ntoa(ip_packet-&gt;ip_src), nt...
<p>Well, there is a struct called udphdr (probably short for udp header). And some part of the program assumes the struct has the members source and dest which it hasn't.</p> <p>Look at file ngrep.c line 544 and 545 to find the offending lines.</p> <p>Possible causes:</p> <ul> <li>type name type error.</li> <li>stru...
26,300
<p>Having analyzed a light-load web application running in tomcat, using JMX Console, it turns out the "PS Old Gen" is growing slowly but constant. It starts with 200MB and grows around 80MB/Hour.</p> <p>CPU is not an issue, it runs at 0-1% on average, but somewhere it leaks memory, so it will become unstable some day...
<p>You could try <a href="http://java.sun.com/javase/6/docs/technotes/tools/share/jmap.html" rel="nofollow noreferrer">jmap</a>, one of the <a href="http://java.sun.com/javase/6/docs/technotes/tools/" rel="nofollow noreferrer">JDK Development Tools</a>. You can use <a href="http://java.sun.com/javase/6/docs/technotes/t...
<p>JRockit Mission Control can analyze memory leaks while connected to JVM. No need to take snapshots all the time. This can be useful if you have a server with a large heap.</p> <p>Just hook the tool up to the JVM and it will give you a trend table where you can see which type of objects that are growing the most, an...
48,550
<p>I need to return only the facet counts from solr. So I basically want to search over all documents and return the facet counts, but I don't want to return any search results. Is this possible?</p> <p>Thanks</p>
<p>Setting <code>facet=true</code> will enable faceting and setting <code>rows=0</code> will prevent any results being returned. Conveniently the <code>numFound</code> will show you how many results were found. </p>
<p>So, from what I have understood if I need to get facets count for all documents in a paginated system, I need to make two requests (selects):<br> - The first to get the facets count for all documents.<br> - And the second to get the documents from current page.</p>
26,112
<p>Unfortunately I have to use Windows Server 2003 on my 32 bit workstation due to memory constraints of Windows XP.</p> <p>In Windows XP, when you connect via Remote Desktop the current session I am logged in is instantly shared on the Remote Desktop. I can see all the applications I have opened on my workstation and...
<p>Logon to any session on Windows 2003 server. Goto Administrative tools-->Terminal services configuration-->Server Settings-->Restrict each user to one session(check this box)</p> <p>login again using RDP &amp; you are good to go.</p>
<p>You can run MSTSC /admin or MSTSC /console depending on what version you have installed which will then connect to the console sessions</p>
10,629
<p>I'm trying to read binary data using C#. I have all the information about the layout of the data in the files I want to read. I'm able to read the data "chunk by chunk", i.e. getting the first 40 bytes of data converting it to a string, get the next 40 bytes.</p> <p>Since there are at least three slightly different...
<p>The problem is the <strong>string</strong>s in your struct. I found that marshaling types like byte/short/int is not a problem; but when you need to marshal into a complex type such as a string, you need your struct to explicitly mimic an unmanaged type. You can do this with the MarshalAs attrib.</p> <p>For your ex...
<p>Try this:</p> <pre><code>using (FileStream stream = new FileStream(fileName, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); StructType aStruct = (StructType)formatter.Deserialize(filestream); } </code></pre>
2,452
<p>I have an inherited QTreeWidget (called PackList) class and its parent is a KXmlGuiWindow. How can I access to the parent's slots? </p> <p>I've tried getParent()->mySlot() from the QTreeWidget class but I've got</p> <pre><code>error: no matching function for call to 'PackList::mySlot()' </code></pre> <p>Does any...
<p>If you know the parent's class, you will have to cast parentWidget() to that class and then call your slot. Keep in mind whether or not it's a slot makes no difference in this case. You are just calling a method.</p> <pre><code>((KXmlGuiWindow*)parentWidget())-&gt;mySlot(); </code></pre> <p>You can make the call w...
<p>I'm not sure I fully understand your question.</p> <p>However, you can access the parent widget of a widget with <a href="http://doc.trolltech.com/4.4/qwidget.html#parentWidget" rel="nofollow noreferrer">parentWidget()</a>.</p> <p>Then, you should be able to call any public slot :</p> <pre><code>parentWidget()-&g...
45,943
<p>Especially when considering a fresh Rails project, what does your version control and deployment workflow look like? What tools do you use?</p> <p>I'm interested in answers for Mac, *nix and Windows work machines. Assume a *nix server.</p> <p>I'll edit for clarity if need be.</p>
<ol> <li>Create a copy of my personal Rails 2.1.1 template with preinstalled plugins and frozen gems.</li> <li>Change DB passwords, session secret/name and <code>deploy.rb</code>.</li> <li>Create a private or public repository on GitHub as needed.</li> <li>Push the empty rails project to GitHub.</li> <li>SSH to Server ...
<p>Using Windows Vista and a fresh Ubuntu install at Slicehost.</p> <ol> <li>Create a new empty project in NetBeans.</li> <li>Fire deprec (<a href="http://www.deprec.org" rel="nofollow noreferrer">http://www.deprec.org</a>) to install the Rails stack, including version control, on the target slice.</li> <li>Commit the...
24,825
<p>I am developing a .NET WinForms application which relies on user.config to store various useful settings such as intranet web service URLs. We would like to make it possible to import custom initial settings as part of the installation. The use case for this is if a company has 100 machines they want to install th...
<p>If you create this application for larger companies, then you should have a look at <a href="http://technet.microsoft.com/en-us/windowsserver/grouppolicy/default.aspx" rel="nofollow noreferrer">Group Policy</a>. Unfortunately, it'll bring your application back to the golden age of registry. I understand, that this w...
<p>If it is acceptable for you to hardcode at least one setting in the config file, you can use this to point to a database or web service or network file path where all the custom config settings can be stored. Using System.Configuration.ConfigurationManager.OpenExeConfiguration() you can then update the config file ...
10,119
<p>Getting sporadic errors from users of a CMS; Ajax requests sometimes result in a "501 Method not implemented" response from the server. Not all the time; usually works. </p> <p>Application has been stable for months. Users seem to be getting it with Firefox 3. I've seen a couple references via Google to such proble...
<p>You may want to check the logs of the server to see what's causing the issue. For example, it might be that these requests are garbled, say, because of a flaw in the HTTP 1.1 persistent connection implementation.</p>
<p>The problem occurs as your app is not running on the same domain as your service. You need to configure your Server to accept those calls by adding the 'Access-Control-Allow-Origin' Header.</p>
19,067
<p>How can I tell Activerecord to not load blob columns unless explicitly asked for? There are some pretty large blobs in my legacy DB that must be excluded for 'normal' Objects.</p>
<p>I just ran into this using rail 3.</p> <p>Fortunately it wasn't that difficult to solve. I set a <code>default_scope</code> that removed the particular columns I didn't want from the result. For example, in the model I had there was an xml text field that could be quite long that wasn't used in most views.</p> <p...
<p>A clean approach requiring NO CHANGES to the way you code else where in your app, i.e. no messing with <code>:select</code> options</p> <blockquote> <p>For whatever reason you need or choose to store blobs in databases. Yet, you do not wish to mix blob columns in the same table as your regular attributes. Bin...
12,066
<p>Someone asked me how familiar I am with VC++ and how familiar I am with C++. What is the difference?</p>
<p>C++ is the actual language, VC++ is Microsoft's Visual C++, an IDE for C++ development.</p> <p>From <a href="http://stason.org/TULARC/webmaster/lang/c-cpp-faq/20-What-is-the-difference-between-C-and-Visual-C.html" rel="noreferrer">stason.org</a>:</p> <blockquote> <p>C++ is the programming language, Visual C++ is Mic...
<p>In some cases, they refer to its corresponding <strong>C++</strong> implementation and its compilers.</p> <blockquote> <p><strong>C++</strong> refers to standard headers/functions and its <strong>GCC C++</strong> compiler.</p> <p><strong>VC++</strong> refers to Microsoft implementation of <strong>C++</strong...
24,029
<p>Do you know any grid control compatible with .NET and Mono?</p> <p>DataGridView seems to be quite buggy on Mono, and GTK# controls depends on GTK+ so you need to install it in windows machines where, usually, it's not present.</p>
<p>You might want to try out the preview of Mono 2.0. DataGridView is vastly better in this version, though there are still several places where it is still lacking.</p> <p><a href="http://mono.ximian.com/monobuild/preview/download-preview/" rel="nofollow noreferrer">http://mono.ximian.com/monobuild/preview/download-...
<p>Which version did you try? Perhaps you should give <a href="http://mono.ximian.com/monobuild/preview/download-preview/" rel="nofollow noreferrer">Mono 2.0 preview</a> a go, it might work for you (no, the Data* controls are not yet perfect, but they have improved greatly). From my experience GTK# controls on Windows ...
5,647
<p>Is there a reasonable way to extract plain text from a Word file that doesn't depend on COM automation? (This is a a feature for a web app deployed on a non-Windows platform - that's non-negotiable in this case.)</p> <p>Antiword seems like it might be a reasonable option, but it seems like it might be abandoned.</...
<p>I use catdoc or antiword for this, whatever gives the result that is the easiest to parse. I have embedded this in python functions, so it is easy to use from the parsing system (which is written in python).</p> <pre><code>import os def doc_to_text_catdoc(filename): (fi, fo, fe) = os.popen3('catdoc -w "%s"' % ...
<p>Honestly <strong>don't use &quot;pip install tika</strong>&quot;, this has been developed for mono-user (one developper working on his laptop) and not for multi-users (multi-developpers).</p> <p>The small class TikaWrapper.py bellow which uses Tika in command line is widely enough to meet our needs.</p> <p>You just ...
6,397
<p>When I telnet into our works sun station my backspace key doesn't work. I use a temporary workaround of:</p> <p>$ stty erase ^H</p> <p>This works but each time I telnet in I have to retype this. How can I set this to work properly in my .cshrc file?</p>
<p>You can put stty erase ^H in your .cshrc file. This will fix the problem.</p>
<p>actually, I've run into multiple levels of this before. X windows sometimes maps DEL to Backspace and vice versa. Sometimes logging into one machine through another machine also does this.</p> <p>Here's a comprehensive look at how to solve this: <a href="http://www.ibb.net/~anne/keyboard.html" rel="nofollow norefe...
15,769
<p>The execvp() function executes the program that is given as an argument. It checks the $PATH variable to find the program. I'm writing something in which I would like to check to see if several programs exist before calling any exec() functions. What's the best way to do this?</p>
<p>You can use getenv to get the PATH environment variable and then search through it.</p> <p><a href="http://www.opengroup.org/onlinepubs/000095399/functions/getenv.html" rel="nofollow noreferrer">http://www.opengroup.org/onlinepubs/000095399/functions/getenv.html</a></p> <p>You can then use fopen to check for the e...
<p>Once you have an absolute (canonicalized) pathname, you can use either <strong>stat</strong>(2) or <strong>access</strong>(2) to see if the file exists.</p> <p>With stat:</p> <pre><code>struct stat st; if (stat(path, &amp;st)) { // path doesn't exist } </code></pre> <p>With access:</p> <pre><code>if (access(p...
42,567
<p>What are the key differences between Flash and Flex? I have over five years experience with flash and feel very comfortable developing with it and ActionScript3. I find myself more and more curious about Flex and want to know when it is best to use flash or flex. Also, is everything that can be done with MXML, ab...
<p>Flex is great if you quickly want to build a UI, you can mock up a functioning UI in a couple hours. Since it still can be limiting for some custom UI's it's not perfect for everything but if something should "look" more or less like an application and fit in a grid it's super quick to mock up the UI in MXML. Also d...
<p>MXML compiles to action script so it's really like a higher level version of that. So, yes, everything that can be done with MXML can be done with actionscript (but not the other way around).</p>
19,230
<p>If two users edit the same wiki topic, what methods have been used in wikis (or in similar collaborative editing software) to merge the second user's edits with the first?</p> <p>I'd like a solution that:</p> <ul> <li>doesn't require locking</li> <li>doesn't lose any additions to the page.</li> <li>It may add extra ...
<p><a href="http://twiki.org" rel="nofollow noreferrer">TWiki</a> automatically merges <a href="http://twiki.org/cgi-bin/view/TWiki.SimultaneousEdits" rel="nofollow noreferrer">Simultaneous Edits</a>.</p> <blockquote> <p>TWiki allows multiple simultaneous edits of the same topic, and then merges the different change...
<p>You can write a "lock" in an other database table with the id of the user and the time and delete the "lock" (that isn't a real lock for those who do not understand) when the person save or after x minute.</p> <p>This way, when someone try to edit and someone already doing it. A message can appear with the time rem...
27,529
<p>When submitting an app to the app store what is the real difference between iPod Touch and iPod Touch 2nd generation? </p>
<p>The following:</p> <ul> <li>Slightly thinner</li> <li>Built-in support for Nike+</li> <li>Volume bar</li> <li>External speaker</li> <li>Faster processor (533MHz vs 400MHz)</li> <li>Supports new headphones with the microphone and volume control (allowing you to use VOIP apps)</li> </ul>
<p>The first-gen iPod touch doesn't ship with iPhone OS 2.0, which is required to run App Store apps. End-users can purchase iPhone OS 2.0 for their first-gen iPod touch from Apple.</p> <p>From an SDK perspective, I'm not sure what, if anything, has changed.</p>
27,703
<p>How can I get a list of the running applications? I'm referring to the ones in the panel at the bottom of the screen.</p>
<p>I believe what you are looking for is libwnck</p>
<p>The panel you are referring to is the GNOME panel. So this is a GNOME question, not a GTK question.</p> <p>There is not a well-defined concept of "multi-window application" in GNOME that I know of. The panel task list is probably build by querying the window manager for the list of windows and grouping the windows ...
39,417
<p>I would like to serve a different content from a single URL depending on whether the user is a browser or a RSS reader (hence avoiding an example.com/feed URL). Thus www.example.com/posts will return an (X)HTML page to a browser and an RSS feed to a feed reader.</p> <p>What the architecturally most appropriate way ...
<p>I'm not sure it's possible in all situations. Consider a user who uses Safari's RSS reader, assuming it uses the same browser identifier string when downloading an RSS feed, how would you tell the two modes apart?</p> <p>I'd really re-consider this approach, there's nothing wrong with a separate feed URL.</p>
<p>Let me introduce you to the User-Agent <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="nofollow noreferrer">HTTP header</a>. It will contain an identifying string for the client accessing your page. It can be faked but you just can't be 100% sure if it's a RSS reader or a browser.</p> <p>Addit...
38,860
<p>How can I discover any USB storage devices and/or CD/DVD writers available at a given time (using C# .Net2.0).</p> <p>I would like to present users with a choice of devices onto which a file can be stored for physically removal - i.e. not the hard drive.</p>
<pre><code>using System.IO; DriveInfo[] allDrives = DriveInfo.GetDrives(); foreach (DriveInfo d in allDrives) { if (d.IsReady &amp;&amp; d.DriveType == DriveType.Removable) { // This is the drive you want... } } </code></pre> <p>The DriveInfo class documentation is here:</p> <p><a href="http://msdn.microso...
<p>This is a complete module for VB.NET : <br> Imports System.IO <br> Module GetDriveNamesByType <br> Function GetDriveNames(Optional ByVal DType As DriveType = DriveType.Removable) As ListBox <br> For Each DN As System.IO.DriveInfo In My.Computer.FileSystem.Drives <br> If DN.DriveType = DType T...
7,480
<p>I'm trying to adress the following issue:</p> <ol> <li><p>I have a server side .net application holding a Dictionary of PONO: the cache.</p></li> <li><p>I have many client side .net User interfaces which can query some of these PONO, either by using the key or by asking the server to filter only PONO with a specifi...
<p>Have you looked at Microsoft's WCF Technology? We are building a system that performs similar function to your project and it is working well.</p> <p>Here are 2 examples of WCF I used as roadmaps and might be helpful to you:</p> <ul> <li><a href="http://www.codeproject.com/KB/WCF/WCFWPFChat.aspx" rel="nofollow no...
<p>You are looking for push technology. I would look into the use of <a href="http://en.wikipedia.org/wiki/Comet_%28programming%29" rel="nofollow noreferrer">Comet</a>. Try for example, the <a href="http://weblogs.java.net/blog/caroljmcdonald/archive/2008/10/dojo_rest_comet_1.html" rel="nofollow noreferrer">Dojo</a> im...
48,555
<p>Let me start by saying that I do not advocate this approach, but I saw it recently and I was wondering if there was a name for it I could use to point the guilty party to. So here goes.</p> <p>Now you have a method, and you want to return a value. You <em>also</em> want to return an error code. Of course, except...
<p>I'd agree that this isn't specifically an antipattern. It might be a smell depending upon the usage. There are reasons why one would actually not want to use exceptions (e.g. the errors being returned are not 'exceptional', for starters).</p> <p>There are instances where you want to have a service return a common...
<p>In defense of the anti-pattern designation, this code lends itself to being used in a few ways:</p> <ol> <li>Object x = MyFunction().payload; <em>(ignoring the return result - very bad)</em> </li> <li>int code = MyFunction().result; <em>(throwing away the payload - may be okay if that's the intended use.)</em> <...
9,831
<p>I would like to transfer a text file to a webserver using wininet as if the file was being transferred using a web form that posts the file to the server.</p> <p>Based on answers I've received I've tried the following code:</p> <pre><code> static TCHAR hdrs[] = "Content-Type: multipart/form-data\nContent-Length: 2...
<p>Let's take this one step at a time.</p> <p>First the HTTP headers Involved:</p> <ol> <li>Content-Type: multipart/form-data</li> <li>Content-Length: &lt;this depends on the sum of the bytes of the contents&gt;</li> </ol> <p>Then you have to build a string with the contents of a POST Form. Lets assume you have the ...
<p><a href="http://msdn.microsoft.com/en-us/library/aa384322(VS.85).aspx#Posting_data_to_the_" rel="nofollow noreferrer">Here</a>'s a general description of the things involved in that. Basically, you have to create an HTTP request to a web address, attach information to the request and then send it. The request must b...
19,853
<p>When you have a complex property, should you instantiate it or leave it to the user to instantiate it?</p> <p>For example (C#)</p> <p>A)</p> <pre><code> class Xyz{ List&lt;String&gt; Names {get; set;} } </code></pre> <p>When I try to use, I have to set it.</p> <pre><code>... Xyz xyz = new Xyz(); xyz.Name ...
<p>This is my normal solution:</p> <pre><code>class XYZ { public XYZ () { Names = new List&lt;string&gt;(); } public List&lt;string&gt; Names { get; private set; } } </code></pre> <p><s>(Note that it doesn't work with XmlSerialization, as you need getters and setters on all XmlSerialized properties.) (You can ...
<p>If possible you should try to encapsulate your data. Exposing the object as a list requires the user to know a too many intimate details about the class. For example, they have to know whether or not they have to create the list from scratch to avoid a null reference exception. </p> <pre><code>public class Xyz { ...
31,117
<p>I coded something using Date statement in Access VBA. It was working fine until the start of this month, but now I am seeing that the Date has automatically changed the format from <code>dd/mm/yyyy</code> to <code>mm/dd/yyyy</code>. Has anyone else encountered the same problem?</p>
<p>The default Access SQL date format, regardless of locale, is mm/dd/yyyy. If you use an invalid date format, it will 'helpfully' try to convert that to a valid date for you.</p> <p>So, if you use '30/09/2008', it will recognize you're using dd/mm/yyyy, and convert it appropriately. However, a value like '10/01/2008'...
<p>I have been very successful using the datevalue() function. When getting dates from unbound controls it seems to be clever enough to interpret the format "dd/mm/yyyy" correctly. Thus, a Jet SQL query like </p> <p><code>"Select * from DateTable where StartDate = datevalue(" &amp; me!TxtStartDate &amp; ");"</code> ...
22,595
<p>can we output a .jpg image or .gif image in C? <p>I mean can we print a picture as output with the help of a C program?<p>Aslo can we write a script in C language for HTML pages as can be written in JavaScript? <p>Can the browsers operate on it?<p>If not possible is there any plugin for any of the browsers? <p>Any e...
<p>You can generate a web page from a C program by using the <a href="http://hoohoo.ncsa.uiuc.edu/cgi/" rel="nofollow noreferrer">Common Gateway Interface</a> (CGI). The C program is compiled and runs on the server, this is different from Javascript which runs on the browser.</p> <p>You can also generate images via CG...
<ul> <li>To save jpeg files, you will need <a href="http://www.ijg.org/" rel="nofollow noreferrer">libjpeg</a>. I am sure that there is a similar library for GIFs too.</li> <li>C is <strong>not</strong> a scripting language. You cannot write scripts in C like in Javascript. You can write server-side code in with CGI if...
30,545
<p>We use SQL Server 2000 MSDE for an Point Of Sale system running on about 800 cash registers. Each box has its own copy, and only the local software accesses it. </p> <p>This is a newly updated platform for the cash register vendor--who shall remain nameless.</p> <p>Routinely we are seeing corruption of Master, MSD...
<p>I have a rule of thumb that for every 100 problems 90 of them are user misunderstandings (like turning off the PC), 10 are caused by software and 1 is hardware. </p> <p>With so many systems to update I would be looking for things like, systems that have not been fully patched. Users turning off PCs, and so on. A...
<p>I know its not an "alternative" but believe it or not i have found many answers to my microsoft problems from microsoft.</p> <p>You might want to submit a query at the <a href="http://msdn.microsoft.com/en-us/default.aspx" rel="nofollow noreferrer">microsoft developer network</a></p>
14,462
<p>I have set up a cruisecontrol.net build server. When running it in console mode it works fine, but when trying to run it as a windows service it doesn't work. The log file shows the following message:</p> <pre><code>ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control operation failed: No VSS dat...
<p>Not sure if it's applicable but when I had problems switching between the Console version and the Service version it was down to access rights for the user I was starting the service as. </p> <p>Perhaps the Service does not have access rights to the srcsafe.ini file and your account does(assuming that's what your u...
<p>I ran into similar issues when setting up our CI environment at work. If you can get log-in permissions for the service account you are using, you can log in as that account and run CC.NET via the console and debug your issues.</p>
41,825
<p>I need to execute a callback when an IFRAME has finished loading. I have no control over the content in the IFRAME, so I can't fire the callback from there.</p> <p>This IFRAME is programmaticly created, and I need to pass its data as a variable in the callback, as well as destroy the iframe.</p> <p>Any ideas?</p> ...
<p>First up, going by the function name <em>xssRequest</em> it sounds like you're trying cross site request - which if that's right, you're not going to be able to read the contents of the iframe.</p> <p>On the other hand, if the iframe's URL is on your domain you can access the body, but I've found that if I use a ti...
<p>Using <code>onload</code> attrbute will solve your problem.</p> <p>Here is an example. </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 a() { alert("Your ifram...
19,832
<p>I have two controllers which share most of their code (but must be, nonetheless, different controllers). The obvious solution (to me, at least) is to create a class, and make the two controllers inherit from it. The thing is... where to put it? Now I have it in app_controller.php, but it's kind of messy there.</p>
<p>In cake, components are used to store logic that can be used by multiple controllers. The directory is /app/controllers/components. For instance, if you had some sharable utility logic, you would have an object called UtilComponent and a file in /app/controlers/components called UtilComponent.php. </p> <pre><cod...
<p>Btw, if the reason for "they must be seperate controllers" is the URLs you require. Remember you can use routing:</p> <pre><code>Router::connect('/posts', array('controller' =&gt; 'posts', 'action' =&gt; 'index')); Router::connect('/comments', array('controller' =&gt; 'posts', 'action' =&gt; 'list_comments')); </co...
16,277
<p>I want to use CodeDOM to both declare and initialize my static field in one statement. How can I do this?</p> <pre><code>// for example public static int MyField = 5; </code></pre> <p>I can seem to figure out how to declare a static field, and I can set its value later, but I can't seem to get the above effect.</...
<p>Once you create your CodeMemberField instance to represent the static field, you can assign the InitExpression property to the expression you want to use to populate the field.</p>
<p>I think what you want is a const rather than static. I assume what you want is the effect of having a static readonly which is why you always want the value to be 5.</p> <p>In c# consts are treated exactly the same as a readonly static.</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa645749(VS.71).aspx" ...
4,919
<p>I'd like to do some basic profiling of my code, but found that the DateTime.Now in C# only have a resolution of about 16 ms. There must be better time keeping constructs that I haven't yet found.</p>
<p>Here is a sample bit of code to time an operation:</p> <pre><code>Dim sw As New Stopwatch() sw.Start() //Insert Code To Time sw.Stop() Dim ms As Long = sw.ElapsedMilliseconds Console.WriteLine("Total Seconds Elapsed: " &amp; ms / 1000) </code></pre> <p>EDIT:</p> <p>And the neat thing is that it can resume as well...
<p>You could call down to the high-resolution performance counter in Windows. The function name is QueryPerformanceCounter in kernel32.dll.</p> <p>Syntax for importing into C#:</p> <pre><code>[DllImport("Kernel32.dll")] private static extern bool QueryPerformanceCounter(out long lpPerformanceCount); </code></pre> <...
19,717
<p>I'm trying to do something like </p> <pre><code>URL clientks = com.messaging.SubscriptionManager.class.getResource( "client.ks" ); String path = clientks.toURI().getPath(); System.setProperty( "javax.net.ssl.keyStore", path); </code></pre> <p>Where client.ks is a file stored in com/messaging in the jar file that I...
<p>Still working on implementation, but I believe it is possible to load the keystore from the jar via InputStream and explicitly set the TrustStore programatically (vs setting the System properties). See the article: <a href="https://stackoverflow.com/questions/7591281/setting-multiple-truststore-on-the-same-jvm">Set...
<p>You can get an <code>InputStream</code> to a resource in a jar file, but not a <code>File</code>. If the "thing" that ultimately reads the keystore expects a <code>File</code> or a path to a file, your only option is to extract it to the filesystem.</p>
44,848
<p>Our WinForms application has been reported to occasionally just close on its own. It neither shows our own crash error submit dialog nor Windows' error submit dialog, it just closes and is gone, often when the person was afk and not doing anything with the application. It seems to be a semi-rare occurrence, maybe ...
<p>Stack overflows due to infinite recursion are a big cause of apps quitting with no warning. Unless you've done something deliberate to cause a silent exit, then unhandled exceptions (other than stack overflow) will normally display some kind of UI before the app quits. Stack overflow is the most common exception (...
<p>You could add some logic in the FormClosing event to ask the user if thats what they really want to do, you can then cancel the closing event and your application will continue to run if all is well. If you keep noticing this problem and it never performs your logic, you're going to have to get your hands dirty in t...
24,621
<p>I am attempting to use a Stream Result to return an image from a struts2 application. I seem to be having problem with configuring the action. Here is the configuration:</p> <pre><code> &lt;result name="success" type="stream"&gt; &lt;param name="contentType"&gt;image/jpeg&lt;/param&gt; &l...
<p>I found <a href="http://www.nabble.com/Struts-2-File-upload-to-store-the-filedata-td14168069.html" rel="nofollow noreferrer">this</a> which explained that the <code>InputStream</code> has to be created by me. It makes sense that I create an <code>InputStream</code> from the file that I want the user to download and ...
<p>Inputname defines the name of the method that outputs the "stream"</p> <p>public InputStream getInputStream () { return new ByteArrayInputStream ( _bytes ); }</p>
32,139
<p>I must be getting daft, but I can't seem to find how to read old-fashioned ini files with VB 6.0. All I can seem to find is about reading from and writing to the registry. Can someone push me in the right direction? Mind you, I am not a programmer, just a hobbyist trying to have some harmless fun with his computer, ...
<p>There are two built-in ways of doing observation in Cocoa: Key-Value Observing and notifications. In neither system do you need to maintain or notify a collection of observers yourself; the framework will handle that for you.</p> <p>Key-Value Observing (KVO) lets you observe a property of an object — including ev...
<p>That's not generally the way that it's done. Take a look at the discussion <a href="https://stackoverflow.com/questions/95567/is-there-any-benefit-to-using-cocoas-version-of-mvc-with-net">here</a>, in particular the link to the Apple documentation.</p> <p>If you still want to do it the way you say you do, it's not p...
20,024
<p>I have some curious behavior that I'm having trouble figuring out why is occurring. I'm seeing intermittent timeout exceptions. I'm pretty sure it's related to volume because it's not reproducible in our development environment. As a bandaid solution, I tried upping the sql command timeout to sixty seconds, but a...
<p>SQL commands time out because the query you're using takes longer than that to execute. Execute it in Query Analyzer or Management Studio, <em>with a representative amount of data in the database</em>, and look at the execution plan to find out what's slow.</p> <p>If something is taking a large percentage of the ti...
<p>Try changing the SqlConnection's timeout property, rather than that of the command</p>
10,249
<p>I used the LINQ to SQL designer in Visual Studio to create an object model of a database. Now, I want to add XML comments to each generated property but I can't figure out how to do it without erasing the properties the next time the dbml file is refreshed.</p> <p>How can this be done?</p>
<blockquote> <p>Is there a way to determine at what point I would encounter a stack overflow?</p> </blockquote> <p>Not really. A stack overflow happens when you exhaust the stack space - however...</p> <ul> <li>The initial stack size can be changed programatically and may default to different amounts depending on y...
<p>Sure - e.g. if you want to traverse a tree structure what else would you use ? </p> <p>Maybe you would like to have something like a maximum depth to be sure you're not writing an infinite loop. (if this makes sense in your example)</p>
5,823
<p>I have a nullable property, and I want to return a null value. How do I do that in VB.NET ?</p> <p>Currently I use this solution, but I think there might be a better way.</p> <pre><code> Public Shared ReadOnly Property rubrique_id() As Nullable(Of Integer) Get If Current.Request.QueryString(...
<p>Are you looking for the keyword "Nothing"?</p>
<p>Or this is the way i use, to be honest ReSharper has taught me :)</p> <pre><code>finder.Advisor = ucEstateFinder.Advisor == "-1" ? (long?)null : long.Parse(ucEstateFinder.Advisor); </code></pre> <p>On the assigning above if i directly assign null to finder.Advisor*(long?)* there would be no problem. But if i try t...
9,804
<p>I am looking to set full trust for a single web part, is this possible? manifest.xml maybe?</p>
<p>Have you tried registering the assembly in the GAC? This is the preferred approach to giving any assembly full trust on your machine:</p> <pre><code>gacutil.exe \i C:\Path\To\Dll.dll </code></pre> <p>Hope that helps. Let me know if I misunderstood your question.</p>
<p>You can install a CAB packaged web part to the GAC using</p> <pre><code>STSADM -o addwppack -filename yourwebpart.cab -globalinstall </code></pre> <p>If you are using WSP packages you need to set attributes in the manifext.xml file</p> <pre><code>&lt;Assembly Location="yourassembly.dll" DeploymentTarget="GlobalAs...
25,423
<p>When I commit I get this error from Subversion:</p> <pre><code>bash-2.05b$ svn commit -m "testing subversion, still" Adding baz svn: Commit failed (details follow): svn: MKCOL of '/viper/!svn/wrk/6b9bcd38-b2fe-0310-95ff-9d1a44098866/sandboxes/ohammersmith/trunk/baz': 405 Method Not Allowed (http://svn.examp...
<p>This happens when you have added a directory that someone else has also added and already committed. The error message on a commit is really confusing, but if you do an <code>svn up</code> instead you'll see this message:</p> <pre><code>bash-2.05b$ svn up svn: Failed to add directory 'baz': object of the same name...
<p>Sometimes this happens. Solution: When you create any new repository must add read.me file to create a default branch(trunk) so that it will find a proper path to push your stuff. If you create a repository and do not add read. me and if it is blank then upload a file like test.txt and take that uploaded file as lat...
12,461
<p>I've created a custom exception for a very specific problem that can go wrong. I receive data from another system, and I raise the exception if it bombs while trying to parse that data. In my custom exception, I added a field called "ResponseData", so I can track exactly what my code couldn't handle.</p> <p>In cust...
<p>You shouldn't fill <code>.Message</code> with debug information, but rather with a concise, helpful piece of text.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.exception.message.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.exception.message.aspx</a></p> <blockquote> <p><str...
<p>I don't understand the question -- you're extending System.Exception, and you already added the Elmah field. That's where it belongs -- as a public property of the exception itself.</p>
7,122
<p>I am testing the application in the debug mode under several conditions. Now I'm doing it by writing some of the states and executed functions on the piece of paper and then comparing the scenarios.</p> <p>Does anyone know if there is any built-in functionality in VS2008 or any additional tool that could record the...
<p>Access will convert to a number for you, as was mentioned, the dates are stored as numbers.</p> <pre><code>Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("TestTable") rs.AddNew rs!NumberDate = Now() 'Value stored, eg, 39791.4749074074 ' rs.Update rs.MoveLast 'To show that it converts back to the corre...
<p>Access stores date internally as a floating point number (number of days since 31.12.1899 or something), have you tried using CDate() to convert the number back to a date? You should be able to query using BETWEEN then.</p> <p>Another possibility is that the date is stored numerically but not converted (i.e 3112189...
45,870
<p>I just saw this behaviour and I'm a bit surprised by it...</p> <p>If I add 3 or 4 elements to a Dictionary, and then do a "For Each" to get all the keys, they appear in the same order I added them.</p> <p>The reason this surprises me is that a Dictionary is supposed to be a HashTable internally, so I expected thin...
<p>If you use .NET Reflector on the 3.5 class libraries you can see that the implementation of Dictionary actually stores the items in an array (which is resized as needed), and hashes indexes into that array. When getting the keys, it completely ignores the hashtable and iterates over the array of items. For this re...
<p>The question and many of the answers seem to misunderstand the purpose of a hashtable or dictionary. These data structures have no specified behaviors with respect to the enumeration of the values (or in fact the keys) of the items contained in the data structure. </p> <p>The purpose of a dictionary or hashtable ...
18,648
<p>Seems like there are so many different ways of automating one's build/deployment that it becomes difficult to parse through all the different scenarios that people support in tutorials on the web. So I wanted to present the question to the stackoverflow crowd ... what would be the best way to set up an automated bu...
<p>I recently spent a few days working on automating deployments at my company.</p> <p>We use a combination of CruiseControl, NAnt, MSBuild to generate a release version of the app. Then a separate script uses MSDeploy and XCopy to backup the live site and transfer the new files over.</p> <p>Our solution is briefly d...
<p>I had a <a href="https://stackoverflow.com/questions/55323/aspnet-web-application-build-output-how-do-i-include-all-deployment-files">related question</a> about getting a deployable set of files from an automated build. I found Web Deployment Projects (links and all in the old question) did what I needed - they're a...
8,215
<p>How do I check if a field (textbox) is empty or filled only with white spaces (spaces/enters/tabs etc.), using javascript RegExp?</p>
<pre><code>if (myField.value.match(/\S/)) { // field is not empty } // or if (/\S/.test(myField.value)) { // field is not empty } </code></pre> <p>Explanation, since other people seem to have some <strike>crazy</strike> different ideas:</p> <p><code>\s</code> will match a space, tab or new line.<br> <code>\S</cod...
<p>By testing for</p> <p><pre><code>/\s/ or /\S/</pre></code> you will only be testing for one character . So , it will be better to test instead for :</p> <pre><code>/^\s+$/ or /^\S+$/</code></pre> <p>EDIT: please note that <strong>or</strong> is not part of the code .</p> <p>EDIT2:</p> <p>The test for matching :...
39,131
<p>My work has a financial application, written in <code>VB.NET</code> with <code>SQL</code>, that several users can be working on at the same time.</p> <p>At some point, one user might decide to Post the batch of entries that they (and possibly other people) are currently working on.</p> <p>Obviously, I no longer wa...
<p>If you are using Oracle you would <strong>Select for update</strong> on the rows you are locking.</p> <p>here is an example</p> <pre><code>SELECT address1 , city, country FROM location FOR UPDATE; </code></pre>
<p>add </p> <pre><code>with (rowlock) </code></pre> <p>to your SQL query</p> <p><a href="http://www.sql-server-performance.com/articles/per/lock_contention_nolock_rowlock_p1.aspx" rel="nofollow noreferrer">SQL Server Performance article</a></p> <p><strong>EDIT:</strong> ok, I misunderstood the question. What you wa...
6,808
<p>How do you get Pro*c to work within MSVC 6?</p> <p>In otherwords compile a .pc file into a .cpp file.</p>
<p>I'm not familiar with Pro*C, but in general it is possible, using a custom build step in MSVC. If you add the .pc file to your project, then view the Project Settings dialog for that file, on the Custom Build tab you can specify the command(s) needed to compile the .pc file to .cpp. You should also enter the name of...
<p>Visual C++/Visual Studio won't be a big help other than being an editor, but you should be able to get this to work with a Makefile project.</p>
27,656
<p>We all know and love Process.WaitForExit().</p> <p>Given a pid of a process on a remote machine (created by WMI/psexec), how do I wait for it to end?</p>
<p>For me Process.GetProcessByID() just didn't work (it claimed it couldn't connect to the machine). This worked:</p> <pre><code>public static bool WaitForProcess(int pid, string machine, TimeSpan timeout) { // busy wait DateTime start = DateTime.Now; while (IsAlive(pid, machine)) { if (start.Add(timeout)....
<p>Poll the remote computer using SysInternals' PSLIST.</p>
47,817
<p>Just for my own purposes, I'm trying to build a tokenizer in Java where I can define a regular grammar and have it tokenize input based on that. The StringTokenizer class is deprecated, and I've found a couple functions in Scanner that hint towards what I want to do, but no luck yet. Anyone know a good way of going ...
<p>The name "Scanner" is a bit misleading, because the word is often used to mean a lexical analyzer, and that's not what Scanner is for. All it is is a substitute for the <code>scanf()</code> function you find in C, Perl, <em>et al</em>. Like StringTokenizer and <code>split()</code>, it's designed to scan ahead unti...
<p>If I understand your question well then here are two example methods to tokenize a string. You do not even need the Scanner class, only if you want to pre-cast the tokens, or iterate through them more sofistically than using an array. If an array is enough just use String.split() as given below. </p> <p>Please give...
30,258
<p>How do I add a certain number of days to the current date in PHP?</p> <p>I already got the current date with:</p> <pre><code>$today = date('y:m:d'); </code></pre> <p>Just need to add x number of days to it</p>
<p><code>php</code> supports c style date functions. You can add or substract date-periods with English-language style phrases via the <code>strtotime</code> function. examples...</p> <pre><code>$Today=date('y:m:d'); // add 3 days to date $NewDate=Date('y:m:d', strtotime('+3 days')); // subtract 3 days from date $...
<pre><code>&lt;?php $dt = new DateTime; if(isset($_GET['year']) &amp;&amp; isset($_GET['week'])) { $dt-&gt;setISODate($_GET['year'], $_GET['week']); } else { $dt-&gt;setISODate($dt-&gt;format('o'), $dt-&gt;format('W')); } $year = $dt-&gt;format('o'); $week = $dt-&gt;format('W'); ?&gt; &lt;a href="&lt;?php echo...
34,984
<p>Is there a way to view the list of <em>recent documents</em> you've opened in Vim?</p> <p>I realize I could view the cursor <em>jump list</em>, <code>:ju</code>, and then go to a cursor position in the list but this is not ideal because there will be multiple listings of the same document in the list.</p> <p>Is ther...
<p>Don't use a plugin, unless you want a nice menu. From <a href="http://vimdoc.sourceforge.net/htmldoc/starting.html#:oldfiles" rel="noreferrer">Vim Documentation: Starting</a> (or <code>:help old</code>):</p> <pre><code>:ol[dfiles] </code></pre> <p>Then to open one of the listed files, use: <code>'0</code>, <code>'...
<p>The easiest way for me to access recent files is to add the following to one's .gvimrc file:</p> <pre><code>let g:netrw_sort_by = 'time' let g:netrw_sort_direction = 'r' </code></pre> <p>These lines get netrw to sort files by those most recently modified. Then one simply calls :e. and selects the fil...
39,903
<p>I'm working with a group at the MIT Launch startup accelerator for high school and I was hoping to do some market research regarding some of the current problems with desktop 3D printers. I was hoping to get some feedback from all your experience with 3D printing and the hours of troubleshooting you've likely encoun...
<p>First, regarding <strong>"Why do 3D Printers Suck?"</strong> - The answer is <strong>They Don't!</strong></p> <p>Every tool has its limitations and you need to work withing the limitations of the tool.</p> <p>Second, there are <strong>A LOT</strong> of different types/technologies, manufacturers, and price points ...
<p>First, regarding <strong>"Why do 3D Printers Suck?"</strong> - The answer is <strong>They Don't!</strong></p> <p>Every tool has its limitations and you need to work withing the limitations of the tool.</p> <p>Second, there are <strong>A LOT</strong> of different types/technologies, manufacturers, and price points ...
652
<p>I'm not sure how I should express this, but I'll give it a try. <br /> I recently started coding my portfolio in object-oriented PHP and I'm wondering if it's according to best practices to use a single page where the content changes depending on SQL data and the $_GET variable?</p> <p>If so/not, why?</p> <p>Edit:...
<p>Are you asking about using the front controller pattern, where a single file serves all of your requests? Often this is done with an index.php and mod_rewrite getting all of the requests with the rest of the URL being given to it as a parameter in the query string.</p> <p><a href="http://www.onlamp.com/pub/a/php/2...
<p>Everything gatekiller mentioned + you also can't utilize late-binding.</p>
14,821
<p>Do you know any implementation / technique which would provide similar behavior as Viewstate provides in ASP.NET. (Serializing the data into hidden field within the HTML form).</p> <p>I am using only JSP, Servlet, and Spring MVC.</p>
<p>I think the <a href="http://www.stripesframework.org/" rel="nofollow noreferrer">Stripes</a> framework provides that.</p>
<p>Spring Webflow offers a similar facility, scoped to individual conversations. <a href="http://static.springframework.org/spring-webflow/docs/2.0.x/reference/html/ch06.html" rel="nofollow noreferrer">The persistence section of the manual</a> should be able to explain the concepts.</p>
21,354
<p>I have following foreach-loop:</p> <pre><code>using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path, "*.txt")) { // do something, possibly delete the file named strFile } } </code></pre> <p>Could there be side effects when deleting files in th...
<p>GetFiles returns an array, not an iterator so the operation is complete by the time you reference the first file. Also it only returns the file names, not a File handle so you should be completely safe doing any operation on it.</p>
<p>The enumerator doesnt requery on each hit so you should be fine - that said if a file shows up in the folder while you are in the process it will not get deleted. </p>
41,773
<p>I have followed all the instructions here: <a href="http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/" rel="noreferrer">http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/</a></p> <p>to install &amp; config apache get the PHP5 packages and get the CURL packages.</p> ...
<p>You're probably mistaking what PHP.ini you need to edit. first, add a PHPinfo(); to a info.php, and run it from your browser.</p> <p>Write down the PHP ini directory path you see in the variables list now! You will probably notice that it's different from your PHP-CLI ini file.</p> <p>Enable the extension</p> <p>...
<p>You can use binary file of curl .download file from here : <a href="http://www.paehl.com/open_source/?CURL_7.22.0" rel="nofollow">http://www.paehl.com/open_source/?CURL_7.22.0</a> Download the file and after extract put in to any drive and set the absolute path into environment now you can also use curl as a comman...
21,849
<p>I know how to do this if I iterate through all of the characters in the string but I am looking for a more elegant method.</p>
<p>A regular expression will do the trick with very little code:</p> <pre><code>import re ... if re.match("^[A-Za-z0-9_-]*$", my_little_string): # do something here </code></pre>
<p>use a regex and see if it matches!</p> <pre><code>([a-z][A-Z][0-9]\_\-)* </code></pre>
11,536
<p>Is there an XSLT library that is pure Python?</p> <p>Installing libxml2+libxslt or any similar C libraries is a problem on some of the platforms I need to support.</p> <p>I really only need basic XSLT support, and speed is not a major issue.</p>
<p>Unfortunately there are no pure-python XSLT processors at the moment. If you need something that is more platform independent, you may want to use a Java-based XSLT processor like <a href="http://saxon.sourceforge.net/" rel="noreferrer">Saxon</a>. 4Suite is working on a pure-python XPath parser, but it doesn't look ...
<p>Have you looked at <a href="http://4suite.org/index.xhtml" rel="nofollow noreferrer">4suite</a>?</p>
16,770
<p>I'm working with a MySQL query that writes into an outfile. I run this query once every day or two and so I want to be able to remove the outfile without having to resort to su or sudo. The only way I can think of making that happen is to have the outfile written as owned by someone other than the mysql user. Is ...
<p>The output file is created by the mysqld process, not by your client process. Therefore the output file must be owned by the uid and gid of the mysqld process.</p> <p>You can avoid having to sudo to access the file if you access it from a process under a uid or gid that can access the file. In other words, if mys...
<p>If you have another user run the query from cron, it will create the file as that user.</p>
28,700
<p>I entered this statement in JSLint:</p> <pre><code>var number = new Number(3); </code></pre> <p>And received the following message:</p> <blockquote> <p>Do not use Number as a constructor.</p> </blockquote> <p>Why is that? The statement is creating a number object, not a primitive value, so I don't see why usin...
<p>In addition to breaking === and typeof returning &quot;object&quot;, using the Number constructor also changes the way the value is used in boolean contexts. Since &quot;new Number(0)&quot; is an object, not a literal value, it evaluates as &quot;true&quot; because it is not null. So for example:</p> <pre><code>var ...
<blockquote> <p>in JavaScript, an Object type is not equal to another Object type, even when they have the exact same value, unless they are both the EXACT SAME object.</p> <p>In other words, in Matthew's example below, n1 == n2 is false because you are comparing two REFERENCES to two SEPARATE objects, but n1 == n1 is ...
48,220
<p>I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example:</p> <pre><code>public interface Person { String getName(); } public interface Employee extends Person { int getSalary(); } </code></pre> <p>Introspecting on Employee only yields salary even tho...
<p>This issue is covered in Sun bug <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4275879" rel="nofollow noreferrer">java.beans.Introspector doesn't work for interfaces</a></p>
<p>In such a case, you should write a custom BeanInfo class.</p>
22,371
<p>Here is my sample code. It is meant to be an iterative procedure for gauss seidel (matrix solver). Essentially when the error is small enough it breaks out of the while loop.</p> <pre><code>i=1 while (i&gt;0): x_past = x_present j=0 while(j&lt;3): value=0 k=0 while(k&lt;3): ...
<p>Yes, I think the answers here show your problem. Just to try and clarify a little bit.</p> <p>You're referencing a list, so when the list changes any reference to that list will reflect that change. To demonstrate:</p> <pre><code>&gt;&gt;&gt; x_present = [4,5,6] &gt;&gt;&gt; &gt;&gt;&gt; x_past = x_present &gt;&gt;...
<p>It looks as if x_present is a list. I suspect that this means that the assignment x_last = x_present makes x_last into an alias, i.e. they reference the same variable. Might this be the case?</p>
33,144
<p>Is there any way to embed a widget in a data-bound <em>DataGridViewCell</em> when it is not in editing mode?</p> <p>For example, we are wanting to display an existing calendar widget in a cell. That cell contains a comma separated list of dates. We want to show the calendar instead of the text. </p> <p>We could...
<p>You should derive your own type from <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.aspx" rel="nofollow noreferrer">DataGridViewColumn</a> (e.g. a <em>DataGridViewCalendarColumn</em>) and return a <em>DataGridViewCalendarCell</em> (that you have to create yourself, too) as t...
<p>You can instead of drawing calendar, take a calendar control, set them the grid as parent and set them same bounds ( left, top, width, height ) as cell has.</p>
15,597
<p>I have to do a cross site POST (with a redirection, so not using a XMLHTTPRequest), and the base platform is ASP.NET. I don't want to POST all of the controls in the ASP.NET FORM to this other site, so I was considering dynamicly creating a new form element using javascript and just posting that.</p> <p>Has anyone ...
<p>I do this all the time. Works really well. You will have to look through the Request's parameters manually, though, unless you get creative with what you pass as the parameters won't map onto controls on that page. You could also do this in a REST way by passing the parameters in the query string, but I prefer th...
<p>One caveat: you cannot add a FORM tag to the document using innerHTML. You must add it by creating a new DOM element. You can add fields using innerHTML, but not the form itself.</p>
23,357
<p>What's the best way to validate that an IP entered by the user is valid? It comes in as a string.</p>
<p>Don't parse it. Just ask.</p> <pre><code>import socket try: socket.inet_aton(addr) # legal except socket.error: # Not legal </code></pre>
<p>I only needed to parse IP v4 addresses. My solution based on Chills strategy follows:</p> <pre> def getIP():<br/> valid = False<br/> while not valid :<br/> octets = raw_input( "Remote Machine IP Address:" ).strip().split(".")<br/> try: valid=len( filter( lambda(item):0&lt;=int(item)&lt;256, ...
41,277
<p>Every few days VS2008 decides to get mad at me and fails to generate a designer file claiming it cannot find the file specified and that it's missing an assembly. Here's the scenario:</p> <p>The aspx page has a reference to a custom user control (inheriting UserControl) which references another assembly in the bac...
<p>We've had similar problems before, unfortunately I don't remember the exact solution. </p> <p>If your using a "Web Site" project (no project file) then start by checking that both your page and your control both set the ClassName property in the first line of your aspx/ascx file and that you specify the full name o...
<p>You might try archiving a template of a new file with its designer equivalent. If VS coughs then you can do an "Add Existing" option with the file you already have. </p> <p>It seems, however, to be an issue with your installation of VS2008 so you might try reinstalling it. </p>
5,277
<p>I'm trying to get only the list of id of object bob for example instead of the list of bob. It's ok with a HQL request, but I would know if it's possible using criteria ?</p> <p>An example :</p> <pre><code>final StringBuilder hql = new StringBuilder(); hql.append( "select bob.id from " ) .append( bob.class.get...
<p>I think you could do that with Projections, something like</p> <pre><code>Criteria.forClass(bob.class.getName()) .add(Restrictions.gt("id", 10)) .setProjection(Projections.property("id")) ); </code></pre>
<p>You can do that like this</p> <pre><code> bob bb=null; Criteria criteria = session.createCriteria(bob.class); criteria.add(Restrictions.eq("id",id)); bb = (bob) criteria.uniqueResult(); </code></pre> <p>as Restrictions you can add your condition</p>
8,296
<p>This is a problem I have seen other people besides myself having, and I haven't found a good explanation.</p> <p>Let's say you have a maintenance plan with a task to check the database, something like this:</p> <pre><code>USE [MyDb] GO DBCC CHECKDB with no_infomsgs, all_errormsgs </code></pre> <p>If you go look i...
<p>For starters, always remember that <code>GO</code> is not a SQL keyword; it is merely a batch separator that is (generally) implemented/recognized by the client, not the server. So, depending on context and client, there really is no guarantee that the current database is preserved between batches.</p>
<p>You have a check datasbase integrity task and you double-clicked it choose MyDb and when the plan runs it only checks master?? weird. Are you sure you don't another plan running? </p>
3,335
<p>Someone just sent me a decompile of a program into C. It was a very good decompile, producing nice, mostly readabe C code (if you overlook the fact that none of the variables or functions had a human-readable name) that mostly looked like it would actually compile.</p> <p>There was one big problem, though. I happ...
<p>I don't think there are any machine code decompilers that produce Pascal code. Most "Delphi decompilers" parse form and RTTI data, but do not actually decompile the machine code. I can only recommend using something like DeDe (or <a href="http://delphi.about.com/od/devutilities/a/decompiling_3.htm" rel="noreferrer">...
<p>Languages like Delphi, C and C++ Compile to processor-native machine code, and the output executables have little or no metadata in them. This is in contrast with Java or .Net, which compile to object-oriented platform-independent bytecode, which retains the names of methods, method parameters, classes and namespace...
43,461
<p>I am trying to set up a masterpage that contains a javascript popup subroutine that can be used in multiple web pages. The popup already works in a single page environment. I now want to migrate it to a master page. Any ideas will be greatly appreciated. I already searched this site and tried a couple of the suggest...
<p>Just take what you have in your single page and place it in the master page. It is really that simple. :) Then just replace the main body of the HTML in the master page with the content sections and you should be ready to go.</p>
<p><a href="http://dev.iceburg.net/jquery/jqModal/" rel="nofollow noreferrer">this</a> is my current favourite, seems to be most robust and flexible. Simply include the js files in your master then create an isntance on your pages</p>
41,004
<p>The question is simple: I cannot understand the <a href="http://en.wikipedia.org/wiki/Zipper_(data_structure)" rel="noreferrer">Zipper</a> data structure.</p> <p>My question is related to its uses with a Tree.</p> <p>I want to understand how can I change the tree node using zipper. And how not to copy the whole tr...
<p>Let's start with the Zipper-analog for lists. If you'd like to modify the nth element of a list, it takes O(n) because you have to copy the n-1 first elements. Instead, you can keep the list as a structure ((first n-1 elements reversed) nth element (remaining elements)). For example, the list <code>(1 2 3 4 5 6)</co...
<p>The code focuses on a cell like this picture shows. There are areas above,below, to the left and to the right. We move over this grid. The focus is the green square.</p> <p><a href="https://i.stack.imgur.com/cCPWm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cCPWm.png" alt="enter image descript...
49,854
<p>I am trying to pull data from an ACD call data system, <code>Nortel Contact Center 6.0</code> to be exact, and if you use that particular system what I am trying to capture is the daily call by call data. However when I use this code</p> <p>(sCW is a common word string that equals <code>eCallByCallStat</code> and ...
<p>Seems like an error with the query itself...</p> <p>If you can step through your code and post the contents of sSql, it would probably help troubleshoot...</p> <p>When you go through it, be sure quotes are getting escaped properly.</p>
<p>I start by deleting the contents of sSQL with <code>sSql=""</code></p> <p>after that, because the query is run in a for loop I build the query in each of the next lines, each line builds on the previous line, I made it that way so it would be easier to edit and understand by the next guy.</p> <p>After running thro...
31,172
<p>I am trying to slice a model that is half a mm less than max width, but not successful.</p> <p><a href="https://i.stack.imgur.com/puSzw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/puSzw.png" alt="enter image description here"></a></p> <p>What am I missing? Is there some minimum value less th...
<p>Take a look at this post: <a href="https://community.ultimaker.com/topic/15588-cura-23-not-using-full-print-area/" rel="nofollow noreferrer">https://community.ultimaker.com/topic/15588-cura-23-not-using-full-print-area/</a>. As the raft/skirt/brim will fall outside of the build volume, Cura is not able to slice it. ...
<p><a href="/a/10566">This answer</a> already addresses that Ultimaker Cura "eats up" platform space for e.g. skirt, brim, raft, dual extruder, deposition of priming blob, prime towers, etc. Disabling those features will reclaim platform space so you can print larger prints. <strong><em>However, that will only work whe...
1,406
<p>What is the <em>definitive</em> way to mimic the CSS property min-width in Internet Explorer 6? Is it better not to try?</p>
<pre class="lang-css prettyprint-override"><code>foo { min-width: 100px } // for everyone * html foo { width: 100px } // just for IE </code></pre> <p>(or serve a separate stylesheet to IE using <a href="http://www.quirksmode.org/css/condcom.html" rel="nofollow noreferrer">conditional comments</a>)</p>
<p>Use conditional comments to reference and MSIE 6 specific style sheet, then create CSS as below.</p> <p>Compliant browsers will use:</p> <pre><code>min-width: 660px; </code></pre> <p>Then MSIE 6 will use:</p> <pre><code>width: expression((document.body.clientWidth &lt; 659)? "660px" : "auto"); </code></pre>
11,878
<p>The basic problem is like this:<br> A subscriber has successfully replicated a row from the publisher, using transactional replication. Now, how do we keep track the time of this row being last successfully replicated? </p> <p>A friend has suggested the following solution, which he used for his SQL Server 2000:<br...
<p>I'd do exactly what your friend suggested. That way, only calls to the replication procedure would update the timestamp. </p> <p>The problem with this approach is that you need a write lock, but I don' see any other practical way.</p> <p>You could otherwise use a trigger that fires when you fetch the row (don't qu...
<p>If you are working with transactional replication, why don't you just record time of primary data update and consider it was replicated to the other databases on next replication job? </p>
19,578
<p>Shell scripts are often used as glue, for automation and simple one-off tasks. What are some of your favorite "hidden" features of the Bash shell/scripting language?</p> <ul> <li>One feature per answer</li> <li>Give an example and short description of the feature, not just a link to documentation</li> <li>Label the...
<p><strong>insert preceding line's final parameter</strong></p> <p><kbd>alt</kbd>-<kbd>.</kbd> the most useful key combination ever, try it and see, for some reason no one knows about this one.</p> <p>press it again and again to select older last parameters. </p> <p>great when you want to do something else to somet...
<p>Embedded Command substitution:</p> <blockquote> <p>hostname &amp;&amp; dig +short $(hostname) &amp;&amp; dig +short -x $(dig +short $(hostname))</p> </blockquote> <p>This command is good for checking RDNS on your mail server. :P</p>
25,973
<p>A co worker of mine asked me to review some of my code and he sent me a diff file. I'm not new to diffs or version control in general but the diff file was very difficult to read because of the changes he made. Specifically, he used the "extract method" feature and reordered some methods. Conceptually, very easy ...
<p>Eclipse can <a href="http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-240.htm" rel="nofollow noreferrer">export refactoring history</a> (see <a href="http://mirror.calvin.edu/eclipse/downloads/drops/S-3.2M5-200602171115/eclipse-news-M5.html" rel="nofollow noreferrer">3.2 release n...
<p>I asked a <a href="https://stackoverflow.com/questions/78339">similar question</a> a while ago and never did get a satisfactory answer. I'll be watching your question to see what people come up with.</p> <p>For your particular situation, it might be best to review the latest version of the file, using the diff as a...
19,808
<p>In every form we derive from <code>FormBaseControl</code>, we have the following code. I'm sure there is a better way to type the controller object than this, but at the moment we have it included in every page. In the example below, <code>base.Controller</code> is of type <code>BaseController</code>, from which <...
<p>Can you not use a generic class to fix this?</p> <p>I.e. instead of:</p> <pre><code> private ExportController MyController { get { return base.Controller as ExportController; } } </code></pre> <p>in the derived class. </p> <p>Put:</p> <pre><code> protected T MyController { get { return this a...
<p>I think there is a design problem here. </p> <p>Are you sure that MyController is needed to be ExportControler (or any other) and not the base (or derivated class)? May an intermediate class, interface or generics avoid this? </p> <p>Please, give details about why do you need redefinie MyControler all the time.</p...
43,788
<p>I'm interested in putting together my first online game using Flash as the client and writing a back-end application in C++ where the actual game state is kept.</p> <p>I've done lots of games in C++ before using SDL, SFML, Allegro, etc etc but never gotten around to using the network libraries. I was just intereste...
<p>Although it's primarily written for C, it's still great for C++:<br> <a href="http://beej.us/guide/bgnet/" rel="nofollow noreferrer">Beej's guide to networ programming.k</a><br> It covers all the basics, and has a section on changes needed for Win32 :)<br> Also I seem to recall that Flash needed terminating null-byt...
<p>I'm not sure if your game needs real time communications or if if making requests to a server to load, save and execute games is sufficient.</p> <p>If it is you might be best to use some kind of "middleware" layer to handle the networking parts. Flash is happy making xml documents and sending them to a server over ...
32,765