instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Is there a way to identify at run-time of an executable is being run from within valgrind? I have a set of C++ unit tests, and one of them expects <code>std::vector::reserve</code> to throw <code>std::bad_alloc</code>. When I run this under valgrind, it bails out completely, preventing me from testing for both mem...
<p>You should look at <a href="http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq" rel="noreferrer">this page</a> from the Valgrind manual, it contains a <code>RUNNING_ON_VALGRIND</code> macro (included from valgrind.h) which does what you want.</p>
<p>I looked at the valgrind doucmentation and didn't find an easy answer. But here are a couple of things you can try:</p> <ul> <li><p>Write your own wrapper around the offending new operation and raise the exception before valgrind gets its private new function going.</p></li> <li><p>Try as poster above suggested ex...
47,713
<p>I'm using python\pyodbc and would like to access the second result set of a stored procedure. As near as I can tell, pyodbc does not support multiple result sets. Additionally, I can't modify the stored procedure. Are there any options to access the second result set using SQL or some other work-around? Perhaps crea...
<p>No need for anything fancy. Just use the <a href="https://github.com/mkleehammer/pyodbc/wiki/Cursor#nextset" rel="nofollow noreferrer">cursor's <code>nextset()</code> method</a>:</p> <pre><code> import pyodbc db = pyodbc.connect ("") q = db.cursor () q.execute (""" SELECT TOP 5 * FROM INFORMATION_SCHEMA.TABLES SELE...
<p>There are a few possible methods <a href="http://www.sommarskog.se/share_data.html" rel="nofollow noreferrer">here</a>. If the result sets are all the same, you might be able to use the INSERT...EXEC method. Otherwise OPENQUERY might work.</p>
34,410
<p>What resources or methods would OpenSCAD users suggest to piece together disparate STL files?</p> <p>I'd like to take an existing STL model-library of STL parts (head, torso, arms, legs) and make it a Thingiverse OpenSTL maker, similar to the castle generator and/or the puzzle generators available.</p> <p>This way...
<p>Cura prior to version 2.5 does not take G-code as an input. I'm not sure what you mean by "print only using Cura." Don't you have a SD slot on your control board? For that matter, why can't you drive the USB port from Slic3r? </p> <p>Remember: G-code is the equivalent of "compiled code," the raw commands which dri...
<p>Cura prior to version 2.5 does not take G-code as an input. I'm not sure what you mean by "print only using Cura." Don't you have a SD slot on your control board? For that matter, why can't you drive the USB port from Slic3r? </p> <p>Remember: G-code is the equivalent of "compiled code," the raw commands which dri...
449
<p>Let's say I have a search page called Search.aspx that takes a search string as a url parameter ala Google (e.g. Search.aspx?q=This+is+my+search+string).</p> <p>Currently, I have an asp:TextBox and an asp:Button on my page. I'm handling the button's OnClick event and redirecting in the codebehind file to Search.as...
<p>You need to understand that MVC doesn't directly reference .aspx pages like WebForms in its URLs. Its main purpose is to separate concerns, that is model (data), controller (logic), and view (presentation).</p> <p>First, you'd have to create a route matching your URLs, which would now look like this for example : /...
<p>You can use a simple javascript in the button's onclick to redirect to the search page:</p> <pre><code>Search &lt;input type="text" id="go" size="4" /&gt;&lt;input type="button" value="&lt;%=Html.Encode("&gt;&gt;") %&gt;" onclick="javascript:window.location='&lt;%=Url.Action("Search", "Home") %&gt;/' + document.get...
43,206
<p>I'm looking to build a query that will use the non-clustered indexing plan on a street address field that is built with a non-clustered index. The problem I'm having is that if I'm searching for a street address I will most likely be using the 'like' eval function. I'm thinking that using this function will cause ...
<p>If your LIKE expression is doing a start-of-string search (<code>Address LIKE 'Blah%'</code>), I would expect the index to be used, most likely through an index seek.</p> <p>If you search for <code>Address LIKE '%Blah%'</code>, a table scan/index scan will occur, depending on how many fields you return in your quer...
<p>If your LIKE expression is doing a start-of-string search (<code>Address LIKE 'Blah%'</code>), I would expect the index to be used, most likely through an index seek.</p> <p>If you search for <code>Address LIKE '%Blah%'</code>, a table scan/index scan will occur, depending on how many fields you return in your quer...
48,539
<p>I am working on a new project. Is there any benefit with going with a WCF web service over a regular old fashion web service?</p> <p>Visual Studio offers templates for both. What are the differences? Pros and cons?</p>
<p>What is a "regular old fashioned web service?" An ASMX service, or are you using WSE as well? ASMX services are not naturally interoperable, don't support WS-* specs, and ASMX is a technology that is aging very quickly. WSE (Web Service Enhancements) services DO add support for WS-* and can be made to be interoperab...
<p>In my experience</p> <p><strong>WCF</strong></p> <p>It is absurdly verbose to work with it, it is not quite compatible with other microsoft products and, of course, it is not widely accepted outside ot the microsoft world.</p> <p>But my main problem is it is not stable, it trends to fail (in some situation) and i...
2,841
<p>I'm trying to come up with ways to speed up my secure web site. Because there are a lot of CSS images that need to be loaded, it can slow down the site since secure resources are not cached to disk by the browser and must be retrieved more often than they really need to.</p> <p>One thing I was considering is perhap...
<p>Browsers (especially IE) get jumpy about this and alert users that there's mixed content on the page. We tried it and had a couple of users call in to question the security of our site. I wouldn't recommend it. Having users lose their sense of security when using your site is not worth the added speed.</p>
<p>Be aware that in IE 7 there are issues with mixing secure and non-secure items on the same page, so this may result in some users not being able to view all the content of your pages properly. Not that I endorse IE 7, but recently I had to look into this issue, and it's a pain to deal with.</p>
47,222
<p>I'd like to find a Windows batch counterpart to Bash's <code>$@</code> that holds a list of all arguments passed into a script. </p> <p>Or I have to bother with <code>shift</code>?</p>
<p><a href="https://stackoverflow.com/a/357338/511529">dancavallaro</a> has it right, <code>%*</code> for all command line parameters (excluding the script name itself). You might also find these useful:</p> <p><code>%0</code> - the command used to call the batch file (could be <code>foo</code>, <code>..\foo</code>, <...
<pre> @echo off :start :: Insert your code here echo.%%1 is now:%~1 :: End insert your code here if "%~2" NEQ "" ( shift goto :start )</pre>
46,588
<p>I'm running PHP on Windows/IIS.</p> <p>My session variables don't seem to be preserved from page-to-page.</p> <p>This code&hellip;</p> <pre><code>//echos out the session variables in a nice format for inspection echo "&lt;p&gt;&lt;pre&gt;"; print_r($_SESSION); echo "&lt;/pre&gt;&lt;/p&gt;"; </code></pre> <p>&hel...
<p>can you post a bit more of your session code? some basics:</p> <ul> <li>did you start your session? (<a href="http://php.net/session_start" rel="nofollow noreferrer"><code>session_start()</code></a> )</li> <li>did you check whether your save path has proper permissions (not mentioned in OP)</li> <li>session.save_pa...
<p>can you post a bit more of your session code? some basics:</p> <ul> <li>did you start your session? (<a href="http://php.net/session_start" rel="nofollow noreferrer"><code>session_start()</code></a> )</li> <li>did you check whether your save path has proper permissions (not mentioned in OP)</li> <li>session.save_pa...
21,774
<p>For the last couple hours I have been messing with all sorts of different variations of SQL Server full text search. However I am still unable to figure out how the ranking works. I have come across a couple examples that really confuse me as to how they rank higher then others. For example</p> <p>I have a table wi...
<p>I've found AND and OR clauses don't apply across columns. Create an indexed view that merges the columns and you'll get better results. Look at my past questions and you'll find information that suites your scenario.</p> <p>I also have found I'm better off not appending a '*'. I thought it'd turn up more matches...
<p>What happens if you remove the DoB criteria?</p> <p>MS Full-Text search is really really a black box that's hard to understand and customize You pretty much take it AS IS, unlike Lucene is great for customization</p>
41,247
<p>I have come across numerous arguments against the inclusion of multiple inheritance in C#, some of which include (philosophical arguments aside):</p> <ul> <li>Multiple inheritance is too complicated and often ambiguous</li> <li>It is unnecessary because interfaces provide something similar</li> <li>Composition is a...
<p>I've never missed it once, not ever. Yes, it [MI] gets complicated, and yes, interfaces do a similar job in many ways - but that isn't the biggest point: in the general sense, it simply isn't needed most of the time. Even single inheritance is overused in many cases.</p>
<p>Interfaces are multiple inheritance. As a matter of fact, I would consider Java/C# type interfaces the "proper" implementation of multiple inheritance. Forcing multiple inheritance through the use of interfaces, rather then allowing inheritance from multiple concrete or abstract classes forces the developer to use c...
23,280
<p>I have extensively used Prototype before and it helped us add considerable interactivity to our web applications. However we are looking at making the move to use jQuery in order to standardize on something better supported in Visual Studio.</p> <p>I understand that we can use the jQuery.noConflict to run it alongs...
<p>I can't really help you too much with your question, other than to say that I haven't heard of any such tool, and that I'd be really surprised if one actually existed.</p> <p>While I think jQuery is a great library, and that you're right to be wanting to only use one library, just remember that the cost of you chan...
<p>Thanks guys for your input. I was looking for more of a syntax comparison than anything automated, but nickf makes a good point in that the real cost need not be too great. We only used Prototype on a few pages that really needed a high level of interactivity, so as long as mind out Ps and Qs it should not hurt to u...
32,037
<p>How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn't successful for whatever reason)?</p>
<p>Use the <code>SC</code> (service control) command, it gives you a lot more options than just <code>start</code> &amp; <code>stop</code>.</p> <pre> DESCRIPTION: SC is a command line program used for communicating with the NT Service Controller and services. USAGE: sc &lt;server&gt; [com...
<p>I am writing a windows service in C#, the stop/uninstall/build/install/start loop got too tiring. Wrote a mini script, called it <code>reploy.bat</code> and dropped in my Visual Studio output directory (one that has the built service executable) to automate the loop. </p> <p>Just set these 3 vars </p> <p><code>se...
16,197
<p>I have two arrays of animals (for example).</p> <pre><code>$array = array( array( 'id' =&gt; 1, 'name' =&gt; 'Cat', ), array( 'id' =&gt; 2, 'name' =&gt; 'Mouse', ) ); $array2 = array( array( 'id' =&gt; 2, 'age' =&gt; 321, ), array( ...
<p>This does what Erik suggested (id no. as array key) and merges vlaues in <code>$array2</code> to <code>$results</code>.</p> <pre><code>$results = array(); foreach($array as $subarray) { $results[$subarray['id']] = array('name' =&gt; $subarray['name']); } foreach($array2 as $subarray) { if(array_key_exists...
<pre><code>$new = array(); foreach ($array as $arr) { $match = false; foreach ($array2 as $arr2) { if ($arr['id'] == $arr2['id']) { $match = true; $new[] = array_merge($arr, $arr2); break; } } if ( !$match ) $new[] = $arr; } </code></pre>
4,477
<p>If i have a simple named query defined, the preforms a count function, on one column:</p> <pre><code> &lt;query name="Activity.GetAllMiles"&gt; &lt;![CDATA[ select sum(Distance) from Activity ]]&gt; &lt;/query&gt; </code></pre> <p>How do I get the result of a sum or any query that dont return of ...
<p>Sorry! I actually wanted a sum, not a count, which explains alot. Iv edited the post accordingly</p> <p>This works fine:</p> <pre><code>var criteria = session.CreateCriteria(typeof(Activity)) .SetProjection(Projections.Sum("Distance")); return (double)criteria.UniqueResult(); </code></...
<p>I think in your original example, you just need to to query.UniqueResult(); the count will return an integer.</p>
9,078
<p>Apple's CoreGraphics library defines two functions for describing an arc.</p> <ul> <li>CGPathAddArc adds an arc based on a center point, radius, and pair of angles.</li> <li>CGPathAddArcToPoint adds an arc based on a radius and a pair of tangent lines.</li> </ul> <p>The details are explained in <a href="http://dev...
<p><code>CGContextAddArc</code> does this:</p> <p><img src="https://twistedape.me.uk/blog/images/AddArc.png" alt="addArc"></p> <p>where the red line is what will be drawn, sA is <code>startAngle</code>, eA is the <code>endAngle</code>, r is <code>radius</code>, and x and y are <code>x</code> and <code>y</code>. If yo...
<p>The former gets you a portion of a circle (really, an approximation of one), while the latter exposes the fact that you're creating a Bézier path. Depending on what you're actually drawing, one or the other might be more convenient. You could really consider both of them conveniences for CGPathAddCurveToPoint.</p>...
10,358
<p>So far I've seen many posts dealing with equality of floating point numbers. The standard answer to a question like "how should we decide if x and y are equal?" is</p> <pre><code>abs(x - y) &lt; epsilon </code></pre> <p>where epsilon is a <em>fixed</em>, small constant. This is because the "operands" x and y are o...
<p>It all depends on the specific problem domain. Yes, using relative error will be more correct in the general case, but it can be significantly less efficient since it involves an extra floating-point division. If you know the approximate scale of the numbers in your problem, using an absolute error is acceptable.<...
<p>Using relative error is at least not as bad as using absolute errors, but it has subtle problems for values near zero due to rounding issues. A far from perfect, but somewhat robust algorithm combines absolute and relative error approaches:</p> <pre><code>boolean approxEqual(float a, float b, float absEps, float re...
42,562
<p><br />I have an application where I need the user to upload a photo. After the photo is uploaded to the server, which shouldn't take very long, the user should get back a response that's a regular HTML page saying "thanks...bla bla bla..."<br /> Now, after the the response is sent back to the client and he goes on h...
<p>We do this for a lightweight logging situation:</p> <pre><code>Action&lt;object&gt; d = delegate(object val) { // in this anonymous delegate, write code that you want to run ProcessDataAndLog(); }; d.BeginInvoke(null, null, null); // this spins off the method asynchronously. </code></pre> <p>It's by no me...
<p>I'm no ASP.NET programmer, but the way you generally do this is to start another Thread on the server, which does this background processing for you while the originating Thread returns the View and exits.</p> <p>See if you can find something if you search for "ASP.NET start Thread"</p>
43,482
<p>I would like to create an iPhone app that can open the google maps app and place a pin on the map.</p> <p>I have the exact location of the pin, specified by its longitude and latitude. I also have a name for the pin e.g. 'location 1' that should be displayed along with the pin.</p> <p>I know that UIApplication:ope...
<p>You can use a URL of the format: <a href="http://maps.google.com/maps?q=Your+Location+name@latitude,longitude" rel="noreferrer">http://maps.google.com/maps?q=Your+Location+name@latitude,longitude</a></p> <p><a href="http://maps.google.com/maps?q=This+is+near+Lake+Shore+Drive@41.9288,-87.6315" rel="noreferrer"><a hr...
<p>Why should your user have to exit your app to see a map. You can embed a Google map in your application easily. You can even drop multiple pins for which you have lat &amp; long information. </p> <p>In fact, in my opinion your user should never have to leave your application to view a google map.</p> <p>An exam...
26,851
<p>I recently came across an issue with Windows 2003 (apparently it also exists in other versions too), where if an SSL/TLS server is requesting client certificate authentication and it has more than 16KB of trusted certificate DNs, Internet Explorer (or any other app that uses schannel.dll) is unable to complete the S...
<p>Since ASN.1 is self describing, it's fairly easy to write an ASN.1 parser. As you probably know, ASN.1 data contains a tree of values, where each value type is identified by a globally assigned OID (Object ID). You can find a free ASN.1 decoder with source code at: <a href="http://www.geocities.co.jp/SiliconValley-S...
<p>openssl asn1parse will do it, but you'll need to do some manual parsing to figure out where the issuer sequence begins. Per RFC 5280, it's the 4th item in the TBSCertificate sequence (potentially 3rd if it's a v1 certificate), immediately following the signature algorithm. In the following example:</p> <pre><code> ...
9,786
<p>Given that my client code knows everything it needs to about the remoting object, what's the simplest way to connect to it?</p> <p>This is what I'm doing at the moment:</p> <pre><code>ChannelServices.RegisterChannel(new HttpChannel(), false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(IRemoteS...
<p>The first two lines are in the server-side code, for marshaling out the server object, yes?</p> <p>In that case, yes, the third line is the simplest you can get at client-side.</p> <p>In addition, you can serve out additional server-side objects from the <strong>MyServerObject</strong> instance, if you include pub...
<p>WCF. </p> <p>I have used IPC before there was a WCF, and believe me, IPC is a bear. And it isn't documented fully/correctly.</p> <p>What’s the simplest way to connect to a .NET remote server object? WCF.</p>
4,556
<p>I have a web app on our intranet (VS 2005). There are a couple pages that don't require the user to be logged into the app (feedback and the default page). I am trying to get the domain and username to display and/or send with the feedback. Is there a way to do this without requiring the user to log in? I've tri...
<p>Theresa, I think this is what you're looking for...</p> <pre><code>AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal; WindowsIdentity identity = (WindowsIdentity)principal.Identity; String userName= principal.Identi...
<p>Assuming you have turned Windows Authentication on in IIS for your site:</p> <pre><code>public string user_Name { get { string x = Page.User.Identity.Name; x = x.Replace("YOURDOMAIN\\", ""); return x; } } </code></pre> <p>The x = x.Replace("DOMAIN\", ""); strips out the DOMAIN...
44,462
<p>It has always been best practice to open links in the same window. Should that still be the rule now that most common browsers use tabs? Personally i prefer closing a tab/window over hitting the backbutton. What are your thoughts?</p>
<p>If you prefer closing a tab/window over hitting the back button, then by all means, click links with your middle mouse button. But please don't force your surfing preferences on others. Tabs don't change this principle in the slightest.</p>
<p>I'm going to wear out my scroll wheel button by the amount of tabs I open. There's a great Firefox extension that allows you to close the current tab with a single keypress, and I've assigned to it, so it's very easy to close tabs quickly.</p>
14,969
<p>We are sending out Word documents via email (automated system, not by hand). The email is sent to the user, and CC'd to me.</p> <p>We are getting reports that some users are having the attachments come through corrupted, though when we open the copy that is CC'd to me, it opens fine.</p> <p>When the user forwards ...
<p>I have always been fond of <a href="http://www.codeblocks.org" rel="nofollow noreferrer">Code::Blocks</a> It's a wonderful C/C++ IDE, with several helpful addons. As for a compiler I've always used MingW but I hear <a href="http://www.digitalmars.com" rel="nofollow noreferrer">DigitalMars C/C++</a> compiler is good....
<p><a href="http://www.netbeans.org/features/cpp/" rel="nofollow noreferrer">Netbeans</a> provides a fairly slick C/C++ development environment. Excellent for anyone who is already familiar with NB for Java, Ruby, or PHP development. Provides many of the same features as Visual Studio, Borland, or CodeWarrior (are they...
18,190
<p>How do I delimit a Javascript data-bound string parameter in an anchor <code>OnClick</code> event?</p> <ul> <li>I have an anchor tag in an ASP.NET Repeater control.</li> <li>The <code>OnClick</code> event of the anchor contains a call to a Javascript function.</li> <li>The Javascript function takes a string for its ...
<p>I had recently similar problem and the only way to solve it was to use plain old HTML codes for single (<code>&amp;#39;</code>) and double quotes (<code>&amp;#34;</code>). </p> <p>Source code was total mess of course but it worked.</p> <p>Try</p> <pre><code>&lt;a id="aShowHide" onclick='ToggleDisplay(&amp;#34;&l...
<p>Try putting the extra text inside the server-side script block and concatenating.</p> <pre><code>onclick='&lt;%# "ToggleDisplay(""" &amp; DataBinder.Eval(Container.DataItem, "JobCode") &amp; """);" %&gt;' </code></pre> <p>Edit: I'm pretty sure you could just use double quotes outside the script block as well.</p>...
2,413
<p>How can I achieve the following? I have two models (blogs and readers) and a JOIN table that will allow me to have an N:M relationship between them:</p> <pre><code>class Blog &lt; ActiveRecord::Base has_many :blogs_readers, :dependent =&gt; :destroy has_many :readers, :through =&gt; :blogs_readers end class Re...
<p>Simpler solution that's built into Rails:</p> <pre><code> class Blog &lt; ActiveRecord::Base has_many :blogs_readers, :dependent =&gt; :destroy has_many :readers, :through =&gt; :blogs_readers, :uniq =&gt; true end class Reader &lt; ActiveRecord::Base has_many :blogs_readers, :dependent =&gt...
<p>Easiest way is to serialize the relationship into an array: </p> <pre><code>class Blog &lt; ActiveRecord::Base has_many :blogs_readers, :dependent =&gt; :destroy has_many :readers, :through =&gt; :blogs_readers serialize :reader_ids, Array end </code></pre> <p>Then when assigning values to readers, you apply...
40,775
<p>I thought .Net code gets compiled into MSIL, so I always wondered how do Yellow Screens produce the faulty code. If it's executing the compiled code, how is the compiler able to produce code from the source files in the error message?</p> <p>Feel free to edit this question/title, I know it doesn't really make sens...
<p>A .Net assembly is compiled with metadata about the bytecode included that allows easy decompilation of the code - that's how tools like <a href="http://www.red-gate.com/products/reflector/" rel="noreferrer">.Net Reflector</a> work. The PDB files are debug symbols only - the difference in the Yellow Screen Of Death...
<p>I think this is down to the debug information that can be included with the compiled assemblies..(although I could definately be wrong)</p>
4,054
<p>I are working in a small development team of 4 people. We are trying develop "Agile style" - story points, small tasks, etc... Unfortunately, we are currently managing our tasks in a (shared) excel table.</p> <p>We looked at some available tools (Mingle, TFS, Scrum for Team System), but all of these looked like the...
<p><img src="https://lh3.ggpht.com/thomas.carr/SNKKrk6eOUI/AAAAAAAAA2Y/nrhxuYzrBOQ/s512/ATT637484.jpg" alt="alt text"></p> <hr> <p><strong>Update Response:</strong> It doesn't seem imprortant to track WHAT was underestimated as much as WHY it was underestimated. This is something addressed at the iteration retrospec...
<p>This question is mostly a duplicate of <a href="https://stackoverflow.com/questions/12328/what-bug-tracking-software-do-you-use">https://stackoverflow.com/questions/12328/what-bug-tracking-software-do-you-use</a> which has <em>a lot</em> of answers - tasks are not necessarily bugs, but good tools let you specify oth...
12,007
<p>I am working on a webpage in ASP.Net/C# that uses absolute positioning for a textbox, for several in fact. It was working just fine, until I added some more text boxes. That is, the existing text boxes still positioned correctly, but the new ones did not, despite the fact that I created new styles in the CSS for the...
<p>If you have absolutely positioned elements that have a parent that is either absolutely or relatively positioned, they will position themselves relative to their container instead of the whole page.</p> <p>In other words, your elements might be positioning themselves from different origin points.</p>
<p>It is difficult to explain problems like this if no actual code is provided, but my first guess would be that you're having problem with new controls that are not using the same parent containers as the old ones.</p> <p>Have you checked the css rules that apply for parent containers of properly working text boxes? ...
23,425
<p>I'm looking for a good algorithm that can give me the unique edges from a set of polygon data. In this case, the polygons are defined by two arrays. One array is the number of points per polygon, and the other array is a list of vertex indices.</p> <p>I have a version that is working, but performance gets slow when...
<p>Yes<br> Use a double hash map.<br> Every edge has two indexes A,B. lets say that A > B.<br> The first, top level hash-map maps A to another hash-map which is in turn maps B to some value which represents the information you want about every edge. (or just a bool if you don't need to keep information for edges).<br> ...
<p>First you need to make sure your vertices are unique. That is if you want only one edge at a certain position. Then I use this data structure</p> <p><code>typedef std::pair&lt;int, int&gt; Edge;</code></p> <p><code>Edge sampleEdge;</code></p> <p><code>std::map&lt;Edge, bool&gt; uniqueEdges;</code></p> <p>Edge co...
25,458
<p>I have a CakePHP application that in some moment will show a view with product media (pictures or videos) I want to know if, there is someway to include another view that threats the video or threats the pictures, depending on a flag. I want to use those "small views" to several other purposes, so It should be "like...
<p>In the interest of having the information here in case someone stumbles upon this, it is important to note that the solution varies depending on the CakePHP version.</p> <h2>For CakePHP 1.1</h2> <p><code>$this->renderElement('display', array('flag' => 'value'));</code></p> <p>in your view, and then in <code>/app/...
<blockquote> <p>I want to use those "small views" to several other purposes, so It should be "like" a cake component, for reutilization.</p> </blockquote> <p>This is done with "Helpers", as <a href="http://book.cakephp.org/2.0/en/views/helpers.html" rel="nofollow noreferrer">described here</a>. But I'm not sur...
11,917
<p>How do I find areas of my code that run slowly in a C++ application running on Linux?</p>
<p>If your goal is to use a profiler, use one of the suggested ones.</p> <p>However, if you're in a hurry and you can manually interrupt your program under the debugger while it's being subjectively slow, there's a simple way to find performance problems.</p> <p>Just halt it several times, and each time look at the c...
<p>As no one mentioned Arm MAP, I'd add it as personally I have successfully used Map to profile a C++ scientific program. </p> <p>Arm MAP is the profiler for parallel, multithreaded or single threaded C, C++, Fortran and F90 codes. It provides in-depth analysis and bottleneck pinpointing to the source line. Unlike ...
49,190
<p>How do you iterate over each file in a directory with a .bat or .cmd file?</p> <p>For simplicity please provide an answer that just echoes the filename or file path.</p>
<p>Command line usage:</p> <pre><code>for /f %f in ('dir /b c:\') do echo %f </code></pre> <p>Batch file usage:</p> <pre><code>for /f %%f in ('dir /b c:\') do echo %%f </code></pre> <p><strong>Update</strong>: if the directory contains files with space in the names, you need to change the delimiter the <code>for /f...
<p>I had some malware that marked all files in a directory as hidden/system/readonly. If anyone else finds themselves in this situation, cd into the directory and run <code>for /f "delims=|" %f in ('forfiles') do attrib -s -h -r %f</code>.</p>
21,801
<p>How do you create a custom control (not an ASCX control) and, more importantly, use it in your project? I'd prefer not to create a separate project for it or compile it as a DLL</p>
<p>Server controls should be compiled into a DLL. There should be no reason to be afraid of having an additional assembly in your project, and it helps create good project organization.</p> <p>ASP.NET Server controls are actually custom classes in an assembly. They do not have an "ascx" markup file associated to them....
<p>Create the class for the control and build the solution. If everything goes well the control should now be available on the toolbox.</p> <p>Sometimes the VS doesn't update the toolbox. If that happens add the Register directive to the page:</p> <pre><code>&lt;%@ Register Assembly="NAME_OF_THE_ASSEMBLY" Namespace="...
39,408
<p>I'm having problem in the following line:</p> <pre><code>rd.PrintOptions.PaperSize = PaperSize.PaperFanfoldStdGerman; </code></pre> <p>it throws an exception saying HRESULT: 0x8002000B (DISP_E_BADINDEX)) </p> <p>if I skip this line, the same error eccurs here:</p> <pre><code>rd.PrintOptions.ApplyPageMargins(con...
<p>Number of rows should not matter. Make sure the fields your searching on are indexed properly. If you only have 3 varchar(25) fields, then you probably need to add a primary key that is not a varchar.</p>
<p>For optimal reading you should have an index. A table exists to hold the rows it was designed to contain. As the number of rows increases, the value of the index comes into play and reading remains brisk.</p>
36,587
<p>How do I find the 'temp' directory in Linux? I am writing a platform neutral C++ function that returns the temp directory. In Mac and Windows, there is an API that returns these results. In Linux, I'm stumped. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>Check following variables:</p> <ul> <li>The environment variable <code>TMPDIR</code></li> <li>The value of the <a href="http://www.gnu.org/software/libc/manual/html_node/Temporary-Files.html#index-P_005ftmpdir-1608" rel="noreferrer"><code>P_tmpdir</code> macro</a></li> </ul> <p>If all fails try to use the director...
<p>In standard c, you could try: P_tmpdir</p>
5,094
<p>I need to prevent a document from being saved / saved as (say from ms word). I've looked around and I havn't quite found a satifying answer. I've considered EFS... but I don't think it prevents the user from saving the document as... (though it prevents access to the original source file). Any ideas outthere?</p...
<p>Run it on completely locked-down system with read-only disk, no network and no removable drives. Access to the computer must be phisically restricted as well.</p> <p>This should prevent Save As from working, but still won't prevent document from being copied (someone may take photo of the screen and OCR it).</p>
<p>It usually isn't worth it to disable Save As, because you need access to the original in order to open it in the first place. There are always ways to copy a file.</p> <p>I had the same issue come up when someone asked me to disable Save As for a PDF.</p>
38,516
<p>I wrote a windows service a few months ago that would ping a Sharepoint list using _vti_bin/lists.asmx function GetListItemChanges. It was working fine until a few weeks ago when my company upgraded our Sharepoint instance to SP1.<br> Now whenever my service attempts to access Sharepoint I receive an 401.1 authenti...
<p>Based upon the information provided, I doubt this is a programming error. Can you get access to the IIS Manager interface on the server hosting the SharePoint site? If so, check the valid authentication technologies permitted. Are anonymous connections allowed? Is Windows Integrated Authentication enabled? HTTP ...
<p>Do you have proxies on your internal network?</p> <p>I'm thinking along the lines of double-hop, and that Basic Auth is not prone to that but that NTLM is. If you have a proxy, then the double-hop is an issue. If you are accessing the machine directly and can only count one hop (service to web service) then this sh...
41,070
<p>I'm an expert C# 3 / .NET 3.5 programmer looking to start doing some runtime codegen using System.Reflection.Emit.DynamicMethod. I'd love to move up to the next level by becoming intimately familiar with IL.</p> <p>Any pointers (pun intended)?</p>
<p>The best way to learn it, is to write something you understand, then look at the IL it created. Also, depending on what you are doing, you can use expression trees instead of emitting IL, and then when you compile the expression trees, those smart guys at microsoft create the IL for ya.</p>
<p><a href="https://rads.stackoverflow.com/amzn/click/com/1590596463" rel="nofollow noreferrer" rel="nofollow noreferrer">Expert .NET 2.0 IL Assembler.</a> Although this book may be a little dated now, it was still a great overview for me.</p>
18,786
<p>Which Database table Schema is more efficient and why?</p> <pre><code>"Users (UserID, UserName, CompamyId)" "Companies (CompamyId, CompanyName)" </code></pre> <p>OR</p> <pre><code>"Users (UserID, UserName)" "Companies (CompamyId, CompanyName)" "UserCompanies (UserID, CompamyId)" </code></pre> <p>Given the fact t...
<p>For sure, the earlier one is more efficient given that constraint. For getting the same information, you will have less number of joins in your queries.</p>
<p>I think you mean "many to one" when it comes to users and companies - unless you plan on having a unique company for each user.</p> <p>To answer your question, go with the first approach. One less table to store reduces space and will make your queries use less JOIN commands. Also, and more importantly, it correctl...
5,976
<p>I love data visualisation and to spread that love I thought we could share our favourite examples of data visualisation:</p> <p><strong>Chess moves</strong> <a href="http://turbulence.org/spotlight/thinking/chess.html" rel="noreferrer">http://turbulence.org/spotlight/thinking/chess.html</a></p> <p><strong>Chris Ha...
<p><a href="http://infosthetics.com/" rel="nofollow noreferrer">Information Aesthetics</a>'s feed is on my home page and has been the source of many interesting visualizations since I've placed it there.</p>
<p>A friend of mine did this and got it exposed at MOMA in NY</p> <p><a href="http://pmcruz.com/information-visualization/traffic-in-lisbon-condensed-in-one-day" rel="nofollow">http://pmcruz.com/information-visualization/traffic-in-lisbon-condensed-in-one-day</a></p> <p>It represents the trafic in lisbon over time, i...
30,309
<p>Do you have pseudocode for field validation of the following items in the UK? I am from the USA, so I only know the ones in the USA right now.</p> <ul> <li>Address Line 1</li> <li>Phone Number</li> <li>Mobile Number (in case they have a special rule for this, which they might not)</li> <li>Post Code</li> </ul>
<p>Address line 1, if you want to validate what the user entered freeform, you're probably hosed. There's huge variability. You can use the PostCode Address File (see below) to assist,</p> <p>Typically, if you want a "standard" address, UK-oriented websites ask for the postcode, then prompt the user to choose the corr...
<p>I've started the code (or at least a bunch of RegEx patterns) for Django forms validation for GB telephone numbers <a href="https://github.com/django/django/pull/316/files" rel="nofollow">here</a>.<br> With a basic explanation <a href="http://thedjangoforum.com/board/thread/1269/" rel="nofollow">here</a>.</p>
34,980
<p>Unlike C++, in C# you can't overload the assignment operator. </p> <p>I'm doing a custom Number class for arithmetic operations with very large numbers and I want it to have the look-and-feel of the built-in numerical types like int, decimal, etc. I've overloaded the arithmetic operators, but the assignment remains...
<p>It's still not at all clear to me that you really need this. Either:</p> <ul> <li>Your Number type should be a struct (which is probable - numbers are the most common example of structs). Note that all the types you want your type to act like (int, decimal etc) are structs.</li> </ul> <p>or:</p> <ul> <li>Your Num...
<p>Maybe what you're looking for can be solved using C# accessors.</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa287786(v=vs.71).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa287786(v=vs.71).aspx</a></p>
37,343
<p>I've got a project which requires a fairly complicated process and I want to make sure I know the best way to do this. I'm using ASP.net C# with Adobe Flex 3. The app server is Mosso (cloud server) and the file storage server is Amazon S3. The existing site can be viewed at <a href="https://www.noisetrade.com" rel="...
<p>The bit about updating the zip but not having the temporary files if the user adds or removes a track leads me to suspect that you want to build zips containing multiple tracks, possibly complete albums. If this is incorrect and you're just putting a single mp3 into each zip, then StingyJack is right and you'll pro...
<p>MP3's are compressed. Why bother zipping them?</p>
35,175
<p>I found this <a href="http://pecl.php.net/package/threads" rel="noreferrer">PECL package called threads</a>, but there is not a release yet. And nothing is coming up on the PHP website.</p>
<p>From the PHP manual for the <a href="http://php.net/pthreads"><strong>pthreads</strong></a> extension:</p> <blockquote> <p>pthreads is an Object Orientated API that allows user-land multi-threading in PHP. It includes all the tools you need to create multi-threaded applications targeted at the Web or the Console....
<p>There is the rather obscure, and soon to be deprecated, feature called <a href="http://docs.php.net/manual/en/control-structures.declare.php#control-structures.declare.ticks" rel="nofollow noreferrer">ticks</a>. The only thing I have ever used it for, is to allow a script to capture SIGKILL (Ctrl+C) and close down g...
25,744
<p>I'm currently designing a RepRap 3D printer that will not have a heated bed. I have heard that it is possible to use a power brick with commercial printers lacking heatbeds. Is this possible with a RepRap printer using a RAMPS board?</p> <p>I'm referring specifically to the TronXY X1 power brick. I was wondering if...
<p><strong>Printing speed is dependent by the firmware and physical properties of your printer</strong>.</p> <p>Slicers typically compute the expected time by assuming the printer will execute <em>exactly</em> what it is instructed to do, but a printer is a real object, with mass and momentum, and stepper motors that ...
<p>I use a Anet A8 which has a system acceleration and jerk of 400 and 20 When i slice with Cura, then I use a gcode without acceleration control, because the printer does this by its own and a combination with the gcode acceleration/jerk control gets me some strange behavior (e.g. sometimes some ultra slow movement i...
875
<p>What is the meaning of this attribute?</p> <pre><code>&lt;System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)&gt; _ </code></pre>
<p><a href="http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=390" rel="nofollow noreferrer">This explains it perfectly</a></p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataobjectattribute.aspx" rel="nofollow noreferrer">DataObjectAttribute</a> "identifies a type as an object suitable for binding to an ObjectDataSource object."</p> <p>The <a href="http://msdn.microsoft.com/en-us/library/system.componentmode...
49,790
<p>Is is possible to get login credentials such as name/id if user does login by OpenId?</p>
<p>There are two accepted methods for retrieving these kind of things by OpenID: SReg and Attribute Exchange (AX). Both of these are extensions to the standard OpenID specification; SReg is the older of the two and specifies a set of fields that can be requested and sent with authentication, whereas AX allows requestin...
<p>You will not get their actual username (or password), but you will get their OpenID wich is unique.</p>
10,771
<p>Using <code>MySQL</code>, I can do something like:</p> <pre><code>SELECT hobbies FROM peoples_hobbies WHERE person_id = 5; </code></pre> <p><strong>My Output:</strong></p> <pre><code>shopping fishing coding </code></pre> <p>but instead I just want 1 row, 1 col:</p> <p><strong>Expected Output:</strong></p> <pre...
<p>You can use <a href="https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat" rel="noreferrer"><code>GROUP_CONCAT</code></a>:</p> <pre><code>SELECT person_id, GROUP_CONCAT(hobbies SEPARATOR ', ') FROM peoples_hobbies GROUP BY person_id; </code></pre> <p>As Ludwig stated in <a href="...
<p>In sql server use string_agg to pivot a row field values into a column:</p> <pre><code>select string_agg(field1, ', ') a FROM mytable or select string_agg(field1, ', ') within group (order by field1 dsc) a FROM mytable group by field2 </code></pre>
34,934
<p>I'm trying to use xcodebuild and OCUnit with my Continuous Integration server (<a href="http://www.jetbrains.com/teamcity/" rel="noreferrer">TeamCity</a>). </p> <p>JetBrains offers test observer implementations for boost::test and CppUnit that format test output in a way that TeamCity can interpret. I need to do ...
<p>You can write your own observer by extending the SenTestObserver class and implementing the notification listeners</p> <ul> <li>(void) testSuiteDidStart:(NSNotification *) aNotification</li> <li>(void) testSuiteDidStop:(NSNotification *) aNotification</li> <li>(void) testCaseDidStart:(NSNotification *) aNotificatio...
<p>I have implemented a simple Teamcity Adapter, you can view the <a href="https://gist.github.com/994882" rel="nofollow">gist here</a>. SenTestObserver isn't exactly broken, it simply doesn't adhere to the best practices:</p> <p>This is what you need to call in your Observer subclass to have it properly registered:</...
30,755
<p>I am considering building a application using PRISM (Composite WPF Guidance/Library). The application modules will be vertically partitioned (i.e. Customers, Suppliers, Sales Orders, etc). This is still all relatively easy... I also have a Shell with a main region were all the work will happen but now I need the fol...
<p>Just finished watching <a href="http://www.dnrtv.com/default.aspx?showNum=124" rel="nofollow noreferrer">Brian Noyes on Prism</a> at dnrTV. This answered all my question... </p>
<p>to save you time, check <a href="http://johnpapa.net/building-a-presentation-framework-with-prism-for-silverlight" rel="nofollow noreferrer">John Papa's Presentation Framework article</a>. It will be more easy if you have 3rd object(<code>Screen Conductor</code>) to handle your screens in showing or hiding from regi...
7,181
<p>I'm trying to unit test a page in my ASP.NET MVC application that, when posted to, will delete a user's item. I want to restrict this page so that it can only be posted to by the owner of said item. Originally, I wanted to just stick a quick check in the controller that checked if the HttpContext.Current.User.Iden...
<p>The last line of your question is probably the quickest solution, however, I don't think you need to create the interface, <code>HttpContext.Current.User</code> is already an <code>IPrincipal</code> and <code>HttpContext.Current.User.Identity</code> is already an <code>IIdentity</code>.</p> <p>If your checking logi...
<p>I use Thread.CurrentPrincipal.Identity.Name. It's trivial to create a GenericPrincipal for a unit test and attach it.</p>
37,902
<p>This isn't a question but I thought I'd start a thread where links to exceptionally useful (and widely applicable) vb6 code could be placed.</p> <p>My choice is by someone called John Korejwa and is located on planet sourcecode at </p> <p><a href="http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId...
<p><a href="http://www.vbaccelerator.com/home/index.asp" rel="noreferrer">http://www.vbaccelerator.com/home/index.asp</a></p> <p>More useful VB6 code then you can shake a stick at :)</p>
<p><a href="http://www.freevbcode.com/" rel="nofollow noreferrer">FreeVBCode.com</a> has always been my favorite place to look before reinventing the wheel.</p>
28,818
<p>Most of our Eclipse projects have multiple source folders, for example:</p> <ul> <li>src/main/java</li> <li>src/test/java</li> </ul> <p>When you right-click on a class and choose New JUnit Test, the default source folder for the new test is "src/main/java" (presumably the first source folder listed in the project ...
<p>I use <a href="http://moreunit.sourceforge.net/" rel="noreferrer">moreUnit</a>, an Eclipse plugin to assist writing unit tests. Among other features, it lets you configure the default source folder of tests.</p>
<p>Now you can use my fast code eclipse plug-in. With this plug-in you can configure the test path to be <code>src/test/java</code> only once. It also has a jump to the unit test feature. It is available at : <a href="http://fast-code.sourceforge.net/" rel="nofollow">http://fast-code.sourceforge.net/</a>.</p>
9,451
<p>For some reason the Windows command prompt is "special" in that you have to go to a properties dialog to resize it horizontally rather than just dragging the corner of the window like every other app. Unsurprisingly this feature made it into P-P-P-Powershell as well -- is there any way around this via command prompt...
<p>2019 Update:</p> <ul> <li>Microsoft has released the terminal app on <a href="https://github.com/microsoft/terminal" rel="nofollow noreferrer">Github</a> &amp; the <a href="https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701" rel="nofollow noreferrer">Windows Store</a>, and it has tabs, panels, ...
<p>You might consider installing <a href="http://www.farmanager.com/" rel="nofollow noreferrer">FAR</a>. It's an excellent text mode file manager and much more. It could also be resized by dragging the corner of the window :)</p>
18,602
<p>I have a question about how to deploy WPF application into a PC without Framework 3.5. If a PC just installs Windows XP and sp3, Is it possible to design a setup package that can install WPF Application directly on this PC? <p> The situation is like this:<p> I designed a simple WPF Application. And I want to get its...
<p>Visual Studio 2008 SP1 adds support for the "Client Profile" subset of the .NET Framework. If the Windows XP SP3 machines you're targeting don't have any version of the .NET Framework installed already, this will install a slimmed-down version of the Framework with the assemblies you need for a WPF app. Microsoft pr...
<p>When you use ClickOnce, In your Deploy Option from Project Propertys, set your requireds assemblyes as included, then if you really needs some assemblyes, use gacutil.exe or drag and drop on your client local GAC</p>
23,225
<p>If i make a label in TFS, and later make a new label with the same name... then the old label is replaced by the new one. </p> <p>How do I prevent TFS from overwriting a label?</p>
<p>The following MSDN article covers <a href="http://msdn.microsoft.com/en-us/library/9ew32kd1(VS.80).aspx" rel="nofollow noreferrer">using the Scope of a label to try and minimize the occurrences of these mishaps</a>:</p> <blockquote> <p><strong>Using the /Child Option to Avoid Labeling Mishaps</strong></p> <p>If you ...
<p>Thanks, that led me on the right track. </p> <p>It seems that the label overwrite is a "feature" and not a bug. It's working as designed sixletter's link above explains it, and below are two more with info about it.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms181439(VS.80).aspx" rel="nofollow norefer...
14,037
<p>How can we produce the effect of the red line under a bad spelling word like the image below :</p> <p><a href="http://img505.imageshack.us/img505/7253/options285x395rg9.th.png" rel="nofollow noreferrer">alt text http://img505.imageshack.us/img505/7253/options285x395rg9.th.png</a></p> <p><strong>Update</strong></p>...
<p>You can do this using a <a href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.richtextbox?view=windowsdesktop-6.0" rel="nofollow noreferrer">RichTextBox</a> control, which will allow you to set the underline style and underline color on any portion of text.</p> <p>And here's an <a href="https:/...
<p>use google's spellchecker</p> <p><a href="http://www.asp101.com/articles/jeremy/googlespell/default.asp" rel="nofollow noreferrer">http://www.asp101.com/articles/jeremy/googlespell/default.asp</a></p>
21,633
<p>I need to round a value up to the nearest multiple of 2.5.</p> <p>For example:<br> 6 --> 7.5<br> 7.6 --> 10<br> etc. </p> <p>This seems like the best way to do this?</p> <pre><code> Function RoundToIncrement(ByVal originalNumber As Decimal, ByVal increment As Decimal) As Decimal Dim num = Math.Round(o...
<p>Divide the number by 2.5, round up to the nearest integer, then multiply the result by 2.5.</p> <p>You're close.</p> <pre><code>Function RoundToIncrement(ByVal orignialNumber As Decimal, ByVal increment As Decimal) As Decimal Return Math.Ceiling( orignialNumber / increment ) * increment End Function </code></p...
<pre><code> /* This will round up (Math.Ceiling) or down (Math.Floor) based on the midpoint of the increment. The other examples use Math.Ceiling and therefore always round up. Assume the increment is 2.5 in this example and the number is 6.13 */ ...
28,133
<p>I am facing a problem. I would like to localize my action names in my project so french people can have clean urls with french names.</p> <p><a href="http://www.test.com/Home" rel="nofollow noreferrer">http://www.test.com/Home</a> should be <a href="http://www.test.com/Accueil" rel="nofollow noreferrer">http://www....
<p>you can do this when you register the routes in global.asax.</p> <p>if normally you have this:</p> <pre><code>routes.MapRoute("Catalog-Brands", "catalog/brand/", new {controller = "Brand", action = "Index", isActive = true}); </code></pre> <p>you could make this one too (I don't know french, sorry)</p> <pre><cod...
<p>If you can use ISAPIs, that is to say, if you control IIS, the best thing is to use a ISAPI I recommend you Ionics Isapi: <a href="http://www.codeplex.com/IIRF" rel="nofollow noreferrer">http://www.codeplex.com/IIRF</a></p> <p>It implements more or less what Rewrite mod in Apache does (redirections).</p>
40,760
<p>How can I check the existence of an element in jQuery?</p> <p>The current code that I have is this:</p> <pre><code>if ($(selector).length &gt; 0) { // Do something } </code></pre> <p>Is there a more elegant way to approach this? Perhaps a plugin or a function?</p>
<p>In JavaScript, everything is 'truthy' or 'falsy', and for numbers <code>0</code> means <code>false</code>, everything else <code>true</code>. So you could write:</p> <pre><code>if ($(selector).length) </code></pre> <p>You don't need that <code>&gt;0</code> part.</p>
<p>Use the following syntax to check if the element actually exists using jQuery.</p> <pre><code>let oElement = $(".myElementClass"); if(oElement[0]) { // Do some jQuery operation here using oElement } else { // Unable to fetch the object } </code></pre>
5,089
<p>The back button just causes my page to refresh. Is there a way around this without disabling the cache?</p>
<p>Try adding this to your HTML header:</p> <pre><code>&lt;META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"&gt; &lt;META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"&gt; </code></pre>
<p>where you click on product/image on page there call onclick javascript function i.e.</p> <pre><code>function getHashOnBack(valueget) { location.hash = "#backTo=" + $(window).scrollTop();$(document).height(); } </code></pre> <p>Now, put</p> <pre><code>$(document).ready(function () { var ab = window.location....
25,588
<p>By definition algorithms are independent from the medium they run on. E.g. I use Excel tables to play with data structures and to do some move/shuffling/marking experiments before implementing an algorithm in a programming language. </p> <p>What tools and techniques do you use to design and simulate the function of...
<p>Algorithms are independent of language, true. But any medium you use is a language, period. Using Excel means you're using the excel "language" (rows, columns, cells, etc.) to express some of your algorithm. Maybe not the complete, finished product, but you've expressed it in Excel.</p> <p>UML diagrams are a lan...
<p>I guess it depends on the complexity of the algorithm.</p> <p>Quite often I'll actually draw a quick sketch of a flowchart on some paper. There are some excellent diagramming tools available, but I still haven't found one that is as quick as a good old fashioned sketch on a piece of paper.</p> <p>Other than that,...
42,175
<p>Conventional IPv4 dotted quad notation separates the address from the port with a colon, as in this example of a webserver on the loopback interface:</p> <pre><code>127.0.0.1:80 </code></pre> <p>but with IPv6 notation the address itself can contain colons. For example, this is the short form of the loopback addres...
<p>They work almost the same as today. However, be sure you include <code>[]</code> around your IP.</p> <p>For example : <a href="http://en.wikipedia.org/wiki/IPv6_address#Literal_IPv6_addresses_in_network_resource_identifiers" rel="noreferrer"><code>http://[1fff:0:a88:85a3::ac1f]:8001/index.html</code></a></p> <p>Wi...
<p>They're the same, aren't they? Now I'm losing confidence in myself but I really thought IPv6 was just an addressing change. TCP and UDP are still addressed as they are under IPv4.</p>
22,614
<p>I have a number of databases on a Windows 2000 Server running the 32 bit version of SQL Server 2000. I need to transfer all the data and settings to a new server running the 64 bit version of SQL 2008 on Windows 2003 64 bit.</p> <p>Is this as simple as backing up the databases and restoring to the new server. Will ...
<p>To transfer logins, you should be able to use the 'Transfer Logins Task' described in Books Online <a href="http://technet.microsoft.com/en-us/library/ms137870.aspx" rel="nofollow noreferrer">here</a>.</p> <p>Ross Mistry has published a few <a href="http://www.networkworld.com/community/node/30052" rel="nofollow no...
<p>I would use the RedGate SQL Compare and SQL Data Compare. That would give you some assurances of the integrity of the database. However its not going to be an online migration of the data, you would have to prevent updates during the transition.</p>
39,701
<p>Does the change of macs over to Intel chips mean we are done with the bit twiddling on numbers in binary resources for cross platform data distributions?</p> <p>Is that the last of this problem or are there some other platforms I'm not aware of?</p>
<p>You seem to forget the endianness transcends processor architectures. There are plenty of algorithms and protocols that demand a particular byte order. For example, I spent two weeks trying to get an MD5 hashing algorithm to work, only to realize that I had assumed network byte order (Big Endian) while Ronald Rivest...
<p>Define PC, what do you consider a PC?</p> <p>I am currently typing this from an Linux distribution that is running on an arm 9 processor, which can be set into different endianness, but the default is big endian. Little endian is used by Intel, AMD and Via (x86 compatible).</p> <p>Endian-ness won't go away any tim...
11,358
<p>I am using VS2008 and Resharper. Resharper creates a directory _Resharper.ProjectName. These files provide no value for source control that I am aware of and cause issues when committing changes. How can I get SVN to ignore them? I am using TortoiseSVN as my interface for SVN.</p> <p>EDIT: You guys are fast.</p...
<p><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-ignore.html" rel="noreferrer">Here's a link to show the ignoring process in TortoiseSVN</a></p>
<p>SVN only controls what you put into it when creating your repository. Don't just import your entire project folder but import a "clean" folder BEFORE doing a build. After the build you get all the object files or your _Resharper folder etc. but they are not version controlled.</p> <p>I forgot: the <pre>svn:ignore</...
9,484
<p>Basically what I need is an automated way to update the product version number in WiX (3.0 with Votive etc), and then get that version number into an Inno Setup "bootstrapper"</p> <p>I pretty much have the process mostly automated, however version numbers still need to be updated manually which obviously isn't idea...
<p>No need to pass anything! You can simply let the InnoSetup Preprocessor read the version info straight from the binary's version resource, e.g.:</p> <pre><code>#define AppName "My App" #define SrcApp "MyApp.exe" #define FileVerStr GetFileVersion(SrcApp) #define StripBuild(str VerStr) Copy(VerStr, 1, RPos(".", VerSt...
<p>I found this for the inno setup section which looks like it would work:</p> <p><a href="http://agiletracksoftware.com/blog.html?id=4" rel="nofollow noreferrer">http://agiletracksoftware.com/blog.html?id=4</a></p>
46,656
<p>In the C programming language and Pthreads as the threading library; do variables/structures that are shared between threads need to be declared as volatile? Assuming that they might be protected by a lock or not (barriers perhaps).</p> <p>Does the pthread POSIX standard have any say about this, is this compiler-de...
<p>As long as you are using locks to control access to the variable, you do not need volatile on it. In fact, if you're putting volatile on any variable you're probably already wrong.</p> <p><a href="http://web.archive.org/web/20190219170904/https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-fo...
<p>Some people obviously are assuming that the compiler treats the synchronization calls as memory barriers. "Casey" is assuming there is exactly one CPU.</p> <p>If the sync primitives are external functions and the symbols in question are visible outside the compilation unit (global names, exported pointer, exported...
10,363
<p>What is the difference between using system() to execute a binary and using the combination of fork/execvp. </p> <p>Is there any security/portablility/performance difference.</p>
<p>System also uses a <code>fork</code>/<code>exec</code>... combination. If you do <code>fork</code>/<code>exec</code> yourself you can execute parallel to your running process, while <code>system</code> is blocking (includes the <code>wait</code>). Also <code>system</code> executes the command not direct, but via a ...
<p>system() works on Windows but fork() doesn't.</p> <p>Unless you use a compatibility layer such as Cygwin, but even then a fork can be very expensive.</p>
39,179
<p>We have a software product that evolves at the rhythm of clients' needs and of a more general roadmap.</p> <p>Because we are in a SCRUM project environment, it happens very regurlarly that a new feature makes its way to the product, and then we are confronted with the choice of:</p> <ul> <li>implementing this feat...
<p>I'd suggest the following, which we use in my current environment: treat the unplanned feature like you would a security fix.</p> <ul> <li>Each planned release (e.g. 3.0, 3.1) gets its own version number, and its own tag in source code. After it's released, you don't touch it.</li> <li>New features after a planned...
<p>A new branch like( 'new_feature_branch') is there to materialize a <a href="https://stackoverflow.com/questions/16142#114384">development effort</a> which is not compatible with the current branch (like 'release_branch')</p> <p>So if your current release_branch is not very active, you can use it for the new feature...
31,207
<p>I am using http remoting in C# to talk between two applications. Earlier when I was running both applications on a single machine/two machines, it was very slow. We have a proxy server to connect to the internet. We set "Bypass proxy server for local addresses" in IE and now when I run both applications on one mach...
<p>What sort of data are you sending, and at what rate? And are you using lots of calls to remote (<code>MarshalByRefObject</code>) objects?</p> <p>In reality, it is hard to fully control the data with remoting. Personally, I would recommend something message-based, for example WCF. This makes the interfaces between s...
<p>There aren't a lot of remote calls, as feared. A single remote call takes 10 secs on different machines while it takes only 350ms when on a single machine. </p> <p>when I run proxycfg.exe, it shows "Direct Access (no proxy server)"</p>
48,915
<p>I am writing a QT application and I need to embed a terminal (we say,xterm) within a QDialog, like some KDE application (see kdevelop/kate/...).</p> <p>I've been trying with: - QX11EmbedContainer placed into the QLayout of my QDialog - QProcess for the program I want to excecute</p> <p>I expect the QProcess runn...
<p>Sorry, I've tried your solution before posting oh this site and it does not work. I've solved switching to kdelibs and using those imports and this code</p> <pre><code>#include &lt;kparts/part.h&gt; #include &lt;assert.h&gt; #include &lt;kde_terminal_interface.h&gt; #include &lt;kpluginfactory.h&gt; #include &lt;kl...
<p>You need to pass the window ID of the container to the xterm.</p> <p>If you look at the example in the Qt help for QX11EmbedContainer, it just passes the window id to the QProcess. Change this to</p> <pre><code> QProcess process(&amp;container); QString executable(app.arguments()[1]); QStringList arguments; ar...
39,297
<p>Please help! I'm really at my wits' end. My program is a little personal notes manager (google for "cintanotes"). On some computers (and of course I own none of them) it crashes with an unhandled exception just after start. Nothing special about these computers could be said, except that they tend to have AMD CPUs....
<p>So it doesnnt crash when configuration is DEBUG Configuration? There are many things different than a RELEASE configruation: 1.) Initialization of globals 2.) Actual machine Code generated etc..</p> <p>So first step is find out what are exact settings for each parameter in the RELEASE mode as compared to the DEBUG...
<p>Most heisenbugs / release-only bugs are due to either flow of control that depends on reads from uninitialised memory / stale pointers / past end of buffers, or race conditions, or both.</p> <p>Try overriding your allocators so they zero out memory when allocating. Does the problem go away (or become more reproduci...
16,017
<p>I have a SUM array formula that has multiple nested IF statements, making it very inefficient. My formula spans over 500 rows, but here is a simple version of it:</p> <pre><code>{=SUM(IF(IF(A1:A5&gt;A7:A11,A1:A5,A7:A11)-A13:A17&gt;0, IF(A1:A5&gt;A7:A11,A1:A5,A7:A11)-A13:A17,0))} </code></pre> <p>As you can see, th...
<pre><code>=MAX( MAX( sum(A1:A5), sum(A7:A11) ) - sum(A13:A17), 0) </code></pre>
<p>You may want to look into the VB Macro editor. In the Tools Menu, go to Macros and select Visual basic Editor. This gives a whole programming environment where you can write your own function.</p> <p>VB is a simple programming language and google has all the guidebooks you need.</p> <p>There, you can write a fun...
40,790
<p>I am designing an part for my car. It is a panel for the rear door. I want to add it some cases for tools, but before going on, could you tell me:</p> <p>It is a large flat panel, around 100cm by 35cm.</p> <p><strong>Is it going to be suitable for printing in that ABS material? Is it too big?</strong></p> <p><a h...
<p>ABS would be fine, as a material, for the application.</p> <p>The problem, given the scale, would be the printing device used. I would suggest that you have the piece cut to spec for you using a polycarbonate. </p> <p>If you have access to a workshop you could do so yourself if you set up proper fencing using a la...
<p>It is a huge part that would not fit in most 3D printers, do you have access to a 3D printer this big? Even if it does fit it will take a long time to print.</p> <p>Considering it's a simple flat shape, maybe laser cut / CNC acrylic or wood would be better, as you will have a stronger part, and most likely faster a...
375
<p>I am sending the echo to mail function via PHP from variable that includes HTML code. The strange thing is, that this </p> <pre><code>&lt;����}im� </code></pre> <p>shows up AFTER the string.. but I do not manipulate with it anymore. The charset of mail function (the attachment) is same as charset of HTML code.</p>...
<p>Encoding problem, maybe it tries to display binary code?</p> <p>You should use htmlentities if ou want to display HTML</p> <blockquote> <p>// Outputs: A 'quote' is</p> <p>&lt;b&gt;bold&lt;/b&gt; echo</p> <p>htmlentities($str);</p> </blockquote>
<p>Those characters are probably "junk" data in your string. Depending on where the string is coming from these characters could be: extra TCP data in the socket after the HTML page, or extra data in the file after the HTML page, or someone else actually put these characters in their HTML page (perhaps their file was ...
38,483
<p>I know it happens sometime before Load, but during what event exactly?</p>
<p>It's loaded into memory between init and load. See t<a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="noreferrer">his article</a> for a full break down of the page lifecycle.</p>
<p>The Viewstate is actually loaded in the OnPreLoad event of the page,Just after the Page_InitComplete.</p>
12,030
<p>In C++ program, I am trying to #import TLB of .NET out-of-proc server.</p> <p>I get errors like:</p> <blockquote> <p>z:\server.tlh(111) : error C2146: syntax error : missing ';' before identifier 'GetType'</p> <p>z:\server.tlh(111) : error C2501: '_TypePtr' : missing storage-class or type specifiers</p> <p>z:\server...
<p>Added no_namespace and raw_interfaces_only to my #import:</p> <pre><code>#import "server.tlb" no_namespace named_guids </code></pre> <p>Also using TLBEXP.EXE instead of REGASM.EXE seems to help this issue.</p>
<p>Also, make sure your C# class doesn't have this attribute:</p> <p>[ClassInterface(ClassInterfaceType.AutoDual)] &lt;-- Seems to cause errors in C++ with _TypePtr</p>
3,382
<p>I am curious about the algorithm/principles behind the estimates that the slicing softwares provide. Is there a standard technique behind this and how accurate is it ?</p>
<p>Much of the software used in 3D printing is open-source, and so are some slicers. Cura, for instance, does (or did, this source code is from an older branch) its print time estimation in <a href="https://github.com/smorloc/Curation/blob/master/Cura/util/gcodeInterpreter.py" rel="noreferrer">gcodeInterpreter.py</a>.<...
<p>Generally speaking, the typical algorithm takes into account the slicer's speed settings for specific features of the build, such as infill, perimeters, top/bottom layers, etc. The distance traveled by the nozzle at a specific speed for each feature is also part of the equations involved. There are some rather vague...
664
<p>I have stfw but I cannot find a simple / standalone way to create a webservice client in java.</p> <p>Does anyone have a link/sample into this?</p>
<p>How about using <a href="http://ws.apache.org/axis2/" rel="nofollow noreferrer">Axis2</a>?</p> <p>Just follow the <a href="http://ws.apache.org/axis2/1_4_1/quickstartguide.html" rel="nofollow noreferrer">quickstart guide</a> and you should be on your way.</p> <p>Here is another more descriptive <a href="http://ws....
<p>I presume you're referring to a SOAP web service? For a RESTful web service in which requests are submitted via HTTP GET, you really don't need anything more than a web browser.</p>
25,695
<p>I wrote a piece of code to convert PHP's striplashes into valid Python [backslash] escapes:</p> <pre><code>cleaned = stringwithslashes cleaned = cleaned.replace('\\n', '\n') cleaned = cleaned.replace('\\r', '\n') cleaned = cleaned.replace('\\', '') </code></pre> <p>How can I condense it? </p>
<p>Not totally sure this is what you want, but..</p> <pre><code>cleaned = stringwithslashes.decode('string_escape') </code></pre>
<p>Python has a built-in escape() function analogous to PHP's addslashes, but no unescape() function (stripslashes), which in my mind is kind of ridiculous.</p> <p>Regular expressions to the rescue (code not tested):</p> <pre><code>p = re.compile( '\\(\\\S)') p.sub('\1',escapedstring) </code></pre> <p>In theory that...
3,437
<p>I understand that we can use SMS Sender in command line mode. But i been getting this error same as this article <a href="http://www.oreillynet.com/pub/a/wireless/2003/10/10/sms.html" rel="nofollow noreferrer">http://www.oreillynet.com/pub/a/wireless/2003/10/10/sms.html</a></p> <p>The smssender.exe will use the las...
<p>Not a direct answer to your question, but might help..</p> <p>Take a look at some of the sms gateway services out there. I've used Kapow with a lot of success.</p> <p><a href="http://www.kapow.co.uk/" rel="nofollow noreferrer">http://www.kapow.co.uk/</a></p> <p>It's a UK company, but I'm sure you find one in your...
<p>Just discovered the answer to your question nad it is really easy.... just use the first time the GUI version of SMSSENDER.EXE and in the Options menu, select enable logging... after thar you can start using the command line with success.</p>
23,036
<p>I am being sent an xml feed via multicast, but I don't know the multicast group address. Can I just use localhost instead?</p> <pre><code>Socket socket = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp); IPEndPoint ip = new IPEndPoint(IPAddress.Any,8888); socket.Bind(ip); socket.SetSock...
<p>No.</p> <p>You (your client) needs to join the multicast group, you'll AddMembership to the multicast group IP, then connect.</p> <p>Otherwise you won't be able to receive the multicast feed. Your code would work with a UDP broadcast though.</p>
<p>Unlike unicast, you do need to know the group address for multicast.</p>
37,196
<p>How can I deploy an iPhone application from Xcode to real iPhone device without having a US$99 Apple certificate?</p>
<p>It sounds like the application isn't signed. Download ldid from Cydia and then use it like so: <code>ldid -S /Applications/AccelerometerGraph.app/AccelerometerGraph</code></p> <p>Also be sure that the binary is marked as executable: <code>chmod +x /Applications/AccelerometerGraph.app/AccelerometerGraph</code></p>
<p>There is no workaround. You can only ad hoc deploy apps if they are registered with your device. This prevents you from building your own app store.. </p>
30,583
<p>How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET?</p>
<p>This guy seems to have your answer.</p> <blockquote> <p><a href="https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net" rel="noreferrer">https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net</a></p> </blockquote> <p>And in case the blog ever goes away or breaks the url, here's the githu...
<p>Using the logic from the previous answer, this was my take:</p> <pre><code>public class CRC32 { private readonly uint[] ChecksumTable; private readonly uint Polynomial = 0xEDB88320; public CRC32() { ChecksumTable = new uint[0x100]; for (uint index = 0; index &lt; 0x100; ++index) ...
2,960
<p>We are using classic asp to call a C# dll and in the C# dll we are using System.Drawing.Printing.PrinterSettings.InstalledPrinters to get a list of availabe printers. If the printers are not shared they will not show up when a user trys to print. The Local System account can see and print to them from a VB6 dll and ...
<p>As I recall, running a website uses the Network User account, which may not have permission to view local printers.</p> <p>There was a page on MSDN that said how you can impersonate another user that might have access to the printers, but I've not been able to find it.</p> <p>Edit: I posted too soon. <a href="http...
<p>As I recall, running a website uses the Network User account, which may not have permission to view local printers.</p> <p>There was a page on MSDN that said how you can impersonate another user that might have access to the printers, but I've not been able to find it.</p> <p>Edit: I posted too soon. <a href="http...
3,554
<p>Came across this error today. Wondering if anyone can tell me what it means:</p> <blockquote> <blockquote> <p>Cannot sort a row of size 9522, which is greater than the allowable maximum of 8094.</p> </blockquote> </blockquote> <p>Is that 8094 bytes? Characters? Fields? Is this a problem joining multiple ta...
<p>In SQL 2000, the row limit is 8K bytes, which is the same size as a page in memory. </p> <p>[Edit]</p> <p>In 2005, the page size is the same (8K), but the database uses pointers on the row in the page to point to other pages that contain larger fields. This allows 2005 to overcome the 8K row size limitation.</p>
<p>That used to be a problem in SQL 2000, but I thought that was fixed in 2005.</p>
3,746
<p>I've just noticed this Meta post, <a href="https://meta.stackexchange.com/q/364007/280335">Testing three-vote close and reopen on 13 network sites</a> and I wondered whether we should employ it here, and what do other people think?</p> <p>We are a smallish site, with a smallish number of active users (although it is...
<h2>Yes, we should have a <em>three</em> vote close question review queue</h2>
<h2>No, we should stay with the <em>five</em> vote close question review queue</h2>
79
<p>Using MVC with an observer pattern, if a user action requires polling a device (such as a camera) for data, should the polling be done in the Controller and the result passed off the Model or should a request be sent to the Model and the Model itself performs the polling.</p> <p>This question is my attempt to recon...
<p>The syntax you're trying to use is new in <strong><a href="http://effbot.org/zone/element-xpath.htm" rel="noreferrer">ElementTree 1.3</a></strong>.</p> <p>Such version is shipped with <strong>Python 2.7</strong> or higher. If you have Python 2.6 or less you still have ElementTree 1.2.6 or less.</p>
<p>There are several problems in this code.</p> <ol> <li><p>Python's buildin ElementTree (ET for short) has no real XPATH support; only a limited subset By example, it doesn't support <em>find-from-root</em> expressions like <code>//target</code>. </p> <p>Notice: the <a href="http://docs.python.org/2/library/xml.etr...
27,432
<p>Anyone know of some tutorial material for how to use Interface Builder for iPhone development? I can find sample projects and stuff and that's extremely helpful, but they do not reveal how things where setup in Interface Builder.</p>
<p>The Pragmatic Programmers have some <a href="http://www.pragprog.com/screencasts/v-bdiphone/writing-your-first-iphone-application" rel="nofollow noreferrer">screencasts</a> on building an iphone application. I haven't watched those, but I have watched some of their other videos and they were pretty good.</p> <p>Th...
<p>You can actually get a lot out of these screen-casts which are free as of now: <a href="http://www.cocoacast.com/?q=blog/1" rel="nofollow noreferrer">http://www.cocoacast.com/?q=blog/1</a></p> <p>Note that they are very 'connected' to the Aaron Hillegass book on Mac programming (which is also a great resource). Som...
46,499
<p>I have written something that uses the following includes:</p> <pre><code>#include &lt;math.h&gt; #include &lt;time.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;windows.h&gt; #include &lt;commctrl.h&gt; </code></pre> <p>This code works fine on 2 machines with the Platform SDK installed, bu...
<p>Use Dependency Walker. Download and install from <a href="http://www.dependencywalker.com/" rel="noreferrer">http://www.dependencywalker.com/</a> (just unzip to install). Then load up your executable. The tool will highlight which DLL is missing. Then you can find the redistributable pack which you need to ship ...
<p>I suspect it is trying to find a version of common controls that isn't installed. You may need a manifest file to map the version of common controls to your target operating system. Also, you may need to make sure you have installed the same VC runtimes that you were linked to.</p> <p><a href="http://blogs.msdn.com...
18,765
<ol> <li>Why is operator '&amp;' defined for bool?, and operator '&amp;&amp;' is not? </li> <li>How exactly does this 1) bool? &amp; bool? and 2) bool? and bool work?</li> </ol> <p>Any other "interesting" operator semantics on Nullable? Any overloaded operators for generic T?</p>
<p>Operators on <code>Nullable&lt;T&gt;</code> are "lifted" operators. What this means is: if T has the operator, T? will have the "lifted" counterpart.</p> <p>&amp;&amp; and || aren't really operators in the same sense as &amp; and | - for example, they can't be overloaded - from the ECMA spec 14.2.2 Operator overloa...
<p>-- In addition, the logical &amp;&amp; operator along with the || operator cannot be overloaded.</p> <p>2) The reason that the bitwise operator works is because it operates on single bits, which is a simple 1 or 0. This is what boolean operators essentially are, true and false, 1 and 0.</p>
38,952
<p>Is there any way to add iCal event to the iPhone Calendar from the custom App?</p>
<p>Based on <a href="https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/EventKitProgGuide/ReadingAndWritingEvents.html#//apple_ref/doc/uid/TP40004775-SW1" rel="noreferrer">Apple Documentation</a>, this has changed a bit as of iOS 6.0.</p> <p>1) You should request access to the user's c...
<p>The Google idea is a nice one, but has problems.</p> <p>I can successfully open a Google calendar event screen - but only on the main desktop version, and it doesn't display properly on iPhone Safari. The Google mobile calendar, which does display properly on Safari, doesn't seem to work with the API to add events....
30,560
<p>SQL Experts,</p> <p>Is there an efficient way to group runs of data together using SQL?<br> Or is it going to be more efficient to process the data in code. </p> <p>For example if I have the following data:</p> <pre><code>ID|Name 01|Harry Johns 02|Adam Taylor 03|John Smith 04|John Smith 05|Bill Manning 06|John S...
<p>Try this:</p> <pre><code>select n.name, (select count(*) from myTable n1 where n1.name = n.name and n1.id &gt;= n.id and (n1.id &lt;= ( select isnull(min(nn.id), (select max(id) + 1 from myTable)) from myTable nn where nn.id &gt; n.id and nn.name &lt;&gt; n.name ...
<p>For this particular case, all you need to do is group by the name and ask for the count, like this:</p> <pre><code>select Name, count(*) from MyTable group by Name </code></pre> <p>That'll get you the count for each name as a second column.</p> <p>You can get it all as one column by concatenating like this:</p> ...
4,166
<p>I need a thread to wait until a file is exist or created. I have the following code so far:</p> <pre><code>while(!receivedDataFile.isFileExists("receiveddata.txt")) { try { Thead.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); return null; } } </code></pre> ...
<p>You should find out which thread interrupts that thread. Threads don’t do that on their own.</p>
<p>If all you want is a notification when a file is created, AND you can (and willing) to go native (JNI) AND you want only win32 support, you could use the code <a href="http://www2.hawaii.edu/~qzhang/FileSystemWatcher/index.html" rel="nofollow noreferrer" title="File system watcher using JNI (native)">here</a>.</p>
45,911
<p>How do you set up your .NET development tree? I use a structure like this:</p> <pre><code>-projectname --config (where I put the configuration files) --doc (where I put all the document concerning the project: e-mails, documentation) --tools (all the tools I use: Nunit, Moq) --lib (all the libraries used by ...
<p>We use a very similar layout as covered in JP Boodhoo's blog post titled <a href="http://blog.developwithpassion.com/2007/10/01/directory-structure-for-projects/" rel="nofollow noreferrer">Directory Structure For Projects</a>.</p>
<p>At my place of work we have multiple projects, where each project gets its own sub-directory, like so: -proj1<br> --proj1.csproj<br> -proj2<br> --proj2.csproj<br> -proj3<br> --proj3.csproj<br> solutionfile.sln </p> <p>The rest of your setup looks okay, but I think you should figure out how you would incorporate m...
9,714
<p>I am currently plowing my way through <a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html" rel="nofollow noreferrer">IBM's tutorial on CakePHP</a></p> <p>At one point I run into this snippet of code:</p> <pre><code>&lt;?php class Dealer extends AppModel { var $name = 'Dealer'; var $h...
<p>Assign the value null instead of leaving anything out. The <a href="http://php.net/isset" rel="noreferrer">manual says</a></p> <blockquote> <p>isset() will return FALSE if testing a variable that has been set to NULL</p> </blockquote> <pre><code>&lt;?php class Dealer extends AppModel { var $name = 'Dealer'; var ...
<p>It is legal, though as far as I'm aware, you have to explicitly say it's 'empty' by assigning null to it,</p> <pre><code>$hasMany = array ('Product' =&gt; array( 'className' =&gt; 'Product', 'conditions'=&gt; null, // is this allowed? 'order'=&gt; null, // same thing here 'foreignKey'=&gt;'dealer_id')); </code></pr...
20,124
<p>I need to serialize the System.Configuration.SettingsProperty and System.Configuration.SettingsPropertyValue class object through WCF.</p>
<p>Using your own class is reasonable option. You can also use the VS designer settings if you want. </p> <p>The VS designer keeps property settings in the <a href="http://msdn.microsoft.com/en-us/library/system.configuration.applicationsettingsbase.aspx" rel="nofollow noreferrer">ApplicationSettingsBase</a> class. By...
<p>I guess you're asking because you can't return a list of SettingProperty. I would create a serializable class myself and load the properties there.</p>
20,605
<p>In XEmacs this is done by the calling the function char-to-ucs on a character. GNU Emacs does not seem to have this function. In GNU Emacs, characters seem to be ordinary integers. Running C-x = on a latin character reveals that the Emacs codepoint is different from the Unicode codepoint for the corresponding cha...
<p>In a modern Emacs, M-x describe-char will tell you about the character at point.<br> An example:</p> <pre><code> character: ¢ (2210, #o4242, #x8a2, U+00A2) charset: latin-iso8859-1 (Right-Hand Part of Latin Alphabet 1 (ISO/IEC 8859-1): ISO-IR-100.) code point: #x22 syntax: w which means: word ...
<p>Thanks for the quick answers. I looked at the source code for describe-char, and found the following snippet which solves my problem. I tested it in both XEmacs 21.4.13 Mule and GNU Emacs 22.1.1 and it seems to work.</p> <pre><code>(or (get-char-property (point) 'untranslated-utf-8) (encode-char (char-after) ...
29,216