instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>When I discovered <a href="http://www.boost.org/doc/libs/1_47_0/libs/conversion/lexical_cast.htm" rel="noreferrer"><code>boost::lexical_cast</code></a> I thought to myself "why didn't I know about this sooner!" - I hated having to write code like </p> <pre><code>stringstream ss; ss &lt;&lt; anIntVal; mystring = ss...
<p>Probably the most used part of boost for me is <a href="http://www.boost.org/doc/libs/1_37_0/libs/smart_ptr/shared_ptr.htm" rel="noreferrer">boost::shared_ptr</a>.</p>
<p>Talking about boost::lexical_cast, why isn't something like 'format' a static member in the std::string library?<br> Almost all gui libs have something like CString::Format("%i") or QString::Number("%i") which return an initialised string.</p>
42,221
<p>Are there any performance benefits to me not using the gridview in asp.net for simple tables querying from a stored procedure and instead writing the html in server code myself. I'm sure my code would certainly be more concise in output.</p>
<p>I am going to propose an alternate solution. If you don't need any of the features of a GridView, why not use a repeater.</p> <p>A repeater keeps it simple for implementation, but also allows you to have full control over the generated source. Without the issue of string concatentation preformance.</p> <p>I've f...
<p>No, there are no performance benefits with using a GridView. In general, the GridView is going to decrease a little bit of performance due to the fact that items are written into the ViewState,and additional HTML is generated. The benefits you DO get from the GridView include command events and arguments that can be...
45,569
<p>I have two otherwise-identical machines (called &quot;Lefty&quot; and &quot;Righty&quot;), so I have a baseline to compare. I am running Marlin 2.0.7.2 on both machines. They are Creality CR-10 printers with BTT SKR e3 Mini v1.2 boards, with Marlin I compiled myself. Both machines are (as far as I know!) running ...
<p>Annoyingly, this went away with a replacement board. I don't have a better fix.</p>
<p>For both machines did you compare extruder's (E) steps/mm setting in Marlin and possibly stored in EPROM (so check from the LCD in Configuration&gt;Advanced settings) ?</p> <p>Also stepper motors ... I believe they are exactly of the same type? There are 1.8 degree and 0.9 degree stepper motors on the market - so ex...
1,821
<p>I have a Nant build script which CruiseControl uses to build a solution on-demand.</p> <p>However, we only recently got CruiseControl so our official build number is different from what is listed in CruiseControl.</p> <p>I know CruiseControl injects some properties into build scripts so that I can access the CC bu...
<p>A custom build labeler is required for this. Perforce is our source control provider and we derive our version number from it. The code is as follows:</p> <pre><code>/// &lt;summary&gt; /// Gets the latest change list number from perforce, for ccnet to consume as a build label. /// &lt;/summary&gt; [ReflectorType( ...
<p>We had this problem as well. I ended up writing a special CC labelling plugin.</p>
33,664
<p>I need a command to replace the hosts file on my machine. Seems pretty straight forward but I cannot get the command to work with xcopy. Any obvious flaws in the command?</p> <p>luaexec -w -f "XCOPY" "%ScriptPath%/ModifiedHosts/vista/hosts" "%windir%/system32/drivers/etc/hosts" /H</p> <p>The /R flag does not seem...
<p>Did you get any error?</p> <p>Try this:</p> <pre><code>luaexec -w -f "XCOPY %ScriptPath%/ModifiedHosts/vista/hosts %windir%/system32/drivers/etc/hosts" /H </code></pre> <p>Also, you can try robocopy.</p>
<p>is the hosts file write protected? it probably is.. add a /R to your commandline</p>
40,801
<p>Ok so I have an abstract base class called Product, a KitItem class that inherits Product and a PackageKitItem class that inherits KitItem. ie.</p> <pre><code>Product KitItem : Product PackageKitItem : KitItem </code></pre> <p>I have my KitItems loaded and I need to load up a collection of PackageKitItems which ar...
<p>The problem you have is that since ShallowCopy() is a member of KitItem, MemberwiseClone() is just copying the KitItem fields and returning a KitItem even if the original object is a PackageKitItem.</p> <p>I think what you have to do in this circumstance add to KitItem:</p> <pre><code>public virtual KitItem Shallo...
<p>In your Product constructor you are already doing some form of shallow copy, aren't you? If you haven't overwritten your constructor, then you should be able to just create a new PackageKitItem that receives a KitItem as its parameter.</p> <pre><code>PackageKitItem tempPackKitItem = new tempPackKitItem(kitItem); </...
36,011
<p>I am trying to figure out what is the 'grafts' in the Git.</p> <p>For example, in one of the latest comments <a href="http://web.archive.org/web/20080930112610/http://log.emmanuelebassi.net/archives/2007/09/when-the-levee-breaks/" rel="noreferrer">here</a>, Tobu suppose to use <b>git-filter-branch</b> and <b>.git/i...
<p>From <a href="https://git.wiki.kernel.org/index.php/GraftPoint" rel="noreferrer">Git Wiki</a>:</p> <blockquote> <p>Graft points or grafts enable two otherwise different lines of development to be joined together. It works by letting users record fake ancestry information for commits. This way you can ma...
<p>When working with git-svn: </p> <p>git grafts are very useful to import a Git tree into a Subversion repository.</p> <p>E.g. I created a local Git repository as a start. After working on it several days, creating lots of commits, I had to publish it into the central Subversion repository and I didn't want to lose ...
19,583
<p>I would like to programmatically create a gloss effect on an Image, kinda like on the Apple-inspired design that the Web has adopted when it was updated to 2.0 Beta.</p> <p>Essentially this:</p> <p><a href="http://nhc.hcmuns.googlepages.com/web2_icons.jpg" rel="nofollow noreferrer">example icons http://nhc.hcmuns....
<p>I can explain that effect in graphic terms. </p> <ol> <li><p>Create an image around 3* the size of the icon.</p></li> <li><p>Within this image, create a circle where (the height of the icon) &lt; radius &lt; 2*(the height of the icon).</p></li> <li><p>Fill the circle with an alpha blend/transparency (to white) of ...
<p>Responding to the C# code ... Overall, good job on getting the imaging going. I've had to do similar things with some of my apps in the past.</p> <p>One piece of advice, however: All graphics objects in .NET are based on Windows GDI+ primitives. This means these objects require correct disposal to clean up their no...
13,496
<p>I'm working with a client that needs to generate millions of the alphanumeric codes used in magazine scratch-off cards, bottlecap prizes, and so on. They have to be short enough to print on a cap, they want to make sure that ambiguous characters like 1 and I, 0 and O, etc. are not included, and they have to be expli...
<p>If you need about 10 million unique keys (for example), the best approach is to pick a key-space that's exponentially bigger, and start randomly generating. Read about the <a href="http://en.wikipedia.org/wiki/Birthday_paradox" rel="noreferrer">Birthday Paradox</a> -- it's the main thing you should be worried about....
<p>Oddly enough, with the following seed I was only able to generate 32 unique strings.</p> <p>ABCDEFGHJKLMNPQRSTUVWXYZ23456789</p> <p>With a longer seed I was able to generate many more--generated 40,000 unique strings successfully.</p> <p>ABCDEFGHJKLMNPQRSTUVWXYZ234567892345678923456789ABCDEFGHJKLMNPQRSTUVWXYZ2345...
27,016
<p>I have an app that creates a couple of WebView instances and I'd like to have them operate as independently as possible.</p> <p>At the very least, I don't want them sharing cookies. A quick google search gave me results liking "you can't." I'm hoping someone has a better answer.</p>
<p>The basic answer is "you can't".</p> <p>After looking at this for a bit, I think it's possible, but extremely complicated. It would involve implementing a resourceLoadDelegate on your WebView that implements <code>-webView:resource:willSendRequest:redirectResponse:fromDataSource:</code> and modifies the request to ...
<p>I would assume that cookies would be configured on a service / application level and not for particular instances or processes. Perhaps you could revise your question to find a way to resolve the problem you are having which requires that the instances do not share cookies.</p> <p>What is the motivation for not sh...
47,551
<p>Is it possible to add a custom tab to a project properties page in the Visual Studio 2008? What I want to do is to be able to add a custom tab to properties page for the projects created from default project templates (WPF Application, WPF custom controls library, etc).</p>
<p>Keith,</p> <p>I'm working on VS add-in for WPF applications localization. I want to be able to manage project specific settings via "project properties" page. I did some research and it seems that it is not possible to extend existing projects in this way.</p>
<p>It seems that during the time this question was asked, this feature was not implemented in Visual Studio SDK.</p> <p>There's answer for similar question <a href="https://stackoverflow.com/a/5325158/2617201">https://stackoverflow.com/a/5325158/2617201</a> which refers to Microsoft Documentation at <a href="https://l...
3,110
<p>Using Restlet I needed to serve some simple static content in the same context as my web service. I've configured the component with a <code>Directory</code>, but in testing, I've found it will only serve 'index.html', everything else results in a 404.</p> <pre><code>router.attach("/", new Directory(context, new Re...
<p>Best thing I can think of is to encode it yourself. How about this subroutine?</p> <pre><code>from urllib2 import Request, urlopen from binascii import b2a_base64 def b64open(url, postdata): req = Request(url, b2a_base64(postdata), headers={'Content-Transfer-Encoding': 'base64'}) return urlopen(req) conn = b...
<p>PyCURL provides an interface to CURL from Python.</p> <p><a href="http://curl.haxx.se/libcurl/python/" rel="nofollow noreferrer">http://curl.haxx.se/libcurl/python/</a></p> <p>Curl will do all you need. It can transfer binary files properly, and supports many encodings. However, you have to make sure that the pr...
18,143
<p>I have been having some issues with my Cocoon Create Model Maker/Wanhao Duplicator i3 Mini. The hotend doesn't get up to temperature. </p> <p>I will go to any of the heating functions (start print, preheat, add filament, etc.) and it will begin to reheat the nozzle. The temperature rises until eventually, it stops ...
<p>The solution was posted in a comment, as the asker hasn't posted an answer yet, it is answered in this community wiki answer:</p> <blockquote> <p>Ended up replacing the thermistor which solved the problem.</p> </blockquote>
<p>Maybe, the thermistor is not fully seated and does not measure temperature effectively. </p> <p>Try inserting the thermistor into the hole by filling the gaps with metal wire or conductive paste.</p>
1,436
<p>I am having trouble understanding how the System Registry can help me convert a DateTime object into the a corresponding TimeZone. I have an example that I've been trying to reverse engineer but I just can't follow the one critical step in which the UTCtime is offset depending on Daylight Savings Time.</p> <p>I am...
<p>Here is a code snippet in C# that I'm using in my WPF application. This will give you the current time (adjusted for Daylight Savings Time) for the time zone id you provide.</p> <pre><code>// _timeZoneId is the String value found in the System Registry. // You can look up the list of TimeZones on your system using ...
<pre><code>//C#.NET public static bool IsDaylightSavingTime() { return IsDaylightSavingTime(DateTime.Now); } public static bool IsDaylightSavingTime(DateTime timeToCheck) { bool isDST = false; System.Globalization.DaylightTime changes = TimeZone.CurrentTimeZone.G...
27,987
<p>I've long been under the impression that <code>goto</code> should never be used if possible.</p> <p>However, while perusing libavcodec (which is written in C) the other day, I was surprised to notice multiple uses of it.</p> <p>Is it ever advantageous to use <code>goto</code> in a language that supports loops and fu...
<p>Everybody who is anti-<code>goto</code> cites, directly or indirectly, Edsger Dijkstra's <a href="http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html" rel="noreferrer">GoTo Considered Harmful</a> article to substantiate their position. Too bad Dijkstra's article has virtually <em>n...
<p>The problem with 'goto' and the most important argument of the 'goto-less programming' movement is, that if you use it too frequently your code, although it might behave correctly, becomes unreadable, unmaintainable, unreviewable etc. In 99.99% of the cases 'goto' leads to spaghetti code. Personally, I cannot think ...
4,406
<p>I have a listbox where the items contain checkboxes:</p> <pre><code>&lt;ListBox Style="{StaticResource CheckBoxListStyle}" Name="EditListBox"&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;CheckBox Click="Checkbox_Click" IsChecked="{Binding Path=IsChecked, Mode=TwoWay}" Content="{...
<p>To begin with, put the content outside the <code>CheckBox</code>:</p> <pre><code>&lt;StackPanel Orientation="Horizontal"&gt; &lt;CheckBox IsChecked="{Binding IsChecked}"/&gt; &lt;TextBlock Text="{Binding DisplayText}"/&gt; &lt;/StackPanel&gt; </code></pre> <p>After that, you will need to ensure that pressi...
<p>You can also bind the IsChecked property of the CheckBox and IsSelected property of the ListBoxItem:</p> <pre><code>&lt;ListBox&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;CheckBox Content="{Binding DisplayText}" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSour...
15,520
<p>Does Django have any template tags to generate common HTML markup? For example, I know that I can get a url using</p> <pre><code>{% url mapper.views.foo %} </code></pre> <p>But that only gives me the URL and not the HTML code to create the link. Does Django have anything similar to Rails' link_to helper? I found <...
<p>No it doesn't.</p> <p><a href="http://www.b-list.org/" rel="noreferrer">James Bennett</a> answered a <a href="http://www.b-list.org/weblog/2006/jul/02/django-and-ajax/" rel="noreferrer">similar question</a> a while back, regarding Rails' built-in JavaScript helpers.</p> <p>It's <em>really</em> unlikely that Django...
<p>This won't answer directly to the question, but why not using <code>&lt;a href="{% url mapper.views.foo %}"&gt;foo&lt;/a&gt;</code> in template then?</p>
8,670
<p>I have a product, X, which we deliver to a client, C every month, including bugfixes, enhancements, new development etc.) Each month, I am asked to err "guarantee" the quality of the product.</p> <p>For this we use a number of statistics garnered from the tests that we do, such as:</p> <ul> <li>reopen rate (number...
<p>I don't think you can ever really estimate the number of bugs in your app. Unless you use a language and process that allows formal proofs, you can never really be sure. Your time is probably better spent setting up processes to minimize bugs than trying to estimate how many you have.</p> <p>One of the most impor...
<p>How long is a piece of string? Ultimately what makes a quality product? Bugs gives some indication yes, but many other factors are involved, Unit Test coverage is a key factor in IMO. But in my experience the main factor that effects whether a product can be deemed quality or not, is good understanding of the proble...
3,596
<p>The Visual Studio refactoring support for C# is quite good nowadays (though not half as good as some Java IDE's I've seen already) but I'm really missing C++ support.</p> <p>I have seen <a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/RefactorCPP/index.xml" rel="noreferrer">Refactor!</a> and am cur...
<p>Visual Assist X by Whole Tomato software is not free, but it's absolutely worth the money if you use Visual Studio for C++.</p> <p><a href="http://www.wholetomato.com/" rel="noreferrer">http://www.wholetomato.com/</a></p>
<p>I'm not familiar with the tools you mentioned but the refactoring support for C++ in <a href="http://www.eclipse.org/downloads/packages/" rel="nofollow noreferrer">Eclipse 3.4</a> is getting pretty useful and growing.</p>
3,692
<p>The code-complete feature in Visual Studio is very useful, and it still works for C# and C++ code - but no longer works for XAML (XML) editing.</p> <p>Is there a setting somewhere that can re-enable this? My co-workers still have it working.</p>
<p>I think <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PageIndex=1&amp;SiteID=1&amp;PageID=1&amp;PostID=4004417" rel="nofollow noreferrer">this post on the MSDN forums</a> might be of assistance. Basically, the Win SDK breaks XAML Intellisense. I think there is a more mainstream (non-registry hack) solution...
<p>(I'm assuming that you mean intellisense by "code complete")</p> <p>Intellisense for xml documents is controlled by XSD files. When you're editing a xaml file, look at the menu bar. You should see a menu item called XML. At the bottom of this you'll see a menu item "Schemas..." Click on that. </p> <p>You'll s...
25,212
<p>I am wondering if there is a "best" way to shuffle a list of elements that contains duplicates such that the case where array[i] == array[i+1] is avoided as much as possible.</p> <p>I am working on a weighted advertising display (I can adjust the number of displays per rotation for any given advertiser) and would l...
<p>This is pretty similar to <a href="https://stackoverflow.com/questions/344860/good-algorithm-for-combining-items-from-n-lists-into-one-with-balanced-distribu">this question</a>. If you replace A, B, and C in the example given over there with your advertisers, I think you arrive at the same problem. Maybe some of t...
<p>What's the biggest number of duplicates you may have? 2, 3, any?</p>
46,724
<p>Is there an easy way to run a MySQL query from the Linux command line and output the results in <a href="http://en.wikipedia.org/wiki/Comma-separated_values" rel="noreferrer">CSV</a> format?</p> <p>Here's what I'm doing now:</p> <pre class="lang-none prettyprint-override"><code>mysql -u uid -ppwd -D dbname &lt;&lt; ...
<p>From <em><a href="http://www.tech-recipes.com/rx/1475/save-mysql-query-results-into-a-text-or-csv-file/" rel="noreferrer">Save MySQL query results into a text or CSV file</a></em>:</p> <pre><code>SELECT order_id,product_name,qty FROM orders WHERE foo = 'bar' INTO OUTFILE '/var/lib/mysql-files/orders.csv' FIELDS TERM...
<p>You can use the below command from your SQL editor/Terminal:</p> <pre><code>mysql -h(hostname/IP&gt;) -u(username) -p(password) databasename &lt;(query.sql) &gt; outputFILE(.txt/.xls) </code></pre> <p>E.g.,</p> <ul> <li><p>hostname -x.x.x.x</p> </li> <li><p>uname - username</p> </li> <li><p>password - password</p> <...
46,492
<p>I'm building my own DLP printer with UV LEDs. I use a 20A relay to power them on, since they require high power and can't be directly driven by arduino or Raspberry.</p> <p>I'm planning to use them with NanoDLP on Raspberry + GRBL on Arduino.</p> <p>Is it possible to make NanoDLP tell GRBL to power on (send digita...
<p>I have no experience with either GRBL or DLP printers, but the</p> <pre><code>M7 M8 M9 </code></pre> <p>coolant control codes should be able to be sent by NanoDLP to GRBL. Those seem to allow for direct digital output. Apparently you can set the pin you want them to use in the <code>cpu_map.h</code> file, with the...
<p>I think you don't have to use the Arduino. There´s an option in NanoDLP to control the z-axis through the Raspberry GPIO.</p>
689
<p>I am looking for a way to take a user uploaded image that is currently put in a temporary location ex: /tmp/jkhjkh78 and create a php image from it, autodetecting the format.</p> <p>Is there a more clever way to do this than a bunch of try/catching with imagefromjpeg, imagefrompng, etc?</p>
<p>This is one of the functions of <a href="http://www.php.net/manual/en/function.getimagesize.php" rel="noreferrer">getimagesize</a>. They probably should have called it "getimageinfo", but that's PHP for you.</p>
<p>You can call a system command (if you're under linux/unix), <code>file</code> if you like:</p> <pre><code>kender@eira:~$ file a a: JPEG image data, EXIF standard 2.2 </code></pre>
22,970
<p>So I have an Access database with a front and a back end. I will be distributing it to users soon, but I have no control over where exactly they will put the files on their computers. However, I think I can count on them putting front and back ends in the same folder.</p> <p>As such, when the front end opens, I w...
<p>Create a Macro and name it "autoexec". For the macro action, select "RunCode" and then set the function name to the name of the function you use to check your linked tables.</p>
<p>As others have suggested, I'd use the AutoExec macro in this case. If your code that checks the linked tables is currently a sub, change it to a function that returns TRUE if it succeeds. You can then use the "conditions" column in the AutoExec macro to exit the application with a user-friendly error dialog if the...
27,675
<p>Does anyone know of a good method for editing PDFs in PHP? Preferably open-source/zero-license cost methods. :)</p> <p>I am thinking along the lines of opening a PDF file, replacing text in the PDF and then writing out the modified version of the PDF?</p> <p>On the front-end</p>
<p>If you are taking a 'fill in the blank' approach, you can precisely position text anywhere you want on the page. So it's relatively easy (if not a bit tedious) to add the missing text to the document. For example with Zend Framework:</p> <pre><code>&lt;?php require_once 'Zend/Pdf.php'; $pdf = Zend_Pdf::load('blank...
<p>We use <a href="http://www.pdflib.com/pdflib-gmbh/" rel="nofollow noreferrer">pdflib</a> to create PDF files from our rails apps. It has bindings for PHP, and a ton of other languages.</p> <p>We use the commmercial version, but they also have a <a href="http://www.pdflib.com/download/pdflib-family/pdflib-lite/" rel=...
2,896
<p>I have an image and on it are logos (it's a map), I want to have a little box popup with information about that logo's location when the user moves their mouse over said logo.</p> <p>Can I do this without using a javascript framework and if so, are there any small libraries/scripts that will let me do such a thing?...
<p>Yes, you can do this without Javascript. Use an HTML image map, with title attributes, like this:</p> <pre><code>&lt;img usemap="#logo" src="http://stackoverflow.com/Content/Img/stackoverflow-logo-250.png"&gt; &lt;map name="logo"&gt; &lt;area shape="rect" href="" coords="52,42,121,65" title="Stack"&gt; &lt;area sha...
<p>you can use <code>title</code> attribute for simple tooltip. its works on almost all DOM objects.</p>
4,479
<p>We have the requirement to take a form submission and save some data, then redirect the user to a page offsite, but in redirecting, we need to "submit" a form with POST, not GET.</p> <p>I was hoping there was an easy way to accomplish this, but I'm starting to think there isn't. I think I must now create a simple ...
<p>Doing this requires understanding how HTTP redirects work. When you use <code>Response.Redirect()</code>, you send a response (to the browser that made the request) with <a href="http://en.wikipedia.org/wiki/HTTP_302" rel="noreferrer">HTTP Status Code 302</a>, which tells the browser where to go next. By definitio...
<p>Typically, all you'll ever need is to carry some state between these two requests. There's actually a really funky way to do this which doesn't rely on JavaScript (think &lt;noscript/>).</p> <pre><code>Set-Cookie: name=value; Max-Age=120; Path=/redirect.html </code></pre> <p>With that cookie there, you can in the ...
6,874
<p>Our build server is taking too long to build one of our C++ projects. It uses <a href="https://en.wikipedia.org/wiki/Microsoft_Visual_Studio#2008" rel="nofollow noreferrer">Visual Studio 2008</a>, running <code>devenv.com MyApp.sln /Build</code> -- see <a href="https://learn.microsoft.com/en-us/visualstudio/ide/refe...
<p>Menu <em>Tools</em> → <em>Options</em> → <em>Projects and Solutions</em> → <em>VC++ Project Settings</em> → <em>Build Timing</em> should work.</p>
<p>If you want to invoke an external program that can track your total build times, you can use the following solution for <a href="https://en.wikipedia.org/wiki/Microsoft_Visual_Studio#2010" rel="nofollow noreferrer">Visual Studio 2010</a> (and maybe older). The code below uses CTime by Casey Muratori. Of course, you ...
10,783
<p>What are the relative merits of the xdoc and apt formats for writing websites of Maven projects? Is one more expressive than the other? Has one got better tool support than the other?</p>
<p>The XDOC format is definitely a richer mechanism for creating documents and is required if you want to produce documents with TOC/TOF, headers, footers or footnotes (and other document attributes), since the APT format doesn't support these.</p> <p>That being said, I tend to use the APT format for almost all intern...
<p>APT format is easy to use. However, it does not support custom styling (for example styling a character or a heading). The closest to preformatted text that you can use with APT is the "verbatim text" Like in HTML, verbatim text is preformatted. Unlike HTML, verbatim text is escaped: inside a verbatim display, marku...
21,005
<p>I'm trying to retrieve a file from a server using SFTP (as opposed to FTPS) using Java. How can I do this?</p>
<p>Another option is to consider looking at the <a href="http://www.jcraft.com/jsch/" rel="noreferrer" title="JSch library">JSch library</a>. JSch seems to be the preferred library for a few large open source projects, including Eclipse, Ant and Apache Commons HttpClient, amongst others.</p> <p>It supports both user/p...
<p>The best solution I've found is <a href="http://www.lag.net/paramiko/" rel="nofollow noreferrer">Paramiko</a>. There's a Java version.</p>
3,542
<p>I am using SQL Server 2005. I want to constrain the values in a column to be unique, while allowing NULLS.</p> <p>My current solution involves a unique index on a view like so:</p> <pre><code>CREATE VIEW vw_unq WITH SCHEMABINDING AS SELECT Column1 FROM MyTable WHERE Column1 IS NOT NULL CREATE UNIQ...
<p>Using SQL Server 2008, you can <a href="https://learn.microsoft.com/en-us/sql/relational-databases/indexes/create-filtered-indexes" rel="noreferrer">create a filtered index</a>.</p> <pre class="lang-sql prettyprint-override"><code>CREATE UNIQUE INDEX AK_MyTable_Column1 ON MyTable (Column1) WHERE Column1 IS NOT NULL ...
<p>Strictly speaking, a unique nullable column (or set of columns) can be NULL (or a record of NULLs) only once, since having the same value (and this includes NULL) more than once obviously violates the unique constraint.</p> <p>However, that doesn't mean the concept of "unique nullable columns" is valid; to actually...
23,249
<p>how do you encode words using the huffman code such as NEED</p>
<p>Huffman encoding basically uses variable-length bit strings to represent tokens (generally characters with a couple of exceptions). The more common a token is, the shorter it's bit-length is and this is (usually) dynamic as the stream is processed.</p> <p>There are usually two special tokens, ESCAPE and END-STREAM....
<p>Take a look at my Huffman in C# project: <a href="https://github.com/kad0xf/HuffmanSharp" rel="nofollow">https://github.com/kad0xf/HuffmanSharp</a></p>
45,192
<p>I'm refactoring some code currently implemented in stored procedures to use LinqToSql (for use in training). Is it possible to use SQL functions in a linqToSql Query?</p>
<p>Here is some helpful information from a MSDN Forum Post. <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2940301&amp;SiteID=1" rel="nofollow noreferrer">Soundex and LINQ</a>.</p>
<p>I haven't tried it myself yet but the below method <a href="https://stackoverflow.com/questions/2993087/linq-to-sql-soundex-possible">originally posted here</a> seems to be the best possible solution.</p> <pre><code> [Function(Name="SoundEx", IsComposable = true)] public string SoundsLike(string input) {...
18,627
<p><code>console.log(&quot;double&quot;);</code> vs. <code>console.log('single');</code></p> <p>I see more and more JavaScript libraries out there using single quotes when handling strings. What are the reasons to use one over the other?</p> <p>I thought they're pretty much interchangeable.</p>
<p>The most likely reason for use of single vs. double in different libraries is programmer preference and/or API consistency. Other than being consistent, use whichever best suits the string.</p> <p>Using the other type of quote as a literal:</p> <pre><code>alert('Say &quot;Hello&quot;'); alert(&quot;Say 'Hello'&quot;...
<p>For use of JavaScript code across different languages, I've found single quotes to consistently require less code tweaking.</p> <p>Double quotes support multi-line strings.</p>
30,071
<p>Is it possible to set the title of a page when it's simply a loaded SWF?</p>
<p>This is how I would do it:</p> <pre><code>ExternalInterface.call("document.title = 'Hello World'"); </code></pre> <p>Or more generalized:</p> <pre><code>function setPageTitle( newTitle : String ) : void { var jsCode : String = "function( title ) { document.title = title; }"; ExternalInterface.call(jsCode, ne...
<p>I would think you would be able to do it. You would have to access the javascript DOM. </p> <p>A couple links that may steer you down the correct path.. </p> <p><a href="http://homepage.ntlworld.com/kayseycarvey/document2.html" rel="nofollow noreferrer">http://homepage.ntlworld.com/kayseycarvey/document2.html</a>...
11,354
<p>i've got a commenting system in our database. Just like stackoverflow -> each post has a list of comments. kewl.</p> <p>Anonymous people can add a comment or registered users also.</p> <p>In my table, i'm thinking of having the following:</p> <ul> <li>Userid int NULLABLE</li> <li>AnonymousNickname varchar(100) NU...
<p>A simple constraint would be</p> <pre><code>(Userid is not null and AnonymousNickname is null and AnonymousEmail is null) or (Userid is null and AnonymousNickname is not null and AnonymousEmail is not null) </code></pre> <p>This will force only one or the other to be set. It sounds like this would be reasonable b...
<p>I wouldn't include the constraint. You should rename the anonymous name field to name. When a registered user leaves a comment, put their username into the name field. This saves you a lookup against the user table when you list out your comments. Also, if a user is deleted from the user table, their comments outliv...
47,801
<p>I am looking to clean up some of the HTML generated by a .NET 2.0 TreeView controller. Switching to another version/model is not an available option.</p> <p>My first crack yielded an extended TreeView, with an overridden Render that Regex'd out the text I didn't need and output to the page.</p> <p>The problem was...
<p>Use the ASP.NET CSS Control Adapters:</p> <p><a href="http://www.asp.net/CSSAdapters/TreeView.aspx" rel="nofollow noreferrer">http://www.asp.net/CSSAdapters/TreeView.aspx</a></p> <blockquote> <p>Without adapters both use HTML &lt;table&gt; tags. Control adapters can be used so that nested &lt;ul&gt; tags are ren...
<p>You regex'd out something that the control needs to handle postbacks. It may be the highly-convoluted id's or the runat attribute... whatever it is, if you're stuck with web controls, you're stuck with bad html.</p> <p>Your only true (and non-destructive) way to do what you want is not by <em>extending</em> curren...
32,792
<p>I understand that Microsoft uses this template when versioning their products: Major.Minor.Build.Revision. </p> <p>Major is changed when the "developers" want to show that there is a big change in the software and backward compatibility cannot be assumed. Maybe a major rewrite of the code is done. </p> <p>Minor nu...
<p>We generally do major.minor[.maintenance[.build]] where I work, but it seems to vary a little per project.</p> <p>Major/minor the same as you mentioned. maintenance would be incremented for small (bug) fixes and build for each time the build server runs.</p>
<p>I just have a number. First release is <code>001</code>. Second release's third beta is <code>002b3</code>, and so on. This is just for personal stuff mind, I don't actually have anything 'released' at the moment, so this is all theory.</p>
17,206
<p>The documentation with the module itself is pretty thin, and just tends to point to MOP.</p>
<p>First you should read through the <a href="http://metacpan.org/pod/Moose::Manual" rel="nofollow noreferrer">Manual</a> if you haven't already. Then you can go on to read the <a href="http://metacpan.org/pod/Moose::Cookbook" rel="nofollow noreferrer">Cookbook</a>.</p> <p>I think the docs are actually pretty good the...
<p>I too am just starting to move on to Moose. Since the term <em>good</em> can be rather subjective, I'll just detail what I found was good in these resources. The resources may be more or less helpful depending on your skills/experience in Perl.</p> <p>I started off at this <a href="http://www.perlmonks.org/?node_...
10,467
<p>Does anyone know if there is a good equivalent to Java's <code>Set</code> collection in C#? I know that you can somewhat mimic a set using a <code>Dictionary</code> or a <code>HashTable</code> by populating but ignoring the values, but that's not a very elegant way. </p>
<p>If you're using .NET 3.5, you can use <a href="http://msdn.microsoft.com/en-us/library/bb359438.aspx" rel="noreferrer"><code>HashSet&lt;T&gt;</code></a>. It's true that .NET doesn't cater for sets as well as Java does though.</p> <p>The <a href="http://powercollections.codeplex.com" rel="noreferrer">Wintellect Powe...
<p>I know this is an old thread, but I was running into the same problem and found HashSet to be very unreliable because given the same seed, GetHashCode() returned different codes. So, I thought, why not just use a List and hide the add method like this</p> <pre><code>public class UniqueList&lt;T&gt; : List&lt;T&gt;...
22,212
<p>I need to implement a browser based component (most likely java applet since it needs to be cross-browser) that will allow us to digitally sign and verify data in the XadES format. What options are available and what is the best solution?</p>
<p>The best solution I would think would be to build a web service or if applicable build it right into your application. Unless you want to provide more details on how you plan to implement it or any other platform / business constraints then finding the best solution is a shot in the dark at this point.</p> <p>So he...
<p>The best solution I would think would be to build a web service or if applicable build it right into your application. Unless you want to provide more details on how you plan to implement it or any other platform / business constraints then finding the best solution is a shot in the dark at this point.</p> <p>So he...
41,454
<p>I'm writing my own Modal Popup as a template control in ASP.NET. I got two template containers - one for the heading of the window and one for the actual control i want to display in the modal window (let's call it the form control). The form controls can contain server controls like buttons, textbox'es etc.</p> <p...
<p>What I usually do is not test directly against the web-service, but to try and put as little code as possible in the service, and call a different class which does all the real work. Then I write unit tests for that other class. It turns out that class can sometimes be useful outside of the web-service context, so t...
<p>Above my web method unit tests, I have the following:</p> <pre><code>// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example, // http://.../Default.aspx). This is necessary for the unit test to be executed on the web server, // whether you are testing a page, web service, or a W...
48,617
<p>When programming a large transaction (lots of inserts, deletes, updates) and thereby violating a constraint in Informix (v10, but should apply to other versions too) I get a not very helpful message saying, for example, I violated constraint r190_710. How can I find out which table(s) and key(s) are covered by a cer...
<p>Tony Andrews suggested (pointing to a different end-point for the URL):</p> <blockquote> <p>From <a href="http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp" rel="noreferrer">Informix Guide to SQL: Reference</a> it appears you should look at the system catalog tables SYSCONSTRAINTS and SYSINDICES.</p...
<p>From <a href="http://www.dbcenter.cise.ufl.edu/triggerman/infoshelf/sqlr/01.fm3.html#225634" rel="nofollow noreferrer">Informix Guide to SQL: Reference</a> it appears you should look at the system catalog tables SYSCONSTRAINTS and SYSINDICES.</p>
41,391
<p>I've been looking into making applications suitable for multiple languages in C# since I need to work on a small project where this is the case. I have found basically two ways to do this:</p> <p>Set a form's Localizable property to true, set the Language property, fill all the labels and such, and you're 'done'. T...
<p>I have always used resource files for multi-language applications.<br> The are many articles on the web explaining how to use them.<br> <br> I have used two different ways:</p> <ul> <li>A resource file per form</li> <li>A global resource file </li> </ul> <p>The resource file / form, is easier to implement, you onl...
<p>I recently wrote a program with both German and English language support. I was surprised to find out that if I simply named my english resources LanguageResources.resx and my German resources LanguageResources.de.resx, it automatically selected the correct language. The ResXFileCodeGenerator took care of it all for...
14,540
<p>I have a separate partition on my disk formatted with FAT32. When I hibernate windows, I want to be able to load another OS, create/modify files that are on that partition, then bring Windows out of hibernation and be able to see the changes that I've made.</p> <p>I know what you're going to type, "Well, you're not...
<p>So I finally got a solution to my problem. In my mind, I associated Mount Point with Mount. These are NOT the same thing. Removing all of the volume mount points does not make the volume unmounted. It's still mounted but not in the sense that you have a path you can access in explorer.</p> <p><a href="http://msdn.m...
<p>My memory is that the FAT table is read during the OS boot and mounting of the volume. Can't you do a shutdown, then modify the FAT, then reboot Windows?</p>
28,703
<p>Can anybody tell me when Application_End is triggered in a lifecycle of an application? When all sessions are ended, will Application_End be triggered automatically? + Are there any other reasons why Application_End could be triggered?</p>
<p>The <code>application_end</code> event primarily fires when the IIS pool is recycled or the application itself is unloaded. One other thing to note, that a change to a dependent file (say web.config) will cause the application to reload itself, which will in cause the application_end event to fire while it is closin...
<p>In my case, the Aapplication Pool was being recycled because the property <strong>Idle Time-Out (minutes)</strong></p> <p>The Default value of this property is 20 (minutes)</p> <p><a href="https://i.stack.imgur.com/A6wJr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A6wJr.png" alt="enter image d...
36,702
<p>Suppose I have a string 'nvarchar(50)', which is for example the T-SQL string segment used in creating a table of that type. How do I best convert that to an enum representation of System.Data.DbType?</p> <p>Could it handle the many different possible ways of writing the type in T-SQL, such as:</p> <pre><code>[nva...
<p>As a preliminary answer, check out the Joel test: <a href="http://www.joelonsoftware.com/articles/fog0000000043.html" rel="noreferrer">http://www.joelonsoftware.com/articles/fog0000000043.html</a></p> <p>Just an appetizer:</p> <blockquote> <ol> <li>Do you use source control?</li> <li>Can you make a build in ...
<p>Knowledge management is crucial. As you already plan to use wiki (like Trac or <a href="http://www.redmine.org/" rel="nofollow noreferrer">Redmine</a>) you could use it for KM as well.</p>
11,643
<p>Which type of input is least vulnerable to Cross-Site Scripting (XSS) and SQL Injection attacks.</p> <p>PHP, HTML, BBCode, etc. I need to know for a forum I'm helping a friend set up.</p>
<p>We need to know more about your situation. Vulnerable how? Some things you should always do:</p> <ul> <li>Escape strings before storing them in a database to guard against SQL injections</li> <li>HTML encode strings when printing them back to the user from an unknown source, to prevent malicious html/javascript</...
<p>The input that is the least vulnerable to attack is the "non-input". </p> <p>Are you asking the right question?</p>
19,249
<p>Printer: Elegoo Mars 3 LCD Resin printer</p> <p>The letter height is about 3 mm.</p> <p>I engraved a word (text) on the side of a cylinder (which is about 14 mm in diameter and 4 mm in height). I am not sure about the exact depth of the engraving (but should be about 0.5 mm but that's not important).</p> <p>The tex...
<p>No, at least not at a consumer level. The layering created by the printing process would create imperfections, and clear resin frequently yellows if not cured properly and then protected form strong UV light. Resins that do not yellow tend to have a blue cast to them.</p> <p>You would be better off using a commercia...
<h1>Clear Resin isn't clear everywhere</h1> <p>Any light-curing resin has a specific bandwidth to which it is totally opaque just to be able to cure. This is typically a blue color, but at this and adjacent wavelength, the lens will not allow light to pass through it, no matter if you can manage to get imperfections do...
2,154
<p>I had a friend request that I print out the Bathymetry of Lake Michigan as a gift for her PhD adviser. I went to NOAA and the site had a few files for the Bathymetry of Lake Michigan.</p> <p>Files and types are located here: <a href="http://www.ngdc.noaa.gov/mgg/greatlakes/michigan.html" rel="noreferrer">http://www...
<p>In order to properly get an STL file out of a point cloud, you'll need some tool to help triangulate the points to create proper shell surfaces. The shell that is created in an STL is what the slicing engine will &quot;slice&quot;.</p> <p>I'm not as familiar with the full potential of MeshLab, but I would think this...
<p>You can do this using MATLAB, or possibly Octave (the open-source version of MATLAB). I'm doing this right now to print a globe with exaggerated topography and bathymetry. MATLAB has tons of tools for importing data. I'm sure you can import the Lake Michigan bathymetry data, though you may have to hunt for an import...
215
<p>I have to write an applet that brings up a password dialog. The problem is that dialog is set to be always on top but when user clicks on IE window dialog gets hidden behind IE window nevertheless. And since dialog is modal and holds <strong>all</strong> IE threads IE pane does not refresh and dialog window is still...
<p>What argument are you using for the parent?</p> <p>You may have better luck if you use the parent of the Applet.</p> <pre><code>javax.swing.SwingUtilities.getWindowAncestor(theApplet) </code></pre> <p>Using the getWindowAncestor will skip the applet parents (getRoot(component) will return applets). In at least s...
<p>You might try launching a modal from JavaScript using the JavaScript integration (see <a href="http://www.raditha.com/java/mayscript.php" rel="nofollow noreferrer">http://www.raditha.com/java/mayscript.php</a> for an example). </p> <p>The JavaScript you would need would be something like:</p> <pre><code>function g...
9,862
<p>Is it possible to update IIS on Windows XP from 5.1 to 6?</p> <p>If so how?</p> <p>Thanks.</p>
<p>No, it is not possible. The version of IIS is tied to a specific version of Windows.</p> <pre><code>XP = IIS 5.1 2003 = IIS 6 2008 = IIS 7 </code></pre> <p>More information available at <a href="http://support.microsoft.com/kb/224609" rel="noreferrer">http://support.microsoft.com/kb/224609</a>.</p>
<p>it is possible if you have XP x64 Pro</p>
22,753
<p>I have a form with multiple fields that I'm validating (some with methods added for custom validation) with Jörn Zaeffere's excellent jQuery Validation plugin. How do you circumvent validation with specified submit controls (in other words, fire validation with some submit inputs, but do not fire validation with oth...
<p>You can add a CSS class of <code>cancel</code> to a submit button to suppress the validation</p> <p>e.g</p> <pre><code>&lt;input class="cancel" type="submit" value="Save" /&gt; </code></pre> <p>See the jQuery Validator documentation of this feature here: <a href="https://jqueryvalidation.org/reference#link-skippi...
<p>Here is the simplest version, hope it helps someone,</p> <pre><code>$('#cancel-button').click(function() { var $form = $(this).closest('form'); $form.find('*[data-validation]').attr('data-validation', null); $form.get(0).submit(); }); </code></pre>
24,937
<p>The callstack shows the following:</p> <pre><code>[MissingMethodException: No parameterless constructor defined for this object.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandle&amp; ctor, Boolean&amp; bNeedSecurityCheck) +...
<p>I solved the issue which is caused of SelectList object because it does not provide the default constructor so we cant have in out ViewModel. </p>
<p>The root of my problem was also SelectList.</p> <p>I had this:</p> <pre><code>&lt;%: Html.DropDownListFor(m =&gt; Model.Destinations, Model.Destinations)%&gt; </code></pre> <p>When I should have had this:</p> <pre><code>&lt;%: Html.DropDownListFor(m =&gt; Model.Destination, Model.Destinations)%&gt; </code></pre>...
42,912
<p>Is it possible to have something like a <code>JTextArea</code> which will color some keywords based on some mappings I have ?</p>
<p>I am not sure, because I believe <code>JTextArea</code> only directly supports a single font in a single color.</p> <p>According to <a href="http://www.cs.bris.ac.uk/Teaching/Resources/COMS30122/tools/highlight/design.html" rel="nofollow noreferrer"><code>SyntaxHighlighter</code> class</a> article, <code>JTextPane<...
<p>I am not sure, because I believe <code>JTextArea</code> only directly supports a single font in a single color.</p> <p>According to <a href="http://www.cs.bris.ac.uk/Teaching/Resources/COMS30122/tools/highlight/design.html" rel="nofollow noreferrer"><code>SyntaxHighlighter</code> class</a> article, <code>JTextPane<...
31,500
<p>I am trying to make a small, data-driven widget that is populated with data from a database on the fly. I can load it initially just fine, but when the index of an ASP DropDownMenu is changed, the widget returns a 404.</p> <p>This could be a symptom of how I am using the Javascript, or how I am using the ASP. I h...
<p>If the postback is returning 404, I'd look at the url that you're sending the postback to. </p> <pre>http://webwidgetstest.reeceandnichols.com/rDeskWidgetMLSt.aspx?agentname=jendene</pre>
<p>Also your widget has some security issues going on, namely SQL Injection.</p> <blockquote> <p>Dim SelectString As String = "select ListingNumber, ListingSearchHitCount, ListingDetailHitCount, VirtualTourHitCount from FNIS.dbo.ListingHitCountCurrent, RAN.dbo.Heartland_Residential where Heartland_Reside...
43,846
<p>Is it possible to programaticly run compiled Python (comiled via py2exe) as administrator in Vista?</p> <p>Some more clarification:<br /> I have written a program that modifies the windows hosts file (c:\Windows\system32\drivers\etc\hosts) in Vista the program will not run and will fail with an exception unless you...
<p>Following the examples from <code>Python2x\Lib\site-packages\py2exe\samples\user_access_control</code> just add <code>uac_info="requireAdministrator"</code> to console or windows dict:</p> <pre><code>windows = [{ 'script': "admin.py", 'uac_info': "requireAdministrator", },] </code></pre>
<p>The best solution for pyinstaller is found here: <a href="https://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script/41930586#41930586">Request UAC elevation from within a Python script?</a></p> <p>No amount of manipulation of exe manifest file will work. Handle uac from within pyt...
23,701
<p>I'm looking for the single biggest reason you are glad that you've already made the jump from SQL2000 to SQL2005.</p>
<p>Native XML support is big for us here.</p>
<p>YOU CAN'T EXPORT TABLES with a "right click" anymore. This is more of a problem than a good reason.</p>
17,008
<p>In a design that I need to prototype, I have a coaxial, rotational joint between 2 cylinders connected to another coaxial rotational joint between 2 cylinders by a hinge. I have attached the individual part files as well as their assembly where you can use your mouse cursor to check how they move. <a href="https://...
<h3>Consider ball bearings</h3> <p>Depending on the requirements for your joint, I would consider making a design that utilizes <em>ball bearings</em>. With ball bearings, your join will not wear down as quickly, and also move smoothly.</p> <h3>Handling dimensional inaccuracy</h3> <p>The topic of how to achieve dimensi...
<p>Have you considered to use a service to have the part printed? You can print almost anything in one "pass" using selective laser sintering, typically done in nylon. I am currently un-boxing an SLS printer, so I cannot currently offer to print it, but the capabilities of SLS are substantial for parts of this nature. ...
211
<p>I have to analyse some existing Erlang code.</p> <p>Does anybody knows about a tool able to visually / graphically trace the modules calls ?</p> <p>The behaviour should be : give a directory containing the source code, and get a gui / picture / file of the calls (module1->module2->module3....).</p> <p>Something l...
<p><a href="http://www.erlang.org/doc/man/xref.html" rel="noreferrer"><code>xref</code></a> in OTP works like this. It gives you data about which dependencies exist between applications and modules and produces call graphs. <a href="http://www.erlang.org/doc/apps/tools/xref_chapter.html" rel="noreferrer">Here's an over...
<p><a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=6&amp;url=http%3A%2F%2Fwww.erlang.org%2Fworkshop%2F2008%2FSess42.pdf&amp;ei=t3sxSc34IJW20gWZ7ojJCw&amp;usg=AFQjCNFWACgyfEYAnffqgrQO0qclPJGPJw&amp;sig2=BNVd1WMrsnkWFnM6BdSCGA" rel="nofollow noreferrer">Gradual Typing of Erlang Programs: A Wrangl...
42,204
<p>I'll take away the obvious one here: mic and webcam support. Other than that, if you ran the Silverlight team, what would your highest priority be for Silverlight v.Next?</p> <p>Disclaimer: If we get some good responses, I'll pass them along to folks I know on the Silverlight team.</p> <p><strong>UPDATE</strong>: ...
<p>Full cross-platform support for Windows, Mac and Linux with complete feature parity for each OS. ;)</p>
<p>What about some way to be able to wrap Silverlight around AIR and be able to run it as a client in a multi platform way... I guess this is more of a request to the Adobe team rather than the Microsoft one, yet I should be cool!</p> <p>Cheers!</p>
3,788
<p>I've been learning Java for about a month now, and not very familiar with a client/server situation like this one.</p> <p>Basically I ran into a situation where our client java software (GUI) displayed a nullpointerexception popup but no stack trace on the client side. Someone had to go check the server side for th...
<p>Not really. It is not recommended to show the way your app works from behind to the client. Mainly for security reasons. Your stacktrace shows all the objects being called, methods and if compiled with debug info, even lines. That's too much information for the client, it is ok to have it on the server.</p> <p>Thi...
<p>The client only needs to know hat it needs to know. In alot of cases it perfectly fine to not show any stacktraces on your client. Your users should get clear error messages but dont care about a stacktrace.</p> <p>For debugging purposes a stacktrace is generally lost anyway, application gives errors, users restart...
22,958
<p>using MVP, what is the normal order of construction and dependency injection.</p> <p>normally you create a presenter for each view and pass the view into the presenter on constructor. But what if you have:</p> <ol> <li>A Service that multiple views need to listen to events on.</li> <li>Multiple views all pointing...
<p>Here is what I do:</p> <p>First, I define theses interfaces:</p> <pre><code>public interface IView&lt;TPresenter&gt; { TPresenter Presenter { get; set; } } public interface IPresenter&lt;TView, TPresenter&gt; where TView : IView&lt;TPresenter&gt; where TPresenter : IPresenter&lt;TView, TPresenter&gt; ...
<pre><code>interface IEmployee { int EmployeeId {get;} string FirstName {get;} string LastName {get;} } interface IEmployeeRepository { void SaveEmployee(IEmployee employee); IEmployee GetEmployeeById(int employeeId); IEmployee[] Employees { get; } } interface IEmployeeView { event Action&lt...
22,935
<p>Our CF server occasionally stops processing mail. This is problematic, as many of our clients depend on it. </p> <p>We found suggestions online that mention zero-byte files in the undeliverable folder, so I created a task that removes them every three minutes. However, the stoppage has occurred again.</p> <p>I ...
<p>What we ended up doing:</p> <p>I wrote two scheduled tasks. The first checked to see if there were any messages in the queue folder older than <em>n</em> minues (currently set to 30). The second reset the queue every night during low usage.</p> <p>Unfortunately, we never really discovered why the queue would com...
<p>There is/was an issue with the mail spooler and messages with attachments in CFMX 8 that was fixed with one of the Hotfixes. Version 8.0.1, at least, should have had that fixed.</p>
12,052
<p>I am wrapping a native C++ class, which has the following methods:</p> <pre><code>class Native { public: class Local { std::string m_Str; int m_Int; }; typedef std::vector&lt;Local&gt; LocalVec; typedef LocalVec::iterator LocalIter; LocalIter BeginLocals(); LocalIte...
<p>Iterators aren't exactly translatable to "the .net way", but they are roughly replaced by IEnumerable &lt; T > and IEnumerator &lt; T >. </p> <p>Rather than </p> <pre><code> vector&lt;int&gt; a_vector; vector&lt;int&gt;::iterator a_iterator; for(int i= 0; i &lt; 100; i++) { a_vector.push_back(i); } ...
<p>@Phillip - Thanks, your answer really got me started in the right direction. </p> <p>After seeing your code, and doing a little more reading in Nish's book <strong>C++/CLI in Action</strong>, I think using an indexed property that returns a const tracking handle to a Local instance on the managed heap is probably t...
11,056
<p>Say you have a class declaration, e.g.:</p> <pre><code> class MyClass { int myInt=7; int myOtherInt; } </code></pre> <p>Now, is there a way in generic code, using reflection (or any other means, for that matter), that I can deduce that myInt has a default value assigned, whereas myOtherInt does not? Note the d...
<p>I compiled your code and load it up in ILDASM and got this</p> <pre><code>.method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 15 (0xf) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldc.i4.7 IL_0002: stfld int32 dummyCSharp.MyClass:...
<p>The compiler can be set to generate a warning if you try to use a variable before assigning it a value. I have the default setting and that how it behave.</p>
34,212
<p>I have two tables, one that contains volunteers, and one that contains venues. <strong>Volunteers are assigned one venue each</strong>.</p> <p>The id of the venues table (venues.id) is placed within the volunteers table in the venue_id column (volunteers.venue_id).</p> <p>I know I could get a count of how many mat...
<p>This will give you all of the venues, with those having no volunteers showing up with a 0 volunteer_count</p> <pre><code>select venues.venue_name, count(*) as volunteer_count from venues left outer join volunteers on venues.id = volunteers.venue_id group by venues.venue_name </code></pre> <p>[EDIT] I just reali...
<pre><code>SELECT venues.venue_name, COUNT(volunteers.*) AS cvolun FROM venues INNER JOIN volunteers ON venues.id = volunteers.venue_id </code></pre>
27,706
<p>Hi does anybody know how to initialize two list at the same time with ajax?</p> <p>This is my code</p> <pre><code>&lt;html&gt; &lt;body onload="iniciaListas()"&gt; &lt;script type="text/javascript"&gt; var xmlHttp function iniciaListas() { muestraListaPaises(); muestraListaProfesiones(); } functio...
<p>I would recommend using a different ID for the Ocupation node, and double the adding:</p> <p>JS Snip - grab the other list, add to both:</p> <pre><code>//Se obtine el id de la lista var obCon = document.getElementById("pais"); var obOcupation = document.getElementById("ocupation"); ... for (var i=0; i&lt;obCod.l...
<p>With ajax is perhaps not specific enough. Do you mean in JavaScript?</p>
31,219
<p>I am using CSS Tidy. Due to all of its compression measures, in some cases it's messing up my pages by combining or re-arranging selectors, etc. Even with the options shown below, pages with the compressed CSS do not render as they do with the uncompressed.</p> <p>My question is: How can I configure CSS Tidy to com...
<p>If you realy want this behaviour ( I don't think, this is good pattern, bud its not matter ), you can derive from EventArgs class and add property for author of deletion. Then you can do:</p> <pre><code>c.Delete( this ); //this = window // ... void business_Deleted(object sender, EventArgs e) { bool isDeletedFr...
<p>From the few lines that I see, this could be the problem:</p> <pre><code>Business business = (Business)businessBindingSource.DataSource; </code></pre> <p>It looks like you are changing the reference held by business to a different object. Perhaps yours was only an example though and you are using the same object ...
39,149
<p>I'm a programmer dammit, I should be allowed to ask these kinds of IT questions! :)</p> <p>Anyway the problem is as follows. I'm writing an automatic build script to deploy code to a live windows 2003 server. To get access to the server I enabled the VPN role, and I can connect to it remotely from my dev machine us...
<p>If you include well designed open source <em>libraries</em> that are instructive to analyse, have a look at <a href="http://www.boost.org" rel="nofollow noreferrer">Boost</a>.</p> <p>About persistence / serialization (not relational mapping though), have a look at <a href="http://www.boost.org/doc/libs/1_36_0/libs/...
<p>While this doesn't fit your specific requirements (it's not a business app for a start), I think that <a href="http://ogre3d.org" rel="nofollow noreferrer" title="OGRE">OGRE 3D</a> is a great example of an open source C++ project.</p>
29,002
<p>Is there a simple way to convert a string to Title Case? E.g. <code>john smith</code> becomes <code>John Smith</code>. I'm not looking for something complicated like <a href="http://ejohn.org/blog/title-capitalization-in-javascript/" rel="noreferrer">John Resig's solution</a>, just (hopefully) some kind of one- or t...
<p>Try this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function toTitleCase(str) { return str.replace( /\w\S*/g, function(txt) { return txt.charAt(0).t...
<p>ES6 one liner</p> <pre><code>const toTitleCase = string =&gt; string.split(' ').map((word) =&gt; [word[0].toUpperCase(), ...word.substr(1)].join('')).join(' '); </code></pre>
23,941
<pre><code>&lt;?php class foo { //this class is always etended, and has some other methods that do utility work //and are never overrided public function init() { //what do to here to call bar-&gt;doSomething or baz-&gt;doSomething //depending on what class is actually instantiated? ...
<p>You just have to call $this->doSomething(); in your init() method.</p> <p>Due to polymorphism, the correct method of the child object will be called at runtime depending on the class of the child.</p>
<pre><code>public function init() { $this-&gt;doSomething(); } $obj = new bar(); $obj-&gt;doSomething(); // prints "bar" $obj2 = new baz(); $obj-&gt;doSomething(); // prints "baz" </code></pre>
39,088
<p>I'm seeing some code I've inherited that looks like the following:</p> <pre><code>@interface SomeClass (private) </code></pre> <p>This is within <code>SomeClass.m</code>, the implementation file. There is an accompanying header file which doesn't suggest that the class is using a category. Is <code>(private)</code...
<p>It isn't the name "private" that makes it private; the methods are private because they are in a category declared within the implementation file.</p> <p>There are three uses of a category, each of which add methods to a class (note: methods only, not iVars)</p> <p><strong>Extending an existing Cocoa class</strong...
<p>"Private" is just a name that suggests the methods are not public and are used for the internal implementation of the class, but there's nothing in the declaration of the category that enforces that.</p> <p>Also, methods defined in a category are added to the class definition at runtime, so the accompanying header ...
47,109
<p>I thought I was a decent programmer until I tried writing gamepad code for OS X. Now I feel deeply useless.</p> <p>Does anyone know of any code that I can legally use in my (non-free) game?</p> <p>Is it really this hard to talk to a gamepad on OS X? What am I missing?</p>
<p>Check out the HID Manager, especially the new <a href="http://developer.apple.com/technotes/tn2007/tn2187.html" rel="nofollow noreferrer">HID Manager APIs in Leopard</a>. It's somewhat verbose, but the essence of it is that you can get callbacks when devices are attached and detached, and get callbacks when events ...
<p>No code, but communicating with gamepads and the like is pretty straightforward with the <a href="http://developer.apple.com/DOCUMENTATION/mac/Sprockets/GameSprockets-162.html#HEADING162-0" rel="nofollow noreferrer">InputSprocket</a> mechanism. What was the precise problem you had?</p>
12,067
<p>I'm trying to create number of Evenement instances and set the date for them:</p> <pre><code> for (int i=2004; i&lt;2009; i++){ evenementen.add(new Evenement("Rock Werchter", "Rock", "Werchter", 200000, (Date)formatter.parse(i+"/07/03"))); </code></pre> <p>But I can't seem t...
<p>You may want to use Calendar to create your dates.</p> <pre><code>for (int i=2004; i&lt;2009; i++) { Calendar cal = Calendar.getInstance(); cal.clear(); // Calendar.JULY may be different depending on the JDK language cal.set(i, Calendar.JULY, 3); // Alternatively, cal.set(i, 6, 3); evenementen....
<p>You may want to use Calendar to create your dates.</p> <pre><code>for (int i=2004; i&lt;2009; i++) { Calendar cal = Calendar.getInstance(); cal.clear(); // Calendar.JULY may be different depending on the JDK language cal.set(i, Calendar.JULY, 3); // Alternatively, cal.set(i, 6, 3); evenementen....
36,971
<p>So I bought a prusa i3 kit from a company called folger tech off of ebay. I've built it and even printed out a few parts, but I noticed that a lot of noise seemed to be happening only while the x-axis motor was moving the extruder. Then I noticed if I put my finger lightly on the plastic part of the x-carriage I cou...
<p>It's probably intentional. Threaded rods are almost never perfectly straight. If the nut is rigidly coupled to the carriage, then the slightest deviation in the screw will either cause it to bind up or appear as artifacts (e.g. z-wobble) in the print. By making the nut slightly loose, it can move around a bit to com...
<p>I do not agree with the answer of Tom.</p> <p>In a proper design, the nut is supposed NOT to be loose, especially in the Z-direction. All options of the nut to move can cause imprecise layer heights and Z-wobble. There is also the possibility to introduce Z-wobble by bent rods and good contact of the nut. However, ...
235
<p>I am struggling to get an Epson "ESC/POS" printer to print barcodes (Using Delphi) and want to test if the printer is not faulty. Do you know where I can find a program to print a barcode in "ESC/POS"? I suppose as a last resort an OPOS program will also be OK.</p> <p>Also, a demo Delphi Program that works will als...
<p>I Have a full tests program written in Delphi 5 for the TMT88's but the source is abit big for here so here is the barcode bits</p> <p>Please note that as its snippets from the full object some vars/functions may be missing</p> <p>To get the barcode chars</p> <pre><code>{** * @param a ean13 barcode numeric val...
<p>Get the Microsoft POS For .Net 1.11, it's got an SDK that includes a sample application that performs all the basic operations on POS hardware. I'm using it all the time to test that cash drawers work ok for example.</p> <p>There's also a source code included (in .Net), so you can see how they do it.</p>
39,753
<p>The company I work for currently uses "Go To Meeting" to share our desktops but it's quite expensive for what we use it for and we are looking for cheaper (or even free) alternatives.</p> <p>We have evaluated yuuguu and yugma but they aren't up to scratch. They are both slow and only allow the sharers to share the ...
<p>I use <a href="http://www.crossloop.com" rel="nofollow noreferrer">CrossLoop</a> and it works well, it is free!</p>
<p>I use <a href="http://logmein.com/" rel="nofollow noreferrer">LogmeIn</a> and <a href="https://secure.logmein.com/products/hamachi/vpn.asp" rel="nofollow noreferrer">Hamachi</a>, for remote desktop and VPN solutions. They have free and paid plans.</p>
25,217
<p>If I have a forums site with a large number of threads, will the search engine bot crawl the whole site every time? Say I have over 1,000,000 threads in my site, will they get crawled every time the bot crawls my site? or how does it work? I want my website to be indexed but I don't want the bot to kill my website! ...
<p>Complicated stuff.</p> <p>From my experience, it depends more on what URL scheme do you use to link pages together that will determine if the crawler will crawls which pages.</p> <ul> <li><p>Most engine crawl the entire website, if it is all <em>properly hyperlinked</em> with a <em>crawl-friendly URLs</em> e.g. us...
<p>To build on what chakrit said, some search engines (Google in particular) will only index pages that have only one or two parameters. After that the page is generally ignored probably because it's seen as being too dynamic and therefore an unreliable URL.</p> <p>It's best to create SEO friendly URLS that are devoid ...
34,137
<p>I've been developing web applications for a while and i am quite comfortable with mySql, in fact as many do i use some form of SQL almost every day. I like the syntax and a have zero problems writing queries or optimizing my tables. I have enjoyed this mysql <a href="http://www.tmtm.org/en/mysql/ruby/" rel="nofoll...
<p>You're right that hiding the SQL behind ActiveRecord's layer means people might forget to check the generated SQL. I've been bitten by this myself: missing indexes, inefficient queries, etc.</p> <p>What ActiveRecord allows is making the easy things easy:</p> <pre><code>Post.find(1) </code></pre> <p>vs</p> <pre>...
<p>Avoiding SQL helps you when you decide to change the database scheme. The abstraction is also necessary for all kinds of things, like validation. I doesn't mean you don't get to write SQL: you can always do that if you feel the need for it. But you don't have to write a 5 line query where all you need is user.save. ...
19,474
<p>I have an Informix SQL query which returns a set of rows. It was slightly modified for the new version of the site we've been working on and our QA noticed that the new version returns different results. After investigation we've found that the only difference between two queries were in the number of fields returne...
<p>Adding <code>--+ ORDERED</code> join-order directive fixes the problem by allowing you to get your results in predictable order each time.</p> <p>The links goes to the description of how the directive works <a href="http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls1144.htm"...
<p>I take it that by 'fields' you mean the number of rows of output data? In my experience, people use 'fields' and 'columns' as synonyms. Given that the names in the select-list did not change, you presumably were only getting differences in the number of rows returned.</p> <p>Given the same tables, input data and ...
39,261
<p>I'm importing some data from a <code>CSV</code> file, and numbers that are larger than <code>1000</code> get turned into <code>1,100</code> etc. </p> <p>What's a good way to remove both the quotes and the comma from this so I can put it into an <code>int</code> field?</p> <p><strong>Edit:</strong> </p> <p>The dat...
<p>My guess here is that because the data was able to import that the field is actually a varchar or some character field, because importing to a numeric field might have failed. Here was a test case I ran purely a MySQL, SQL solution.</p> <ol> <li><p>The table is just a single column (alpha) that is a varchar.</p> ...
<p>Daniel's and Eldila's answer have one problem: They remove all quotes and commas in the whole file.</p> <p>What I usually do when I have to do something like this is to first replace all separating quotes and (usually) semicolons by tabs. </p> <ul> <li><em>Search:</em> ";"</li> <li><em>Replace:</em> \t</li> </ul> ...
2,947
<p>Is there a way to select manually a node in virtualizing TreeView and then bring it into view?</p> <p>The data model I'm using with my TreeView is implemented based on the VM-M-V model. Each TreeViewItem's IsSelected property is binded to a corresponing property in ViewModel. I've also created a listener for TreeVi...
<p>The link Estifanos Kidane gave is broken. He probably meant <a href="http://code.msdn.microsoft.com/Changing-selection-in-a-6a6242c8/sourcecode?fileId=18862&amp;pathId=753647475" rel="noreferrer">the "Changing selection in a virtualized TreeView" MSDN sample</a>. however, this sample shows how to select a node in a ...
<p>Here is an example taken from an <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a74f22cc-5f82-4070-9f32-c6985dbdead5/" rel="nofollow noreferrer">MSDN Question</a> public void ScrollToItem(int index)</p> <pre><code> { Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPr...
22,207
<p>I need to read the value of a property from a file in an Ant script and strip off the first few characters. The property in question is</p> <pre><code>path=file:C:/tmp/templates </code></pre> <p>This property is store in a file that I can access within the ant script via</p> <pre><code>&lt;property file="${web.in...
<p>I used the <a href="http://ant-contrib.sourceforge.net/tasks/tasks/propertyregex.html" rel="nofollow noreferrer">propertyregex task</a> from <a href="http://ant-contrib.sourceforge.net/" rel="nofollow noreferrer">Ant Contrib</a> to do something similar.</p>
<p>You could probably use ant's exec task and a system command.</p> <p>I wrote this up quickly to test the concept:</p> <pre><code>&lt;target name="foo"&gt; &lt;property name="my.property" value="file:C:/foo/bar"/&gt; &lt;exec executable="/bin/cut" inputstring="${my.property}" outputproperty="new.property"&gt; ...
44,490
<p>I have a port scanning application that uses work queues and threads.</p> <p>It uses simple TCP connections and spends a lot of time waiting for packets to come back (up to half a second). Thus the threads don't need to fully execute (i.e. first half sends a packet, context switch, does stuff, comes back to thread ...
<p>For higher level (method, class) wise, <a href="http://www.python.org/doc/2.5.2/lib/module-dis.html" rel="nofollow noreferrer">dis module</a> should help.</p> <p>But if one needs finer grain, <a href="http://www.python.org/doc/2.5.2/lib/debugger-hooks.html" rel="nofollow noreferrer">tracing</a> will be unavoidable....
<p>" I suspect I can improve performance by modifying the sys.setcheckinterval" </p> <p>This rarely works. Correct behavior can't depend on timing -- you can't control timing. Slight changes on OS, hardware, patch level of Python or phase of the moon will change how your application behaves.</p> <p>The <a href="ht...
37,666
<p>I'm rewriting a PHP web site in ASP.NET MVC. I'd like to maintain the same user base but the passwords are hashed using the PHP crypt() function. I need the same function in .Net so that I can hash a password on login and check it against the hashed password in the user database.</p> <p>crypt in this case is using ...
<p>There are a few .NET methods for md5 hashing, <code>System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, format)</code> is the easiest to use, even though it's a mouthful. Just pass "md5" through as the format.</p> <p>Depending on how PHP is doing this, it may be as simple as choppi...
<p>I am currently working on exactly the same issue. The solution I came up with was to call the php function directly via an extern call:</p> <pre><code>[DllImport( "php5ts.dll", EntryPoint = "crypt", CharSet = CharSet.Ansi )] private static extern string crypt( string str, string salt ); </code></pre> <p>This works...
44,738
<p>If this is possible, please provide a sample query or two so I can see how it would work. Both tables will be in the same database.</p> <p>Thanks!</p>
<p>Pseudo code:</p> <pre><code>insert into &lt;target-table&gt; ( &lt;column-list&gt; ) select &lt;columns&gt; from &lt;source-table&gt; </code></pre>
<p><code>INSERT...SELECT</code> is the answer; see <a href="http://dev.mysql.com/doc/refman/5.1/en/insert-select.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.1/en/insert-select.html</a>.</p> <p>For example:</p> <pre><code>INSERT INTO names SELECT last_name, first_name FROM people </code></pre>
29,562
<p>is it somehow possible to call a rails function or to access a rails object from within jQuery? I'd like to do something like:</p> <pre><code>jQuery(document).ready(function($) { $('#mydiv').html("&lt;%= @object.name %&gt;"); }); </code></pre> <p>OR</p> <pre><code>jQuery(document).ready(function($) { $('#mydiv')....
<p>You'll have to have a method in the controller that will render what you need, if you want to do that. Another way to do it is to use view blocks, like in the end of your layout view</p> <pre><code>&lt;script type="text/javascript"&gt; &lt;%= yield :footerjs %&gt; &lt;/script&gt;</code></pre> <p>and in the view do...
<p>@changelog: thx a lot for your answer. </p> <p>The problem depicted below the line was solved by enclosing the <code>&lt;%= yield :myjs %&gt;</code> in the appropriate javascript tags as follows:</p> <pre><code>&lt;script type="text/javascript"&gt; &lt;%= yield :myjs %&gt; &lt;/script&gt; </code></pre> <p>Thanks ...
32,742
<p>Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database folder is c:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data. </p> <p>How can VBScript be used to retrieve that folder? </p> <p>Maybe by using SMO? And if so, how? &lt;- Forget that. SMO uses .NET. Only possible...
<p>The <a href="http://technet.microsoft.com/en-us/library/ms144134.aspx" rel="nofollow noreferrer">PrimaryFilePath Property</a> of <a href="http://technet.microsoft.com/en-us/library/ms133993.aspx" rel="nofollow noreferrer">SQL-DMO</a> looks interesting. </p> <p>The MSDN states that SQL-DMO is deprecated as of SQL Se...
<p>Use this code in the custom action,</p> <pre><code>strName = "(local)\SQLEXPRESS" arrNames = Split(strName, "\") intIndex = Ubound(arrNames) strFile = arrNames(intIndex) strFile = trim(strFile) if strFile &lt;&gt; "" then reg = readFromRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\" &am...
37,780
<p>let's say I have a excel spread sheet like below:</p> <pre> col1 col2 ------------ dog1 dog dog2 dog dog3 dog dog4 dog cat1 cat cat2 cat cat3 cat </pre> <p>I want to return a range of cells (dog1,dog2,dog3,dog4) or (cat1,cat2,cat3) based on either "dog" or "cat"</p> <p>I know I can do a loop to ch...
<p>Here are some notes on using a recordset to return the range.</p> <pre><code>Sub GetRange() Dim cn As Object Dim rs As Object Dim strcn, strFile, strPos1, strPos2 Set cn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") strFile = ActiveWorkbook.FullName strcn = "Provider...
<p>Thanks DJ.</p> <p>That FindAll solution still uses a VBA loop to do things.</p> <p>I'm trying to find a way without using user level loop to filter a range in excel VBA.</p> <p>Here I found a solution. it takes advantage of excel built-in engine to do the job. </p> <p>(1) use worksheetfunction.CountIf(,"Cat...
35,683
<p>I have a product registration form that allows the user to add additional product fields by clicking "add product". When the user clicks add product, Javascript creates new product field in an existing div.</p> <p>I currently allow up to 10 products to be added on the form, so I setup a div structure like this:</p>...
<p>You can dynamically add more DIVs easily. I use <a href="http://prototypejs.org" rel="nofollow noreferrer">Prototype</a>:</p> <pre><code>$("someContainerDiv").insert(new Element("div", { id: "product_"+prodId, 'class':'prod' })) </code></pre> <p>Then put your contents in <code>$("product_"+prodId).innerHTML</code>...
<p>I have one word to say <a href="http://jquery.com" rel="nofollow noreferrer">jQuery</a> :)</p> <p>Example (to construct inputs on the fly for your form):</p> <pre><code>output = ''; for(i in products){ output += '&lt;div id="product_' + products[i].id + '"&gt;'; output += '&lt;input type="text" name="product...
47,346
<p>I'm trying to refer to a drive whose letter may change. I'd like to refer to it by its label (e.g., MyLabel (v:) within a Batch File. It can be referred to by V:\ . I'd like to refer to it by MyLabel.</p> <p>(This was posted on Experts Echange for a month with no answer. Let's see how fast SO answers it )</p>
<p>The previous answers seem either overly complicated, and/or not particularly suited to a batch file.</p> <p>This simple one liner should place the desired drive letter in variable myDrive. Obviously change "My Label" to your actual label.</p> <pre><code>for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "...
<p>You can use the WMI query language for that. Take a look at <a href="http://msdn.microsoft.com/en-us/library/aa394592(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa394592(VS.85).aspx</a> for examples. The information you are looking for is available e.g. through the property Volume...
7,014
<p>The <a href="https://help.prusa3d.com/article/6Gtws6Yqjg-pei-print-surface-preparation" rel="noreferrer">Prusa3d knowledge base</a> mentions that acetone will "rejuvenate" PEI in addition to cleaning oil and grease from the surface.</p> <blockquote> <p>About once a week, or when <strong>prints stop sticking</stro...
<p>Rejuvenate is probably a bit of an exaggerated term. The number one adhesion suppressor is grease. The stuff that comes off of the fingers used to handle the sheet. Even if you are careful and only handle the sides, the grease will be carried to the center of the plate next time its cleaned with less aggressive solv...
<p>Acetone is smelly nasty stuff. Here's a sample recommendation for PEI maintenance from one of a few (million?) 3d printing help sites. </p> <blockquote> <p>Use isopropyl alcohol, methyl alcohol, soap, Heptane, Hexane, or Naphtha. Avoid ketones (such as MEK) or strong bases (such as sodium hydroxide).</p> </b...
1,283
<p>I have an SQL database with multiple tables, and I am working on creating a searching feature. Other than having multiple queries for the different tables, is there a different way to go about said searching function?</p> <hr> <p>I should probably add that a lot of my content is database driven to make upkeep eas...
<p>Different approaches to consider:</p> <p>1) Multiple queries pre-baked, like you described.</p> <p>2) Dynamic sql that you put together on the fly based on user-entered criteria.</p> <p>3) If text is involved, based on SQL Server full text search or Lucene.</p> <p>In my open source app BugTracker.NET, I do both ...
<p>Since you have tagged the question with Asp.net I suppose you want to search your webpages. In that case you can use Indexing Server to perform freetext searches easily that search the generated html and any keywords you have set up. </p> <p>As Corey Trager suggested, using Lucene.NET is also an option. It has a go...
31,170
<p>I'm writing a WinForms app which has two modes: console or GUI. Three projects within the same solution, one for the console app, one for the UI forms and the third to hold the logic that the two interfaces will both connect too. The Console app runs absolutely smoothly. </p> <p>A model which holds the user-select...
<p>Since you are doing UI binding via event subscription, <a href="http://groups.google.co.uk/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/214e55884b16f4d9/f12a3c5980567f06#f12a3c5980567f06" rel="nofollow noreferrer">you might find this helpful</a>; it is an example I wrote a while ago that shows...
<p>I found this article - "<a href="http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/186338b6-2fe1-4d41-bab5-c35bf64a6b8d/" rel="nofollow noreferrer">Updating IBindingList from different thread</a>" - which pointed the finger of blame to the BindingList - </p> <blockquote> <p>Because the BindingList is ...
24,431
<p>I have an ASP .Net (3.5) website. I have the following code that uploads a file as a binary to a SQL Database:</p> <pre><code>Print(" protected void UploadButton_Click(object sender, EventArgs e) { //Get the posted file Stream fileDataStream = FileUpload.Post...
<p>So are you really just after how to serve a byte array in ASP.NET? It sounds like the database part is irrelevant, given that you've said you are able to get the binary file with a LINQ query.</p> <p>If so, look at <a href="http://msdn.microsoft.com/en-us/library/system.web.httpresponse.binarywrite.aspx" rel="nofol...
<p>How big are the files? Huge buffers (i.e. byte[fileLength]) are usually a bad idea.</p> <p>Personally, I'd look at things like <a href="http://groups.google.co.uk/group/microsoft.public.dotnet.languages.csharp/msg/314e7e3782e59a93" rel="nofollow noreferrer">this</a> and <a href="http://groups.google.co.uk/group/mic...
29,733
<p>Here are two different questions but I think they are related.</p> <ol> <li><p>When using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command <code>hg outgoing</code>.</p></li> <li><p>When using Git, how do ...
<p>Git can't send that kind of information over the network, like Hg can. But you can run <code>git fetch</code> (which is more like <code>hg pull</code> than <code>hg fetch</code>) to fetch new commits from your remote servers.</p> <p>So, if you have a branch called <code>master</code> and a remote called <code>origi...
<p>When you do git fetch, all the contents including branches,tags ( refs) are stored temporarily in .git/FETCH_HEAD whose content can be viewed with command: git log FETCH_HEAD If you don't use suffix -a with git fetch then by default, FETCH_HEAD's content's will be overwritten by new contents. From these contents, yo...
28,621
<p>I'm trying to get distinct results using the Criteria API in NHibernate. I know this is possible using HQL, but I would prefer to do this using the Criteria API, because the rest of my app is written using only this method. I <a href="http://forum.hibernate.org/viewtopic.php?t=941669," rel="noreferrer">found this fo...
<p>To perform a distinct query you can set the projection on the criteria to Projections.Distinct. You then include the columns that you wish to return. The result is then turned back into an strongly-typed object by setting the result transformer to AliasToBeanResultTransformer - passing in the type that the result sh...
<p>I also ran into the problem of the non-distinct number of items (I use a fetch="join" in my mapping file). I used Linq To Nhibernate to solve the problem, which is used in the following way:</p> <pre><code> var suppliers = (from supplier in session.Linq&lt;Supplier&gt;() from product i...
41,108
<p>I'm occasionaly getting the following popup from an AJAX.NET application</p> <pre>Sys.WebForms.PageRequestManagerServerErrorException: An Unknown error occurred while processing the request on the server. The status code returned from the server was: 12031</pre> <p>From the <a href="http://support.microsoft.com/kb...
<p>It's a viewstate problem, but not related with time but with size. Try playing with maxRequestLength in your web.config.</p>
<p>sometimes the error occurs if you have added a server SSL certificate(https).If the certificate is not valid it will give this error.</p>
29,659