instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>If I have $var defined in Page1.php and in Page2.php I have</p> <pre> //Page2.php include('Page1.php'); echo $var; </pre> <p>For what reasons will it not print the value of $var to the screen? The files are in the same directory so paths shouldn't be the issue. I've checked the php.ini file and nothing really ...
<p>Possible causes:</p> <ul> <li>The current working path isn't always the same as the file's. For example, if Page2.php is being included at a higher level, that higher level will be the path. Either make sure you've loaded Page2.php directly or move Page1.php accordingly.</li> <li>Make sure <code>$var</code> is real...
<p>I've just tested:</p> <p>page1.php:</p> <pre><code>&lt;?php $foo = "bar" ?&gt; </code></pre> <p>page2.php:</p> <pre><code>&lt;?php include('page1.php'); echo $foo; ?&gt; </code></pre> <p>This works.</p> <p>You might want to check your file paths. Also var_dump() is handy to check the variable output.</p>
21,653
<p>I have a solution with about 20 projects (that use Devexpress controls) in and when I do a normal solution build (ctrl-shift-B) it says everything is completed sucessfully when in actualy fact it has done nothing. To get it to build i have to right click on the solution and use the batch build option.</p> <p>I've ...
<p>I've had similar issues. It's a long shot, but right-click your solution and go to Properties -> Configuration Properties. Check to make sure all of your projects have the "Build" option checked.</p>
<p>Perhaps Ctrl+Shift+B has been assigned to one of the "check-to-see-if-it-is-needed-before-building" type of functions?</p> <p>Check in the keyboard setting:</p> <ul> <li>Right-click the toolbar</li> <li>Select Customize in the popup menu</li> <li>Click the Keyboard button in the lower right corner of the dialog</l...
43,876
<p>I made a Java Applet with some Standard GUI Components on it. I used the <a href="http://www.miglayout.com/" rel="nofollow noreferrer">MigLayout</a> Manager.</p> <p>If I move the mouse slowly over the various GUI Components everything appears to be fine, but if I move the mouse fast, it flickers.</p> <p>What could...
<p>One thought would be to check your code (and/or the MigLayout code) for unnecessary <code>repaint()</code> operations.</p> <p>Custom UIs and layouts can cause weird problems sometimes...</p>
<p>you could use double buffering in java applet to improve screen refreshing speed. ask more if details needed..</p>
17,798
<p>The application is planned to be built using ASP.NET, .NET Remoting &amp; MS SQL Server. High availability is required at presentation layer, application layer and database.</p> <p>Does IIS 7.0 provide any advantages over IIS 6.0 in regard to the High availability aspect?</p>
<p>Take a look at the <a href="http://highscalability.com/" rel="nofollow noreferrer">High Scalability Blog</a></p>
<p>Make sure your design scales in a horizontal manner.</p> <p>That is, have your system hiding behind a load balance layer with the servers that are actually providing the service behind the load balance layer.</p> <p>When you need to increase capacity, you build a new server or servers and plug it in alongside the ...
31,059
<p>Does anyone else find that the documentation of a lot of payment processors have poor or incomplete documentation as to how to use their API? Or it's just plain confusing?</p> <p>Recently I have setup both <a href="http://www.paypal.com" rel="nofollow noreferrer">PayPal</a> and <a href="http://www.beanstream.com" r...
<p>well, this isn't really specific to payment processor documentation, in that, all things being equal, well documented APIs will help encourage development. for what it's worth, i've worked with paypal, authorize.net, ups, and usps APIs, and didn't find them overtly confusing (not implying that they were a particular...
<p>I've only worked with PayPal, but the simple version (where you just set up an HTML form on your web page and submit it with the PayPal button) is super-easy to work with. And if you're looking for near real-time payment feedback, I always found it easier to just write a program to check my PayPal email account per...
34,722
<p>We have got loads of options for <code>php + MySQL + Apache</code> combo... Which is the best pack among these ?</p> <p>Lets confine our ideas to <code>WAMP vs XAMPP</code>, is there a better option to go for?</p> <p>I created an online programming contest web app called <code>CodeFire</code> on <code>XAMPP</code>...
<p>I like XAMPP, personally. I have an install running on a thumbdrive that I carry around that's pretty much my development environment for LAMP web dev on any machine I happen to be at (I'm mostly on Windows client machines).</p> <p>Small, fully-functional, and stable - works really well for my needs.</p>
<p>I use xampp, because it offers easy upgradeability and portability. You can easily upgrade the version wihtout a hassle.</p> <p>I use xampp's 7zip installer version which is a very nice when it comes to be upgrading your php and phpmyadmin quite frequently in order to fix the bugs that are introduced in previous ve...
13,100
<p>I am trying to hide the button based on the user's role using the following code: </p> <pre><code> &lt;asp:Button ID="btndisplayrole" Text="Admin Button" Visible='&lt;%= WebApplication1.SiteHelper.IsUserInRole("Admin") %&gt;' runat="server" OnClick="DisplayRoleClick" /&gt; </code></pre> <p>But when I run the above...
<p>Kind of an interesting issue.. But as the error message states, the string <code>&lt;%= WebApplication1.SiteHelper.IsUserInRole("Admin") %&gt;</code> cannot be converted to a boolean.</p> <p>Unfortunately i cannot explain why the expression isn't evaluated, but instead is treated like a string.</p> <p>The reason w...
<pre><code>Visible='&lt;%= WebApplication1.SiteHelper.IsUserInRole("Admin").ToString() %&gt;' </code></pre> <p>OR</p> <pre><code>Visible=&lt;%= WebApplication1.SiteHelper.IsUserInRole("Admin") %&gt; </code></pre>
48,290
<p>What is the purpose of the colon before a block in Python?</p> <p>Example:</p> <pre><code>if n == 0: print "The end" </code></pre>
<p>The colon is there to declare the start of an indented block.</p> <p>Technically, it's not necessary; you could just indent and de-indent when the block is done. However, based on the <a href="http://www.python.org/dev/peps/pep-0020/" rel="noreferrer">Python koan</a> “explicit is better than implicit” (EIBTI), I be...
<p>The colon is a complete annoyance. If you need to indent after an 'if' or a 'for', then just look for the 'if' or the 'for'.</p> <p>Cmon', all this rationalization. The 'spin' language for the propeller chip easily overcomes this issue.</p> <p>PLEASE, let's make the colon optional, and get on with some logical pro...
26,496
<p>I have seen many apps that take instrument classes and take <code>-javaagent</code> as a param when loading also put a <code>-noverify</code> to the command line.</p> <p>The Java doc says that <code>-noverify</code> turns off class verification.</p> <p>However why would anyone want to turn off verification even if...
<p>Start-up time, I'd say. Verification that classes are correct takes some time when the class is loaded. Since classes might be loaded in a lazy fashion (not on app start, but when being used for the first time), this might cause unexpected and undesired runtime delays.</p> <p>Actually the class does not need to be ...
<p>Start up time used to be a bit of an issue. However, verifiers are now faster, as are processors. Code compiled with JDK6 javac will by default include extra information to make the verifier step faster. Apache Harmony just uses a much faster verification algorithm.</p> <p>Some very old versions of javac produced i...
38,547
<p>How can I see which file extensions are related to which kind of syntax highlighting? Unfortunately, <code>Tools -&gt; Options -&gt; Text Editor -&gt; File Extensions</code> lists only those entered manually, no default ones. And I didn't manage to find it on my own via Google or other means. </p> <p>My particular ...
<p>maybe <a href="http://cc.codegear.com/Item/25538" rel="nofollow noreferrer">Andreas Hausladen's DFMCheck</a> helps?</p> <p>Uli.</p>
<p>Just to be sure, but have you used 'inherited' in the inherited dfm?</p> <pre><code>inherited Form1: TForm1 Caption = 'Form1' PixelsPerInch = 96 TextHeight = 13 end </code></pre> <p>If you have 'object' and not 'inherited' you get a lot of problems.</p>
37,746
<p>I'm developing a small tray-icon application for Windows and I need to display non-intrusive visual notifications similar to those that appear when you receive a new message in MSN Messenger or any other IM application.</p> <p>I have looked at <a href="http://www.fullphat.net/index.php" rel="noreferrer">Snarl</a>, ...
<p>You can do it by depending on a GUI library.</p> <p>For example, with PyQt,it is possible :</p> <ul> <li><p><a href="http://pyqt.sourceforge.net/Docs/PyQt4/qsystemtrayicon.html" rel="nofollow noreferrer">PyQt QSystemTrayIcon Documentation</a></p></li> <li><p><a href="http://qt-project.org/doc/qt-4.8/qsystemtrayico...
<p>You don't need anyhting. Just use toasters windows with Win32 api</p>
44,803
<p>What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?</p> <p>It's possible to determine if a path string is UNC using the following:</p> <pre><code>new Uri(path).IsUnc </code></pre> <p>That works great for paths that start with C:\ or ...
<p>Don't know if there's a more efficient way of doing this, but it seems to work for me:</p> <pre><code> IPAddress[] host; IPAddress[] local; bool isLocal = false; host = Dns.GetHostAddresses(uri.Host); local = Dns.GetHostAddresses(Dns.GetHostName()); foreach (IPAddress hostAddress in host) ...
<p>I don't know of a single method to check that. However, you can compare the Uri's <code>Host</code> property to either the local host name or IP address.</p> <p>You can get the local machine name using:</p> <pre><code>string hostName = System.Net.Dns.GetHostName() </code></pre> <p>You can then get an array of IP...
46,182
<p>I've got a dropdown list that is being populated via a webservice using ASP>NET AJAX. On the success callback of the method in javascript, I'm populating the dropdown via a loop:</p> <pre><code>function populateDropDown(dropdownId, list, enable, showCount) { var dropdown = $get(dropdownId); dropdown.options...
<p>Although I'm not really sure how it does it the CascadingDropDown in the AJAX Control Toolkit does support this.</p> <p>This is the line that appears to do it:</p> <pre><code>AjaxControlToolkit.CascadingDropDownBehavior.callBaseMethod(this, 'set_ClientState', [ this._selectedValue+':::'+text ]); </code></pre> <p>...
<p>You need to use Request.Form for this - you can't encrypt ViewState on the fly from the client - it would defeat the whole point of it :).</p> <p>Edit: Responding to your Edit :) the Page Lifecycle is the thing that allows you to use the ViewState persistence in the first place. The control tree is handled there an...
18,882
<p>What is the simplest way of copying symbolic links on the Mac?</p> <p>A python or perl solution would be preferred, but any solution would be a help.</p> <p>I am copying frameworks for an installation package, and need the links to be maintained</p>
<p>As David mentioned, OS X is missing the handy -a option that gnu cp has.</p> <p>However, if you use -R to do a recursive copy, then it will copy symlinks by default, so</p> <pre><code>cp -R source destination </code></pre> <p>ought to work.</p>
<p>As you tagged python, i asume you mean something like copytree(src, dst[, symlinks]). Real symlinks (created by ln -s) will be copied as on any unix system. But if you create an alias with the finder, you wont get a symlink, but an alias. The MacOS offers two types of links: unix type symlinks and aliases (see <a hr...
27,259
<p>I'm a very novice OCaml programmer so please forgive me if this is a stupid/obvious question. There's <em>a lot</em> to absorb and I may have missed this in the documentation.</p> <p>I have a base of code that's starting to look like this:</p> <pre><code>let update_x p x = add_delta p; p.x &lt;- x; refresh ...
<p>You can't do quite what you want, but you can greatly reduce the boilerplate with a higher-order function:</p> <pre><code>let update_gen set p x = add_delta p; set p x; refresh p let update_x = update_gen (fun p v -&gt; p.x &lt;- v) let update_y = update_gen (fun p v -&gt; p.y &lt;- v) let update_z = update_...
<p>As noted above ocaml has macro system. And for this task only small fraction of it is needed :</p> <pre><code>open Printf type t = { mutable x : float; mutable y : float; mutable z : float; mutable t : int; } let add_delta p = p.t &lt;- p.t + 1 let refresh p = printf "%d) %.2f %.2f %.2f\n" p.t p.x p.y p.z DEFINE...
26,527
<p>I am trying to develop a multimedia site and I am leaning heavily toward Silverlight however Flash is always a main player. I am a Speed and performance type developer. Which Technology will load fastest in the given scenarios? 56k, DSL and Cable?</p>
<p>It all depends on what you're doing: animation, video, calculation, etc? There are <a href="http://www.tobinharris.com/2008/8/30/performance-of-silverlight-vs-flash-vs-javascript-vs-tracemonkey" rel="nofollow noreferrer">some tests that show Silverlight being faster for raw computation</a>, while Flash's graphics en...
<p>Actually, you have to assume that Flash is probably already installed on the user's browser, and SilverLight probably not. So the cost of installing silverlight (though a small download) has to be taken in to consideration as well.</p> <p>Silverlight, however, does have some pretty neat out of the box multimedia su...
9,140
<p>I'm trying to access the Facebook API Admin.getMetrics method via jQuery. I'm correctly composing the request url on the server side (in order to keep my app secret secret). I'm then sending the url over to the browser to be request using <code>jQuery.getJSON()</code>.</p> <p>Facebook requires that I send a copy of...
<p>The use of <code>jQuery.getScript</code> turned out to be close to -- but not quite -- the answer. Using getScript eliminates jQuery's need to add the dynamically named anonymous function to the request params (though it will still do that if you go ahead and pass it an anonymous function as in the above code). Howe...
<p>This is a better solution with a fixed callback:</p> <pre><code>window.fixed_callback = function(data){ alert(data.title); }; $(function() { $.getScript("http://api.flickr.com/services/feeds/photos_public.gne?tags=cats&amp;tagmode=any&amp;format=json&amp;jsoncallback=fixed_callback", function(data) { a...
24,857
<p>I have a bunch of generic interfaces and classes</p> <pre><code>public interface IElement { // omited } class Element implements IElement { // omited } public interface IElementList&lt;E extends IElement&gt; extends Iterable { public Iterator&lt;E&gt; iterator(); } class ElementList implements IElementList&l...
<p><code>IElementList</code> needs to implement <code>Iterable&lt;E&gt;</code>. Otherwise, the interface specifies <code>Iterator iterator()</code>, not <code>Iterator&lt;E&gt; iterator()</code>. This makes the compiler think that you're iterating over <code>Object</code>s.</p> <p>I made this change, and it compiled f...
<p>Your function returns an ElementList not an Element, and ElementList is not an iterable over Element</p>
40,602
<p>When I add an assembly reference to a project in Visual Studio 8 the Aliases property, of that reference, is set to "global". What is this property good for and why is it set to global?</p> <p>MSDN tells me that this is a list of aliases for the assembly but not why I might want to use this property or why most ar...
<p>This is for "extern aliases". Suppose you want to use two different types, both of which are called <code>Foo.Bar</code> (i.e. <code>Bar</code> in a namespace of <code>Foo</code>). The two types will be in different assemblies (by definition) - you use the property in VS to associate an alias with each reference, th...
<p>Search for "<a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias" rel="nofollow noreferrer">extern alias</a>"; it is a very rarely used feature that is only needed to disambiguate between two dlls that contribute the same types (for example, two different versions of the ...
36,439
<p>I have a serious problem and I can't find a way to solve it because I have no idea why is it happening. For some reason the things I print get really messy, like a mountain range growing on the print. It looks like overflow but it can't be because I'm already using 0.82 flow modifier and if I go any lower the printo...
<p>It definitely looks like over extruding. But similar effect can appear with proper extruding (or not too much exceeded) but with too high temperature.</p> <p>If it appears only on some parts of the first layer then it can be:</p> <ul> <li>bed leveling issue (or eventually bed is bent)</li> <li>caret mechanism issu...
<p>This is happening on the first or second layer, correct? It looks like your nozzle is trammed too close to the build plate. If there is less gap between the nozzle and bed than the slicer expects, it will over-extrude the first layer. That tends to produce "bacon" patterns of ripples on the bottom of the print as th...
334
<p>How do I loop into all the resources in the resourcemanager?</p> <p>Ie: foreach (string resource in ResourceManager) //Do something with the recource.</p> <p>Thanks</p>
<p>Use ResourceManager.<a href="http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.getresourceset.aspx" rel="noreferrer">GetResourceSet</a>() for a list of all resources for a given culture. The returned ResourceSet implements IEnumerable (you can use foreach).</p> <hr> <p>To answer Nico's quest...
<p>I wonder why would you like to loop through all of the resources.</p> <p>Anyway, <code>ResourceManager</code> needs to be instantiated giving it a <code>Type</code> or the base name where to lookup for resources. Then you will be able to retrieve a <code>ResourceSet</code> but for a given <code>CultureInfo</code>, ...
16,944
<p>I need to monitor my Windows Server event logs so that I know if there is a problem with any of my ASP.Net websites (IIS errors, windows login errors etc) - errors that would end up in the event log rather than being handled by my application's error logging.</p> <p>Has anyone had any experience of <a href="http://...
<p>I currently use EventSentry and I have to say I am very happy with it. I get an email when my backups don't run, the reports are helpful and my experience with the support staff has been great. In my case, EventSentry was much cheaper than GFI and offered the value I needed.</p>
<p>I haven't used this tool, but Microsoft' System Center Operations Manager (used to be called Microsoft Operations Manager) should do all of that. </p> <p><a href="http://www.microsoft.com/systemcenter/opsmgr/default.mspx?sess=296d9b4b1d52c17152baa2806e58dd78" rel="nofollow noreferrer">System Center Operations Mana...
39,748
<p>I'm trying to get some WPF concepts down, so I've put together a simple example of what I'm trying to do. I would like to set a custom property of a user control, and have it be used by an element within the control.</p> <p>I've been researching and experimenting, but I'm not fully understanding everything here. An...
<p>Sorry to repost, but After re-reading you post, I think that you might be better off with templating. I've attached some samples in VB</p> <p>Window.xaml</p> <pre><code>&lt;Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winf...
<p>You need to create a DependencyProperty in your CircleInSquare class. Do some googling on that. The concept of using the property for your circle class like below is called AttachedProperties, and you will probably need to handle the CircleColorChanged event to do what you need.</p> <pre><code>&lt;Ellipse app:Cir...
46,743
<p>I wish to test a function that will generate <code>lorem ipsum</code> text, but it does so within html tags. So I cant know in advance the textual content, but i know the html structure. That is what I want to test. And maybe that the length of the texts are within certain limits. So what I am wondering is if the as...
<pre><code>$expected = array( '&lt;p', 'preg:/[A-Za-z\.\s\,]+/', '/p' ); </code></pre>
<p>Extend the SimpleExpectation class and then use your new Expectation class in the assert statement</p> <p>see: <a href="http://www.lastcraft.com/expectation_documentation.php#extending" rel="nofollow noreferrer">http://www.lastcraft.com/expectation_documentation.php#extending</a></p> <p>the example given is for va...
16,026
<p>I am considering using Maven for a Java open source project I manage.</p> <p>In the past, however, Maven has not always had the best reputation. What are your impressions of Maven, at this time? </p>
<p>For an open-source project, Maven has some advantages, especially for your contributors (eg mvn eclipse:eclipse).</p> <p>If you do go with Maven, the one rule you must follow religiously is: don't fight the tool. Layout your project exactly how Maven recommends, follow all its conventions and best practices. Every ...
<p>@MetroidFan2002: Maven 1 is deprecated and it's arguably more stable than Maven 2 (although less features). Writing Jelly script is definitely a bad idea.</p> <p>yc</p>
39,043
<p>Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python.</p>
<p>Use <a href="http://lxml.de/" rel="nofollow noreferrer">lxml</a> which is the best xml/html library for python.</p> <pre><code>import lxml.html t = lxml.html.fromstring("...") t.text_content() </code></pre> <p>And if you just want to sanitize the html look at the lxml.html.clean <a href="http://lxml.de/lxmlhtml.ht...
<p>Regular expressions are not scary, but writing your own regexes to strip HTML is a sure path to madness (and it won't work, either). Follow the path of wisdom, and use one of the many good HTML-parsing libraries.</p> <p>Lucas' example is also broken because "sub" is not a method of a Python string. You'd have to ...
5,819
<p>How do I convert a DateTime structure to its equivalent <a href="http://www.w3.org/Protocols/rfc822/#z28" rel="noreferrer">RFC 822 date-time</a> formatted string representation <strong>and</strong> parse this string representation back to a DateTime structure in .NET? The RFC-822 date-time format is used in a number...
<p>This is an implementation in C# of how to parse and convert a DateTime to and from its RFC-822 representation. The only restriction it has is that the DateTime is in Coordinated Universal Time (UTC). I agree that this is not very elegant code, but it does the job.</p> <pre><code>/// &lt;summary&gt; /// Provides met...
<p>Based on the answer of Kirk Liemohn, I used this method with success:</p> <pre><code>private DateTimeOffset? ParseDate(string date) { const string FORMAT = &quot;ddd, d MMM yyyy HH:mm:ss zzz&quot;; const string FORMAT2 = &quot;ddd, dd MMM yyyy HH:mm:ss zzz&quot;; const string FORMAT3 = &q...
36,137
<p>I am developing a scientific application used to perform physical simulations. The algorithms used are O(n3), so for a large set of data it takes a very long time to process. The application runs a simulation in around 17 minutes, and I have to run around 25,000 simulations. That is around one year of processing ...
<p>I would very highly recommend the Java Parallel Processing Framework especially since your computations are already independant. I did a good bit of work with this undergraduate and it works very well. The work of doing the implementation is already done for you so I think this is a good way to achieve the goal in "...
<p>You already suggested it, but disqualified it: Multi cores. You could go for multi core, if you had enough cores. One hot topic atm is GPGPU computing. Esp. NVIDIAs CUDA is a very priomising approach if you have many independent task which have to do the same computation. A GTX 280 delivers you 280 cores, which can...
43,246
<p>In Oracle, I have set the <code>log_archive_dest1='D:\app\administrator\orcl\archive'</code> parameter and shutdown the database. When I tried to start up the db, I got the following error:</p> <pre><code>SQL&gt; startup mount; ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated ORA-09...
<p>You probably need a trailing \ on the dir name</p> <p>ie D:\app\administrator\orcl\archive\</p>
<p>I've never used Oracle but some things you might try are</p> <ul> <li>Make sure the permissions on the file path you're using allow the database to read / write to it?</li> <li>Make sure all the folders in the path already exist</li> <li>On Windows you might find the '\' characters confuse the database. Do you spec...
17,866
<p>I have two C DLLs that I need to access in the same executable. I have header files and .LIB files for both libraries. Unfortunately a subset of the functions that I need to access have the exact same names. The best solution I have been able to come up with so far is to use LoadLibrary to load one of the DLLs and e...
<p>It used to be you could 'rename' an imported symbol using a linker .def file. You probably still can, but it's been so long since .def files have been widely used, it's difficult to locate documentation.</p> <p>The current MSDN documentation lists the IMPORTS directive as a 'reserved keyword'. I'm not sure if thi...
<p>You may be able to build new import library files that rename the functions in question and then implicitly link with both DLL modules using these new import libraries. Here is a Microsoft Knowledge Base article that describes the process: <a href="http://support.microsoft.com/kb/131313" rel="nofollow noreferrer">Ho...
36,293
<p>How can I replace multiple spaces in a string with only one space in C#?</p> <p>Example:</p> <pre><code>1 2 3 4 5 </code></pre> <p>would be:</p> <pre><code>1 2 3 4 5 </code></pre>
<pre><code>string sentence = "This is a sentence with multiple spaces"; RegexOptions options = RegexOptions.None; Regex regex = new Regex("[ ]{2,}", options); sentence = regex.Replace(sentence, " "); </code></pre>
<p>I looked over proposed solutions, could not find the one that would handle mix of white space characters acceptable for my case, for example:</p> <ul> <li><code>Regex.Replace(input, @&quot;\s+&quot;, &quot; &quot;)</code> - it will eat your line breaks, if they are mixed with spaces, for example <code>\n \n</code> s...
25,321
<p>I need to build a terminal-like application that needs to be used under my usual Ubuntu install but also under Windows. I've been looking for a terminal component that accepts commands and is able to show some kind of command history together with output.</p> <p>There is a component called VTE that is used in gnome...
<p>Maybe you want to look at the old GNOME widget called zvt, it might have been ported to Win32.</p>
<p>Gnuplot wxt provides a terminal which is compiled with GTK on X and uses the win32 API on windows. It uses the WxWindows interface to compile into both environments.</p>
44,452
<p>I once wrote this line in a Java class. This compiled fine in Eclipse but not on the command line. </p> <p>This is on</p> <ul> <li>Eclipse 3.3</li> <li>JDK 1.5</li> <li>Windows XP Professional</li> </ul> <p>Any clues?</p> <p>Error given on the command line is:</p> <pre><code>Icons.java:16: code too large ...
<p>Taking from <a href="http://forums.sun.com/thread.jspa?threadID=747860&amp;messageID=4278559" rel="nofollow noreferrer">this forum on Sun's support site</a>, no method can be more than 64 KB long:</p> <p>When you have code (pseudo) like the following...</p> <pre><code>class MyClass { private String[] s = { "a", ...
<p>Hard to say from what's provided, but guesses are</p> <ol> <li>Different JVM in Eclipse than command line.</li> <li>Bad classpath settings in command line.</li> </ol> <p>What are the compile errors?</p> <p>Can you isolate the problem in a dummy class for demonstration?</p>
14,101
<p>I can't retrieve cookie maxage it always returns -1</p> <p>Creating cookie:</p> <pre><code>Cookie securityCookie = new Cookie("sec", "somevalue"); securityCookie.setMaxAge(EXPIRATION_TIME); </code></pre> <p>Retrieve cookie:</p> <pre><code>Cookie[] cookies = request.getCookies(); if (cookies != null) { for(in...
<p>When a browser sends a cookie back to the origin server, it doesn't include any age. So it is logical that your "retrieve" code above does not receive a max age: it is not included in the request.</p> <p>When the cookie is received from the server, the browser uses the max age parameter to determine how long the co...
<p>The value may be modified by the browser.</p> <p>You create a cookie and want to set a max age. The cookie is sent to the browser. The browser may reject the cookie or ignore a max age too long for its policy. This modified cookie is sent back to your application.</p> <p>Check your browser settings.</p>
21,410
<p>I'm working on a stored procedure in SQL Server 2000 with a temp table defined like this:</p> <pre>CREATE TABLE #MapTable (Category varchar(40), Code char(5))</pre> <p>After creating the table I want to insert some standard records (which will then be supplemented dynamically in the procedure). Each category (abo...
<p>DJ's is a fine solution but could be simplified (see below).</p> <p>Why does it need to be a single statement?</p> <p>What's wrong with:</p> <pre><code>insert into #MapTable (category,code) values ('Foo','AAAAA') insert into #MapTable (category,code) values ('Foo','BBBBB') insert into #MapTable (category,code) va...
<p>This might work for you:</p> <pre><code>CREATE TABLE #MapTable (Category varchar(40), Code char(5)) INSERT INTO #MapTable SELECT X.Category, X.Code FROM (SELECT 'Foo' as Category, 'AAAAA' as Code UNION SELECT 'Foo' as Category, 'BBBBB' as Code UNION SELECT 'Foo' as Category, 'CCCCC' as Code) AS X SELECT * FROM #...
30,256
<p>I am using Qt Dialogs in one of my application. I need to hide/delete the help button. But i am not able to locate where exactly I get the handle to his help button. Not sure if its a particular flag on the Qt window.</p>
<p>By default the <em>Qt::WindowContextHelpButtonHint</em> flag is added to dialogs. You can control this with the <em>WindowFlags</em> parameter to the dialog constructor. </p> <p>For instance you can specify only the <em>TitleHint</em> and <em>SystemMenu</em> flags by doing:</p> <pre><code>QDialog *d = new QDialog...
<p>I couldn't find a slot but you can override the virtual <code>winEvent</code> function.</p> <pre><code>#if defined(Q_WS_WIN) bool MyWizard::winEvent(MSG * msg, long * result) { switch (msg-&gt;message) { case WM_NCLBUTTONDOWN: if (msg-&gt;wParam == HTHELP) { } break; ...
10,734
<p>I have the following code:</p> <pre><code>string prefix = "OLD:"; Func&lt;string, string&gt; prependAction = (x =&gt; prefix + x); prefix = "NEW:"; Console.WriteLine(prependAction("brownie")); </code></pre> <p>Because the compiler replaces the prefix variable with a closure "NEW:brownie" is printed to the console....
<p>I see the underlying problem now. It is deeper than I first thought. Basically the solution is to modify the expression tree before serializing it, by replacing all subtrees that do not depend on the parameters with constant nodes. This is apparently called "funcletization". There is an explanation of it <a href="ht...
<p>What about this</p> <pre><code>string prefix = "OLD:"; string _prefix=prefix; Func&lt;string, string&gt; prependAction = (x =&gt; _prefix + x); prefix = "NEW:"; Console.WriteLine(prependAction("brownie")); </code></pre>
13,578
<p>When you link to an unmanaged library (say 'A.dll') which in turn links to another library ('B.dll'), and B.dll is missing, you will get a run-time error message about failing to load 'B.dll'.</p> <p>But when you P/Invoke into 'A.dll' from managed code, you'll get a general exception of this form:</p> <p>Unhandled...
<p>I don't think there's any specific API you can use to pinpoint why <code>LoadLibrary</code> (the underlying Win32 API) failed for 'A.dll'. I recommend the use of a tool like <a href="http://www.dependencywalker.com/" rel="nofollow noreferrer">Dependency Walker</a> to troubleshoot DLL loading errors.</p>
<p>I'm not sure how you can get this in the form of an exception. When I run into this problem I usually try and open the DLL with depends.exe. It's pretty good and reporting missing dependencies that exist if the DLL is simply loaded from it's current location.</p>
33,805
<p>I have a column that contains dates, when I click the column header the column is sorted numerically and not by date. How would I sort this by date? The date is in the format dd/mm/yy.</p> <p>Example (sorted oldest first):</p> <p>10/12/08 &lt;--December 10/09/08 &lt;--September 12/12/08 &lt;--December</p> <p>Many...
<p>Is the source a datatable? If so, you'll probably need to specify that the column in question is of type DateTime:</p> <pre><code>myDataTable.Columns["ColumnName"].DataType = System.Type.GetType("System.Date"); </code></pre> <p>Hope that helps!</p>
<p>When the datagrid is not bound to a datasource and the dataGrid is filled row by row, the following approach works for me:</p> <pre><code>//Init dataGridView_records.Columns[0].DefaultCellStyle.Format = "dd/MM/yy HH:mm:ss"; </code></pre> <p>then fill the datagrid as follows:</p> <pre><code>DateTime date = DateTi...
48,183
<p>I am trying to establish the best practice for handling the creation of child objects when the parent object is incomplete or doesn't yet exist in a web application. I want to handle this in a stateless way so in memory objects are out.</p> <p>For example, say we have a bug tracking application.</p> <p>A Bug has a...
<p>Create the incomplete bug and define a process for handling incompleteness. (Wait X minutes/hours/days, then delete it/email someone/accept it as it is.) Even without a title or description, knowing that a problem occurred and the information in the attachment is potentially useful. The attachment may include a f...
<p>In this case I would consider storing the attachments in some type of temporary storage, be it Session State, a temp directory on the file system, or perhaps a database. Once the bug has been saved, I would then copy the attachments to their actual place.</p> <p>Careful with session though, if you let them upload l...
42,757
<p>In Cura, when you enable "Print support structure", is there a way to see what it will look like?</p>
<p>Select the View Modes Button in the upper right hand corner, and select Layers.</p> <p><a href="https://i.stack.imgur.com/grPQi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/grPQi.png" alt="Cura"></a></p>
<p>Cura generates support based on the outlines of the layers which will be printed, rather based on the triangles of the 3D model. It is therefore not possible to show the generated support in the solid view.</p> <p>You can view the support in the layer view however. In Cura 2 that's on the left bottom of the screen....
205
<p>On our site, we get a large amount of photos uploaded from various sources. </p> <p>In order to keep the file sizes down, we strip all <a href="http://en.wikipedia.org/wiki/Exif" rel="noreferrer">exif data</a> from the source using <a href="http://www.imagemagick.org/www/mogrify.html" rel="noreferrer">mogrify</a>:<...
<p>You can save a large amount of space, especially if you have a large number of images..</p> <p>Add the following to text.txt (format of the IPTC tags taken from <a href="http://www.narf.ssji.net/~shtrom/wiki/tips/imagemanipulation" rel="noreferrer">here</a>):</p> <pre><code>2#110#Credit="My Company" 2#05#Object Na...
<p>I doubt you will gain lot of space by removing Exif information...</p> <p>Anyway, I can be wrong, but Exif metadata belongs more to store technical (and contextual) information. For stuff like copyright, you should use IPTC instead.</p> <p>That's something you can do, apparently, with ImageMagick: <a href="http://...
28,404
<p>I've got the following code to end a process, but I still receive an error code 2 (Access Denied).</p> <pre><code>strComputer = "." Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2") Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'MSSEARCH.exe...
<p>It's quite legitimate to get "access denied" for ending a program. If it's a service (which I'm guessing mssearch.exe is), then it is probably running as the "SYSTEM" user, which has higher privileges than even the Administrator account.</p> <p>You can't log on as the SYSTEM account, but you could probably write a...
<p>As a non-privileged user, you can only end processes you own. In a multiuser environment this can bite you in the ankle, because WMI would return equally named processes from other users as well, unless you write a more specific WQL query.</p> <p>If your process is a service, and your script runs under a privileged...
27,788
<p>I'm writing a little tile-based game, for which I'd like to support light sources. But my algorithm-fu is too weak, hence I come to you for help.</p> <p>The situation is like this: There is a tile-based map (held as a 2D array), containing a single light source and several items standing around. I want to calculate...
<p>The roguelike development community has a bit of an obsession with line-of-sight, field-of-view algorithms.</p> <p>Here's a link to a roguelike wiki article on the subject: <a href="http://roguebasin.roguelikedevelopment.org/index.php?title=Field_of_Vision" rel="noreferrer">http://roguebasin.roguelikedevelopment.or...
<p>If you don't want to spend the time to reinvent/re-implement this, there are plenty of game engines out there. <a href="http://www.ogre3d.org/" rel="nofollow noreferrer">Ogre3D</a> is an open source game engine that fully supports lighting, as well as sound and game controls.</p>
21,051
<p>I've got a php page which handles requets for file downloads. I need to be able to detect when a file has been downloaded successfully. How can this be done? Perhaps there's some means of detecting this client-side then sending a confirmation down to the server.</p> <p>Thanks.</p> <p>Edit: By handle, I mean that t...
<p>Handle the download in a seperate php script (better do a little more than just <code>readfile($file);</code>, you can also provide the ability to resume downloads like in this <a href="https://stackoverflow.com/questions/157318/resumable-downloads-when-using-php-to-send-the-file">question</a>). Then in this script,...
<p>What Treb said, but I should add that you can check if the client is still listening during download with <a href="http://nl3.php.net/connection_status" rel="nofollow noreferrer">connection_status()</a>.</p> <p>Don't forget to <code>flush()</code> after you've written data to the client, it helps in detecting if th...
23,646
<p>I am new to Ajax.Net.</p> <p>I want to know how to access data send from Ajax POST method. (ie)AjaxObject.send("Some Data")</p> <p>How to access that "Some Data" in form?</p> <p>I can access same when i used GET method and passed data in Querystring. like Request.Querystring("name") in ASP.</p>
<p>You need to define a Webservice (asmx) on the server. You can find good documentation on <a href="http://www.asp.net" rel="nofollow noreferrer">http://www.asp.net</a></p> <p>Specifically around webservices: <a href="http://www.asp.net/AJAX/Documentation/Live/tutorials/ASPNETAJAXWebServicesTutorials.aspx" rel="nof...
<p>On the server-side, you access POSTed ajax data the same way you access any POSTed form data:</p> <pre><code>Request.Form("name") </code></pre>
42,187
<p>I'm trying to set a WPF image's source in code. The image is embedded as a resource in the project. By looking at examples I've come up with the below code. For some reason it doesn't work - the image does not show up. </p> <p>By debugging I can see that the stream contains the image data. So what's wrong?</p> <pr...
<p>After having the same problem as you and doing some reading, I discovered the solution - <a href="http://msdn.microsoft.com/en-us/library/aa970069.aspx" rel="noreferrer">Pack URIs</a>.</p> <p>I did the following in code:</p> <pre><code>Image finalImage = new Image(); finalImage.Width = 80; ... BitmapImage logo = n...
<p>Force chose UriKind will be correct:</p> <pre><code>Image.Source = new BitmapImage(new Uri(&quot;Resources/processed.png&quot;, UriKind.Relative)); </code></pre> <p>UriKind options:</p> <pre><code>UriKind.Relative // relative path UriKind.Absolute // exactly path </code></pre>
45,554
<p>I want to add a comma in the thousands place for a number.</p> <p>Would <code>String.Format()</code> be the correct path to take? What format would I use?</p>
<pre><code>String.Format("{0:n}", 1234); // Output: 1,234.00 String.Format("{0:n0}", 9876); // No digits after the decimal point. Output: 9,876 </code></pre>
<p>The method I used to not worry anymore about cultures and potential formatting issues is that I formatted it as currency and took out the currency symbol afterwards.</p> <p><code>if (decimal.TryParse(tblCell, out result))</code></p> <pre><code>{ formattedValue = result.ToString("C").Substring(1); } </code></pre>...
13,129
<p>Is there any difference between:</p> <pre><code>if foo is None: pass </code></pre> <p>and</p> <pre><code>if foo == None: pass </code></pre> <p>The convention that I've seen in most Python code (and the code I myself write) is the former, but I recently came across code which uses the latter. None is an instance...
<p><code>is</code> always returns <code>True</code> if it compares the same object instance</p> <p>Whereas <code>==</code> is ultimately determined by the <code>__eq__()</code> method</p> <p>i.e.</p> <pre><code> >>> class Foo(object): def __eq__(self, other): return True >>> f = Foo() >>> f == Non...
<pre><code>a is b # returns true if they a and b are true alias a == b # returns true if they are true alias or they have values that are deemed equivalence a = [1,3,4] b = a[:] #creating copy of list a is b # if gives false False a == b # gives true True </code></pre>
4,616
<p>I need some software to explore and modify some SQLite databases. Does anything similar to SQL Server Management Studio or MySQLAdmin exist for it?</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/5817" rel="nofollow noreferrer">As a Firefox plugin</a> (aimed mainly at gears, but should work)</p> <p><a href="http://www.sqlitemanager.org" rel="nofollow noreferrer">As a (sucky) web based app</a></p> <p>And <a href="http://www.sqlite.org/cvstrac/wiki?p=Ma...
<p>I also discovered some SQLite software for Visual Studio at <a href="http://sqlite.phxsoftware.com/" rel="nofollow noreferrer">http://sqlite.phxsoftware.com/</a> which allows you to use the Visual Studio Server Explorer to create connections to SQLite databases.</p>
7,984
<p>When you open a page in the browser, an instance of the page is created on the server. But, when you use AJAX, does anyone know if the entire page object is created at the server on postbacks?</p>
<p>When you are using ASP.NET Ajax, a AJAX request will still process all code-behind code, however, the only rendering updates will be those to items inside your update panel.</p>
<p>It also depends on whether by using the term AJAX, you are referring to real AJAX or the AJAX .NET toolkit, which mostly is a set of javascript functions, in which 90% or so of them aren't really ajax. In most of those later controls, the entire page is called, and the output is only parsed for the particular infor...
26,881
<p>I'm starting a project which requires reading outlook msg files in c#. I have the specs for compound documents but am having trouble reading them in c#. Any pointers would be greatly appreciated.</p> <p>Thanks.</p>
<p>Here is my shot. This is an initial translation of this <a href="http://www.codeguru.com/cpp/cpp/cpp_mfc/files/article.php/c13487__1/" rel="noreferrer">article</a>.</p> <pre><code>namespace cs_console_app { using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes...
<p><a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.aspx" rel="nofollow noreferrer">Outlook Interop</a>. While I have never used the outlook interop, you <strong>SHOULD</strong> be able to open the email messages with it.</p> <p><a href="http://msdn.microsoft.com/en-us/library/microso...
21,603
<p>In an impersonation scenario related to Sharepoint I need to execute some code in a separate process (the process will run in the context of a certain user). I do not want to launch a separate application, basically I want to do a "run as" on just a method.</p>
<p>I haven't tried this myself but <a href="http://michiel.vanotegem.nl/Permalink,guid,36633846-2eca-40fe-9957-2859d8a244dc.aspx" rel="nofollow noreferrer">this seems</a> to do the trick.</p> <p>If you are fine with the impersonated method blocking until it finishes it should work. So your code would be something like...
<p>"Execute code in a separate process" = "launch a separate application" though.</p> <p>I mean, you could launch a single process and then make requests to it to run the particular method... but it's not clear whether that's what you want.</p>
39,296
<p>What is the most efficient algorithm for grouping identical items together in an array, given the following:</p> <ol> <li>Almost all items are duplicated several times.</li> <li>The items are not necessarily integers or anything else that's similarly simple. The range of the keys is not even well-defined, let alon...
<p>I think you could just hash the objects, since real order doesn't matter, only grouping. Identical objects will end up grouped in the same bucket. This is assuming that every type you're interested in has its own hash function, or you can define your own and overload it (taking each type as a parameter to a differ...
<p>If you know the range of the possible values, and it's small, you could do: (pseudo-ish code)</p> <pre><code>uint[] bucket = new int[10]; foreach(uint val in foo) { ++bucket[val]; } uint bar_i = 0; uint[] bar = new int[foo.length]; foreach(int val = 0; val &lt; 10; val++) { uint occurrences = bucket[val]; ...
46,143
<p>I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath the application are several 2.0 apps. To completely logout a user can I just logout of the 1.1 app with FormsAuthentication.SignOut or is it more complicated than that?</p>
<p>What you are looking to do is called Single Sign On and Single Sign Off. There are differences based on how you have the applications set up. I will try to clarify where those differences come into play.</p> <p>To implement single sign on and single sign off you need to make the cookie name, protection, and path ...
<p>It could be easier if you are having a central session store for all your applications. You can then set the session to null in one place.</p>
7,929
<p>I have a <a href="https://www.monoprice.uk/products/monoprice-maker-ultimate-3d-printer-uk" rel="nofollow noreferrer">Monoprice Maker Ultimate 3D Printer</a> and have tried to replace the nozzle.</p> <p>The nozzles I bought turned out to be too small.</p> <p><img src="https://i.imgur.com/iYnMTVf.jpg" alt="Imgur"><...
<h2>What part fits?</h2> <p>A replacement nozzle needs to fit 3 parameters:</p> <ul> <li>Thread diameter and pitch need to match up, to allow mounting</li> <li>Thread length should be close to the original to allow secure fastening</li> <li>The style needs to fit: there are quite some styles of nozzle - most are not li...
<h2>What part fits?</h2> <p>A replacement nozzle needs to fit 3 parameters:</p> <ul> <li>Thread diameter and pitch need to match up, to allow mounting</li> <li>Thread length should be close to the original to allow secure fastening</li> <li>The style needs to fit: there are quite some styles of nozzle - most are not li...
1,196
<p>Does anyone know of a good open source plugin for database querying and exploring within Eclipse? </p> <p>The active Database Exploring plugin within Eclipse is really geared around being associated with a Java project. While I am just trying to run ad-hoc queries and explore the schema. I am effectively looking fo...
<p>It's this way in SQL (as a logic language) because null means unknown/undefined.</p> <p>However, in programming languages (like say, C++ or C#), a null pointer/reference is a specific value with a specific meaning -- nothing.</p> <p>Two nothings are equivilent, but two unknowns are not. The confusion comes from t...
<p>In SQL you would have to do something like:</p> <pre><code>WHERE column is NULL </code></pre> <p>rather than</p> <pre><code>WHERE column = NULL </code></pre>
10,092
<p>I've been using <a href="http://www.jcraft.com/jsch/" rel="nofollow noreferrer">JSch</a> for a couple of weeks now. It seems to <em>work</em> okay, but its API is a little bit cumbersome. I'm also a little off put by its total lack of documentation (not even javadoc style comments). Has anyone used a good Java SS...
<p>Here's one way, using the <a href="http://www.php.net/list" rel="nofollow noreferrer">list</a> language construct</p> <pre><code>function returnsAnArray () { return array ('test'); } list($foo)=returnsAnArray(); </code></pre> <p>You could grab a sequence of elements from an offset by combining this with <a href...
<p>I ask myself why one would like to avoid creating a temporary variable for a returned array. Why don't you just return one value instead of an whole array? Maybe you'll have to overthink your program logic.</p> <p>Or is it a performance/memory issue? Consider using <a href="http://de2.php.net/manual/en/language.ref...
20,794
<p>For years, maybe 10, I've been fascinated with cryptography. I read a book about XOR bit-based encryption, and have been hooked ever since thing.</p> <p>I guess it's more fair to say that I'm fascinated by those who can break various encryption methods, but I digress.</p> <p>To the point -- what methods do you use...
<p>To contradict what everyone else has said so far, <strong>go for it!</strong> Yeah, your code might have buffer overflow vulnerabilities in it, and may be slow, buggy, etc, but you're doing this for <strong>FUN</strong>! I completely understand the recreational enjoyment found in playing with crypto.</p> <p>That ...
<p>Usually, I start by getting a Ph.D in number theory. Then I do a decade or so of research and follow that up with lots of publishing and peer review. As far as the techniques I use, they are various ones from my research and that of my peers. Occasionally, when I wake up in the middle of the night, I'll develop a...
14,411
<p>Admittedly this might not be a problem on larger screens, but my employer is abit tight and refuses to buy monitors larger than 19inch, this means that I dont have much screen real estate to view all the Visual Studio windows and my code at the same time, or two pieces of code at once. Is there anything that allows ...
<p>You can right click on the tab strip and insert a new vertical (or horizontal) tab group.</p> <p>This allows you to view multiple tabs at the same time.</p>
<p>Hmm.. I don't think there is a way from within Visual Studio. For maximizing real estate and working on simultaneous files, I use that method plus viewing the files on Full Screen mode.</p> <p>Do you multiple monitors?</p>
3,764
<p>In <a href="https://stackoverflow.com/users/23233/mmalc">@mmalc's</a> <a href="https://stackoverflow.com/questions/155964/what-are-best-practices-that-you-use-when-writing-objective-c-and-cocoa#156288">response</a> to <a href="https://stackoverflow.com/questions/155964/what-are-best-practices-that-you-use-when-writi...
<p>It's basically a guideline to minimize the potential for bugs.</p> <p>In this case there is the (possibility) that your setter/getter may inadvertently make direct or indirect assumptions about the state of the object. These assumptions could be a problem when the object is in the midst of being setup or destroyed....
<p>In fact, for a class that comes and goes rather often (like a detail view controller), you want to use the accessor in the init; otherwise, you could end up releasing a value in viewDidUnload that you try to access later (they show that in CS193P...)</p>
23,420
<p>I have a PPPOE connection on a computer. That computer has two LAN cards and I activated ICS on it. The problem is, the connection kinda degrades over time (don't know why), and a redial would be nice, hourly maybe. I was thinking of writing an AutoIT script that would do this, if, for example I'm sending some data ...
<p>you can use rasdial (which is build in into windows) and create a batch script (.bat extension) like so:</p> <pre><code>rasdial connectionname </code></pre> <p>-or- </p> <p>if you want to do it in a programming language, you can just call the command internally</p> <p>C# example:</p> <pre><code>public static in...
<p>Maybe you can make something for yourself with <a href="http://webtools.live2support.com/windows/rasdial.php" rel="nofollow noreferrer">rasdial</a> and <a href="http://support.microsoft.com/kb/313565" rel="nofollow noreferrer">at</a>?</p>
39,464
<p>I'm working on a project and I want to store some easily enumerated information in a table. MySql's enum data type does exactly what I want: <a href="http://dev.mysql.com/doc/refman/5.0/en/enum.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/enum.html</a> . Is there an equivalent in SQL Server 2005?<...
<p>Does this work for you?</p> <p>From <a href="http://blechie.com/wtilton/archive/2007/08/24/303.aspx" rel="noreferrer">http://blechie.com/wtilton/archive/2007/08/24/303.aspx</a></p> <p>Create table...</p> <p><strong>MySQL:</strong></p> <pre><code>ColumnName ENUM('upload', 'open', 'close', 'delete', 'edit', 'add')...
<p>One characteristic of MySQL's ENUM data type is that it stores only a numeric index into the list of values, not the string itself, on each row. So it's usually more storage-efficient. Also the default behavior when you sort by an ENUM column is to sort by the numeric index, therefore by the order of elements in t...
32,896
<p>I am wondering what the correct mechanism to enable communication between controls in WPF is. My goal is to not use conventional events and have to manually wire them up. The default behavior of routed commands (tunneling, bubbling) seems to be along the right lines but I guess I'm missing something.</p> <blockquo...
<p>The best mechanism is to refactor and separate the data view from the data model.</p> <p>Create a data model that provides DependencyProperty properties (rather than standard C# properties) for each data point, but does not provide a UI. The values in the data model can affect each other when modified.</p> <p>You...
<p>If you want to transfer data between elements, <code>Binding</code> is the way to go. There are many tutorials and books about this on the net.</p> <p>If you want to effect <code>Style</code> changes, then you can use <code>DataTriggers</code>, which also use Bindings.</p> <p>There is no way to send events in the ...
22,286
<p>I am writing a .NET assembly using C++/CLI (version 9.0), and I would like to use the PIMPL idiom to avoid putting unnecessary stuff in my public header. Unfortunately, when I try to forward declare a class, and then use a tracking handle to it, I get Linker warning 4248: </p> <blockquote> <p>warning LNK4248: unr...
<p>I think you're using two technologies which do not really sit together well:</p> <p>The natural application for pimpl is to avoid having to make header file changes all the time thereby causing big recompilations on big C++ projects.</p> <p>The natural application for C++/cli is to write skinny little interop piec...
<p>Upon further digging and reflecting I have discovered that in some respects .NET does not really need to support PIMPL in the same way as C++, since you can mark a class private to an assembly - this essentially has the same effect, in some ways. However often the PIMPL idiom is used to hide headers that you don't w...
43,480
<p>I have a pictures table that has the following columns:</p> <pre><code>PICTURE_ID int IDENTITY(1000,1) NOT NULL, CATEGORY_ID int NOT NULL, IMGDATA image NOT NULL, CAPTION1 text COLLATE SQL_Latin1_General_CP1_CI_AS NULL, MIME_TYPE nchar(20) NOT NULL DEFAULT ('image/jpeg'), IMGTHDATA image NOT NULL </code></pre> <p>...
<p>you can make a page that returns the image as a stream and reference that page from an Image column (or an IMG tag in a template column); see <a href="http://www.netomatix.com/development/GridViewDisplayBlob.aspx" rel="nofollow noreferrer">GridViewDisplayBlob.aspx</a></p>
<p>There is no real simple way to do this. Basically you're going to need to create a handler to display the images. Then in your grid you will create an img tag with the URL pointing to your image handler. </p> <p>An example of this can be found <a href="http://blogs.msdn.com/jdixon/articles/495408.aspx" rel="nofollo...
24,364
<p>Is there a simple way in Perl that will allow me to determine if a given variable is numeric? Something along the lines of:</p> <pre><code>if (is_number($x)) { ... } </code></pre> <p>would be ideal. A technique that won't throw warnings when the <code>-w</code> switch is being used is certainly preferred.</p>
<p>Use <code>Scalar::Util::looks_like_number()</code> which uses the internal Perl C API's looks_like_number() function, which is probably the most efficient way to do this. Note that the strings "inf" and "infinity" are treated as numbers.</p> <h2>Example:</h2> <pre><code>#!/usr/bin/perl use warnings; use strict; ...
<p>if ( defined $x &amp;&amp; $x !~ m/\D/ ) {} or $x = 0 if ! $x; if ( $x !~ m/\D/) {}</p> <p>This is a slight variation on Veekay's answer but let me explain my reasoning for the change.</p> <p>Performing a regex on an undefined value will cause error spew and will cause the code to exit in many if not most environm...
3,373
<p>For many questions the answer seems to be found in "the standard". However, where do we find that? Preferably online.</p> <p>Googling can sometimes feel futile, again especially for the C standards, since they are drowned in the flood of discussions on programming forums.</p> <p>To get this started, since these ar...
<h3>PDF versions of the standard</h3> <p>As of <strike>1st September 2014</strike> March 2022, the best locations by price for the official C and C++ standards documents in PDF seem to be:</p> <ul> <li><p>C++20 – ISO/IEC 14882:2020: <a href="https://www.csagroup.org/store/product/CSA%20ISO%25100IEC%2014882%3A21/?format...
<p>Although not an actual standard, there is an amendment to ISO C (C89/90) called C94/95, or Normative Addendum 1. It was integrated into C99, although some compilers such as <a href="http://clang.llvm.org/docs/UsersManual.html" rel="nofollow">Clang</a> allow you to specifiy <code>-std=c94</code> on the command line. ...
10,739
<p>I replaced the controller board in my Monoprice Select Mini with an Arduino/Ramps setup and compiled an uploaded Marlin 1.1.0-RC8 to run it. I've got most everything calibrated and working with one exception.</p> <p>I tell the printer to home for xyz and then level my bed with a piece of paper then start a print an...
<p>I found the issue. When the hotend and bed are at temps for PLA everything works fine but at temps for ABS the Z offset would get all messed up. After a bunch of testing I was able to track it down to a single gcode statment <code>G1 Z15.0 F6000</code> At the higher temps my Z stepper skips steps at that feed rate....
<p>If nozzle sets lower than it should, after heating up, then you may need to calibrate with heater turned on.</p> <p>Another (although less likely) reason can be an incorrect Z steps number. However, if the print, after adjusting the first line height, does well, this should not be the case.</p> <p>Fast track solut...
557
<p><strong>What libraries are there to write C# internationalized applications?</strong></p> <p>Typical functionalities that should be contained in the library:</p> <ul> <li>Validation of country specific data (e.g. VAT numbers, phone numbers, addresses,...)</li> <li>Validation of bank and financial coordinates (e.g....
<p>I wouldn't say that no one does i18n, but I don't know of any generic tools that can be used for every project. Maintaining a database with all of the information you are looking for would be an epic project. It sounds like what you're looking for isn't a specific C# library, but more a collection of information onl...
<p>Not exactly a "library", per se, but I've actually ran into a great service (for pay), by a company called <a href="http://www.fiftyone.com/" rel="nofollow noreferrer">E4X</a> (former client of mine).<br> What they provide is complete localization of your ecommerce site, including language translations, currency exc...
13,316
<p>For practicality sake, I need to print a design such that there will be weight hanging parellel to the layer lines. Is there an infill pattern that would be better than others at handling this?</p> <p>I realize that all kinds of infill will still have the same layer boundaries. Just wondering if choosing any given ...
<p>Yes, some infill patterns are better than others for preventing separation of layers. Basically (modulo some assumptions about uniformity of distribution of force), the shearing strength of the part in the Z direction at a particular layer is going to be proportional to the <em>surface area</em> of bonding between s...
<p>0scar's answer is the "solution" or true answer to the question.</p> <p>Watching youtube the last few days, cubic needs to be considered. I was surprised at what I saw. More to consider is adding design elements:</p> <ul> <li>The concept of flutes along the perimeter.</li> <li>Adding through holes increases streng...
1,588
<p>I'm sure we all have received the wonderfully vague "Object reference not set to instance of an Object" exception at some time or another. Identifying the object that is the problem is often a tedious task of setting breakpoints and inspecting all members in each statement. </p> <p>Does anyone have any tricks to e...
<p>At the point where the NRE is thrown, there is no target object -- that's the point of the exception. The most you can hope for is to trap the file and line number where the exception occurred. If you're having problems identifying which object reference is causing the problem, then you might want to rethink your ...
<p>you can check the Message and InnerException properties</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.exception.innerexception.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.exception.innerexception.aspx</a></p>
14,090
<p>I've found databases typically come in two flavors, your traditional row-oriented RDBMS or an object oriented database (OODBMS). However, in the mid 90s I remember, a new breed of databases showing up that were column oriented. Some of these were given the term 4GL, but I don't think it was a term that stuck.</p> ...
<p><a href="http://en.wikipedia.org/wiki/HBase" rel="noreferrer">HBase</a> is an open-source column-oriented database system modelled on <a href="http://en.wikipedia.org/wiki/BigTable" rel="noreferrer">Google's BigTable</a>.</p>
<p>Sybase IQ is column oriented . All columns are automatically indexed when you create a table and data is nicely compressed in the columns.</p> <p>It's a nice OLAP database (...data warehouse) but I would not recommend it for any kind of transaction processing as it is designed for data warehouse operations.</p> <...
41,580
<p>Ruby is becoming <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html" rel="noreferrer">popular</a>, largely from the influence Ruby on Rails, but it feels like it is currently struggling through its adolescence. There are a lot of similarities between Ruby and Smalltalk -- <a href="http://ruby....
<p>I'm more of a Pythonista than a Ruby user, however the same things hold for Ruby for much the same reasons.</p> <ul> <li><p>The architecture of Smalltalk is somewhat insular whereas Python and Ruby were built from the ground up to facilitate integration. Smalltalk never really gained a body of hybrid application s...
<p>I think part of the problem is the development-environment-is-the-runtime. This gives a lot of power, but it also presents a larger learning curve. </p> <p><a href="http://wiki.squeak.org/squeak/2230" rel="nofollow noreferrer">Here</a> is a hello world tutorial.</p> <p>This is very different from other languages ...
22,691
<p>Errors that occur deep down in a data access layer or even higher up, (say within ADO.net operations for example) rarely make much sense to an end user. Simply bubbling these errors up to a UI and displaying them will usually achieve nothing except frustration for an end user.</p> <p>I have recently employed a basi...
<p>It is just slightly horrible.</p> <p>If you are showing an error to the end user, the user is supposed to be able to act about it. In "The list of customer names your requested could not be displayed." case, your user will just think "so what?" On all of these cases, just display a "something bad happened" message....
<p>Generally when you're dealing with exceptions, performance and efficiency are the least of your worries. You should be more worried about doing something to help the user recover from the problem. If there was a problem writing a certain record to the database, either roll the changes back or at least dump the row...
13,502
<p>I've downloaded the IKVM sources (<a href="http://www.ikvm.net/" rel="nofollow noreferrer">http://www.ikvm.net/</a>) from <a href="http://sourceforge.net/cvs/?group_id=69637" rel="nofollow noreferrer">http://sourceforge.net/cvs/?group_id=69637</a></p> <p>Now I'm trying to get it to build in Visual Studio 2008 and a...
<p>I don't know that this would do it for you but can you try building from the command line?</p> <p>msbuild ________</p> <p>I think that's how I built the application due to the same issues.</p>
<p>This is how I built IKVM 8.1.5717.0 from source. Visual Studio is not required.</p> <ul> <li><p>Create a folder: c:\ikvm\</p></li> <li><p>Add the above folder to PATH (e.g. set PATH=%PATH%;c:\ikvm and leave command prompt open for later).</p></li> <li><p>Download: ikvmsrc-8.1.5717.0.zip (<a href="http://www.frijter...
9,713
<p>We try to convert from string to <code>Byte[]</code> using the following Java code:</p> <pre><code>String source = "0123456789"; byte[] byteArray = source.getBytes("UTF-16"); </code></pre> <p>We get a byte array of length 22 bytes, we are not sure where this padding comes from. How do I get an array of length 20?<...
<p><a href="https://stackoverflow.com/questions/228987/convert-string-to-byte-in-java#228998">Alexander's answer</a> explains why it's there, but not how to get rid of it. You simply need to specify the endianness you want in the encoding name:</p> <pre><code>String source = "0123456789"; byte[] byteArray = source.get...
<p>Try printing out the bytes in hex to see where the extra 2 bytes are added - are they at the start or end?</p> <p>I'm picking that you'll find a <a href="http://en.wikipedia.org/wiki/Byte_Order_Mark" rel="noreferrer">byte order marker</a> at the start (0xFEFF) - this allows anyone consuming (receiving) the byte arr...
28,339
<p>Basically, I have an <code>iframe</code> embedded in a page and the <code>iframe</code> has some <a href="http://en.wikipedia.org/wiki/JavaScript" rel="noreferrer">JavaScript</a> routines I need to invoke from the parent page.</p> <p>Now the opposite is quite simple as you only need to call <code>parent.functionNam...
<p>Assume your iFrame's id is "targetFrame" and the function you want to call is <code>targetFunction()</code>:</p> <pre><code>document.getElementById('targetFrame').contentWindow.targetFunction(); </code></pre> <p>You can also access the frame using <code>window.frames</code> instead of <code>document.getElementById...
<p>Use following to call function of a frame in parent page</p> <pre><code>parent.document.getElementById('frameid').contentWindow.somefunction() </code></pre>
31,311
<p>I have this doubt, I've searched the web and the answers seem to be diversified. Is it better to use mysql_pconnect over mysql_connect when connecting to a database via PHP? I read that pconnect scales much better, but on the other hand, being a persistent connection... having 10 000 connections at the same time, al...
<p>Persistent connections should be unnecessary for MySQL. In other databases (such as Oracle), making a connection is expensive and time-consuming, so if you can re-use a connection it's a big win. But those brands of database offer connection pooling, which solves the problem in a better way.</p> <p>Making a conne...
<p><strong>MYSQL_CONNECT()</strong></p> <p>1.mysql_connect can be used to close the connection.Every time it is opening and closing the database connection, depending on the request .</p> <p>2.Here database is opened everytime when the page is loaded in MYSQL connect</p> <p>3.When the page is loaded, the database is...
30,784
<p>What's the most elegant way to select out objects in an array that are unique with respect to one or more attributes?</p> <p>These objects are stored in ActiveRecord so using AR's methods would be fine too. </p>
<p>Use <a href="http://ruby-doc.org/core-1.9.2/Array.html#method-i-uniq" rel="noreferrer"><code>Array#uniq</code></a> with a block:</p> <pre><code>@photos = @photos.uniq { |p| p.album_id } </code></pre>
<p>Now if you can sort on the attribute values this can be done:</p> <pre><code>class A attr_accessor :val def initialize(v); self.val = v; end end objs = [1,2,6,3,7,7,8,2,8].map{|i| A.new(i)} objs.sort_by{|a| a.val}.inject([]) do |uniqs, a| uniqs &lt;&lt; a if uniqs.empty? || a.val != uniqs.last.val uniqs e...
13,501
<p>Sometimes it seems natural to have a default parameter which is an empty list. Yet <a href="https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument">Python produces unexpected behavior in these situations</a>.</p> <p>If for example, I have a function:</p> <pre><code>def my_fun...
<pre class="lang-py prettyprint-override"><code>def my_func(working_list=None): if working_list is None: working_list = [] # alternative: # working_list = [] if working_list is None else working_list working_list.append(&quot;a&quot;) print(working_list) </code></pre> <p><a href="https://...
<p>I took the UCSC extension class <code>Python for programmer</code></p> <p>Which is true of: def Fn(data = []):</p> <blockquote> <p>a) is a good idea so that your data lists start empty with every call.</p> <p>b) is a good idea so that all calls to the function that do not provide any arguments on the call will get t...
47,829
<p>While an applet is loading, it displays a white rectangle for a split second. How can we get rid of it?</p>
<p>I found a solution that does not require any third-party library or custom tasks using the <a href="http://ant.apache.org/manual/Tasks/script.html" rel="noreferrer"><code>&lt;script&gt;</code> task</a> that allows for using JavaScript (or any other <a href="http://jakarta.apache.org/bsf" rel="noreferrer">Apache BSF<...
<p>There is a math task at <a href="http://ant-contrib.sourceforge.net/" rel="nofollow noreferrer">http://ant-contrib.sourceforge.net/</a> that may be useful</p>
40,298
<p>What is the equivalent of varchar(max) in MySQL?</p>
<p>The max length of a varchar is subject to the max row size in MySQL, which is 64KB (not counting BLOBs):</p> <pre><code>VARCHAR(65535) </code></pre> <p>However, note that the limit is lower if you use a multi-byte character set:</p> <pre><code>VARCHAR(21844) CHARACTER SET utf8 </code></pre> <hr> <p>Here are som...
<p>Mysql Converting column from VARCHAR to TEXT when under limit size!!!</p> <pre><code>mysql&gt; CREATE TABLE varchars1(ch3 varchar(6),ch1 varchar(3),ch varchar(4000000)) ; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql&gt; SHOW WARNINGS; +-------+------+---------------------------------------------+ | Level...
43,128
<p>I am looking for any kind of information (prefer Moq) on how to unit test the Application_Start method in Global.asax. I am using ASP.NET MVC and trying to get to that elusive 100% code coverage!</p> <p>The fact that I'm using MVC is not the point. And saying that not testing Start is not necessary isn't really t...
<p>Some organizations do require those meaningless numbers, and have issues beyond cost. For companies dealing with $ensitive information "Good enough" is not good enough. I had exactly the same issue and like Klas Mellbourn, need to get to 100% (if not higher!) The following worked for me. Although, I'd have preferred...
<p>this function is called the first time your site is visited. recycling the app pool will cause it to be triggered again</p> <p>In most situations, this <em>event handler has no code</em>, so don't waste time pursuing meaningless numbers!</p>
48,620
<p>We are changing some of the text for our old, badly written error messages. What are some resources for best practices on writing good error messages (specifically for Windows XP/Vista).</p>
<p>In terms of wording your error messages, I recommend referring to the following style guides for Windows applications:</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/aa511258.aspx" rel="nofollow noreferrer">Windows user experience guidelines</a>, and specifically the section on error messages <a href...
<p>Support for multilanguage applies for all kinds of messages, but tends to be forgotten in the case of error messages.</p>
14,263
<p>I'm writing by own blogging engine in PHP with a MYSQL backend database. MY question is: How would you go about making user comments and blog posts include newlines wherever they are appropriate?</p> <p>For example, if a user hits the return key in the message/comments box how would this translate into a new line t...
<p>PHP has a function: nl2br which turns new lines into <code>&lt;br /&gt;</code></p> <p><a href="http://us2.php.net/nl2br" rel="nofollow noreferrer">www.php.net/nl2br</a></p>
<p>It's also important what your using for a comment editor. If your using a standard textbox then yes, nl2br is what your looking for. If your going a bit more advanced such as using a WYSIWYG editor like tinyMCE, then it has configuration that can handle that for you.</p>
15,072
<p>I´m using <code>Transaction Binding=Explicit Unbind</code> in the connection string as recommended <a href="http://weblogs.asp.net/ryangaraygay/archive/2008/04/14/issue-with-system-transactions-sqlconnection-and-timeout.aspx" rel="noreferrer">here</a> since I´m also using TransactionScope with timeout. The problem i...
<p>The connections only seem to stay in the pool and not being reused in case you get an exception, just like the example. If you increase the timeout the connection will be reused.</p> <p>A workaround to this problem is to clear the connection pool in case you get an exception like this:</p> <pre><code>using (SqlCon...
<p>For what it's worth, this issue was fixed in .Net 4.0.</p>
40,572
<p>I've got a generic&lt;> function that takes a linq query ('items') and enumerates through it adding additional properties. How can I select all the properties of the original 'item' rather than the item itself (as the code below does)?</p> <p>So equivalent to the sql: select *, 'bar' as Foo from items</p> <pre><co...
<p>There's no easy way of doing what you're suggesting, as all types in C# are strong-typed, even the anonymous ones like you're using. However it's not impossible to pull it off. To do it you would have to utilize reflection and emit your own assembly in memory, adding a new module and type that contains the specifi...
<pre><code>from item in items where someConditionOnItem select { propertyOne, propertyTwo }; </code></pre>
13,518
<p>From the Displays pane in System Preferences, I can manually change the main monitor by dragging the menu bar from one display to the other. I'd like to automate this and make it part of an AppleScript.</p>
<p>The tool I wrote, <a href="https://github.com/jakehilborn/displayplacer" rel="noreferrer">displayplacer</a>, does this.</p> <p>Configure your screens how you like, drag the "white bar" to your primary screen in the macOS system settings, and then execute <code>displayplacer list</code>. It will output the command t...
<p>Much like you can tell System Events.app to sleep your Mac, you can tell Image Events.app to mess with your displays. The Image Events application provides a "displays" collection. Each display has a "profile" with lots of goodies. However, everything I just mentioned is read-only, so I don't have a good way to d...
9,392
<p>I just recently upgraded my Printrbot Simple Metal with a heated bed (and longer x-axis). I looked up some tutorials, and all of them placed the thermistor as in the picture on the left below, so I did too. However, the design of the heat plate seems to strongly suggest thermistor placement as in the picture on the ...
<p>You are correct about the walls. Using a <em>Solidify</em> object modifier is probably your best bet. A low <em>Thickness:</em> value (<em>0.1</em> is probably good) helps keep the walls thin but strong. You can monitor the thickness while you adjust the value from <em>Wireframe</em> view.</p> <p><a href="https://i...
<blockquote> <p>What are the things that i have to watch out for when 3d printing? </p> </blockquote> <p><a href="https://blender.stackexchange.com/q/7910/2816">non manifold geometry</a> : geometry that can not exist in the real world. </p> <p>It's a good idea to check if the dimensions of your mesh are correct b...
306
<p>I have backups of files archived in optical media (CDs and DVDs). These all have par2 recovery files, stored on separate media. Even in cases where there are no par2 files, minor errors when reading on one optical drive can be read fine on another drive.</p> <p>The thing is, when reading faulty media, the read time...
<p><code>man readom</code>, a program that comes with cdrecord:</p> <pre><code> -noerror Do not abort if the high level error checking in readom found an uncorrectable error in the data stream. -nocorr Switch the drive into a mode where it ignores read errors in data s...
<p>dd(1) is your friend.</p> <p>dd if=/dev/cdrom of=image bs=2352 conv=noerror,notrunc</p> <p>The drive may still retry a bit, but I don't think you'll get any better without modifying firmware.</p>
17,969
<p>I'm trying to write a piece of code that will do the following:</p> <p>Take the numbers 0 to 9 and assign one or more letters to this number. For example:</p> <pre><code>0 = N, 1 = L, 2 = T, 3 = D, 4 = R, 5 = V or F, 6 = B or P, 7 = Z, 8 = H or CH or J, 9 = G </code></pre> <p>When I have a code like 0123, it's an ea...
<p>It can be done easily recursively.</p> <p>The idea is that to handle the whole code of size n, you must handle first the n - 1 digits. Once you have all answers for n-1 digits, the answers for the whole are deduced by appending to them the correct(s) char(s) for the last one.</p>
<p>Could you do the following: Create a results array. Create an item in the array with value ""</p> <p>Loop through the numbers, say 051 analyzing each one individually.</p> <p>Each time a 1 to 1 match between a number is found add the correct value to all items in the results array. So "" becomes N.</p> <p>Each ti...
12,803
<p>What's the easiest way to remove last row from the text file using SQL Server Integration Services?</p> <p>Thanks.</p>
<p>Because SSIS is pipeline based, there's no good way to look ahead and know that a line is the last line.</p> <p>However, depending on your actual goal, there are a number of ways to achieve this:</p> <ul> <li>If the last row has some identifying information, it can simply be filtered out using the built-in filter ...
<p>Cade has some excellent answers, but just to add another option, you may wish to preprocess the file in a more generaly language like PowerShell or Python to create a new version omitting the offending last line before bringing it in to SQL.</p>
24,549
<p>ToolStripItems show Active highlighting when you mouse over them, even if the form they are in is not in focus. They do not, however, show their tooltips, unless the form is focused. I have seen the <a href="http://blogs.msdn.com/rickbrew/archive/2006/01/09/511003.aspx" rel="noreferrer">ToolStrip 'click-though'...
<p>The problem is that the ToolStrip "controls" like ToolStripButton or ToolStripDropDownButton don't inherit from Control. For now I addressed the problem by focusing the ToolStrip whenever a user hovers over a button. The button's MouseHover event is fired too late -- after the "show tooltip" code would have been...
<p>I was trying to do the same thing and determined it was going to be pretty challenging and not worth it. The reason is that internally, the .NET code is specifically designed to only show the tooltip if the window is active - they are checking this at a Win32 level so its going to be hard to fake the code out.</p> ...
17,279
<p>I have a class and I want to be able to iterate over a certain array member. I did a quick search and found <code>IteratorAggregate</code>:</p> <pre><code>class foo implements IteratorAggregate { protected $_array = array('foo'=&gt;'bar', 'baz'=&gt;'quux'); public function getIterator() { retur...
<p>I don't think you do want to use MAX() as you don't want to group the OrderID. What you need is an ordered sub query with a SELECT TOP 1.</p> <pre><code>select * from Customers inner join Orders on Customers.CustomerID = Orders.CustomerID and OrderID = ( SELECT TOP 1 subOrders.Orde...
<p>Something like:</p> <pre><code>SELECT a.* FROM Customer a INNER JOIN Order b ON a.OrderID = b.Id INNER JOIN (SELECT Id, max(EntryTime) as EntryTime FROM Order b GROUP BY Id) met ON b.EntryTime = met.EntryTime and b.Id = met.Id </code></pre>
42,932
<p>For some reason, I can't seem to get CruiseControl.net to checkout code to anywhere but the starteam working folder for a specificed view.</p> <p>I've tried both overrideViewWorkingDir and overrideFolderWorkingDir, and neither seem to work.</p> <p>Has anyone been able to do this?</p>
<p>Are you looking for the project's <a href="http://confluence.public.thoughtworks.org/display/CCNET/Project+Configuration+Block" rel="nofollow noreferrer">workingDirectory element</a> instead of the <a href="http://confluence.public.thoughtworks.org/display/CCNET/StarTeam+Source+Control+Block" rel="nofollow noreferre...
<pre><code>&lt;sourcecontrol type="starteam"&gt; &lt;executable&gt;C:\Program Files\starbase\StarTeam 5.4\stcmd.exe&lt;/executable&gt; &lt;project&gt;ProjectName/ViewName&lt;/project&gt; &lt;username&gt;UserName&lt;/username&gt; &lt;password&gt;Password&lt;/password&gt; &lt;host&gt;127.0.0.1&lt;/hos...
6,428
<p>My colleague here argues that new programmers must learn ASP first, before they learn ASP.Net. </p> <p>I seem to agree with him as most new programmers who start with ASP.Net do not understand web get, post and state management :(</p> <p>Which is best to learn web programming Classic ASP or ASP.Net?</p>
<p>I'd pick ASP.NET MVC over classic ASP. The problem with classic ASP is the support level for it. With MVC, you learn both about web get/post and state management, while at the same time getting the advantage of using your favorite OO language.</p>
<p>I would recommend just going with ASP.Net. ASP is so old a technology that they will have to learn so many work arounds to things that are common place.</p> <p>I would also go with straight ASP.Net over MVC as the jury is still out (for me anyway) on how valuable MVC really is. It takes a lot of control away from...
44,115
<p>Is there a way to read the properties inside an <a href="https://en.wikipedia.org/wiki/Windows_Installer" rel="nofollow noreferrer">MSI</a> file?</p> <p>For example, given a MSI file named <em>Testpackage.msi</em>, I need to find</p> <pre><code>productName PackageCode version </code></pre> <p>This I am going to use ...
<p>You can use the <a href="http://msdn.microsoft.com/en-us/library/aa367810(VS.85).aspx" rel="nofollow noreferrer">COM-based API for working with MSI</a>, and do something like</p> <pre class="lang-vb prettyprint-override"><code>Function GetVersion(ByVal msiName) Const msiOpenDatabaseModeReadOnly = 0 Dim msi...
<p>I found a lightweight non-programmatic solution in <a href="http://code.google.com/p/lessmsi/" rel="nofollow">lessmsi</a>. It apparently uses wix and just explodes the whole .msi into a specified folder. (It also has a UI but it didn't render great for me on Win7).</p>
38,273
<p>I have a project that utilizes the javax.mail.internet.MimeMessage and other related classes that does mime parsing for emails that we receive. This needs to be ported to .NET.</p> <p>What .Net 3rd party or built in library can I use to replace the Java classes that I'm using?</p> <p>EDIT: Anything change in the l...
<p>I've recently released <a href="https://github.com/jstedfast/MimeKit">MimeKit</a> which is far more robust than any of the other open source .NET MIME parser libraries out there and it's orders of magnitude faster as well due to the fact that it is an actual stream parser and not a recursive descent string parser (w...
<p>Try using <a href="http://www.limilabs.com/mail/" rel="nofollow noreferrer">Mail.dll IMAP component</a>, it's on the market for quite a while, and is well tested.</p> <pre><code>using(Imap imap = new Imap()) { imap.Connect("imapServer"); imap.UseBestLogin("user", "password"); imap.SelectInbox(); Li...
3,958
<p>I have a <code>DataTable</code> with a <code>Name</code> column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the <em>order by</em> clause.</p> <pre><code>var names = (from DataRow dr in dataTable.Rows orderby (string)dr["Name"] select (string)d...
<p><strong>The problem is that the Distinct operator does not grant that it will maintain the original order of values.</strong></p> <p>So your query will need to work like this</p> <pre><code>var names = (from DataRow dr in dataTable.Rows select (string)dr["Name"]).Distinct().OrderBy( name =&gt; name...
<p>Try the following</p> <pre><code>var names = (from dr in dataTable.Rows select (string)dr["Name"]).Distinct().OrderBy(name =&gt; name); </code></pre> <p>this should work for what you need.</p>
2,246