instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Im in the situation that I often send small codesnippets and xml-snippets to coworkers and partners via my outlook.
Has anyone got a good idea or tool that I can use to have my pastes syntaxhighlighted before I paste them into an email.</p>
<p>I was thinking of an intermediate paste to "$fancytool" and then I woul... | <p>Late but I can give an answer that works.
You need 2 things</p>
<ol>
<li>putty</li>
<li>access to some Unix server (With vim)</li>
</ol>
<p>In putty options, Under window → selection , turn the check box on for </p>
<p><code>Paste in to clipboard in RTF as well as plain text</code>.</p>
<p>Log on to the se... | <p>If you're on Windows, Visual Studio does this automatically. At least it does for me, using Visual Studio 2005 on XP and copy/pasting to both MS Word and Lotus Notes</p>
| 27,917 |
<p>I am trying to make one field in a datagrid editable with a numeric stepper. My current attempts look like they are working, but the dataProvider is not actually being changed.</p>
<p>Based on what I have read in a billion different places, the syntax should be </p>
<pre>< mx:DataGridColumn dataField="a" itemR... | <p>You need to select only the item's row for removal. I'm not sure how you have it set up, but if the image element is inside the row you could use:</p>
<pre><code> $("img.delete").click(function() {
var row = $(this).parents('tr:first');
...
success: function(){
$(row).remove(); //Remo... | <p>If it is the html id-attribute you want, then that would work. Why don't you try it?</p>
<p>EDIT: It might be just row.attr('id'); It have slipped from my mind, havn't ben using jQuery for sometime :)</p>
| 49,121 |
<p>I'm trying to find a way to get the open tasks in C#. I've been searching on google and can only find how to get a list of the <strong>processes</strong>. I want the only the tasks that would show up on the taskbar.</p>
<p>Also, along with that, it would be cool if I could get the process the task is associated w... | <p>This article should pretty much tell you exactly what to do, it shows how to build your own task switch and includes the code needed to enumerate all windows and determine if they are "tasks" and it shows you how to use PrintWindow api to get the previews on XP.</p>
<p><a href="http://msdn.microsoft.com/en-us/libra... | <p>@abelenky17</p>
<p>I suspect that this will not cover all cases, for example there are processes who have several top level windows (that all appear in the task manager).
Consider for example: FireFox, Windows Explorer, IE, etc... those applications can have multiple windows on the desktop.
Also, it will not handl... | 39,999 |
<p>I get an error everytime I upload my webapp to the provider. Because of the customErrors mode, all I see is the default "Runtime error" message, instructing me to turn off customErrors to view more about the error.</p>
<p>Exasperated, I've set my web.config to look like this:</p>
<pre><code><?xml version="1.0"?... | <p>This has been driving me insane for the past few days and couldn't get around it but have finally figured it out:</p>
<p>In my machine.config file I had an entry under <code><system.web></code>:</p>
<pre><code><deployment retail="true" />
</code></pre>
<p>This seems to override any other customError s... | <p>It may not be IIS!</p>
<p>I went through all of the answers on this page, as well as several more. None of them solved our issue, BUT they are good things to check and WILL cause problems. SO check those first. If you're still pulling your hair out, and you're using PHP, check your PHP settings.</p>
<p>What fixed it... | 12,715 |
<p>Ran into this problem today, posting in case someone else has the same issue.</p>
<pre><code>var execBtn = document.createElement('input');
execBtn.setAttribute("type", "button");
execBtn.setAttribute("id", "execBtn");
execBtn.setAttribute("value", "Execute");
execBtn.setAttribute("onclick", "runCommand();");
</cod... | <p>to make this work in both FF and IE you must write both ways:</p>
<pre><code>
button_element.setAttribute('onclick','doSomething();'); // for FF
button_element.onclick = function() {doSomething();}; // for IE
</code></pre>
<p>thanks to <a href="http://mcarthurgfx.com/blog/article/assigning-onclick-with-new... | <p>Did you try:</p>
<pre>
execBtn.setAttribute("onclick", function() { runCommand() });
</pre>
| 12,127 |
<p>I have a linq query and I am trying to put that in to a serializable object for a distributed caching (Velocity) but its failing due to a LINQ-to-SQL lazy list</p>
<p>like so</p>
<pre><code> return from b in _datacontext.MemberBlogs
let cats = GetBlogCategories(b.MemberBlogID)
... | <p>If you are putting it in a distributed cache you will need to avoid the LazyList altogether. You can then call .ToList() around the whole LINQ statement as in:</p>
<pre><code>(from x select new MemberBlogs).ToList()
</code></pre>
<p>This should then be cachable because it forces the queries to be evaluated.</p>
| <p>I know this is an old post but I had the same issue as I wanted to execute my LazyList and put them into the AppFabric Cache. I ended up putting some custom serialization logic into the LazyList type.</p>
<p>The first part now looks like this:</p>
<pre><code> public class LazyList<T> : IList<T>, ISeria... | 33,409 |
<p>Is there any possibility that GetPropInfo returns nil even if the given class is declared with correct {$METHODINFO} directives.</p>
<pre><code> type
...
...
{$METHODINFO ON}
TMyClass = class
private
fField: integer;
published
property Field: integer read fField write fField;
... | <p>Gotcha! It seems the problem is hidden at the forward declaration that I overlooked. Didn't know that sneaky feature. </p>
<p>It seems the compiler considers only the first declaration of the class to generate RTTI or not so if you have a forward declaration like this... </p>
<pre><code> type
TMyClass = clas... | <p>I am glad that you have found a solution. It is the same thing with <code>$TypeInfo</code> directive. Delphi 7 help says:</p>
<blockquote>
<p>Note that if a class is forward declared, the first declaration of the class must be declared with the <code>$M</code> switch.</p>
</blockquote>
<p>P.S.: <code>$M+/- = $... | 44,043 |
<p>How can I detect the current text formatting at the cursor position in a WPF RichTextBox?</p>
| <p>The author of this thread also asked about TextDecorations where you did not provide sample code and its different to use. I post this as a <strong>further solution</strong>:</p>
<pre><code>var obj = _myText.GetPropertyValue(Inline.TextDecorationsProperty);
if (obj == DependencyProperty.UnsetVa... | <p>Try the code below where rtb is the RichTextBox:</p>
<pre><code>TextRange tr = new TextRange(rtb.Selection.Start, rtb.Selection.End);
object oFont = tr.GetPropertyValue(Run.FontFamilyProperty);
</code></pre>
| 24,752 |
<p>I am developing an <strong>Isolated Shell</strong> that caters to "<strong>designers/special content creators</strong>" performing specific tasks, using the Shell. As they operate on files, they need to be able to use TFS for source control. This is mainly due to the fact that Developers will also operate on the sam... | <p>It sounds like you are trying to allow the "special content creators" save files in TFS Source Control without having to buy them a license to a Visual Studio Team Edition -- correct me if I'm wrong.</p>
<p>If that's the case, unfortunately I believe that you can't quite do that. Your users still need a Client Acce... | <p>It sounds like you are trying to allow the "special content creators" save files in TFS Source Control without having to buy them a license to a Visual Studio Team Edition -- correct me if I'm wrong.</p>
<p>If that's the case, unfortunately I believe that you can't quite do that. Your users still need a Client Acce... | 4,156 |
<p>I am building a ASP.NET website, and when I click the START DEBUGGING icon, it runs Internet Explorer as the account that I ran Visual Studio with. </p>
<p>I would like to run IE as a different user when debugging.</p>
| <p>You can use the runas command to run IE as a different user for running your app. Later attach to the asp.net worker process when you want to debug.</p>
<p>If you want to just change the credentials for Integrated Authentication, try the setting in the update below.</p>
<p><strong>Update</strong>: If you want IE t... | <p>@Gulzar is on to something, except that as long as you start the debugger (it will fire up the browser, that's ok, just don't close it), then start up IE (or Firefox) using runas as another user and point it to the localhost URL shown in the debugger-started browser, you should be able to interact with the applicati... | 31,405 |
<p>Why don't we get compile errors on inline code errors in asp.net mvc views f.eks</p>
<pre><code><h1><%= ViewData.Model.Title.Tostrig() %></h1>
</code></pre>
<p>The code above will build just fine. Wrong spelling in webform controls will give you an error so I can't see why this isn't supported in... | <p>The ASPX files in both ASP.NET and ASP.NET MVC are not compiled from the Visual Studio IDE. This is often the cause for "false positives" as you have pointed out. </p>
<p>I often add the <a href="http://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx" rel="nofollow noreferrer">aspnet_compiler</a> as a post bu... | <p>You can see </p>
<p><a href="http://odetocode.com/blogs/scott/archive/2006/10/17/8190.aspx" rel="nofollow noreferrer">http://odetocode.com/blogs/scott/archive/2006/10/17/8190.aspx</a></p>
| 45,257 |
<p>I have a xml build of</p>
<pre><code><elig>
<subscriber code="1234"/>
<date to="12/30/2004"
from="12/31/2004"/>
<person name="bob"
ID="654321"/>
<dog type="labrador"
color="white"/>
<location name="hawaii"
islandCod... | <p>First of all your XML is still not well-formed and I actually cannot catch why you're looping over the <code><date/></code> tags - there is only one <code><date/></code> tag inside <code><subscriber/></code> (assuming that the first <code><subscriber/></code> should not be self-closed).</p>
... | <p>In this case, isn't it more logical to move the apply-template calls outside the for-each loop? Since the person, location and dog elements are children of the subscriber, they should be processed within the scope of the subscriber, instead of in the scope of the date.</p>
<p>I.e.:</p>
<pre><code><xsl:template ... | 33,320 |
<p>I'd like to make a click event fire on an <code><input type="file"></code> tag programmatically.</p>
<p>Just calling click() doesn't seem to do anything or at least it doesn't pop up a file selection dialog.</p>
<p>I've been experimenting with capturing events using listeners and redirecting the event, but I... | <p>I have been searching for solution to this whole day. And these are the conclusions that I have made:</p>
<ol>
<li>For the security reasons Opera and Firefox don't allow to trigger file input.</li>
<li>The only convenient alternative is to create a "hidden" file input (using opacity, not "hidden" or "display: none"... | <p>You can use</p>
<pre><code><button id="file">select file</button>
<input type="file" name="file" id="file_input" style="display:none;">
<script>
$('#file').click(function() {
$('#file_input').focus().trigger('click');
});
</script>
</code></pre>
| 25,859 |
<p>I'm auditing our existing web application, which makes heavy use of <a href="http://www.w3schools.com/HTML/html_frames.asp" rel="nofollow noreferrer">HTML frames</a>. I would like to download all of the HTML in each frame, is there a method of doing this with <a href="http://www.gnu.org/software/wget/" rel="nofollow... | <p>as an addition to Steve's answer:</p>
<p>Span to any host—‘-H’</p>
<p>The ‘-H’ option turns on host spanning, thus allowing Wget's recursive run to visit any host referenced by a link. Unless sufficient recursion-limiting criteria are applied depth, these foreign hosts will typically link to yet more hosts, and so... | <pre><code>wget --recursive --domains=www.mysite.com http://www.mysite.com
</code></pre>
<p>Which indicates a recursive crawl should also traverse into frames and iframes. Be careful to limit the scope of recursion only to your web site since you probably don't want to crawl the whole web.</p>
| 14,230 |
<p>So I'm teaching myself Ruby on Rails, with a PHP background. I've written a sloppy, proof-of-concept PHP application called "<a href="http://rezich.com/storybored" rel="nofollow noreferrer">2NDP.</a>" I want to re-create this in Ruby on Rails (but more basic, more clean, and with a better interface), so I can learn ... | <p>Rather then having four seperate columns, a separate joining table might be more appropriate. For example:</p>
<p>Pages -> LinkedPages -> Pages</p>
<p>Then you can create a <a href="http://wiki.rubyonrails.org/rails/pages/Beginner+Howto+on+has_many+:through" rel="nofollow noreferrer">has_many through</a> relations... | <p>Hates_, that was helpful, but if anyone needs a more in-depth explanation about this sort of thing, <a href="http://blog.hasmanythrough.com/2007/10/30/self-referential-has-many-through" rel="nofollow noreferrer">read about it here</a>.</p>
| 46,246 |
<p>As the title already states, I'm trying to declare a nested function and return a pointer to that function. I want this function 'not' to return a new function pointer which will return the negation of whatever the original function was.</p>
<p>Here is what I have:</p>
<pre><code>someType not( someType original ) ... | <p>Steve, you have a completely wrong mental model of what is a C function. </p>
<pre><code>someType resultFunc = calloc( 1024, 1 );
memcpy( resultFunc, &isNot, 1024 );
</code></pre>
<p>From your code fragment, I can surmise that you think that you can copy function's compiled code into a block of memory, and the... | <p>I'm using GCC.</p>
<p>You can turn on nested functions by using the flag:</p>
<pre><code>-fnested-functions
</code></pre>
<p>when you compile.</p>
| 6,174 |
<p>How can I restart(recycle) IIS Application Pool from C# (.net 2)?</p>
<p>Appreciate if you post sample code?</p>
| <p>If you're on <strong>IIS7</strong> then this will do it if it is stopped. I assume you can adjust for restarting without having to be shown.</p>
<pre><code>// Gets the application pool collection from the server.
[ModuleServiceMethod(PassThrough = true)]
public ArrayList GetApplicationPoolCollection()
{
// Use... | <p>Another option:</p>
<pre><code>System.Web.Hosting.HostingEnvironment.InitiateShutdown();
</code></pre>
<p>Seems better than <code>UploadAppDomain</code> which "terminates" the app while the former waits for stuff to finish its work.</p>
| 31,089 |
<p>I have a program I've written in VB.NET 2005, it saves statistics in an XML file. </p>
<p>I use this program on multiple computers. I'd like to set up a webserver where I can upload my XML file, or just the data, and add it to the server ignoring duplicate entries already on the server. </p>
<p>What do I need ... | <p>I did something like this a long time ago to send back HFNetChk XML reports from around the world back to a central server.</p>
<p>I set up a service endpoint on the server (webservice, TCP, whatever fits your req's), and had the client app send the finished XML back to the central server when it was done with its ... | <p>I'll second the recommendation for WCF/asmx services. As for how you store the data it really depends on what you want to do with it, you could leave them as XML or if you want reporting on them, just load them to SQL Server. </p>
| 21,142 |
<p>So I'm programming along in a nice, up to date, object oriented fashion. I regularly make use of the various aspects of OOP that PHP implements but I am wondering when might I need to use closures. Any experts out there that can shed some light on when it would be useful to implement closures?</p>
| <p>PHP will support closures natively in 5.3. A closure is good when you want a local function that's only used for some small, specific purpose. The <a href="http://wiki.php.net/rfc/closures" rel="nofollow noreferrer">RFC for closures</a> gives a good example:</p>
<pre><code>function replace_spaces ($text) {
$re... | <p><strong>Here are examples for closures in php</strong></p>
<pre><code>// Author: HishamDalal@gamil.com
// Publish on: 2017-08-28
class users
{
private $users = null;
private $i = 5;
function __construct(){
// Get users from database
$this->users = array('a', 'b', 'c', 'd', 'e', 'f')... | 17,663 |
<p>I have the SOAP request in an XML file. I want to post the request to the web service in .net
How to implement?</p>
| <pre class="lang-cs prettyprint-override"><code>var uri = new Uri("http://localhost/SOAP/SOAPSMS.asmx/add");
var req = (HttpWebRequest) WebRequest.CreateDefault(uri);
req.ContentType = "text/xml; charset=utf-8";
req.Method = "POST";
req.Accept = "text/xml";
req.Headers.Add("SOAPAction", "http://localhost/SOAP/SOAP... | <p>You need to post the data over HTTP. Use the <a href="http://msdn.microsoft.com/en-us/library/debx8sh9.aspx" rel="nofollow noreferrer">WebRequest class</a> to post the data. You will need to send other data with the post request to ensure you have a valid SOAP envelope. Read the <a href="http://www.w3.org/TR/soap/" ... | 36,520 |
<p>I want to create a right click context menu for my textboxes to provide the typical copy/paste functionality. Any ideas on how to go about this?</p>
| <p>Looks like this is a <a href="http://www.wintellect.com/cs/blogs/sporter/archive/2007/12/09/right-click-event-in-silverlight-1-1-2-0.aspx" rel="nofollow noreferrer">way to do this here</a>, <a href="http://blogs.microsoft.co.il/blogs/justinangel/archive/2007/10/22/question-from-silverlight-forums-custom-context-menu... | <p>The demo in this open source project does just that while supporting nested menus:</p>
<p><a href="http://sl4popupmenu.codeplex.com/" rel="nofollow noreferrer">http://sl4popupmenu.codeplex.com/</a></p>
| 39,063 |
<p>Does anyone know of a good tool to generate the WSDL for a service contract written in C# (i.e. set of methods that are tagged as "[OperationContract]" using WCF)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam a WSDL file. I've found tools for ... | <p>Easiest thing to do is host the service with a base address setup, and then just hit it from a browser with "?wsdl" appended to the end. </p>
<p>Here's an example of a service configuration with a base address specified. Note this goes in the <code><configuration><services></code> element in your config... | <p>Two ways:</p>
<p>a) <strong>Download wsdl file and do below steps</strong>:</p>
<p>i) Open visual studio command prompt as an administrator.</p>
<p>ii) Type below command:</p>
<p>wsdl.exe [path To Your WSDL File]</p>
<p>b) <strong>With endpoint</strong>:</p>
<p>i) Open Visual studio command prompt as an admini... | 11,885 |
<p>I work on a medium sized development team that maintains a 8+ years old web application written in Java 1.4.</p>
<p>For new development I always try to convince people to adhere to newer standards and best practices, That goes from simple things like using new naming standards like HtmlImplementation over HTMLImple... | <p>I really don't think there's anything in the same league as Effective Java. The cost of buying a book is much smaller than the developer time spent reading it (or other material anyway) - so I would strongly recommend going for EJ rather than trying to find anything similar.</p>
<p>There may be an online version of... | <p>I use Sun's <a href="http://java.sun.com/reference/blueprints/" rel="nofollow noreferrer">Java BluePrints</a> as a source of best practices. The code samples serve as a "do it like this" standards document. The naming conventions and project conventions are must-reads. </p>
<p>There's some design-pattern stuff ... | 33,225 |
<p>I am looking for a small wiki engine that is easy to embed into an existing PHP application. Or perhaps a set of libraries to handle all the typical wiki functions.</p>
<p>Currently I am using <a href="http://erfurtwiki.sourceforge.net/" rel="noreferrer">ErfurtWiki</a>, but it is starting to show its age. It hasn... | <p>I highly recommend <a href="http://www.mediawiki.org/wiki/MediaWiki" rel="noreferrer">MediaWiki</a>, the wiki engine that runs wikipedia.</p>
<p>EDIT: As per your comment, MediaWiki is highly embeddable. I've integrated it in numerous projects over the years.</p>
| <p>I like DokuWiki, but pmWiki might be better for you. Here's a list of all the PHP wikis: <a href="http://www.wikimatrix.org/search.php?sid=183" rel="nofollow noreferrer">http://www.wikimatrix.org/search.php?sid=183</a></p>
| 43,915 |
<p>I'm using jquery ajax to post updates back to my server. I'm concerned about making sure I have put in place appropriate measures so that only my AJAX calls can post data.</p>
<p>My stack is PHP on Apache against a MySQL backend.</p>
<p>Advice greatly appreciated!</p>
| <p>Any request that the AJAX calls in your pages can make can also be made by someone outside of the application. If done right, you will not be able to tell if they were made as part of an AJAX call from your webapp or by hand/other means.</p>
<p>There are two scenarios I can think of which you might be talking abou... | <p>Use sessions to ensure that any Ajax posts are done in an authenticated context. Think of your Ajax code as just another client to your server, it becomes easier to tackle authentication issues that way.</p>
| 5,932 |
<p>Pretty much as the question asks. Answers preferably in pseudo code and referenced. The correct answer should value speed over simplicity.</p>
| <p>See <a href="http://www.softsurfer.com/Archive/algorithm_0105/algorithm_0105.htm" rel="nofollow noreferrer">Intersections of Rays, Segments, Planes and Triangles in 3D</a>. You can find ways to triangulate polygons.</p>
<p>If you really need ray/polygon intersection, it's on 16.9 of <a href="http://www.realtimerend... | <pre><code>function Collision(PlaneOrigin,PlaneDirection,RayOrigin,RayDirection)
return RayOrigin-RayDirection*Dot(PlaneDirection,RayOrigin-PlaneOrigin)/Dot(PlaneDirection,RayDirection)
end
</code></pre>
<p>(PlaneDirection is the unit vector which is perpendicular to the plane)</p>
| 40,256 |
<p>Is there a built-in way to know if a given session variable is a serialized object? Say I retrieve a value like $_SESSION['foo'], but I don't know if it was originally a string or if it is a serialized object. Is there some way to check, or once serialized does PHP just see a string as a string as a string? </p>
| <p>It's a pretty common misconception that you have to manually serialize objects before putting them in session. That is not the case. You can simply assign an object instance to a slot in <code>$_SESSION</code>, and PHP will automagically serialize and unserialize it for you, between requests.</p>
| <p>A string is a string is a string. I think the best you'll be able to do is just try to unserialize it, and if it works, it works. If it doesn't, it doesn't.</p>
<p>The only other option would be to use a regex to see if it "looks" like a serialized object. Just running <code>unserialize()</code> on it might be easi... | 34,096 |
<p>I'm working on a system were a user can edit existing objects ("Filter" domain objects to be exact) through a GUI. As a UI hint, we only want to enable the save button if the user really modified something to the object. I was wondering if anyone had any experience with this problem and what the best way would be to... | <p>Correct!</p>
<p>Additionally,you can expose two methods:
BeginEdit - In this method, your mark your IsDirty Flag to True. Meaning you are doing modification. Call this method when you are about to make modifications</p>
<p>CancelEdit - In this method, reset the IsDirty Flag to False. Meaning you have arborted the ... | <p>If you have a set of objects which are being edited then you'll probably need something more than a boolean flag for isDirty(). This problem is not dissimilar to reference counting, i.e. increment a dirty count on edit and decrement on undo. If you are supporting undo I suspect you are going to wind up with some p... | 24,520 |
<p>We manufacture artificial corals for aquarium decorations.</p>
<p>We are trying to use 3D scanning and printing to duplicate live corals. Please see attached photos, left is 3D printed model, right is coral molded using resin.</p>
<p>The problem is lacking detail, the real corals have pores (tiny holes).</p>
<p>C... | <p>First thing to check it's, What printer are you using? is FDM or SLA/SLS? Technology used is the great bottleneck to achieve the results that you want to. </p>
<p>Also, going cheap in 3D printing it's a way to get bad results. A good setup it's really important to get a great XY and Z resolution. </p>
<p>FDM it's ... | <p>Perhaps with the scanned data you could import it into some sort of 3D modeling application such as Blender and add the pores either manually or with a modifier. See <a href="https://docs.blender.org/manual/ko/dev/modeling/modifiers/index.html" rel="nofollow noreferrer">Blender - modifiers</a>.</p>
| 681 |
<p>I have two scripts that often need to be run with the same parameter:</p>
<pre><code>$ populate.ksh 9241 && check.ksh 9241
</code></pre>
<p>When I need to change the parameter (<strong>9241</strong> in this example), I can go back and edit the line in history. But since I need to change the number in two ... | <p>In bash:</p>
<pre><code>!!:gs/9241/9243/
</code></pre>
<p>Yes, it uses <code>gs///</code>, not <code>s///g</code>. :-)</p>
<p>(zigdon's answer uses the last command starting with <code>pop</code>, such as <code>populate.sh</code>. My answer uses the last command, full stop. Choose which works for you.)</p>
| <p>One solution is to simply create a wrapper script (<em>populate_check.ksh</em>) that calls the scripts in turn:</p>
<pre><code>r=$1
populate.ksh $r && check.ksh $r
</code></pre>
<p>Or for multiple parameters:</p>
<pre><code>for r; do
populate.ksh $r && check.ksh $r
done
</code></pre>
<p>For ta... | 24,778 |
<p>I'm writing a utility for myself, partly as an exercise in learning C# Reflection and partly because I actually want the resulting tool for my own use.</p>
<p>What I'm after is basically pointing the application at an assembly and choosing a given class from which to select properties that should be included in an ... | <p>Couple of options here:</p>
<ol>
<li>Attach to <code>AppDomain.AssemblyResolve</code> and do another <code>LoadFile</code> based on the requested assembly.</li>
<li>Spin up another <code>AppDomain</code> with the directory as its base and load the assemblies in that <code>AppDomain</code>.</li>
</ol>
<p>I'd highly... | <p>I worked out <a href="https://stackoverflow.com/users/5380/kent-boogaart">Kent Boogaart</a>'s second option.
Essentially I had to:</p>
<p>1.) Implement the <code>ResolveEventHandler</code> in a separate class, inheriting from <code>MarshalByRefObject</code> and adding the <code>Serializable</code> attribute.</p>
<... | 8,377 |
<p>I've made many different seperate parts of a GUI system for the Nintendo DS, like buttons and textboxes and select boxes, but I need a way of containing these classes in one Gui class, so that I can draw everything to the screen all at once, and check all the buttons at once to check if any are being pressed. My que... | <p>This question is very similar to one I was going to post, only mine is for Sony PSP programming.</p>
<p>I've been toying with something for a while, I've consulted some books and <a href="http://www.3dbuzz.com/xcart/product.php?productid=30&cat=12&page=1" rel="nofollow noreferrer">VTMs</a>, and so far this ... | <p>One useful strategy to keep in mind might be the <a href="http://en.wikipedia.org/wiki/Composite_pattern" rel="nofollow noreferrer">composite pattern</a>. At a low level, it might allow you to treat all GUI objects (and collections of objects) more easily once built. But I have no idea what's involved in GUI framewo... | 2,902 |
<p>Whenever I create a method signature in VS 2008 (C#), I type the two braces:</p>
<p>public void Something() {}</p>
<p>This leaves the cursor to the right of the closing brace. Then I have to use the arrow keys to reposition the cursor in between the braces. Is there a better way to do this without using the arro... | <p>I don't have vs2008 at the moment. Assuming VS2008 still supports this, you could use code snippets. Mess with below til you get what you need. (See Tools|Code Snippets Manager)</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas... | <p>You could record a macro that inserts the } then moves the cursor and then assign the macro to the shift+] key combo, so that your closing curly bracket always performs your macro.</p>
| 39,975 |
<p>We have a small 3 developer team that is currently using Subversion for our source control. We expect the team to group to 8 members within the next 6 to 12 months. We are considering changing our source control to either TFS or Mercurial for improved branching. I know TFS is overkill for just branching, but that is... | <p>In my experience, TFS works really well, even for small teams. If your total number of developers is five or less, you can use the relatively affordable Workgroup edition: above that, you'll have to pony up for the real thing, pricing for which is definitely in the 'Enterprise' realm...</p>
<p>The biggest hurdle to... | <p>It's been awhile, but I'm thinking that it takes about a half-day to get setup, plus some time reading the manuals beforehand to make sure you know what you're doing. Configuration doesn't take too long -- you need to add all of your developers in as licensed users. Setting up projects is not too hard. I usually ... | 26,986 |
<p>I have a simple vb6 editor type application which has a richtextbox as the editor page. It allows users to key in stuff and the store it into a file which will keep all the text in RTF stored as CDATA in xml.</p>
<p>When you load back the file, it will read it off the xml and load back the rtf. We allow for unicode... | <p>You could add a reference to Microsoft Script Control Library (COM) and use code like this to evaluate an expression. (Also works for JScript.)</p>
<pre><code>Dim sc As New MSScriptControl.ScriptControl()
sc.Language = "VBScript"
Dim expression As String = "1 + 2 * 7"
Dim result As Double = sc.Eval(expression)
</c... | <p>Flee
Fast Lightweight Expression Evaluator</p>
<p><a href="https://flee.codeplex.com" rel="nofollow">https://flee.codeplex.com</a></p>
<p>Language Reference</p>
<ul>
<li>ArithmeticOperators Example: a*2 + b ^ 2 - 100 % 5</li>
<li>ComparisonOperators Example: a <> 100</li>
<li>AndOrXorNotOperators Example (... | 46,274 |
<p>I have a table that holds information about cities in a game, you can build one building each turn and this is recorded with the value "usedBuilding".</p>
<p>Each turn I will run a script that alters usedBuilding to 0, the question is, which of the following two ways is faster and does it actually matter which way ... | <p>In general, the 2nd case (with the WHERE) clause would be faster - as it won't cause trigger evaluation, transaction logging, index updating, etc. on the unused rows.</p>
<p>Potentially - depending on the distribution of 0/1 values, it could actually be faster to update all rows rather than doing the comparison - b... | <p>It seems like there would be a lower number of transactions to make the "UPDATE cities SET usedBuilding = 0;" execute than the more specific query. The main reason I can think of against this would be if you had more than one state to your column. If its merely a boolean then it would be fine, but you may want to s... | 15,126 |
<p>I've been programming in C# and Java recently and I am curious where the best place is to initialize my class fields.</p>
<p>Should I do it at declaration?:</p>
<pre><code>public class Dice
{
private int topFace = 1;
private Random myRand = new Random();
public void Roll()
{
// ......
}... | <p>My rules:</p>
<ol>
<li>Don't initialize with the default values in declaration (<code>null</code>, <code>false</code>, <code>0</code>, <code>0.0</code>…).</li>
<li>Prefer initialization in declaration if you don't have a constructor parameter that changes the value of the field.</li>
<li>If the value of the field c... | <p>I normally try the constructor to do nothing but getting the dependencies and initializing the related instance members with them. This will make you life easier if you want to unit test your classes.</p>
<p>If the value you are going to assign to an instance variable does not get influenced by any of the parameter... | 4,418 |
<p>In general, I occasionally have a chain of nested macros with a few preprocessor conditional elements in their definitions. These can be painful to debug since it's hard to directly see the actual code being executed.</p>
<p>A while ago I vaguely remember finding a compiler (gcc) flag to expand them, but I had tro... | <p>gcc -E will output the preprocessed source to stdout.</p>
| <p>GCC and compatible compilers use the -E option to output the preprocessed source to standard out.</p>
<pre><code>gcc -E foo.cpp
</code></pre>
<p>Sun Studio also supports this flag:</p>
<pre><code>CC -E foo.cpp
</code></pre>
<p>But even better is -xdumpmacros. You can find more information <a href="http://docs.or... | 13,191 |
<p>I need to import all ad groups in a few OUs into a table in SQL Server 2008. Once I have those I need to import all the members of those groups to a different table. I can use c# to do the work and pass the data to SQL server or do it directly in SQL server.</p>
<p>Suggestions on the best way to approach this?</p... | <p>Add a Linked Server to your SQL Server and query the Active Directory via LDAP queries. This here described this quite well:</p>
<p><a href="http://codebetter.com/blogs/brendan.tompkins/archive/2003/12/19/4746.aspx" rel="noreferrer">Create a SQL Server View of your AD Users, Brendan Tompkins (MVP)</a> </p>
| <p>As the OP of this question seemed open to other technologies (3 years ago), I posted a walk through that uses SSIS as the technology for querying AD for users, writing those users to a table and doing group lookups on those users. <a href="http://billfellows.blogspot.com/2011/04/active-directory-ssis-data-source.ht... | 24,569 |
<p>It seems like the methods of Ruby's Net::HTTP are all or nothing when it comes to reading the body of a web page. How can I read, say, the just the first 100 bytes of the body? </p>
<p>I am trying to read from a content server that returns a short error message in the body of the response if the file requested isn'... | <p>Shouldn't you just use an HTTP <code>HEAD</code> request (Ruby <code>Net::HTTP::Head</code> method) to see if the resource is there, and only proceed if you get a 2xx or 3xx response? This presumes your server is configured to return a 4xx error code if the document is not available. I would argue this was the corre... | <p>You can't. But why do you need to? Surely if the page just says that the file isn't available then it won't be a huge page (i.e. by definition, the file won't be there)?</p>
| 10,804 |
<p>Assuming one has an abstract base class <code>foo</code> with <code>__get()</code> defined, and a child class <code>bar</code> which inherits from <code>foo</code> with a private variable <code>$var</code>, will the parent <code>__get()</code> be called when trying to access the private <code>$var</code> from outsid... | <p>Yes. </p>
<pre><code><?php
abstract class foo
{
public function __get($var)
{
echo "Parent (Foo) __get() called for $var\n";
}
}
class bar extends foo
{
private $var;
public function __construct()
{
$this->var = "25\n"... | <p>Yes. <code>__get()</code> and <code>__set()</code> (and <code>__call()</code> for that matter) are invoked when a data member is accessed that is not visible to the current execution. </p>
<p>In this case, <code>$var</code> is private, so accessing it publicly will invoke the <code>__get()</code> hook.</p>
| 35,725 |
<p>In a WinForms 2.0 C# application, what is the typical method used for saving and restoring form position and size in an application?</p>
<p>Related, is it possible to add new User scoped application settings AT RUNTIME? I totally see how to add settings at design time, that's not a problem. But what if I want to cre... | <pre><code>private void Form1_Load( object sender, EventArgs e )
{
// restore location and size of the form on the desktop
this.DesktopBounds =
new Rectangle(Properties.Settings.Default.Location,
Properties.Settings.Default.Size);
// restore form's window state
this.WindowState = ( FormWindo... | <p>You could create a base form class with common functionality such as remembering the position and size and inherit from that base class.</p>
<pre><code>public class myForm : Form {
protected override void OnLoad(){
//load the settings and apply them
base.OnLoad();
}
protected override void OnClose(){
/... | 11,800 |
<p>Please help, I am stuck here ---</p>
<pre><code>irb> a = "line of text\n line two\n line three"
irb> system("cat > test_file << #{a}")
cat: of: No such file or directory
cat: text: No such file or directory
=> false
</code></pre>
| <p>You need to quote the interpolated parameter:</p>
<pre><code>system("cat > test_file << \"#{a}\"")
</code></pre>
<p>And, cat is expecting a filename, not some text to append to test_file, so, this would work as I think you intended:</p>
<pre><code>system("echo \"#{a}\" >> test_file")
</code></pre>
... | <p>Writing to a file directly has already been covered by JesperE. To write to a process (in this case a "cat" process) use popen.</p>
<pre><code>IO.popen("cat > foo", "w") do
|f|
f.write("line1\nline2\n")
end
</code></pre>
| 29,291 |
<p>I want to write a script that will stop a scheduled task on a remote computer, do some stuff, and then start the schedule task back up.</p>
<p>How can I do it?</p>
| <p>Here's what I found.</p>
<p>stop:</p>
<pre><code>schtasks /end /s <machine name> /tn <task name>
</code></pre>
<p>start:</p>
<pre><code>schtasks /run /s <machine name> /tn <task name>
C:\>schtasks /?
SCHTASKS /parameter [arguments]
Description:
Enables an administrator to creat... | <p>Try this:</p>
<pre><code>schtasks /change /ENABLE /tn "Auto Restart" /s mycomutername /u mycomputername\username/p mypassowrd
</code></pre>
| 37,039 |
<p>I have an existing site in php running on Apache using the mod_rewrite plug-in. In other words, I currently have urls like www.example.com/section/subsection/ which Google and others have indexed.</p>
<p>However, the site needs a major upgrade, and I would like to move it to asp.net. I only have the option of using... | <p>If you use the ASP.NET MVC framework it has a URL rewriting system built into it.</p>
<p>You can manually add 301 redirects into IIS using IIS Manager if you want to set up "moved" locations.</p>
<p>If you want to do URL re-writing then you will need to implement IHttpModule, hook up the BeginRequest event, and ad... | <p>If you use the ASP.NET MVC framework it has a URL rewriting system built into it.</p>
<p>You can manually add 301 redirects into IIS using IIS Manager if you want to set up "moved" locations.</p>
<p>If you want to do URL re-writing then you will need to implement IHttpModule, hook up the BeginRequest event, and ad... | 47,309 |
<p>I have an MS Access 2002 database with password security. </p>
<p>When I exit the application, the password dialog box reappears. Now, after this I can only exit the application if I give in the password again or press Cancel.</p>
<p>I don't know why this dialog appears on exit.</p>
| <p>Is COMPACT ON CLOSE perhaps turned on? I'm not sure how it works (since I would never even consider using it), but perhaps it closes the database, compacts it and reopens it for some housekeeping? Doesn't make much sense, but you should consider COMPACT ON CLOSE, anyway, because:</p>
<ol>
<li><p>it is useless: any ... | <p>Sounds like something is happening either in an exit macro or module. I don't remember what the exact events are called, but that's where I would check first.</p>
| 26,470 |
<p>I would like to learn the best practices in reloading the application state, such that when my app is started, it should automatically load the "correct" view/subview when it is opened again.</p>
<p>In my particular case, my app has a bunch of view controllers, each taking care of a UITableView. I would like for my... | <p>Building on what Marc said, assuming you've got a base view controller, and then one or more levels of 'drill-down', load all your view controllers up to the 'current' one using <code>[navigationController pushViewController: viewController animated: NO]</code>. Then, when the user hits the Back button, they'll be p... | <p>I've published <a href="http://code.google.com/p/iphone-statefulness/" rel="nofollow noreferrer">a little library</a> to help doing these kinds of things. I'm already using it in an app I've published on the App Store and it's a lot smoother than implementing NSCoder for every view manually :P</p>
| 39,636 |
<p>I am working on a SharePoint application that supports importing multiple documents in a single operation. I also have an ItemAdded event handler that performs some basic maintenance of the item metadata. This event fires for both imported documents and manually created ones. The final piece of the puzzle is a ba... | <p>Sometimes I see the <code>ItemAdded</code> or <code>ItemUpdated</code> firing twice for a single operation.
You can try to put a breakpoint in the <code>ItemAdded()</code> method to confirm that.</p>
<p>The solution in my case was to single thread the <code>ItemAdded()</code> method:</p>
<pre><code>private static... | <p>I'll have to look into that and get back to you. The problem on my end seems to be that there is code running in a different class, in a different feature, being controlled by a different thread, all of which are trying to access the same record.</p>
<p>I am trying to avoid using a fixed delay. With any threading... | 4,237 |
<p>I'm currently facing a problem with my single instance clickonce deployed app, and maybe someone has a good idea about it.</p>
<p>My app is called by a web application, which passes parameters to this exe. Now the problem is, if the application is already running, it takes quite a long time, until the new instance ... | <p>When you setup the deployment setting, you can tell VS to only let the application update every x amount of time (once a day, week, etc). You can also tell it to launch the application and update in the background. Both these would solve your problems on their own I think.</p>
<p>The settings are in the Projects se... | <p>I think I made it not clear, what I'm trying to achieve.</p>
<p>What I'm trying to do is, if there is an instance running, accessing this one directly, without starting the clickonce url. I searching for a solution, where I don't have to write a little program (which has to be deployed as well, ...), which checks i... | 20,047 |
<p>I am trying to get the Azure SDK up and running on my dev PC and have been having some issues. </p>
<p>I have installed the SDK, tools for VS and am trying to run the samples. Every time I try to run the samples the Development Storage service starts and then the Developer Fabric tries to start. This is where is st... | <p>Wow, that happened a long while ago. Someday, I hope that the string class itself is augmented with named formats. Then this move will look like a very prescient move. We liked its similarity and consistency with string.format. Also, it is consistent with the UriTemplate format string.</p>
| <p>In a route, you define placeholders (referred to as URL parameters) by enclosing them in braces ( { and } ). The / character is interpreted as a delimiter when the URL is parsed. </p>
<p>So now why they changed their code for parsing placeholders from [ ] to { } is something which the developers would know better... | 44,096 |
<p>I know how to test an object to see if it is of a type, using the IS keyword e.g.</p>
<pre><code>if (foo is bar)
{
//do something here
}
</code></pre>
<p>but how do you test for it not being "bar"?, I can't seem to find a keyword that works with IS to test for a negative result. </p>
<p>BTW - I have a horrible... | <pre><code>if (!(foo is bar)) {
}
</code></pre>
| <p>There is no specific keyword</p>
<pre><code>if (!(foo is bar)) ...
if (foo.GetType() != bar.GetType()) .. // foo & bar should be on the same level of type hierarchy
</code></pre>
| 7,985 |
<p>I need a Javascript application that, when run, prompts a password to be entered, and if the password is correct, the script causes the webpage to close. If the password is incorrect, the script prompts for the password to be entered again.</p>
<p>I'm planning on loading this script onto my cell phone, which doesn'... | <p>Don't know if this works on your cell phone, but it does with my browser:</p>
<pre><code><head>
<script language="JavaScript">
var pass_entered;
var password="cool";
while (pass_entered!=password) {
pass_entered=prompt('Please enter the password:','');
}
self.close();
</script>
</head&g... | <p>Ok, we can have two approuches.</p>
<ol>
<li>We can all read javascript, so if the person actually open your code he will see the password.</li>
<li>By ajax, check the password in a specific page.</li>
</ol>
<pre><code>
function passWrdAPI() {
this.getHX = function() {
var hx;
try {
... | 36,469 |
<p>I'm looking for way to PHP to detect if a script was run from a manual invocation on a shell (me logging in and running it), or if it was run from the crontab entry.</p>
<p>I have various maintenance type scripts written in php that i have set to run in my crontab. Occasionally, and I need to run them manually ahea... | <p>Instead of detecting when the script is run from the crontab, it's probably easier to detect when you're running it manually.</p>
<p>There are a lot of environment variables (in the $_ENV array) that are set when you run a script from the command line. What these are will vary depending on your sever setup and how ... | <p>It's easy for me... Just <code>count($_SERVER['argc'])</code> and if you have a result higher than zero it will be running out of a server. You just need to add to your <code>$_SERVER['argv']</code> your custom variable, like <code>"CronJob"=true;</code></p>
| 23,156 |
<p><a href="http://www.devexpress.com/Products/NET/ORM/" rel="noreferrer">XPO</a> is the object relational mapper of choice at my company. Any thoughts on the pros and cons?</p>
<hr>
<p>I was just looking for general feeling and anecdotes about the product. We are not switching to XPO. We are just getting rid of hard... | <p>Others will probably pitch in with technical answers (e.g. the query syntax, use of caching, ease or otherwise of mapping to an existing database structure) -- but if you have an established ORM layer the answer is probably </p>
<p>"Why change"?</p>
<p>I've used XPO successfully for years in an established commerc... | <p>The pros and cons compared to what? There are a lot of alternatives out there, the most popular being nHibernate, with the new kid 'ADO.NET Entity Framework' on the block.</p>
<p>Anyways, there are hundreds of answers depending on your situation and requirements.</p>
| 5,150 |
<p>what configuration needs to be tweaked, and where does it live, in order to increase the maximum allowed post size?</p>
| <p>Apache Tomcat by default sets a limit on the maximum size of HTTP POST requests it accepts. In Tomcat 5, this limit is set to 2 MB. When you try to upload files larger than 2 MB, this error can occur.</p>
<p>The solution is to reconfigure Tomcat to accept larger POST requests, either by increasing the limit, or by ... | <p>The root cause of IllegalStateException exception is a java servlet is attempting to write to the output stream after the response has been committed.</p>
<p>Take care that no content is added to the response after redirecting/dispatching request. </p>
| 15,008 |
<p>I'm new to Apex and have just downloaded Eclipse to get to work</p>
<p>Eclipse SDK 3.3.2</p>
<p>I've followed the instructions on</p>
<p><a href="http://wiki.apexdevnet.com/index.php/Force.com_IDE_Installation_for_Eclipse_3.3.x" rel="nofollow noreferrer">http://wiki.apexdevnet.com/index.php/Force.com_IDE_Installa... | <p>Try that process from a <a href="http://community.salesforce.com/sforce/board/message?board.id=scontrols&thread.id=1975" rel="nofollow noreferrer">clean eclipse install</a>, and repeat the installation steps, making sure that before clicking on "Finish" you unselect the checkbox at the lower left: "Ignore featur... | <p>Please check your proxy setting by accessing "<a href="http://www.adnsandbox.com/tools/ide/install/" rel="nofollow noreferrer">http://www.adnsandbox.com/tools/ide/install/</a>" URL in any of browser and update proxy setting in eclipse.</p>
| 47,357 |
<p>My current preferred C++ environment is the free and largely excellent Microsoft Visual Studio 2005 Express edition. From time to time I have sent release .exe files to other people with pleasing results. However recently I made the disturbing discovery that the pleasing results were based on more luck that I would ... | <p>For the C-runtime go to the project settings, choose C/C++ then 'Code Generation'. Change the 'runtime library' setting to 'multithreaded' instead of 'multithreaded dll'.</p>
<p>If you are using any other libraries you may need to tell the linker to ignore the dynamically linked CRT explicitly.</p>
| <p>In regards Jared's response, having Windows 2000 or better will not necessarily fix the issue at hand. Rob's response does work, however it is possible that this fix introduces security issues, as Windows updates will not be able to patch applications built as such.</p>
<p>In another post, Nick Guerrera suggests pa... | 5,809 |
<p>My compact framework application creates a smooth-scrolling list by rendering all the items to a large bitmap surface, then copying that bitmap to an offset position on the screen so that only the appropriate items show. Older versions only rendered the items that should appear on screen at the time, but this appro... | <p>I'd suggest going back to the old mechanism of rendering only part of the data, as the size of the fully-rendered data is obviously an issue. To help prevent rendering problems I would probably pre-render a few rows above and below the current view so they can be "scrolled" in with limited impact.</p>
| <p>Your bitmap definitely <em>is</em> being created in program memory. How much memory the bitmap needs depends on how big it is, and whether or not this required size will generate the OutOfMemoryException depends on how much is available to the PDA (which makes this a randomly-occuring error).</p>
<p>Sorry, but thi... | 38,100 |
<p>I have two lists of custom objects and want to update a field for all objects in one list if there is an object in the other list which matches on another pair of fields.</p>
<p>This code explains the problem better and produces the results I want. However for larger lists 20k, and a 20k list with matching objects,... | <p>That join should be fairly fast, as it will first loop through all of <code>adjList</code> to create a lookup, then for each element in <code>propList</code> it will just use the lookup. This is faster than your O(N * M) method in the larger code - although that could easily be fixed by calling <a href="http://msdn.... | <p>If adjList might have duplicate names, you should group the items before pushing to dictionary.</p>
<pre><code>Dictionary<string, decimal> adjDictionary = adjList
.GroupBy(a => a.PropName)
.ToDictionary(g => g.Key, g => g.Sum(a => a.AdjVal))
propList.ForEach(p =>
{
decimal a;
ad... | 34,166 |
<p>For those who had developed applications with D,</p>
<ul>
<li>which libraries did you use to build your application?</li>
<li>those libraries were good documented?</li>
<li>did you use Tango?</li>
<li>do you feel that D is ready to build big applications?</li>
<li>which IDE did you use? Descent maybe?</li>
</ul>
| <p>Note that any C library can be used with D, as D fully supports the C ABI. D has some limited support for C++ libraries, though not C++ template libraries.</p>
| <p>Code blocks seems to <a href="http://blog.fedora-fr.org/bioinfornatics/post/Code%3A%3ABlocks-and-D-programming" rel="nofollow noreferrer">support D</a>.</p>
| 36,803 |
<p>In my models, there are lots of attributes and methods that perform some calculation based on the model instance's attributes. I've been having the methods return nil if the attributes that the calculations depend on are nil. As a consequence of this design decision, I'm doing a lot of nil checks before displaying... | <p>I tend to think you are doing things right if your problem is choosing whether to display, or not display, the results of a calculation. If it would make no sense to display any value, then nil is perfectly reasonable.</p>
<p>If, however, your business logic is resulting in you getting into a state where much of t... | <p>I attack this problem using two approaches.</p>
<p>I try to move more demanding checks into the model. For instance, method <code>Apartment#address_visible?(current_user)</code> makes it much more cleaner.</p>
<p>Since Rails 2.3 there is also <code>#try</code> method that calls a method only if it is already defin... | 35,897 |
<p>I don't understand it. </p>
<p>The ids of html elements in the master page are changed by the same id but with a prefix and it's breaking the css design.</p>
<p>In the master page I have:</p>
<pre><code><div id="container" runat="server">
<asp:ContentPlaceHolder ...
...
</code></pre>
<p>The above ... | <p>WebForms should only rewrite the ID's of server controls (like <code><asp:ContentPlaceHolder /></code>, not ordinary HTML element like <code><div id="container"></code> without <code>runat="server"</code></p>
<p>You cannot prevent the framework from rewriting ID's on server controls. You can use class n... | <p>I do not need the runat="server" tag and have removed it. Don't know why it was there ... Ids are not changed now. Thanks</p>
| 24,421 |
<p>Cura is slicing my object (a gear with text) with a partial top layer, and I believe it has to do with layer height and rounding issues. I have been able to solve this at specific heights 10-14mm using a layer height of 0.25 mm, however other heights will cause this issue to arise again. There must be a solution to ... | <p>Your model isn't perfect. I took it into Windows 10 3D Builder for simplicity. I kept clicking the "Mirror" function and noticed as it basically flipped there is some slight movement. I measured some points from bottom to top and noticed some differences. </p>
<p>Try to take your model into some software to fix/fla... | <p>Even though you've selected an answer, here's another viewpoint. Ignoring the brim that I've added by default via my slicer, you can see the first few layers are not complete. This indicates a model that's a fraction of a degree off-plane. </p>
<p><a href="https://i.stack.imgur.com/2VRCT.jpg" rel="nofollow noreferr... | 711 |
<p>I just installed the first release candidate of Python 3.0 and got this error after typing:</p>
<pre><code>>>> help('modules foo')
</code></pre>
<pre>[...]
LookupError: unknown encoding: uft-8</pre>
<p>Notice that it says <strong>uft</strong>-8 and not <strong>utf</strong>-8</p>
<p>Is this a py3k specif... | <p>It's not a typo, it's a deliberate error in a test module.</p>
<pre><code>met% pwd
/home/coventry/src/Python-3.0rc1
met% rgrep uft-8 .
./Lib/test/bad_coding.py:# -*- coding: uft-8 -*-
./py3k/Lib/test/bad_coding.py:# -*- coding: uft-8 -*-
</code></pre>
<p>Removing this module causes the <code>help</code> command to... | <p>Looks like a typo in a config file somewhere, whether in the Py3k package or on your machine. You might try installing the stable final Python 2.6 (which supports 3.0 syntax changes with imports from <code>__future__</code>), and if that works you should probably file a bug report.</p>
| 25,813 |
<p>I lost my MySQL username and password. How do I retrieve it?</p>
| <blockquote>
<p>Stop the MySQL process.</p>
<p>Start the MySQL process with the --skip-grant-tables option.</p>
<p>Start the MySQL console client with the -u root option.</p>
</blockquote>
<p>List all the users;</p>
<pre><code>SELECT * FROM mysql.user;
</code></pre>
<p>Reset password;</p>
<pre><code>UPDATE mysql.user S... | <p>Although a strict, logical, computer science'ish interpretation of the op's question would be to require <strong>both</strong> "How do I retrieve my MySQL username" <strong>and</strong> "password" - I thought It might be useful to someone to also address the <strong>OR</strong> interpretation. In other words ...</p>... | 2,639 |
<p>I am working on a project to redesign/ redo an application. The problem is that the old application was written in ASP.net 1.0 and the database is pretty large over 100 tables and 300 odd views.The database handles roles and membership in a very shoddy way. It involves a simple workflow too. The app is pain when it ... | <p>Database redesign is a huge effort. If you or someone on your team is not an expert in database design and ETL, you could end up with a worse mess than you have now. </p>
<p>However, is it possible to perhaps fix just the one or two worst parts of the database and thus achieve an improvement overall? Look at the w... | <p>If you don't want to do the database redesign, you could always restructure your user experience(UI). Use an good pattern if you choose to work with webforms then my advise is to use Model View Presenter-pattern or if you know a lot of javascript and html and you don't like the webforms model use the new ASP.NET MVC... | 47,473 |
<p>It's been a while since I've programmed a GUI program, so this may end up being super simple, but I can't find the solution anywhere online. </p>
<p>Basically my problem is that when I maximize my program, all the things inside of the window (buttons, textboxes, etc.) stay in the same position in the window, which... | <p>You want to check and properly set the Anchor and Dock properties on each control in the Form. The Anchor property on a control tells which sides of the form (top, bottom, left, right) the control is 'anchored' to. When the form is resized, the distance between the control and its anchors will stay the same. This... | <p>Look at the Dynamic Layout: Anchoring and Docking sample at <a href="http://msdn.microsoft.com/en-us/library/aa289756(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa289756(VS.71).aspx</a></p>
<p>It's in VB, but the concepts and the propeties/methods you need are the same in C#.</p>... | 18,642 |
<p>I create an <code>NSURLRequest</code> to post my data in the iPhone application to a server to proceed the PHP script. My PHP script is look like this.</p>
<pre><code><?php
$name = $_POST['name'];
$email = $_POST['email'];
$link = mysql_connect("localhost", "fffasfdas","Nfdsafafs") or die ("Unable t... | <p>You should remove the leading <code>&</code> in <code>myRequestString</code> and the problem is likely that the correct <code>content-type</code> header is not being sent. Try adding a call to</p>
<pre><code>[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
</code></pre... | <p>try this</p>
<pre><code>NSString *name = [[NSString alloc]initWith String: @"Hello World"];
NSString *email = [[NSString alloc]initWith String: @"Ohai2u"];
NSString *urlString = [NSString stringWithFormat:@"http://somedomain.com/sendMail.php?name=%@&email=%@",
[name stringB... | 42,761 |
<p>On various pages throughout my PHP web site and in various nested directories I want to include a specific file at a path relative to the root.</p>
<p>What single command can I put on both of these pages...</p>
<pre>http://www.example.com/pageone.php</pre>
<pre>http://www.example.com/somedirectory/pagetwo.php</pr... | <p>You can just use <code>include $_SERVER['DOCUMENT_ROOT'] . "/includes/analytics.php";</code></p>
| <p>The tilde is interpreted as a special character by the shell, so using it inside PHP code won't work regardless of OS.</p>
<p>If you're trying to access something relative to a user home directory you could try <code>getenv()</code> - I'm pretty sure Windows sets an environment variable equivalent to <code>$HOME</c... | 44,858 |
<p>We're currently using Mantis as our bugtracker, and we're pretty much sick and tired with it. The developers want more SVN integration, the customers want an easier system to work with.</p>
<p>As such, we're looking for a new bugtracker and at the moment we're looking at Redmine. However, in its default setup it do... | <p>Last year we had the same problem, and we figured out that the best solution for us was <a href="http://www.atlassian.com/software/jira/" rel="nofollow noreferrer">Jira</a>.
With respect our workflow is more robust and complicated than yours.</p>
| <p>I've been using Trac for a small personal project, and at work we used Bugzilla for this.</p>
<p>The workflow you described also sounds like how Red Hat utilizes Bugzilla.</p>
| 38,200 |
<p>I've done some research and I can't really find a preferred way to do updating of form controls from a worker thread in C#. I know about the BackgroundWorker component, but what is the best way to do it without using the BackgroundWorker component?</p>
| <p>There's a general rule of thumb that says don't update the UI from any thread other than the UI thread itself. Using the features of the BackgroundWorker is a good idea, but you don't want to and something is happening on a different thread, you should do an "Invoke" or BeginInvoke to force the delegate to execute t... | <p>There's a discussion related to this <a href="https://stackoverflow.com/questions/6184/how-do-i-make-event-callbacks-into-my-win-forms-thread-safe#6189">here</a> and one <a href="https://stackoverflow.com/questions/120540/how-to-update-components-in-different-threads-net-cf">here</a>.</p>
<p>Essentially, you use In... | 25,351 |
<p>I have a directory with 500,000 files in it. I would like to access them as quickly as possible. The algorithm requires me to repeatedly open and close them (can't have 500,000 file open simultaneously).</p>
<p>How can I do that efficiently? I had originally thought that I could cache the inodes and open the files... | <p>Assuming your file system is <a href="http://en.wikipedia.org/wiki/Ext3" rel="nofollow noreferrer">ext3</a>, your directory is indexed with a hashed B-Tree if dir_index is enabled. That's going to give you as much a boost as anything you could code into your app.</p>
<p>If the directory is indexed, your file naming... | <p>Another question is how much data is in the files? Is an SQL back end an option? </p>
| 39,986 |
<p>I have an website. When the user is logged the session details will loaded.
When the user logged out the session details will abandoned. (Log out by clicking the logout menu)
when the user simply closes the browser then how to destroy the session.</p>
<p>In the next time its get logging with the same session data. ... | <p>As part of your handling of the logout, call Session.Clear() to clear the key/value pairs:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.clear.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.clear.asp... | <p>You could configure your sessions to time out quicker.</p>
<p>In web.config: </p>
<pre><code>< sessionState ... timeout="5" />
</code></pre>
| 35,961 |
<p>Here's the scenario. I'm debugging my own app (C/C++) which is using some library developed by another team in the company. An assertion fails when my code generates some edge case. Its a pain because the assertion is not formulated correctly so the library function is working OK but I get all these interruptions wh... | <p>If the code is triggering breakpoints on its own (by __debugbreak or int 3), you cannot use conditional breakpoints, as the breakpoints are not know to Visual Studio at all. However, you may be able to disable any such breakpoints you are not interested in by modifying the code from the debugger. Probably not what y... | <p>You can use conditional breakpoints. Some links:</p>
<p><a href="http://support.microsoft.com/kb/308469" rel="nofollow noreferrer">http://support.microsoft.com/kb/308469</a><br>
<a href="http://dotnettipoftheday.org/tips/conditional_breakpoint.aspx" rel="nofollow noreferrer">http://dotnettipoftheday.org/tips/condit... | 39,231 |
<p>Is there a best practice when it comes to setting client side "onclick" events when using ASP.Net controls? Simply adding the onclick attribute results in a Visual Studio warning that onclick is not a valid attribute of that control. Adding it during the Page_Load event through codebehind works, but is less clear ... | <p><code>**</code><em>just a pre-note on the answer: HTML validation in VS is often BS. It complains about stuff that works IRL, even if that stuff is bad practice. But sometimes you gotta bend the rules to get stuff done.</em></p>
<p>Every ASP.NET page (2.0 and greater) comes with a <a href="http://msdn.microsoft.... | <p>Fix grammatical or spelling errors.</p>
<p>Clarify meaning without changing it.</p>
<p>Correct minor mistakes.</p>
<p>Add related resources or links.</p>
<p>Always respect the original author.</p>
| 22,066 |
<p>Just recently started having issues with an SQL Server Agent Job that contains an SSIS package to extract production data and summarize it into a separate reporting database. </p>
<p>I <em>think</em> that some of the Alerts/Notifications settings I tried playing with caused the problem as the job had been running t... | <p><a href="http://msdn.microsoft.com/en-us/library/ms130214(SQL.90).aspx" rel="nofollow noreferrer">Books Online</a> is probably a good place to start (or at least I like it and generally find it useful).</p>
<p>SQLMenace and bofe made some good points. Here's my additional two cents:</p>
<p>I'd recommend <a href="... | <p>You'll want to have "When the job completes" marked in your notifications page on the job's properties.</p>
<p>Just go to that dropdown and switch it to job completion instead of failure (which is on the screenshot).</p>
<p><img src="https://i.stack.imgur.com/HGlQh.png" alt="Job_Properties_Notification"></p>
<p>Y... | 4,227 |
<p>What are the options? How popular are they? Do these IDEs give similar/better functionality compared to visual studio?</p>
| <p>Yes - you can try using SharpDevelop:</p>
<p><a href="http://www.icsharpcode.net/OpenSource/SD/" rel="nofollow noreferrer">http://www.icsharpcode.net/OpenSource/SD/</a></p>
<p>Or you can just use notepad, or notepad++</p>
<p><a href="http://notepad-plus.sourceforge.net/" rel="nofollow noreferrer">http://notepad-p... | <p>Check out the mono project. <a href="http://www.mono-project.com/" rel="nofollow noreferrer">http://www.mono-project.com/</a><br>
It's the '.NET for linux' project.<br>
They also have an ide based on eclipse as part of the whole thing. Never used it before but I've used eclipse for java and some php work, and eclips... | 6,028 |
<p>I am trying to print an item with a rectangular grid (using PLA on Ultimaker 2+):</p>
<p><a href="https://i.stack.imgur.com/RHcqX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RHcqX.png" alt="item with a grid"></a></p>
<p>Holes are 4x4 mm, distance between holes (wall thickness): 1mm. I am pri... | <p>Slicers never create a grid by crossing the already printed lines - they print perimeters and thicken them into a shell. So if the picture that is to be printed is a #, it does not lay down first the || and then the = crossing over it, it lays down an inner square and then builds the rest to get to the shape. This o... | <ol>
<li>Use the latest stable Cura 3.6.0</li>
<li>Ensure that the setting "Wall Line Count" > 1, recommended value is 3-4</li>
<li>Uncheck the setting flag "Outer Before Inner Walls"</li>
</ol>
| 1,167 |
<p>I keep finding that if I have nested divs inside each other, and one of the inner ones is floated, the outer one won't expand around it.</p>
<p>Example:</p>
<pre><code><div style='background-color:red; '>
asdfasdf
<div style='float:left; background-color:blue; width:400px; height:400px;'>
... | <p>You can do it strictly with CSS using <strong>overflow:hidden</strong></p>
<pre><code><div style='background-color:red;overflow:hidden;'>
...
</div>
</code></pre>
| <p>This article about <a href="http://natbat.net/2008/Sep/28/css-systems/" rel="nofollow noreferrer">CSS systems</a> is definitely worth a read. As Darko Z said it is staggering to see the semantically incorrect answer given by Ant P. </p>
| 43,605 |
<p>I'm trying to get a JEditorPane to highlight the full width of a displayed line. All the examples I've tried only highlight the textual content. For example if I have content such as this:</p>
<pre><code> ---------------------------------
|Here is some text |
|some more text |
----... | <p>This seems not too complicated. I would make that a little <a href="https://stackoverflow.com/questions/172184"><strong>code-challenge</strong></a>.</p>
<p>Just create your own custom Highlighter, extending DefaultHighlighter.</p>
<p>Override the <code>paint()</code> method, and simply leave unchanged the width of... | <p>To prevent selection highlighting from interfering with VonC's solution I added the following line to the TextHighlight constructor (essentially making the selection highlight invisible):</p>
<pre><code>textPane.setSelectionColor(new Color(1.0f, 1.0f, 1.0f, 0.0f));
</code></pre>
| 46,041 |
<p>This is for .NET. IgnoreCase is set and MultiLine is NOT set.</p>
<p>Usually I'm decent at regex, maybe I'm running low on caffeine...</p>
<p>Users are allowed to enter HTML-encoded entities (<lt;, <amp;, etc.), and to use the following HTML tags:</p>
<pre><code>u, i, b, h3, h4, br, a, img
</code></pre>
<p... | <p>Here's a function I wrote for this task:</p>
<pre><code>static string SanitizeHtml(string html)
{
string acceptable = "script|link|title";
string stringPattern = @"</?(?(?=" + acceptable + @")notag|[a-zA-Z0-9]+)(?:\s[a-zA-Z0-9\-]+=?(?:(["",']?).*?\1?)?)*\s*/?>";
return Regex.Replace(html, stringPa... | <p>I think i originally intended to make the values optional, but didn't follow through, as I can see that I added a <code>?</code> after the equals sign and grouped the value portion of the match. Let's add a <code>?</code> after that group (marked with a carot) to make it optional in the match as well. I'm not at my ... | 39,500 |
<p>Is there a way to persist an enum to the DB using NHibernate? That is have a table of both the code and the name of each value in the enum.</p>
<p>I want to keep the enum without an entity, but still have a foreign key (the int representation of the enum) from all other referencing entities to the enum's table.</p>... | <p>Why are you guys over complicating this? It is really simple.</p>
<p>The mapping looks like this:</p>
<pre><code><property name="OrganizationType"></property>
</code></pre>
<p>The model property looks like this:</p>
<pre><code>public virtual OrganizationTypes OrganizationType { get; set; }
</code></... | <p>Try using a stategy pattern. Uou can then put logic into your inner classes. I use this quite alot espically when there is logic that should be contained in the "enum". For example the code below has the abstract IsReadyForSubmission() which is then implemented in each of the nested subclasses (only one shown). HTH<... | 32,063 |
<p>I have created some extra functionality on my Linq-to-SQL classes to make things easier as I develop my applications. For example I have defined a property that retrieves active contracts from a list of contracts. However if I try to use this property in a lambda expression or in general in a query it either throws ... | <p>When accessed individually, I suspect that having a query that returns IQueryable would work - however, I expect that when this is part of a larger Expression, the expression interpreter will complain (which seems like what you are describing).</p>
<p>However, I suspect that you might be able to break it down a bit... | <p>That worked like a charm. The SQL statment generated by <strong>CustomersWithActiveContracts</strong> looked fine to me.</p>
<pre><code>{SELECT [t0].[CustomerID], [t0].[cFirstName], [t0].[cLastName]
FROM [dbo].[Customers] AS [t0]
WHERE ((
SELECT COUNT(*)
FROM [dbo].[Contracts] AS [t1]
WHERE (([t1].[Con... | 23,119 |
<p>I keep finding files which show a size of 10kb but a size on disk on 10gb. Trying to figure out how this is done, anyone have any ideas?</p>
| <p>You can make sparse files on NTFS, as well as on any real filesystem. :-)</p>
<p>Seek to (10 GB - 10 kB), write 10 kB of data. There, you have a so-called 10 GB file, which in reality is only 10 kB big. :-)</p>
| <p>I'm not sure about your case (or it might be a mistake in your question) but when you create a NTFS sparse file it will show different sizes for these fields.</p>
<p>When I create a 10MB sparse file and fill it with 1MB of data windows explorer will show:
<br />
<br />
Size: 10MB
<br />
Size on disk: 1MB<... | 40,618 |
<p>I'm having a problem, creating a fixed-size overall panel for a touchscreen GUI application that has to take up the entire screen. In a nutshell, the touchscreen is 800 x 600 pixels, and therefore I want the main GUI panel to be that size.</p>
<p>When I start a new GUI project in NetBeans, I set the properties of ... | <p>Have you tried <a href="http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html" rel="nofollow noreferrer">java full screen mode</a>?</p>
| <p>I use this method to complete the task, not sure if its the best and you need to wait calling it until the frame is actually on the screen. </p>
<pre><code>protected void growBig()
{
int screenWidth = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width;
int screenHeight = java.awt.Toolkit.getDefaul... | 30,891 |
<p>this is the scenario:
multiple web systems (mostly lampp/wampp) exist, most of them with separate login information, (some share it). We're considering the benefits/disadvantages of unifying them somehow, or at least making handling the user administration parts easier.</p>
<p>Due to the nature of some systems (it... | <p>What we did was to centralise all login details in one repository (Active Directory for us), then wrote a c# library to authenticate with wrappers for all the languages we programmed in (PHP, C, .NET, etc). and then just wrote some glue code in the appropriate place for each application. Aside from our in-house apps... | <p>A lot of people seem to like OpenID for this sort of thing. I'm not sure on it's intranet capabilities though.</p>
<p>Another idea is using your "brain" system to pass authenticated username to the sister/brother applications as a form post, then handle authentication on that system and create their security ticket... | 30,160 |
<p>I'm running Thunderbird on Windows. I often receive .ics (iCal) attachments - invitations to meetings. Currently I save the attachment to my desktop, open Google Calendar, choose 'Add>Import Calendar', browse to the .ics file, and return to the calendar.</p>
<p>Is there any tool that can speed this up... e.g. I for... | <p><strong><a href="http://bfish.xaedalus.net/?p=239" rel="nofollow noreferrer">Lightning</a></strong> gives you a plug-in way for Thunderbird to sync with Google Calendar, works both directions. I've used it without any issues, hopefully it will do what you're after.</p>
| <p><a href="http://www.califyapp.com" rel="nofollow">Calify</a> does just that.<br>
It can open *.ics files in various web calendars, including Google Calendar.</p>
| 12,705 |
<p>I'm working on our back-end encoder service which does an awful lot of video transcoding, and a very small amount of joining of video files. </p>
<p>The transcoding is done using the On2 Flix engine for Windows which works very well, but unfortunately it isn't able to join files (at least as far as I can ascertain ... | <p>FFMPEG's libavcodec and libavformat are your friend. They're extremely versatile and support more than basically anything else, and are effectively the cross-platform standard for multimedia support and manipulation.</p>
<p>You could also try MP4box's library, GPAC, which is an MP4-specific library that is much mo... | <p>For x264: you can simply call the executable itself, or you can include the library itself and call it through its API (encoder_open, etc). With .NET its likely more difficult; being a C program, its API is built around C, though I know both C and C++ programs on Windows and Linux have been built that call the API.... | 25,503 |
<p>What's the difference between these two?
Which is better/faster/reliable?</p>
| <p>SCGI is a language-neutral means of connecting a front-end web server and a web application. WSGI is a Python-specific interface standard for web applications.</p>
<p>Though they both have roots in CGI, they're rather different in scope and you could indeed quite reasonably use both at once, for example having a mo... | <p>They are both specifications for plugging a web application into a web server. One glaring difference is that WSGI comes from the Python world, and I believe there are no non-python implementations.</p>
<p><strong>Specifications are generally not comparable based on better/faster/reliable.</strong> </p>
<p>Only th... | 32,128 |
<p>Consider the following code:</p>
<pre><code>void Handler(object o, EventArgs e)
{
// I swear o is a string
string s = (string)o; // 1
//-OR-
string s = o as string; // 2
// -OR-
string s = o.ToString(); // 3
}
</code></pre>
<p>What is the difference between the three types of casting (okay, the 3... | <pre><code>string s = (string)o; // 1
</code></pre>
<p>Throws <a href="https://msdn.microsoft.com/en-us/library/system.invalidcastexception" rel="noreferrer">InvalidCastException</a> if <code>o</code> is not a <code>string</code>. Otherwise, assigns <code>o</code> to <code>s</code>, even if <code>o</code> is <code>nul... | <p>When trying to get the string representation of anything (of any type) that could potentially be null, I prefer the below line of code. It's compact, it invokes ToString(), and it correctly handles nulls. If o is null, s will contain String.Empty.</p>
<pre><code>String s = String.Concat(o);
</code></pre>
| 16,061 |
<p>I have a project containing at least one DLL along with the executable output. I have added a Deployment Project to this solution, which asked me for a name and working directory upon creation like all projects.</p>
<p>I named this "MyProduc_Installer" and have been able to modify all aspects of the installation p... | <p>If you haven't found the answer to this yet, here is the answer.</p>
<p>Visual Studio has 2 sets of properties for Projects -
1 which you can accesss by selecting the Project in Solution Explorer and then right clicking and selecting 'Properties'. </p>
<p>2nd set of properties is in the 'Properies' window which sh... | <p>I happened across this post, where I was having trouble renaming the Product as well.. In regards to using Click Once Publishing.</p>
<p>Since updating all the old names I couldn't get the Publishing to correct itself.
It was found notepading the project file <strong>xyz.vbproj</strong> in my case and updating the ... | 16,418 |
<p>This is the text from MSDN comment: "According to the book ATL Internals (2ed) the use of attributes is deprecated and should not be used in new ATL projects."</p>
<p>But WHY?!! </p>
| <p>In ATL these attributes were a compiler trick. They were not a core part of the platform like attributes in C#. They were also more confusing to debug than macros's and the method of dumping generated attribute code was a hassle.</p>
<p>I suspect another issue is likely to have been C++ compiler compatibility and s... | <p>Appendix D of the book goes into this.</p>
<p>Attributed ATL requires compiler extensions, and the problems encountered include</p>
<ul>
<li>debugging either code generated by the attribute or the interaction between the attribute and your code</li>
<li>no control over the code generated</li>
<li>bugs, especially ... | 7,303 |
<p><strong>A Little Background Information</strong>:<br>
I've been looking at a few PHP framework recently, and it came down to two. The Zend Framework or CodeIgniter. </p>
<p>I prefer CodeIgniter, because of its simple design. It's very bare bone, and it is just kept simple. The thing I don't like though is the weak ... | <p>Slightly OT, hope you don't mind...</p>
<p>I'm a Zend Framework user and I think it's worth saying that the loose coupling means you don't need to include any files you're not actively using. Hopefully this negates your concern about unnecessary overhead.</p>
<p>With the layouts stuff added in a recent release of... | <p>Check out this <a href="http://codeigniter.com/forums/viewthread/94035/" rel="nofollow noreferrer">custom CodeIgniter templating library</a>. I've already used it on several projects and it is easy to use. I know this post is late but it's worth checking out.</p>
| 6,229 |
<p>I have a ASP.NET application running on a remote web server and I just started getting this error:</p>
<pre><code>Method not found: 'Void System.Collections.Generic.ICollection`1..ctor()'.
</code></pre>
<p>I disassembled the code in the DLL and it seems like the compiler is incorrectly optimizing the code. (Note ... | <p>Ahh, ILMerge - that extra info in your question really helps with your problem. While I wouldn't ever expect the .net compiler to fail in this way I would expect to occasionally see this sort of thing with ILMerge (given what it's doing).</p>
<p>My guess is that two of your assemblies are using the same optimisatio... | <p>Was code recently deployed to that server? Could someone have pushed a build without your knowledge? Can you go to source control, pull the latest, and duplicate the issue?</p>
<p>At this point, with the given information, I doubt it's the compiler. </p>
| 15,025 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/557081/how-do-i-get-the-hmodule-for-the-currently-executing-code">How do I get the HMODULE for the currently executing code?</a> </p>
</blockquote>
<p>I'm trying to find a resource in my own module. If this mod... | <p>Store the module handle away when it is given to you in DllMain and then use it later when you actually need it. A lot of frameworks (e.g., MFC) do this automatically.</p>
| <p>As has been already stated this can be done by saving the module handle passed in to the DllMain function.</p>
<p>But there are other reasons why you should save the handle. </p>
<p>For example if you decide to bind resources to the DLL using the resource linker, you will need this module handle to get at these re... | 14,554 |
<p>FORTRAN provides several functions to convert a double precision number to an integral value. The method used for truncation/rounding differs. I am converting complex scientific algorithms which use these.</p>
<p>According to FORTRAN documentation:<br>
<b>aint(x)</b> returns the integral value between x and 0, ne... | <p>From your definitions of the calls, <strong><code>nint</code></strong> and <strong><code>anint</code></strong> are provided by <code>Math.Round</code> using <code>MidpointRounding.AwayFromZero</code>.</p>
<p>For <strong><code>aint</code></strong>, an explicit cast from <code>double</code> to <code>int</code> will a... | <p>I have an implementation of the function anint, follow the code:</p>
<pre><code>double anint(double x)
{
int a;
double y;
a = (int)x; //a=9
if (10 * x - 10 * (double)a >= 5)
{
a = a + 1;
}
y = (double)a;
return y;
}
</code></pre>
| 30,694 |
<p>Has anyone any reources for learning how to implement SVG with php/mysql (and possibly with php-gtk)? I am thinking of making a top-down garden designer, with drag and drop predefined elements (such as trees/bushes) and definable areas of planting (circles/squares). Gardeners could then track over time how well plan... | <p>You can also change the column name by using:</p>
<pre><code>myDataGrid.Columns[0].HeaderText = "My Header"
</code></pre>
<p>but the <code>myDataGrid</code> will need to have been bound to a <code>DataSource</code>.</p>
| <p>Try this</p>
<pre><code>myDataGrid.Columns[0].HeaderText = "My Header"
myDataGrid.Bind() ;
</code></pre>
| 15,288 |
<p>Earlier versions of the Notes client would automatically turn a <em>sent</em> URL into a clickable link for the recipient (regardless of mail client) but with 6.5 (and presumably later) this no longer happens; that is, the URL is sent as plain text. The Notes UI allows it to be done via the Create->Hotspot->Link Hot... | <p>The automatic conversion of urls into clickable links is a user preference.</p>
<p>In 6.5 it is set via File/Preferences/User Preferences/Basics. In 8 it is set via File/Prefences/Basic Notes Client Config.</p>
<p>I don't think you can create a url link hotspot explicitly using lotusscript. You can create a doc ... | <p>You need to cheat and create a MIME entry to get your links. Going that route you also can take the opportunity to make it look really nice. The sample code is on <a href="https://stackoverflow.com/questions/686384/sending-formatted-lotus-notes-rich-text-email-from-excel-vba" title="Sample Code">this site</a></p>
| 42,021 |
<p>I'm trying to resize dynamically a <code>CMFCPropertySheet</code> to add a custom control at the bottom of each page.</p>
<p>As all Property Pages are not of the same height, I have a mechanism to increase the size if necessary.
For this, I have overridden the <code>OnActivatePage</code> method and by using <code>S... | <p>You can run the tests from the command-line, but it requires that the Test Edition of Visual Studio be installed on your build server:</p>
<p><a href="http://devlicio.us/blogs/derik_whittaker/archive/2008/09/25/clean-build-server-with-mstest-fail.aspx" rel="nofollow noreferrer"><a href="http://devlicio.us/blogs/der... | <p>If you use MSTEST You will have to put that edition on the build server. To cut a long story short youd be better off changing the testing framework the developer is using from MStest to Nunit.
Its a much lighter solution.</p>
| 49,561 |
<p>I have used something like the following to compose policies for my application:</p>
<p>The policy classes look like this:</p>
<pre><code>struct Policy {
static void init();
static void cleanup();
//...
};
template <class CarT, class CdrT>
struct Cons {
static void init() {
CarT::init();
Cdr... | <p>Since no one answered the question satisfactorily, I spent sometime digging into the boost::mpl source. Man, it's not pretty with layers of macros and hundreds of lines of specialization classes. I now have more appreciation for the authors of the boost libraries to make meta programming easier and more portable for... | <p>I think your problem is rather runtime invocation than metafunctions, because you want to call the init functions on the actual runtime objects.</p>
<p>You could try the runtime algorithms of mpl,
like : </p>
<pre><code>for_each<Policies>(InitPolicy());
</code></pre>
<p>with </p>
<pre><code>struct InitPoli... | 32,028 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.