instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I have issues with this overhang:</p>
<p><a href="https://i.stack.imgur.com/7dMhQ.jpg" rel="nofollow noreferrer" title="Damaged overhang"><img src="https://i.stack.imgur.com/7dMhQ.jpg" alt="Damaged overhang" title="Damaged overhang"></a></p>
<p>The whole part always breaks in this overhang during the print.</p>
<... | <p>When you get upwards facing things failing it can be because the slicer has too few top layers which makes angled faces have gaps. While you may think it is a wall the slicer sees it as top layer. Try increasing the number of top layers and check in the preview how it appears.</p>
<p>Infill will normally support th... | <p>As @r-ahlskog pointed out, it was due to the top layers count being too low. Adding some, now it looks perfect:</p>
<p><a href="https://i.stack.imgur.com/DEdbO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DEdbO.jpg" alt="enter image description here"></a></p>
| 1,383 |
<p>Folks, we all know that IP blacklisting doesn't work - spammers can come in through a proxy, plus, legitimate users might get affected... That said, blacklisting seems to me to be an efficient mechanism to stop a persistent attacker, given that the actual list of IP's is determined dynamically, based on application'... | <p>are you on a *nix machine? this sort of thing is probably better left to the OS level, using something like <a href="http://en.wikipedia.org/wiki/Iptables" rel="nofollow noreferrer">iptables</a></p>
<p>edit:</p>
<p>in response to the comment, yes (sort of). however, the idea is that iptables can work independently... | <p>I think it should be a combination of user-name plus IP block. Not just IP.</p>
| 13,817 |
<p>I want to implement a paperless filing system and was looking to use WIA with C# for the image acquisition. There are quite a few sample projects on CodeProject, etc. However, after downloading every one of them that I can find, I have run into a problem.</p>
<p>In each and every one of them, the reference to WIALi... | <p>To access WIA, you'll need to add a reference to the COM library, "Microsoft Windows Image Acquisition Library v2.0" (wiaaut.dll).
add a "using WIA;"</p>
<pre><code>const string wiaFormatJPEG = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}";
CommonDialogClass wiaDiag = new CommonDialogClass();
WIA.ImageFile wiaImage = nu... | <p>It doesn't <strong>need</strong> to be WIA. I was mostly looking at the WIA setup because it offers the same basic interface for different scanners. I've got 3 scanners on this machine and the TWAIN drivers/software for all of them suck (like blocking the screen during scanning).</p>
<p>For document management, I'm... | 3,043 |
<p>The following have been proposed for an upcoming C++ project.</p>
<ul>
<li>C++ Coding Standards, by Sutter and Alexandrescu</li>
<li>JSF Air Vehicle C++ coding standards</li>
<li>The Elements of C++ Style</li>
<li>Effective C++ 3rd Edition, by Scott Meyers</li>
</ul>
<p>Are there other choices? Or is the list abo... | <p>I really think it does not matter which one you adopt, as long as everyone goes along with it. Sometimes that can be hard as it seems that some styles don't agree with peoples tases. I.e. it comes down to arguing about whether prefixing all member variable with <code>m_</code> is <em>pretty</em> or not.</p>
<p>I ha... | <p><a href="http://www.appinf.com/download/CppCodingStyleGuide.pdf" rel="nofollow noreferrer">Poco C++ Coding Style Guide.pdf</a></p>
| 17,551 |
<p>I am looking for a solid and easy to pick up .NET Web Application Framework for company-wide development use. I am considering DotNetNuke. Is it good ? What else can you recommend ?</p>
| <p>If you're wanting a framework for "Web Applications" in .NET, then your choices boil down to ASP.NET or ASP.NET MVC (both from Microsoft), or an open source alternative like Castle Monorail.</p>
<p>ASP.NET would be the way to go if you want to have maximum use of vendor controls, and you're putting together small, ... | <p>SharePoint is an option but I don't recommend it. I've always wanted to try DotNetNuke. It has a strong community and a lot of growth.</p>
<p>Our team worked on SharePoint features for 5 months before we ditched it. Deployment and debugging are awful experiences. We had to resort to lengthy build scripts within V... | 44,576 |
<p>I am trying to modify this <a href="https://www.thingiverse.com/thing:2516525" rel="noreferrer">thing</a>. It's prints OK, but there are some design choices I don't like, so, since the previous makers uploaded their source files, I tried my hand at Sketchup.</p>
<p>My latest round of changes have produced a weird ... | <h1>first issue</h1>
<p>bed inclination. it has to be heavy issue :)</p>
<p>if you have any other printouts then please reveal them so we could see if it's the problem</p>
<h1>next issue</h1>
<p>inversion of hole into solid object</p>
<p>i would say it's caused by wrong calculation of <a href="https://en.wikipedia... | <p>Looks like you are over extruding.</p>
<p>check out this visual guide for example (I like it a lot):</p>
<p><a href="http://support.3dverkstan.se/article/23-a-visual-ultimaker-troubleshooting-guide" rel="nofollow noreferrer">http://support.3dverkstan.se/article/23-a-visual-ultimaker-troubleshooting-guide</a></p>
... | 722 |
<p>I have a dynamic query that returns around 590,000 records. It runs successfully the first time, but if I run it again, I keep getting a <code>System.OutOfMemoryException</code>. What are some reasons this could be happening?</p>
<p>The error is happening here:</p>
<pre><code> public static DataSet GetDataSet(s... | <blockquote>
<p>It runs successfully the first time,
but if I run it again, I keep getting
a System.OutOfMemoryException. What
are some reasons this could be
happening?</p>
</blockquote>
<p>Regardless of what the others have said, the error has nothing to do with forgetting to dispose your DBCommand or DBCon... | <p>Where does it fail?</p>
<p>I agree that your issue is probably that your dataset of 600,000 rows is probably just too large. I see that you are then adding it to Session. If you are using Sql session state, it will have to serialize that data as well.</p>
<p>Even if you dispose of your objects properly, you will... | 46,502 |
<p>3 fields: FirstName, MiddleName, LastName</p>
<p>Any field can be null, but I don't want extra spaces. Format should be "First Middle Last", "First Last", "Last", etc.</p>
| <pre><code> LTRIM(RTRIM(
LTRIM(RTRIM(ISNULL(FirstName, ''))) + ' ' +
LTRIM(RTRIM(ISNULL(MiddleName, ''))) + ' ' +
LTRIM(ISNULL(LastName, ''))
))
</code></pre>
<p>NOTE: This won't leave trailing or leading spaces. That's why it's a little bit uglier than other solutions.</p>
| <p><code>LTrim(RTrim(Replace(IsNull(Firstname + ' ', '') +
isNull(MiddleName, '') +
IsNull(' ' + LastName, ''), ' ', ' ')))</code></p>
| 45,739 |
<p>I'm working on a C# program, and right now I have one <code>Form</code> and a couple of classes. I would like to be able to access some of the <code>Form</code> controls (such as a <code>TextBox</code>) from my class. When I try to change the text in the <code>TextBox</code> from my class I get the following error:<... | <p>You are trying to access the class as opposed to the object. That statement can be confusing to beginners, but you are effectively trying to open your house door by picking up the door on your house plans.</p>
<p>If you actually wanted to access the form components directly from a class (which you don't) you would ... | <p>JUST YOU CAN SEND FORM TO CLASS LIKE THIS</p>
<pre><code>Class1 excell = new Class1 (); //you must declare this in form as you want to control
excel.get_data_from_excel(this); // And create instance for class and sen this form to another class
</code></pre>
<p>INSIDE CLASS AS YOU CREATE CLASS1</p>
<pre><code>cla... | 26,716 |
<p>To pop up the UAC dialog in Vista when writing to the HKLM registry hive, we opt to not use the Win32 Registry API, as when Vista permissions are lacking, we'd need to relaunch our entire application with administrator rights. Instead, we do this trick:</p>
<pre><code>ShellExecute(hWnd, "runas" /* display UAC promp... | <p>try this (from a 32bit process):</p>
<pre><code>> %WINDIR%\sysnative\reg.exe query ...
</code></pre>
<p>(found that <a href="http://ovidiupl.spaces.live.com/blog/cns!1E8A6038167E4BE9!925.entry" rel="noreferrer">here</a>).</p>
| <p>One thing that I've done as a solution for myself is to PInvoke disabling redirection:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365744(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/aa365744(v=vs.85).aspx</a></p>
<p>You can always turn it righ... | 19,631 |
<p>I came across a problem in my current application that required fiddling with the query string in a base <code>Page</code> class (which all my pages inherit from) to solve the problem. Since some of my pages use the query string I was wondering if there is any class that provides clean and simple query string manipu... | <p>Use <code>HttpUtility.ParseQueryString</code>, as someone suggested (and then deleted).</p>
<p>This will work, because the return value from that method is actually an <code>HttpValueCollection</code>, which inherits <code>NameValueCollection</code> (and is internal, you can't reference it directly). You can then s... | <p>What I usually do is just rebuild the querystring. Request has a QueryString collection. </p>
<p>You can iterator over that to get the current (unencoded) parameters out, and just join them together (encoding as you go) with the appropriate separators.</p>
<p>The advantage is that Asp.Net has done the original par... | 49,099 |
<p>I'm trying to drop a SQL Server database using the following code:</p>
<pre><code>SqlCommand command = new SqlCommand("USE MASTER; ALTER DATABASE @database SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE @Database", connection);
command.Parameters.AddWithValue("@database", TestingEnvironment.DatabaseName);
c... | <p>putting it simply the Alter Database command doesn't support parameters as you want it to. you'll have to concat strings here.</p>
| <p>Are the Params case sensitive? You have a capital D in the 2nd @Database.</p>
| 35,160 |
<p>Does the silverlight clr support access to a sql compact database placed in the silverlight application's isolated storage?</p>
<p>If so, any pointers to code samples.</p>
<p>I would like to cache information retrieved from the server in previous sessions. </p>
| <p>Even if it was stored in Isolated Storage, there is no Silverlight library to read in SQL Server Compact Edition. Perhaps in a future version. I have heard of a couple of open source projects that are trying to do this but there are not any that have releases yet. I tried to wrap the Google Gears DB in Beta 2 to no... | <p>I have a sample here, using SQL Server Compact and Silverlight (OOB and elevated and on Windows only) - <a href="http://erikej.blogspot.com/2010/02/access-local-sql-compact-database-from.html" rel="nofollow">http://erikej.blogspot.com/2010/02/access-local-sql-compact-database-from.html</a></p>
| 42,996 |
<p>Well this is incredibly frustrating. After being nagged by Rails that I need to install the C-based MySQL adaptor, I did so... and then discovered that it won't work with MySQL under version 6. Now 'gem uninstall mysql' results in 'unknown gem mysql'. </p>
<p>I just spent half an hour trying to get the thing to... | <p>If you have a contended lock, the second thread has to wait until the first releases the lock.</p>
<p>Your plan sounds <em>nearly</em> okay - but you need to lock when <em>reading</em> data as well, to make sure you get the most recent values, and consistent ones. Otherwise you could be half way through writing som... | <p>That is safe. If one thread has acquired the lock, other threads will have to wait until the lock is released.</p>
<p>However, improbable as it is, you could hit a performance problem since the lock may be TOO global. It really depends on what your state is and how it is mutated by those threads, so I can't help yo... | 27,628 |
<p>I'm calling a bunch of methods that return a list. The list may be empty. If the list is non-empty, I want to return the first item; otherwise, I want to return <code>None</code>. This code works:</p>
<pre class="lang-py prettyprint-override"><code>def main():
my_list = get_list()
if len(my_list) > 0:
... | <h2>Python 2.6+</h2>
<pre><code>next(iter(your_list), None)
</code></pre>
<p>If <code>your_list</code> can be <code>None</code>:</p>
<pre><code>next(iter(your_list or []), None)
</code></pre>
<h2>Python 2.4</h2>
<pre><code>def get_first(iterable, default=None):
if iterable:
for item in iterable:
... | <p>You could use <a href="http://www.refactoring.com/catalog/extractMethod.html" rel="nofollow noreferrer">Extract Method</a>. In other words extract that code into a method which you'd then call.</p>
<p>I wouldn't try to compress it much more, the one liners seem harder to read than the verbose version. And if you us... | 47,511 |
<p>How to balance "zone" time against open and active communication within a development team?</p>
| <p>Read "Peopleware"</p>
<p>Offices with doors.</p>
<p>phones you can turn off.</p>
<p>emails</p>
<p>Usable common areas with whiteboards.</p>
<p>There are some phases of development when lots of collaboration is very productive and other times where individual focus is important. Also, people work differently - ... | <p>Read "Peopleware"</p>
<p>Offices with doors.</p>
<p>phones you can turn off.</p>
<p>emails</p>
<p>Usable common areas with whiteboards.</p>
<p>There are some phases of development when lots of collaboration is very productive and other times where individual focus is important. Also, people work differently - ... | 47,168 |
<p>I have a draggable div that represents a little info popup that the user can drag around the screen. But this div is anchored to a point on the screen, and I would like there to be a caret drawn between the div and the point that it is anchored to.</p>
<p>An example of this can be found on Google maps, when you ho... | <p>So you're essentially trying to draw a dynamic image between two points on the screen? I'm not sure how practical this is in HTML. The dom does not support image rotations and image resizing is limited in quality. You can do server-size image generation but that will be slow and give you high server load.</p>
<p>So... | <p>This tutorial on <a href="http://www.p01.org/releases/Drawing_lines_in_JavaScript/" rel="nofollow noreferrer">Drawing lines in JavaScript</a> may be of some use to you, as it shows you how to do relatively efficient dynamic line drawings using JavaScript (see examples at the bottom of the page).</p>
<p>Also I have ... | 48,718 |
<p>I require a star rating control (which allows partial rating like 4.5) for my application built on asp.net mvc.</p>
<p>Any pointers in this direction will be helpful?</p>
| <p>Rogie, over at <a href="http://www.komodomedia.com/blog/" rel="noreferrer">Komodomedia</a>, has spent far too long on this <a href="http://www.komodomedia.com/blog/2005/08/creating-a-star-rater-using-css/" rel="noreferrer">topic</a> <a href="http://www.komodomedia.com/blog/2005/08/creating-a-star-rater-using-css/" r... | <p>I know this is an old post but I like to answer it for everybody who will find this post through search engines.</p>
<p>This article explains how to implement a star rating system for MVC.
I have implemented it and it works like a charm.</p>
<p><a href="http://www.codecapers.com/post/Building-a-Star-Rating-System-... | 42,864 |
<p>I want to read all thumbnails from a folder with images in Windows XP.
But if I read image file to get thumbnail, it seems a bit slow, so I wish I can first read the windows image thumbnail cache:thumb.db.
Is there any lib in c++ or c to read thumbnails from thumb.db.</p>
| <p>The Thumbs.db file is stored in OLE <a href="http://msdn.microsoft.com/en-us/library/ms693383.aspx" rel="noreferrer">Compound Document</a> format, the same format that many Microsoft Office products use.</p>
<p>You could also try to look into <a href="http://www.petedavis.net/MySite/DynPageView.aspx?pageid=31" rel=... | <p>You might find this useful:</p>
<p>ThumbsDBLib in C++</p>
<p><a href="http://www.windameister.org/blog/index.php/thumbslib-in-cpp" rel="nofollow noreferrer">http://www.windameister.org/blog/index.php/thumbslib-in-cpp</a></p>
| 28,256 |
<p>So I've got a Ruby method like this:</p>
<pre><code>def something(variable, &block)
....
end
</code></pre>
<p>And I want to call it like this:</p>
<pre><code>something 'hello' { do_it }
</code></pre>
<p>Except that isn't working for me, I'm getting a syntax error. If I do this instead, it works:</p>
<pre>... | <p>You need to parenthesize your argument:</p>
<pre><code>something('hello') { do_it }
</code></pre>
<p>That should work.</p>
| <p>Uh, what about:</p>
<pre><code>>> def something(arg1 , &block)
>> yield block
>> end
=> nil
>> def do_it
>> puts "Doing it!"
>> end
=> nil
>> something('hello') { do_it }
"Doing it!"
=> nil
</code></pre>
| 31,907 |
<p>If you are starting to develop a new web application from scratch and the only two requirements you have is that it will be deployed to Windows 2008 Server and that standard ASP.NET incl. VS2008 doesn't cut it (doesn't matter why, let's say it's the license cost, you won't be hosting Windows 2008 Server yourself). W... | <p>I read a benchmark article some time ago that suggested running an open source web stack on top of Windows was the best performer out of all the variations (i.e. WAMP). I don't know how much faith to put in those types of articles, and IIRC it beat out LAMP by some really small margin. You might find WAMP to be a ... | <p>I'm stuck wondering why you'd host on a Windows server and not use ASP.Net. It is the best of the server-side frameworks for a windows environment, as it works most intuitively with IIS.</p>
<p>But there's another problem there: If memory serves, all the other frameworks require additional software to run on the se... | 37,787 |
<p>I want to create a history table to track field changes across a number of tables in DB2. </p>
<p>I know history is usually done with copying an entire table's structure and giving it a suffixed name (e.g. user --> user_history). Then you can use a pretty simple trigger to copy the old record into the history table... | <blockquote>
<p>The error is really nasty, but boils down to the fact that it can't figure out which set::insert to use, since there's three overloads.</p>
</blockquote>
<p>You can work around the ambiguity by giving bind a helpful hand, by specifying a pointer to the function you wish to use:</p>
<pre><code>typede... | <p>Unfortunately, this:</p>
<pre><code>std::for_each(s_vector.begin(), s_vector.end(),
lambda::bind(&std::set<std::string>::insert, s_set, lambda::_1));
</code></pre>
<p>doesn't work. (Note that I used set::insert, because that's what s_set is.) The error is really nasty, but boils down to the fact ... | 35,345 |
<p>I'm in need of a lightweight library for 2d & 3d vectors and 3x3 & 4x4 matrices. In basic C.
Just so I don't reinvent the wheel suboptimally.</p>
<p>Any suggestions?</p>
| <p><a href="http://www.math.uiowa.edu/~dstewart/meschach/" rel="noreferrer">Meschach</a> is a c-only vector/matrix library, significantly smaller than e.g. LAPACK (according to the FAQ, at least :)</p>
| <p>You may also want to have a look at the <a href="http://arma.sourceforge.net" rel="nofollow noreferrer">Armadillo C++ library</a></p>
| 24,252 |
<p>I've gotten comfy with SVN, and now I need a way to deploy my code to staging or live servers more easily. I'd also like some method for putting build info in the footer of this site to aid in testing. Site is PHP/MySQL.</p>
| <p>A script to svn update on an as needed basis. </p>
<p>SVN supports keywords. You can add which keywords you want to expand to the keywords property, and SVN will expand then. See $Id$ or $Rev$, or keywords described in the SVN book.</p>
| <p>A really simple way to manage this is to setup your app in the following way:</p>
<p>Simply make your deployment app a working copy of your trunk (<code>svn co</code> the project to your /www root) and you run an <code>svn up</code> through an ssh console (<code>ssh user@host.com svn up /path/to/project</code>) whe... | 9,218 |
<p>I need a RegEx pattern for extracting all the properties of an image tag.</p>
<p>As we all know, there are lots of malformed HTML out there, so the pattern has to cover those possibilities.</p>
<p>I was looking at this solution <a href="https://stackoverflow.com/questions/138313/how-to-extract-img-src-title-and-al... | <blockquote>
<p>As we all know, there are lots of malformed HTML out there, so the pattern has to cover those possibilities.</p>
</blockquote>
<p>It won't. Use a HTML parser if you have to parse "evil" (from an unknown source) HTML.</p>
| <p>If you want <strong>all</strong> attribute values, might I suggest using the DOM? Something like <code>element.attributes</code> will work well.</p>
<p>If you insist on a regex <code>//\b\w+="[^"]+"//</code> should get everything.</p>
| 45,584 |
<p>I currently work with an Oracle database and we use stored procedures for all our SQL queries. The problem I have is that we do not really having a coding standard for our packages. So what happens is that every developer has a different style (or in some cases no sense of style) in how they format there packages. M... | <ul>
<li><a href="http://www.vim.org/scripts/script.php?script_id=492" rel="nofollow noreferrer">VIM script</a> </li>
<li><a href="http://www.aquafold.com/" rel="nofollow noreferrer">Aqua Data studio</a> $ I use this one all the time.</li>
</ul>
| <p>I like <a href="http://www.toadsoft.com/toad_oracle.htm" rel="nofollow noreferrer">TOAD for Oracle</a>. It has a format feature that's decent. I see there's a freeware version, though I have not used it.</p>
| 5,403 |
<p>Is it possible to retrieve the CPUID and MAC address of a client machine from a Ruby on Rails application?. Are there any plugins available for this?</p>
| <p>I'm pretty sure it is not possible to parse the /proc filesystem of a client computer through a Rails applications (and thank God for that).</p>
<p>What you could do is make use of Javascript to some extent. There are quite some sites on the internet (mainly privacy scanners) which make use of Javascript to show ex... | <p>If the are computers on the localhost network (intranet) you could use ruby to call some command line admin tools. For example you could do a reverse lookup on the ip address to get the computers name. Not sure about Mac Address... You might be able to call a vbscript to do that.</p>
| 35,885 |
<p>I often switch my print material, i.e. ABS / PLA / Wood / Flex,</p>
<p>How can I best clean out my extruder between them to ensure I don't contaminate my next print?</p>
| <p>If you feel you need to <em>clean</em> the nozzle the best approach is a <em>cold pull</em>. You can perform this procedure with many printers, however, you should seek advice from your printer manufacturer before attempting this process if you have any doubts.</p>
<p>With the previously filament still loaded and ... | <p>Some people use a nylon "cleaning" filament when switching types of filaments. It heats well to a variety of temperatures and seems to stick well to whatever is in there when pulling it back out. Be sure to heat it up to the temperature of the filament being removed to get that to bind with the nylon.</p>
| 136 |
<p>Often multiple applications share a large codebase of libraries that change often in development. In these cases, I prefer to create a solution named after the suite, and include separate projects for each application and the shared libraries.</p>
<p>Is this a good approach? How do others structure their code bas... | <p>It really depends on your organization's particular needs. MSDN has a <a href="http://msdn.microsoft.com/en-us/library/ee817674.aspx" rel="noreferrer">good page</a> that goes through the various recommended solution layouts, including:</p>
<ol>
<li>The Single Solution model (preferred)</li>
<li>The Partitioned Sin... | <p>The actual structure of your solution(s) really depends on the internal workflow. Having a very agile, <strong>everyone-refactors-everything approach</strong> would point towards <strong>one solution</strong> with many projects. If your shop has <strong>a dedicated library team</strong> and various application teams... | 24,533 |
<p>I'm trying to register an externally hosted SQL 2000 server through Enterprise Manager which isn't on the default port and I can't see anywhere to change it within Enterprise Manager.</p>
<p>So, the question is, how do I connect to the database if:</p>
<p>I.P. Address is 123.456.789 (example)</p>
<p>Port is 1334</p>... | <p>I found this via <a href="http://www.avianwaves.com/Blog/Default.aspx?id=25&t=Connecting-SQL-Server-Management-Studio" rel="nofollow noreferrer">Google</a>:</p>
<blockquote>
<p>You add a comma and the port number to the end of the server name.</p>
<p>So if you want to connect to MySqlServer.MyDomain.com on port ... | <p>Rob is correct - I have a SQL 2000 server running on the non-default port on a different instance name and the way I access it is like this:</p>
<blockquote>
<p>[ip or dns name]\[instance], [port]</p>
</blockquote>
<p>example:</p>
<blockquote>
<p>my.server.com\MSSQLSERVER2, 12345</p>
</blockquote>
<p>You don... | 11,051 |
<p>Anyone know of a way to use SVK with perforce? The docs <a href="http://svk.bestpractical.com/view/MirrorVCP" rel="nofollow noreferrer">seem to imply</a> it used to be possible, but some <a href="http://lists.bestpractical.com/pipermail/svk-devel/2007-February/000604.html" rel="nofollow noreferrer">mailing list mes... | <p>For a private repository, you should try <a href="http://www.releng.com/p5layer.html" rel="nofollow noreferrer">P5</a></p>
| <p>Why use SVK to mirror Perforce? Surely using a <a href="http://www.perforce.com/perforce/products/p4p.html" rel="nofollow noreferrer">Perforce Proxy</a> is the best way to make your repository distributed?</p>
| 7,602 |
<p>As the title: How would I tell NHibernate, once and for all, that all table and column names are to be quoted in the SQL it generates?</p>
| <p>You can also try:</p>
<pre><code>SchemaMetadataUpdater.QuoteTableAndColumns(configuration);
</code></pre>
| <p>I've not tried this, but as far as i can determine based on the <a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/session-configuration.html#configuration-namingstrategy" rel="nofollow noreferrer">documentation</a> a custom implementation of the naming strategy allows you to rewrite the tab... | 24,377 |
<p>So I started using Cura a few weeks ago, and when I print it goes to 204 Celsius instead of 200. It doesn't really affect my print quality but I just want to know if there's a fix for it. My printer is a Da Vinci Jr 1.0.</p>
| <p>Its mainly due to the regulation loop of the PID Regulator implemented in the Firmware of the Da vinci jr. The P-Factor is a little bit too high. This is the reason why the temperature "overshoots". Because the Printerhead and Nozzle has some volume which is heated up. It takes time to cool down after it has detecte... | <p>That's called PID overshoot. All control loops have varying types of outliers like this. Sometimes, you can't overshoot, sometimes you cant undershoot. But it's a remnant of the math. </p>
<p>The solution here, is to <a href="http://reprap.org/wiki/PID_Tuning" rel="nofollow noreferrer">PID Tune</a>. Once you get an... | 709 |
<p>I have a class with some abstract methods, but I want to be able to edit a subclass of that class in the designer. However, the designer can't edit the subclass unless it can create an instance of the parent class. So my plan is to replace the abstract methods with stubs and mark them as virtual - but then if I ma... | <p>Well you could do some really messy code involving <code>#if</code> - i.e. in <code>DEBUG</code> it is virtual (for the designer), but in <code>RELEASE</code> it is abstract. A real pain to maintain, though.</p>
<p>But other than that: basically, no. If you want designer support it can't be abstract, so you are lef... | <p>I know its not quite what you are after but you could make all of your stubs in the base class throw the NotImplementedException. Then if any of your subclasses have not overridden them you would get a runtime exception when the method in the base class gets called.</p>
| 29,620 |
<p>I want to change a flash object enclosed within with jQuery after an onClick event. The code I wrote, essentially:</p>
<pre><code>$(enclosing div).html('');
$(enclosing div).html(<object>My New Object</object>);
</code></pre>
<p>works in Firefox but not in IE. I would appreciate pointers or suggestion... | <p>The <code>empty()</code> method is the better way of deleting content. Don't know if that will solve your problem though :)</p>
<pre><code>$('#mydiv').empty();
</code></pre>
<p>You could also try the <code>replaceWith(content)</code> method.</p>
| <p>Try the <code>$().remove()</code> method. This also removes event handlers to avoid memory leak problems and is one of the reasons why just setting the HTML to empty is not a good idea.</p>
| 27,413 |
<p>Please let me know why there is lot of white space below the page content and also why horizontal scroll bar is displayed. Attaching link to zip folder below. Unzip and open index.html.<br />
<a href="http://shivanand.in/tmp/Basic_Profile.zip" rel="nofollow noreferrer">link text</a></p>
| <p>First lead:</p>
<p>The rule <code>div#content</code> almost works in IE, and does put extra width in FireFox:</p>
<p>The extra width is applied to your div class "<code>content</code>"</p>
<pre><code>div#content { margin: 3px 3px 3px 188px; background: rgb(255, 255, 255) none
repeat; min-height: 392px; }
</c... | <p>VonC is right. Add overflow: hidden; to div#container rule.
Line 274 of index.css.</p>
| 46,318 |
<pre><code>('1' * N) !~ /^1?$|^(11+?)\1+$/
</code></pre>
<p>On the net, I found this piece of Ruby code that works for N >= 0 that determines whether or not N is a prime. From what I can tell, it looks like play with regex but I have no idea how it works. Could someone tell me how it works?</p>
| <p>You can find a lengthy explanation of this code here:
<a href="http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/" rel="noreferrer">http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/</a></p>
| <p>Greatest Common Divisor (gcd):</p>
<pre><code>/^(1+)\1*=\1+$/.match('1' * x + '=' + '1' * y)[1].length
</code></pre>
<p>Both this and the is_prime one works in about the same way. It tries all combinations before giving up.</p>
<p>This one will try to split the first number in even parts, and match the second num... | 17,727 |
<p>I cleaned up my Flashforge Creator Dual tonight, and loaded some transparent ABS prepping for a print. The filament extruded fine, then started to wiggle, then became fine again. Hot end is 0.4 mm and was heated to 230C. What sort of steps should I take to troubleshoot the issue? Has anyone seen this before?</p>... | <p>No, that's not (entirely) true. There might be some loss of quality if you print multiple objects at once, because when the printhead "hops" from one object to another it might leave a mark or ooze out some material. Also, a large number of retractions in a short period of time might lead to inconsistent extrusion.<... | <p>Just to add to the other answers already here, I've also had problems with layer adhesion when filling up the print bed on an extrusion printer. The longer the print head spends working on details around a single layer, the more chance the layer has to cool off before the next layer gets started. I've started to s... | 425 |
<p>I recently started using Rake to build some of my (non-ruby) packages. Rake is nice, but what I found missing is a way to do hierarchical builds (aggregate Rakefiles in subdirectories). Since this is a common feature in most other build tools, I'm wondering if someone more familiar with Rake has a good solution.</p>... | <p>I would recommend Buildr for non-Ruby build tasks. It is based on Rake (sits on top of it, allowing you to use all of Rake's features) but fits the semantics of compiled languages better. It also supports hierarchical builds.</p>
| <p>The fix I've used to get around this is:</p>
<pre><code>Dir.chdir(File.dirname(Rake.application.rakefile))
</code></pre>
<p>This statement has to be run at every level in the hierarchy except for the root, at the start of every rakefile. A shortened example of how this works in practice:</p>
<p>/rakefile:</p>
<p... | 11,574 |
<p>I have a piece of server-ish software written in Java to run on Windows and OS X. (It is not running on a server, but just a normal user's PC - something like a torrent client.) I would like the software to signal to the OS to keep the machine awake (prevent it from going into sleep mode) while it is active.</p>
<p... | <p>I use this code to keep my workstation from locking. It's currently only set to move the mouse once every minute, you could easily adjust it though.</p>
<p>It's a hack, not an elegant solution.</p>
<pre><code>import java.awt.*;
import java.util.*;
public class Hal{
public static void main(String[] args) throw... | <p>One simple way which i use to avoid "Windows desktop Auto lock" is "Switch On/Off NumLock" every 6 seconds.</p>
<p>Here a Java Program to Switch ON/OFF NumLock.</p>
<pre><code>import java.util.*;
import java.awt.*;
import java.awt.event.*;
public class NumLock extends Thread {
public void run() {
try {
... | 7,621 |
<p>I've got a number of non-technical users that all share a set of project files. It would be ideal to have them using version control, but I think that both subversion and git are too technical for non-technical office staff.</p>
<p>Is there any distributed source control software that would work well for normal pe... | <p>If source control is too technical they can use <a href="http://svnbook.red-bean.com/en/1.2/svn.webdav.autoversioning.html" rel="noreferrer">Subversion with WebDav</a>.</p>
<p>The less technical people will just save files normally from whatever application they use, without worrying/thinking about source control.... | <p>Have you tried Adobe's version cue? This is not open source / free but it may be easier to use for the end-user.</p>
<p><a href="http://www.adobe.com/products/creativesuite/versioncue/" rel="nofollow noreferrer">http://www.adobe.com/products/creativesuite/versioncue/</a></p>
| 7,291 |
<p>As you can see <a href="https://stackoverflow.com/questions/301854/set-selected-value-in-selectlist-after-instantiation">here</a> and <a href="https://stackoverflow.com/questions/295313/modelbinding-with-selectlist">here</a> I'm not a good friend of asp.net MVC's SelectList.<br>
This time I'm wondering how to count ... | <p>Linq has an extension method for <a href="http://www.hookedonlinq.com/CountOperator.ashx" rel="nofollow noreferrer">IEnumerable called Count().</a></p>
| <p>Linq does not have an extension method for IEnumerable called Count(). Count() is implemented for IEnumerable, which is a big difference.</p>
| 38,750 |
<p>I'm storing a tree in a DB using nested sets. The table's fields are id, lft, rgt, and name. </p>
<p>Given a node ID, I need to find all of its direct children(not grandchildren) that are themselves leaf nodes.</p>
| <p>The article <a href="http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/" rel="nofollow noreferrer">Managing Hierarchical Data in MySQL</a> gives a great example of how to use Nested Sets, and gives examples of many common queries, including this one.</p>
<p>here's how to find the immediate childre... | <p>In order to specify and differentiate leaf nodes, keep them with left=right. This changes two things:</p>
<ol>
<li>Leaves are easily identifiable. </li>
<li>When doing an insertion, you will add
only one to the values (left where >
new leaf, right where >= leaf).</li>
</ol>
| 40,835 |
<p>I have a project to recognize the footprint of animals. It is similar to facial recognition.<br>
There is a need to store footprint images in a database and compare them with images captured by camera.</p>
<p>What is the appropriate programming language to do this?</p>
| <p>Any language can be used for image processing, pattern recognition and object detection, which is what you're trying to do here. But you're better off finding a library or even an application instead, and then picking the language based on that choice.</p>
<p>Matlab is fine if you're familiar with it, unless you pl... | <p>Your biggest problem here is developing the algorithm, not choosing the language. My advice would be to prototype your project in Matlab, if you have access to it. What you are trying to do is an active area of research, and many researchers prefer Matlab and publish their Matlab code. This means that you may be ... | 32,497 |
<p>I just updated my Maker Select Plus from the stock (I believe RepRap-based) firmware to Advi3pp, which is Marlin based. The printer starts up and everything seems okay, but I haven't actually tried a print yet and there was a message during the upgrade about deleting incompatible settings. </p>
<p>What do I need to... | <p>If it is Marlin based or RepRap based, many parameters are stored in EEPROM memory. A G-code command <a href="https://reprap.org/wiki/G-code#M502:_Read_parameters_from_.22configuration.h.22" rel="nofollow noreferrer">M502: Read parameters from "configuration.h"</a> would reset all parameters that can be changed to t... | <p>Looks like I don't need to do anything. I printed a 20 mm calibration cube, and aside from some elephant footing it came out as clean and as close to the model dimensions as anything else I've ever put through the machine, with no changes. </p>
<p>So I'll recommend this as a first step to anyone else: start a 20 mm... | 1,348 |
<p>I've been printing small quantities from a PLA filament spool on a Craftbot printer for about two months now. Recently the printed objects have been coming out very brittle. Some structures that printed fine two months ago are now difficult to re-print. The print head gets clogged easily, and when the object does... | <p>Increase nozzle temperature. When the filament is new it will print easier, requiring less heat to print well. So if you didn't store your filament properly to begin with, increasing print temperature will make it jam less and increase layer bonding. </p>
<p>The reason for this is because the moisture that accumula... | <p>PLA absorbs moisture, so keeping the filament dry is a key factor. Aside from that, PLA is naturally more brittle than other plastics like ABS and Nylon Sorry, tried to find a graph to prove it, but couldn't find one.</p>
<p>There's a good <a href="https://groups.google.com/forum/#!topic/makerbot/Rdx2ZnJeQzs">Googl... | 325 |
<p>Shoes has some built in dump commands (Shoes.debug), but are there other tools that can debug the code without injecting debug messages throughout? Something like gdb would be great.</p>
| <p>You can also use Shoes.show_log to automatically open a debug console.</p>
| <p>I was a bit confused about the Apple-/ (or Alt-/) bit mentioned here. What I ended up doing was running <em>./shoes</em> with no arguments, which popped up the console, then started my app with <em>./shoes my_app.rb</em>. </p>
| 8,903 |
<p>I'm looking at a new project where both Native and Managed approaches sound like a good idea. This is a Windows desktop application which should support an MDI interface. The client area will make extensive use of Direct3D. The developers on the project are equally skilled on C#, C++/CLI and MFC.</p>
<p>MFC Advanta... | <p>Why not use both?</p>
<p>You can write the UI (forms) using C#/VB.NET and render the window using C++.</p>
<p>Basically all you need to do is pass the HWND (Window Handle) from the C# to the C++ and initialize the C++ using that value.</p>
<p>You can see an example on my blog: <a href="http://blogs.microsoft.co.i... | <p>This doesn't directly add to either list, but the current "recommended" way to do 3D with .NET is using XNA - Managed DirectX is being deprecated.</p>
<p>Edit: Of course, WPF 3D is also an option! Forgot about that :}</p>
| 30,490 |
<p>How do people usually detect the MIME type of an uploaded file using ASP.NET?</p>
| <p>in the aspx page:</p>
<pre><code><asp:FileUpload ID="FileUpload1" runat="server" />
</code></pre>
<p>in the codebehind (c#):</p>
<pre><code>string contentType = FileUpload1.PostedFile.ContentType
</code></pre>
| <p>Get MIME type from a file in ASP.NET Core</p>
<pre><code>public string GetMimeType(string filePath)
{
var provider = new FileExtensionContentTypeProvider();
if (!provider.TryGetContentType(filePath, out var contentType))
contentType = "application/octet-stream"; // fallback: unknown binary... | 10,688 |
<p>The <a href="http://docs.jquery.com/Events/bind#typedatafn" rel="noreferrer">jQuery documentation</a> says the library has built-in support for the following events: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select,... | <p>You can add and remove events of any kind by using the <a href="http://api.jquery.com/on/" rel="noreferrer"><code>.on()</code></a> and <a href="http://api.jquery.com/off" rel="noreferrer"><code>off()</code></a> methods</p>
<p>Try this, for instance</p>
<pre><code>jQuery(document).on('paste', function(e){ alert('pa... | <p>As jQuery 1.7 you can use <strong>bind(...)</strong> and <strong>unbind(...)</strong> methods for attaching and removing respectively handlers.</p>
<p>Here are examples align your questuion:</p>
<pre><code>$('#someElementId').bind('paste', function(){return false;});
</code></pre>
<p>- this one will block any att... | 29,361 |
<p>When Internet Explorers AutoComplete is turned on for Forms the entries for each field in the HTML form should be cached and displayed as a prompt when the user starts entering content into the form the second time around. </p>
<p>On my website the AutoComplete feature is never displayed for any forms that exist o... | <p>I have determined that the problem is related to the Cache-Headers PHP sends out when the start_session() command is issued and the site is running SSL.</p>
<p>I have been able to get a hold of a person on the IE security team at Microsoft and they have confirmed that this is how IE is supposed to work. Here is a ... | <p>Do you have <code>autocomplete="off"</code> as an attribute in your form elements?</p>
| 47,528 |
<p>I'd like to ignore multiple wildcard routes. With asp.net mvc preview 4, they ship with:</p>
<pre><code>RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
</code></pre>
<p>I'd also like to add something like:</p>
<pre><code>RouteTable.Routes.IgnoreRoute("Content/{*pathInfo}");
</code></pre>
<p>but tha... | <p>There are two possible solutions here.</p>
<ol>
<li><p>Add a constraint to the ignore route to make sure that only requests that should be ignored would match that route. Kinda kludgy, but it should work.</p>
<pre><code>RouteTable.Routes.IgnoreRoute("{folder}/{*pathInfo}", new {folder="content"});
</code></pre></l... | <p>This can be quite tricky.</p>
<p>When attempting to figure out how to map route data into a route, the system currently searches top-down until it finds something where all the required information is provided, and then stuffs everything else into query parameters.</p>
<p>Since the required information for the rou... | 5,019 |
<p>Recently I ran into this error in my web application:</p>
<blockquote>
<p>java.lang.OutOfMemoryError: PermGen space</p>
</blockquote>
<p>It's a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6.
Apparently this can occur after redeploying an application a few times.</p>
<p>What ca... | <p>The solution was to add these flags to JVM command line when Tomcat is started:</p>
<pre><code>-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
</code></pre>
<p>You can do that by shutting down the tomcat service, then going into the Tomcat/bin directory and running tomcat6w.exe. Under the "Java&quo... | <p>If any one is struggling with the same error in netbeans, then here is how I fixed it.</p>
<p><strong>In Netbeans:</strong></p>
<p>Go to services tab --> Right on server -->Choose properties --> go to platform tab -->Inside vm options type -Xms1024m</p>
<p>In my case, I have given -Xms4096m</p>
<p>Here is the sc... | 11,382 |
<p>We're using the Eclipse CDT 5 C++ IDE on Windows to develop a C++ application on a remote AIX host. </p>
<p>Eclipse CDT has the ability to perform remote debugging using gdbserver. Unfortunately, gdbserver is not supported on AIX. </p>
<p>Is anyone familiar with a way to debug remotely using Eclipse CDT without gd... | <p>finally I got gdb run remotly anyhow now. At the Bug-symbol on the taskbar I took Debug Configurations - GDB Hardware Debugging.</p>
<p>In Main C/C++ Applications I set the full path on the Samba share of the executable (<code>X:\abin\vlmi9506</code>). I also set a linked folder on <code>X:\abin</code> in the proje... | <p>tried also to remotly debug an aix-appl with windows eclipse-cdt-gdb.
Got blocked at the end with unix/windows path-problems. Maybe my result can help u a little further - maybe you already got it work. I'm interested in your comment. asked on eclipse news portal- following the answer of martin oberhuber (thanks aga... | 10,677 |
<p>How do you create a static class in C++? I should be able to do something like:</p>
<pre><code>cout << "bit 5 is " << BitParser::getBitAt(buffer, 5) << endl;
</code></pre>
<p>Assuming I created the <code>BitParser</code> class. What would the <code>BitParser</code> class definition look like?</p>... | <p>If you're looking for a way of applying the "static" keyword to a class, like you can in C# for example, then you won't be able to without using Managed C++.</p>
<p>But the looks of your sample, you just need to create a public static method on your BitParser object. Like so:</p>
<p><strong>BitParser.h</st... | <p>One case where namespaces may not be so useful for achieving "static classes" is when using these classes to achieve composition over inheritance. Namespaces cannot be friends of classes and so cannot access private members of a class.</p>
<pre><code>class Class {
public:
void foo() { Static::bar(*this); }
... | 3,075 |
<p>I am using Borland Turbo C++ with some inlined assembler code, so presumably Turbo Assembler (TASM) style assembly code. I wish to do the following:</p>
<pre><code>void foo::bar( void )
{
__asm
{
mov eax, SomeLabel
// ...
}
// ...
SomeLabel:
// ...
}
</code></pre>
<p>So the address ... | <p>Last time I tried to make some assembly code Borland-compatible I came across the limitation that you can't forward-reference labels. Not sure if that's what you're running into here.</p>
| <p>From what I recall, you can't use an external (C++) label in your inline assembly, although you can have TASM-style labels in the asm block that can be referenced by the assembly instructions itself. I think I would use a flag and a post-assembler switch statement to handle branching. For example:</p>
<pre><code>in... | 25,668 |
<p>I wanted to compare the datetime which is in this format "7/20/2008" with the ones in the database which is in format "7/20/2008 7:14:53 AM".</p>
<p>I tried using "like" clause but it did not work beacuse the "like" clause uses only string and the one which I am using is date time format.</p>
<p>Can anyone tell ho... | <p>I assume you're having a problem because <code>date1</code> contains a date only, while your database contains full date/time values. To find matches you need to pick one of these approaches:</p>
<p>1) Remove the time information from the database values before comparing them to your target
2) Convert your target i... | <p>Instead of comparing the date directly, compare it two the min/max you'd accept. So instead of "DbDateCol = mydate" do "DbDateCol >= myDate.Date and DbDateCol < myDate.Date.AddDays(1)".</p>
<p>By using the Date property, you'll lop off the time component (force it to 0). By adding a day, you'll get the start of ... | 27,489 |
<p><strong>problem solved by resetting cura.</strong></p>
<p>I have problems like this: How can I fix this? I can't find the right setting.</p>
<p><a href="https://i.stack.imgur.com/2cf9Q.png" rel="nofollow noreferrer" title="No top layer"><img src="https://i.stack.imgur.com/2cf9Q.png" alt="No top layer" title="No to... | <p>This problem appears when a face is inverted, so the slicer confuses and expect the other wall to close the object. So you need to reverse that face to show the face out and the back face inside the shape to be filled</p>
<p><a href="https://i.stack.imgur.com/OklcS.png" rel="nofollow noreferrer"><img src="https://i... | <p>I'm pretty sure the yellow lines are showing the full path of the extruder head, including where it's retracted. Somewhere in Cura's maze of menus, there's an option to turn on/off various displays related to the slicing. </p>
<p>As to why the top layer isn't there -- most likely it's too thin in your source mod... | 1,036 |
<p>Would like to programmically change the connecton string for a database which utilizes the membership provider of asp.net within a windows application. The system.configuration namespace allows changes to the user settings, however, we would like to adjust a application setting? Does one need to write a class with u... | <p>You can programatically open the configuration with using the System.configuration namespace: </p>
<p><code>Configuration myConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);</code></p>
<p>Then you can access the connection strings collection at:</p>
<p><code>myConfig.ConnectionStrin... | <p>Use the ConnectionStringsSection class. The documentation even provides an example on how to create a new ConnectionString and have the framework save it to the config file without having to implement the whole XML shebang.</p>
<p>See <a href="http://msdn.microsoft.com/en-us/library/system.configuration.connections... | 8,898 |
<p>We're deploying some new WCF calls in our SQL 2005 DB using the CLR. In testing, I hardcoded in the code the endpoint to connect to, and deployed it to our test server. When we go to deploy this to production, we will be deploying it to many different SQL DBs, and using different endpoints to connect to (same servic... | <p>The solutions above would work, but we found that the best practice approach would be to create a new table storing all of the different endpoints into the DB. Then, we updated the CLR to make a call to this table to get the endpoint(s) that were needed. So each server would have the proper metadata loaded for it, a... | <p><a href="http://www.sqljunkies.ddj.com/Article/6CA864E9-E107-408E-B30A-4BA15B0CD11C.scuk" rel="nofollow noreferrer">Accessing Application Configuration Settings from SQL CLR</a> </p>
<p>another <a href="http://blogs.neudesic.com/blogs/shaun_collett/archive/2007/04/29/6050.aspx" rel="nofollow noreferrer">technique</... | 14,935 |
<p>I've been working on my own DIY 3-D printer recently, and I've been trying to experiment a little with different materials for the body. Someone suggested using HDPE (high-density polyethylene), since it works well on a CNC machine, which would make creating a number of prototypes easy. I know HDPE can also be used ... | <p>I've used what is commonly described as UHMW-PE, aka, Ultra-high Molecular Weight Polyethylene for various projects. You may know this material is often used in cutting boards, as it cleans easily and doesn't cut easily.</p>
<p>it does machine in a manner similar to aluminum, although the tool should be cooled/lubr... | <p>I've tried this material (8 mm thickness) for a Prusa i3 clone of my own design but needed to abandon using it as it doesn't allow to be cut by laser easily on my friends laser cutting machine (not a hobby laser cutting machine, it is his business). </p>
<p>HDPE requires lower speed than cutting Plexiglas or Acryli... | 303 |
<p>Hey I was wondering if there were any way to upload images in ASP? I am working on my school's server and I don't really know what is installed and what isn't I Googled a little and came up with "Persits.Upload.1" I tried to instantiate the object with this line:</p>
<p><code>Set Upload = Server.CreateObject("Per... | <p>Sounds like it couldn't load the class, my ASP very rusty though. </p>
<p>That component is a commercial one, so unless someone has paid for it, you probably don't have it installed. </p>
<p>I have used free asp upload <a href="http://www.freeaspupload.net/" rel="nofollow noreferrer">http://www.freeaspupload.ne... | <p>If it's for educational purposes it may be worth droping <a href="http://www.aspupload.com/support.html" rel="nofollow noreferrer">Persits</a> an email to see if they will give you a free license.</p>
<p>They offer a 30-day free trial on their site.</p>
<p>Good luck</p>
| 47,027 |
<p>I have an extrusion problem with my creality CR 10 3D printer while printing.
I am using a standard 0.4 mm nozzle with a 1.75 mm diameter PLA and I use Cura as my slicer.</p>
<p>This printer worked perfectly fine and I stopped using it a few months ago right after the problem started.</p>
<p>When I try p... | <p>Without images of the problem it is difficult to diagnose, but, the described symptoms sounds as if the nozzle is too close to the bed. If the nozzle is too close to the bed, and the extruder not strong enough, the filament flow is very limited due to pressure caused by a very small opening between the nozzle and th... | <p>Clearly you're having an extrusion problem. Extrusion problems usually come either from a clogged nozzle (as @Adam S. said) or from the extruder it self. To determine where the problem is located I would first do a flow rate test using <a href="https://www.youtube.com/watch?v=lWBkPIXTOlo&feature=emb_logo" rel="n... | 1,659 |
<p>I was looking through the plans for C++0x and came upon <code>std::initializer_list</code> for implementing initializer lists in user classes. This class could not be implemented in C++
without using itself, or else using some "compiler magic". If it could, it wouldn't be needed since whatever technique you used t... | <p><code>std::type_info</code> is a simple class, although populating it requires <code>typeinfo</code>: a compiler construct.</p>
<p>Likewise, exceptions are normal objects, but throwing exceptions requires compiler magic (where are the exceptions allocated?).</p>
<p>The question, to me, is "how close can we get to... | <p>I think you're pretty safe on this score. C++ mostly serves as a thick layer of abstraction around C. Since C++ is <em>also</em> a superset of C itself, the core language primitives are almost always implemented sans-classes (in a C-style). In other words, you're not going to find many situations like Java's <cod... | 30,746 |
<p>I have an ASP.NET page with a gridview control on it with a CommandButton column with delete and select commands active.</p>
<p>Pressing the enter key causes the first command button in the gridview to fire, which deletes a row. I don't want this to happen. Can I change the gridview control in a way that it does no... | <p>Every once in a while I get goofy issues like this too... but usually I just implement a quick hack, and move on :)</p>
<pre><code>myGridView.Attributes.Add("onkeydown", "if(event.keyCode==13)return false;");
</code></pre>
<p>Something like that should work.</p>
| <p>In Page_Load, set the focus on the textbox.</p>
| 18,343 |
<p>I know Flex pretty good but also started to use Java FX. I am a little bit confused. Java FX seems to focus more on low level drawing operations and animations. Less on creating standard UIs like Flex.</p>
<p>So is JavaFX more like Flash than Flex?</p>
<p>On the other side JavaFX also supports Swing components as ... | <p>I think JavaFX is more like Flex, because JavaFX is more about building applications than animations (which is, I gather, one of the sensitive distinctions between Flex and Flash). </p>
<p>I think of JavaFX and Flex as the future heirs to Rich Internet Application programming. They're both intended to stretch the... | <p>I'd say it's more like Flash - or at least it's about bringing Flash-like abilities to Java. Don't forget that Flex is built on top of Flash. JavaFX script from what I've seen is quite similar to ActionScript, and not at all like MXML. Sun seem to be stressing the importance of things like video and the ability to w... | 35,005 |
<p>We are deploying our ASP.NET 3.5 app to a production server for beta testing.</p>
<p>Each page is secured using SSL.</p>
<p>On our homepage (default.aspx) we have web services which populate flash objects.</p>
<p>I am getting an error:</p>
<p>The HTTP request is unauthorized with client authentication scheme 'An... | <p>I would think that the request from Flash to the secure web services doesn't have credentials or that the secure certificate in the response can't be validated.</p>
<p>Probably both.</p>
<p>So in flash there will probably need to be some code like:</p>
<pre><code>request.Username = "xyz"
request.Password = "***"
... | <p>Sounds like IIS isn't configured for <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/9ded7af2-fcb7-4ed2-b007-e19f971f6e13.mspx?mfr=true" rel="nofollow noreferrer">anonymous access</a>. </p>
<p>If you believe you have it setup correctly (sounds like it isn't), then you might try t... | 30,874 |
<p>We have an application that has one or more text console windows that all essentially represent serial ports (text input and output, character by character). These windows have turned into a major performance problem in the way they are currently code... we manage to spend a very significant chunk of time in them.... | <p>I agree with Will Dean that the drawing in a console window or a text box is a performance bottleneck by itself. You first need to be sure that this isn't your problem. You say that you draw each line as a whole, but even this could be a problem, if the data throughput is too high. </p>
<p>I recommend that you don'... | <blockquote>
<p>Are the output windows part of the
same application? It almost sounds
like they aren't...</p>
</blockquote>
<p>Yes they are, all in the same process.</p>
<p>I did not write this code... but it seems like SendMessage is a bit heavy for this all in one application case. </p>
<blockquote>
<p>You... | 49,862 |
<p>There is someone in my team that swears by using some kind of GVim feature to do manually code folding.</p>
<p>As I'm using another editor and do not really need the folding feature, I think it only pollutes the source code with tags like:</p>
<pre><code>/* {{{1 */
</code></pre>
<p>Convincing the person not to us... | <p>I would imagine he could just add the following to his .vimrc: </p>
<pre><code>set foldmethod=syntax
</code></pre>
<p>Assuming he is using a version of VIM that supports that. :)</p>
| <p>You should try it yourself. Once you start using foldmethod=marker there is just no going back. I am working on a project now where I can't use marker folding and it feels like washing clothes in a time before there were washing machines.</p>
| 49,643 |
<p>Using online interfaces to a version control system is a nice way to have a published location for the most recent versions of code. For example, I have a LaTeX package here (which is released to CTAN whenever changes are verified to actually work):</p>
<p><a href="http://github.com/wspr/pstool/tree/master" rel="no... | <p>I am using Tortoise SVN for small system ASP.NET development. Most code is interpreted ASPX, but there are around a dozen binary DLLs generated by a manual compile step. Whilst it doesn't make a lot of sense to have these source-code versioned in theory, it certainly makes it convenient to ensure they are correctly ... | <p>In some cases we do, but it's more of a sysadmin type of use case, where the generated files (say, DNS zone files built from a script) have intrinsic interest in their own right, and the revision control is more linear audit trail than branching-and-tagging source control.</p>
| 6,024 |
<p>Given a table structure like this:</p>
<pre><code>CREATE TABLE `user` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`username` varchar(16) NOT NULL,
`password` char(32) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
);
</code></pre>
<p>Is there any use... | <p>I've always been told and read that you should include the <code>LIMIT</code> everytime you only want 1 result. This just tells the DB that it should stop so matter what. In your case, you're probably right it doesn't make a difference, but I think it's better just to always do than always deciding and leaving it ou... | <p>The sql query optimizer should be smart enough to figure this out.</p>
| 23,059 |
<p>Having recently produced an HTML/CSS/Javascript based report from various word and excel files sent to me I'm trying to work out how to do this better in future, ideally enabling non-technical users in the office to do many of the tasks currently handed to me.</p>
<p>There are a range of HTML editors out there but ... | <p>You can't give your non-technial users such a complex HTML template and hope they will not break it. There is no HTML editor that can enforce such rules for structures that are more complex than a class attribute on an element.</p>
<p>This scenario calls for the use of XML: you need to separate your content and pre... | <p>Have you tried <a href="http://www.fckeditor.net/" rel="nofollow noreferrer">FCKEditor</a>. It is very popular and used in a number of blogs, wikis and CMSs. It can produce very clean HTML and is highly customizable.</p>
| 18,501 |
<p>I've just started experimenting with SDL in C++, and I thought checking for memory leaks regularly may be a good habit to form early on. </p>
<p>With this in mind, I've been running my 'Hello world' programs through Valgrind to catch any leaks, and although I've removed everything except the most basic <code>SDL_In... | <p>Be careful that Valgrind isn't picking up false positives in its measurements.</p>
<p>Many naive implementations of memory analyzers flag lost memory as a leak when it isn't really.</p>
<p>Maybe have a read of some of the papers in the external links section of the <a href="http://en.wikipedia.org/wiki/IBM_Rationa... | <p>As per Rob Wells' comments on Purify, download and try out some of the other tools out there. I use BoundsChecker and AQTime, and have seen different false positives in both over the years. Note that the memory leak might also be in a third party component, which you may want to exclude from your analysis. From e... | 28,876 |
<p>I've just introduced a friend to <strong>GNU Screen</strong> and they're having a hard time getting used to it. That makes me think about the essential things he needs to know about the excellent <strong>Screen</strong> utility, the same things that you'd think worthwhile to teach someone, a beginner, from the groun... | <p>I've been using <code>Screen</code> for over 10 years and probably use less than half the features. So it's definitely not necessary to learn all its features right away (and I wouldn't recommend trying). My day-to-day commands are:</p>
<pre><code>^A ^W - window list, where am I
^A ^C - create new window
^A space -... | <p>^A A switches back to the screen you just came from.</p>
| 9,605 |
<p>I'm struggling to find examples/explanations of coding a MS Certificate Authority exit module. </p>
<p>If anybody has any help or resources they can point me at I'd be grateful.</p>
| <p>Perhaps this article will help you? <a href="http://msdn.microsoft.com/en-us/library/aa388214.aspx" rel="nofollow noreferrer">Writing Custom Exit Modules</a></p>
| <p>The Windows 7 SDK contains a sample in directory security/certificateservices/exit/c++/.</p>
<p>You can download only the sample here: <a href="https://github.com/Microsoft/Windows-classic-samples/tree/master/Samples/Win7Samples/security/certificateservices/exit/c%2B%2B/WindowsServer2008R2" rel="nofollow noreferrer... | 25,515 |
<p>I have inherited some legacy PHP code what was written back when it was standard practice to use <a href="http://php.net/register_globals" rel="nofollow noreferrer"><code>register_globals</code></a> (As of PHP 4.2.0, this directive defaults to off, released 22. Apr 2002).</p>
<p>We know now that it is bad for secur... | <p>If you set error reporting to E_ALL, it warns in the error log about undefined variables complete with filename and line number (assuming you are logging to a file). However, it will warn only if when it comes across an undefined variable, so I think you will have to test each code path. Running php from the command... | <p>I know that there's a way to set php.ini values for that script with a certain command, I thus went looking and found this too - <a href="http://forums.macosxhints.com/archive/index.php/t-8538.html" rel="nofollow noreferrer">Goto last post on page</a></p>
<p>I also found the following post which may be of use - <a ... | 2,836 |
<p>In Apple's NSObject documentation, NSZoneFree is called in the - (void)dealloc example code:</p>
<pre><code>- (void)dealloc {
[companion release];
NSZoneFree(private, [self zone])
[super dealloc];
}
</code></pre>
<p>You can find it in context <a href="http://developer.apple.com/documentation/Cocoa/Refe... | <p><code>NSZoneFree()</code> balances out a call to <code>NSZoneMalloc()</code>, just like <code>-release</code> balances a call to <code>-alloc</code> or <code>-copy</code> and <code>CFRelease()</code> balances a call to <code>CFRetain()</code> or <code>CF*Create*()</code> or, for that matter, <code>free()</code> bala... | <p>According to the <a href="https://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Foundation_Functions.pdf" rel="nofollow noreferrer">Foundation Reference</a>:</p>
<blockquote>
<p>Returns memory to the zone from which it was allocated. The standard C ... | 42,194 |
<p>I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have an entity, <code>User</code>, which I have mapped to a table <code>USERS</code> in the DB using Hibernate. I want to have an image associated with this entity, which I plan to store as a <code>BLOB</code> in the DB. I also want to di... | <p>Yes your suggested solution will work. Given that you are working in a Java environment storing the images in the database is the best way to go. If you are running in a single server environment with an application server that will let you deploy in an exploded format technically you could store the images on disk ... | <p>If you want to display the user image directly with their properties perhaps you can consider embedding the image data directly in the HTML.</p>
<p>Using a special data: URL scheme you are able to embed any mime data inside a HTML page, the format is as follows:</p>
<blockquote>
<pre><code>data:<mimetype>;ba... | 18,218 |
<p>I'm developing a web tool using JSP, where there are many users of multiple kind (i.e. administrators, guest, write-enabled users, ...). Since this will be a subscription based system (i.e. user pay for a 3/6/12 month subscription), I need to enforce at most 1 login per user at the same time.
For example, say Mr. Jo... | <ol>
<li>When a user logs in, store the <code>HttpSession.getId()</code> for that user. This could be in an application scope Map from user names to session IDs, or in the database.</li>
<li>For each subsequent request, for a logged-in user, check that <code>request.getSession().getId()</code> is the one stored for tha... | <p>When a user logs in you will want to invalidate any other login they might have at the time. This means doing a check on every request that is made, but you should have that for basic validation anyway. For example you can check the IP address they are accessing from, or the servlet session id, etc. These are all go... | 42,264 |
<p>This may be simple one, but 5 mins of Googling didn't give me the answer.
How do you save and load bitmaps using .Net librabries?</p>
<p>I have an Image object and I need to save it to disk in some format (preferably png) and load back in later.
A C# example would be great.</p>
| <p>Here's a really simple example.</p>
<p><strong>Top of code file</strong></p>
<pre><code>using System.Drawing;
</code></pre>
<p><strong>In code</strong></p>
<pre><code>Image test = new Bitmap("picture.bmp");
test.Save("picture.png", System.Drawing.Imaging.ImageFormat.Png);
</code></pre>
<p>Remember to give write... | <p>About 10 seconds of google lead me to <a href="http://msdn.microsoft.com/en-us/library/9t4syfhh.aspx" rel="nofollow noreferrer">this example</a> for the save method, you can dig around a bit more for the others.</p>
| 20,996 |
<p>I need to reverse engineer a Microsoft SQL Server 2008 in order to create a Microsoft Visio 2007 Database Model Diagram. So I choose "Reverse Engineer" from the Database menu to connect to the DB.</p>
<p>I configured the Microsoft SQL Server Visio driver so that is uses SQL Server Native Client 10.0 as the ODBC dri... | <p>From <a href="http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3825120&SiteID=17" rel="noreferrer">Microsoft support</a> via the Microsoft forums:</p>
<blockquote>
<p>Further investigation reveals that this is expected behavior for Visio 2007. When Visio opens a connection using the Visio SQL Server D... | <p>I also had this problem as above what i found worked </p>
<ol>
<li>was using the Reverse engineer wizard </li>
<li>using the Generic OLE Db provider in the first step </li>
<li>then setting the connection provider in
the next step to the highest SQL native driver shown ( I am using
SQL2016 with SQL native 11.... | 11,828 |
<p>HI,</p>
<p>I am trying to write a query in vba and to save its result in a report.
I am a beginner. this is what i have tried
can somebody correct me</p>
<pre><code>Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
Dim sql As String
Set cn = CurrentProject.Connection
sql = "Select * from table1 where emp... | <p><strong>IF you are wanting to create a report using MS Access's report generator</strong>, you will have to use a Query Object (there might be a way to trick MS Access into running it off of your record set, but it's probably not worth your effort). </p>
<p>You can create the Query Object on the "Database" window. ... | <p>Normally you would design the report based on a data source. Then after your report is done and working properly you use VBA to display or save the report.</p>
| 29,656 |
<p>How do I totally disable caching in nHibernate?</p>
| <p>Use the IStatelessSession to bypass the first level cache: <a href="http://darioquintana.com.ar/blogging/?p=4" rel="noreferrer">http://darioquintana.com.ar/blogging/?p=4</a></p>
<p>In order to use the second level cache you must explicitly configure it. You will not use it if you don't.</p>
<p>You can also turn o... | <p>Note IStatelessSession is I think new in Nhibernate 2.0</p>
<p>second level cache configuration details : <a href="http://nhibernate.info/doc/nhibernate-reference/caches.html" rel="nofollow noreferrer">Chapter 25. NHibernate.Caches</a></p>
| 14,377 |
<p>Ok, I am trying to use Tail to monitor a log file, but I cannot get the same behavior programatically as when I manually run it through cmd prompt using the same parameters.</p>
<p>When run through cmd prompt it displays the new lines <strong>instantly</strong>. Programatically though, I have to wait for about <stro... | <p>Process.StandardOutput, when redirected, defaults to a StreamReader with a 4096-byte buffer, so the answer is yes.</p>
| <p>In most languages and operating systems the standard stream is usually buffered, but the error stream is not.</p>
<p>Try using:
<code>
System.Console.Error
</code></p>
| 29,431 |
<p>We have a few very large Excel workbooks (dozens of tabs, over a MB each, very complex calculations) with many dozens, perhaps hundreds of formulas that use the dreaded INDIRECT function. These formulas are spread out throughout the workbook, and target several tables of data to look-up for values.</p>
<p>Now I nee... | <p>You could iterate over the entire Workbook using vba (i've included the code from @PabloG and @euro-micelli ):</p>
<pre><code>Sub iterateOverWorkbook()
For Each i In ThisWorkbook.Worksheets
Set rRng = i.UsedRange
For Each j In rRng
If (Not IsEmpty(j)) Then
If (j.HasFormula) Then
... | <p>You can use something like this in VBA:</p>
<pre><code>Sub ListIndirectRef()
Dim rRng As Range
Dim oSh As Worksheet
Dim oCell As Range
For Each oSh In ThisWorkbook.Worksheets
Set rRng = oSh.UsedRange
For Each oCell In rRng
If InStr(oCell.Formula, "INDIRECT") Then
Debug.Print oCell.Addr... | 5,474 |
<p>I want to, from JavaScript, access as a variable the file that is loaded as an image in an img tag. </p>
<h2>I don't want to access its name, but the actual data.</h2>
<p>The reason for this is that I want to be able to copy it to and from variables so that I can , among other things, change the image without relo... | <pre><code>// Download the image data using AJAX, I'm using jQuery
var imageData = $.ajax({ url: "MyImage.gif", async: false }).responseText;
// Image data updating magic
imageDataChanged = ChangeImage(imageData);
// Encode to base64, maybe try the webtoolkit.base64.js library
imageDataEncoded = Base64Encode(imageDat... | <p>Try this:</p>
<pre><code>img = new Image();
img.src = "imagefile.jpg";
</code></pre>
| 38,146 |
<p>When I maximize 1 MDI child form, all MDI child forms would be maximized too. Is it possible to have 1 form maximized and another one not?</p>
<p>Thanks in advance.</p>
| <p>A maximized MDI child form should occupy the entire child area and so the state of the other children should not really matter as they are not visible. </p>
| <p>Not possible. Only thing you can do is to set the window in front non MDI and taskbar = no</p>
| 39,725 |
<p>A couple of recent questions discuss strategies for naming columns, and I was rather surprised to discover the concept of embedding the notion of foreign and primary keys in column names. That is</p>
<pre><code>select t1.col_a, t1.col_b, t2.col_z
from t1 inner join t2 on t1.id_foo_pk = t2.id_foo_fk
</code></pre>
<... | <p>I agree with you that the foreign key column in a child table should have the same name as the primary key column in the parent table. Note that this permits syntax like the following:</p>
<pre><code>SELECT * FROM foo JOIN bar USING (foo_id);
</code></pre>
<p>The USING keyword assumes that a column exists by the ... | <p>I agree with you--I take a different approach that I have seen recommended in many corporate environments:</p>
<p>Name columns in the format <em>TableNameFieldName</em>, so if I had a Customer table and UserName was one of my fields, the field would be called CustomerUserName. That means that if I had another table... | 26,313 |
<p>I've got a PHP application which needs to grab the contents from another web page, and the web page I'm reading needs a cookie.</p>
<p>I've found info on how to make this call once i have the cookie ( <a href="http://groups.google.com/group/comp.lang.php/msg/4f618114ab15ae2a" rel="nofollow noreferrer">http://groups... | <p>You'd probably be better off using <a href="http://www.php.net/curl" rel="noreferrer">cURL</a>.
Use <a href="http://www.php.net/manual/en/function.curl-setopt.php" rel="noreferrer">curl_setopt</a> to set up the cookie handling options.</p>
<p>If this is just a one-off thing, you could use Firefox with <a href="http... | <p>You'd probably be better off using <a href="http://www.php.net/curl" rel="noreferrer">cURL</a>.
Use <a href="http://www.php.net/manual/en/function.curl-setopt.php" rel="noreferrer">curl_setopt</a> to set up the cookie handling options.</p>
<p>If this is just a one-off thing, you could use Firefox with <a href="http... | 30,673 |
<p>I'm having an issue with an ObservableCollection getting new items but not reflecting those changes in a ListView. I have enough quirks in the way I'm implementing this that I'm having a hard time determining what the problem is.</p>
<p>My ObservableCollection is implemented thusly:</p>
<pre><code>public class Me... | <p>I resolved this issue.</p>
<p>Neither the static property or the context of the incoming data had anything to do with the issue (which seems obvious in hindsight).</p>
<p>The XAML which was generated from Expression Blend was not up to the task for some reason. All I did to get this to work was assign the ItemSour... | <p>You need to make your poco class within the ObservableCollection implement INotifyPropertyChanged.</p>
<p>Example:</p>
<pre><code><viewModels:LocationsViewModel x:Key="viewModel" />
.
.
.
<ListView
DataContext="{StaticResource viewModel}"
ItemsSource="{Binding Locations}"
IsItemClickEnable... | 45,545 |
<p>I am new to grails.I am doing web application that uploads the image from client side and it stores that in server.</p>
<p>My Gsp code is:</p>
<pre><code><g:uploadForm action="saveImage">
<input type="file" name="image">
<input type="submit" value="Submit">
</g:uploadForm>
</code></pre>
<... | <p>I dont know the following answer is a right way to find the extension of the file.I am also new to this.But this answer is working</p>
<p>Use <strong>file.getOriginalFilename()</strong> method.It returns a string like "test.jpg".Then you split the filename using tokenize method by ".".Then you take the last string ... | <p>Okay, this is really late. But what I found the best solutions (as extensions don't really say something about the content) was to use <code>file.getContentType()</code> ...</p>
<p>E.g., for jpeg images the return value will be a string <code>image/jpeg</code> that you can easily test. Same for other file formats (... | 47,380 |
<p>I use Struts v1.3 and have following input form:</p>
<p>In struts-config.xml:</p>
<pre><code> <form-bean name="testForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="displayName" type="java.lang.String" />
</form-bean>
</code></pre>
<p... | <p>You may have a chance to trim the string right at the moment, the request processor updates the data from the input fields to the form. This was not tested, but what happens when you modify the setter setDisplayName(String displayName) to something like </p>
<pre><code>public void setDisplayName(String displayName)... | <p>Alternatively try using javascript regexp in the jsp that will trim onfocus or onblur</p>
<blockquote>
<p>< html:text name="testForm" property="displayName" onfocus="javascript:this.value=this.value.replace(/^\s+|\s+$/g,'')" onblur="javascript:this.value=this.value.replace(/^\s+|\s+$/g,'')" /></p>
</blockquo... | 29,746 |
<p>I'm trying to call the SQL statement below but get the following error:</p>
<blockquote>
<p>System.Data.SqlClient.SqlException: Conversion failed when converting
the varchar value '+@buildingIDs+' to data type int.</p>
</blockquote>
<pre><code>@"SELECT id, startDateTime, endDateTime
FROM tb_bookings
W... | <p>Bravax's way is a bit dangerous. I'd go with the following so you don't get attacked with SQL Injections:</p>
<pre><code>int[] buildingIDs = new int[] { 1, 2, 3 };
/***/ @"SELECT id, startDateTime, endDateTime From tb_bookings WHERE buildingID IN (" +
string.Join(", ", buildingIDs.Select(id => id.ToString... | <p>It's trying to compare an int with the string value '+@buildingsIDs+'<br>
So it tries to convert the string to convert it to an int and fails.</p>
<p>So do the following:<br>
<code>
buildingsIDs = "1, 5, 6";<br>
@"SELECT id, startDateTime, endDateTime From tb_bookings WHERE buildingID IN (" + buildingIDs + ") AND s... | 22,016 |
<p>Say I'm mapping a simple object to a table that contains duplicate records and I want to allow duplicates in my code. I don't need to update/insert/delete on this table, only display the records.</p>
<p>Is there a way that I can put a fake (generated) ID column in my mapping file to trick NHibernate into thinking ... | <p>The NHibernate mapping makes the assumption that you're going to want to save changes, hence the requirement for an ID of some kind.</p>
<p>If you're allowed to modify the table, you could add an identity column (SQL Server naming - your database may differ) to autogenerate unique Ids - existing code should be unaf... | <p>If you're data is read only one simple way we found was to wrapper the query in a view and build the entity off the view, and add a newguid() column, result is something like </p>
<p>SELECT NEWGUID() as ID, * FROM TABLE</p>
<p>ID then becomes your uniquer primary key. As stated above this is only useful for read... | 32,394 |
<p>Lets say I have an array like this:</p>
<pre><code>string [] Filelist = ...
</code></pre>
<p>I want to create an Linq result where each entry has it's position in the array like this:</p>
<pre><code>var list = from f in Filelist
select new { Index = (something), Filename = f};
</code></pre>
<p>Index to be 0 ... | <p>Don't use a query expression. Use <a href="http://msdn.microsoft.com/en-us/library/bb534869.aspx" rel="noreferrer">the overload of <code>Select</code> which passes you an index</a>:</p>
<pre><code>var list = FileList.Select((file, index) => new { Index=index, Filename=file });
</code></pre>
| <p>You <strong>cannot get an index</strong> using pure LINQ query expressions (those with <code>from.. where.. select..</code> clauses).</p>
<p>However, this doesn't mean you have to completely give up on this LINQ query style. </p>
<p>You just have to <strong>get out of the LINQ query expression</strong> and use a ... | 33,783 |
<p>What's the best way to consume REST web services from .NET?</p>
| <p>A straight forward and easy approach would be to use WebClient which is in the System.Net namespace. </p>
<p>Pretty much all you need to do is pass in the Uri required with any parameters needed in the form of a query string and you should get back the response in the form of a string, be it json or xml. For exampl... | <p>Do you want to consume or publish. If you want to consume, such as making requests the best way to interact with it is to figure out the type it will comback as, usually JSON or XML. After you have your type you can use XmlDocument or JavaScriptSerializer to pull back the information and use it. </p>
<p>If you w... | 42,668 |
<p>I got myself a new 8 gig USB key and I'm looking for a decent solution to have a portable RoR environment to learn on. I did the google on it and found a few possibilities, but I'm curious to hear some real life experiences and opinions. Thanks!</p>
| <p>I like <a href="http://instantrails.rubyforge.org" rel="noreferrer">InstantRails</a>, very easy to use, no installer, and does not modify your system environment.</p>
| <p>Assuming you're on Windows, I'd go for <a href="http://instantrails.rubyforge.org/" rel="nofollow noreferrer">Instant Rails</a> and <a href="http://www.netbeans.org/" rel="nofollow noreferrer">Netbeans</a> (with a JVM for Netbeans).</p>
<p>Netbeans is a bit heavy-weight, but it supports lots of nice rails focused I... | 32,315 |
<p>Not a programming question per se, but interesting for people who do commercial web development.</p>
<p>How do you track all of your clients' hosting, domain registration, and SSL certificate expiry dates?</p>
<p>Do you just keep a spreadsheet or is there some useful piece of software for this?</p>
<p>I've search... | <p>How about we turn it into a programming question! You could use this code (C#), though I would recommend modifying it a bit (e.g. put url's in a file) and throwing it into a service.</p>
<p>This code sets up a certificate validation callback which the HttpWebRequest will call anytime it encounters a certificate. ... | <p>Give a try to <a href="https://epazote.io" rel="nofollow">epazote</a> basically you can create a list of sites (services) on a yaml file and receive an email/alert/hipchat notification before the certificate expires, example:</p>
<pre><code>services:
google:
url: https://www.google.com
seconds: ... | 47,206 |
<p>I have a scenario where users of my ASP.NET web application submit testimonials consisting of text info and images. The submit process has the following steps:</p>
<ul>
<li>First the user inputs the content and chooses a path to an image</li>
<li>When he clicks preview, the info is once again shown so that he can c... | <p>I would recommend <a href="http://msdn.microsoft.com/en-us/library/3ak841sy(VS.80).aspx" rel="noreferrer">IsolatedStorage</a>. It's a kind of virtual folder.</p>
<p>Here is an excerpt from <a href="http://www.codeproject.com/KB/dotnet/IsolatedStorage.aspx" rel="noreferrer">an example on CodeProject</a>:</p>
<pre><... | <p>This is a reply to Leppie who commented on my question (to avoid the char limit)</p>
<p>From: <a href="http://blogs.msdn.com/johan/archive/2007/05/16/common-reasons-why-your-application-pool-may-unexpectedly-recycle.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/johan/archive/2007/05/16/common-reasons-why-yo... | 34,218 |
<p>A page executes a number of tasks and takes a long time to process. We want to give the user feedback as each task is completed. </p>
<p>In ASP.NET webforms we used <code>Response.Flush()</code></p>
<p>What way would you a approach this in ASP.NET MVC?</p>
| <p>You can still use Response.Write() and Response.Flush() for whatever status you want to send down the wire. Or if you have your progress thingy in a user-control, you could do something like:</p>
<pre><code>this.PartialView("Progress").ExecuteResult(this.ControllerContext);
this.Response.Flush();
</code></pre>
<p>... | <p>You can make it in client side. In each step, you set some session variable with the current step. Then, You make another action in your controller say called: "GetProgress" and assign a view and URI for it. </p>
<p>In the action, you will check this session and return the current progress of your task. In the clie... | 26,774 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.