instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>How do you convert between a DateTime and a Time object in Ruby?</p>
| <pre><code>require 'time'
require 'date'
t = Time.now
d = DateTime.now
dd = DateTime.parse(t.to_s)
tt = Time.parse(d.to_s)
</code></pre>
| <p>While making such conversions one should take into consideration the behavior of timezones while converting from one object to the other. I found some good notes and examples in this stackoverflow <a href="https://stackoverflow.com/a/21075654">post</a>.</p>
| 35,366 |
<p>Is there any way you can reset the visited status on links?</p>
<p>The scenario is this: On an intranet-site which naturally has a lot of links we want a link to have the status of "visited" for a set period of time only. I am therefore looking for a way to manipulate the visited status of links.</p>
<p>Is this do... | <p>Links appear as "visited" when the browser chooses to apply the <code>:visited</code> <a href="http://www.w3.org/TR/CSS2/selector.html#link-pseudo-classes" rel="noreferrer">CSS pseudo-class</a>. </p>
<p>The client-side way to reset links to the unvisited state is to (somehow) clear the browsing history. I would be ... | <p>Change the target page to accept a parameter from a query string, and to set a cookie with an appropriate lifetime to that value.</p>
<p>On the referring page, put some Javascript to check for the existence of the cookie.</p>
<p>If it doesn't exist, have the Javascript add a parameter to the URL with a large rando... | 26,758 |
<p>I have a Windows Forms app, that has a single ElementHost containing a WPF UserControl... in my WPF, I have a VERY simple ListView:</p>
<pre><code><ListView Margin="4" ItemsSource="{Binding Notifications}">
<ListView.View>
<GridView>
<GridViewColumn Header="FirstName" Di... | <p>Use virtualization</p>
<pre><code><ListView ItemsSource="{BindingNames}"Name="lv">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<!--<StackPanel/>
If StackPanel was used, the memory consumed was over 2GB and dead slow.
... | <p>I had a case where the answers presented here didn't solve my problem. In my case, setting the <code>MaxHeight</code> property of the <code>ListView</code> to a value larger than the actual displayed height solved it immediately, thanks to <a href="https://stackoverflow.com/a/19426279/720425">this answer here</a>, e... | 37,916 |
<p>I have a C# singleton class that multiple classes use. Is access through <code>Instance</code> to the <code>Toggle()</code> method thread-safe? If yes, by what assumptions, rules, etc. If no, why <em>and</em> how can I fix it?</p>
<pre><code>public class MyClass
{
private static readonly MyClass instance = new ... | <blockquote>
<p>Is access through 'Instance' to the 'Toggle()' class threadsafe? If yes, by what assumptions, rules, etc. If no, why and how can I fix it?</p>
</blockquote>
<p>No, it's not threadsafe.</p>
<p>Basically, both threads can run the <code>Toggle</code> function at the same time, so this could happen</p>
... | <p>Well, I actually don't know C# that well... but I am ok at Java, so I will give the answer for that, and hopefully the two are similar enough that it will be useful. If not, I apologize.</p>
<p>The answer is, no, it's not safe. One thread could call Toggle() at the same time as the other, and it is possible, althou... | 6,402 |
<p>Is there a way to change the colors used by plain Win32 menus (background, text, and highlight) for a single process, <em>without</em> using SetSysColors?</p>
<p>(SetSysColors does a global change, which is bad, and if you crash or forget to set the colors back with SetSysColors again before exiting, they will not ... | <p>The SetMenuInfo() API is your friend. It lets you apply any brush to paint your menu's background.</p>
<p>Something along these lines should solve your problem:</p>
<pre><code>MENUINFO mi = { 0 };
mi.cbSize = sizeof(mi);
mi.fMask = MIM_BACKGROUND|MIM_APPLYTOSUBMENUS;
mi.hbrBack = hBrush;
HMENU hMenu = ::GetMe... | <p>I have to ask, why? Adopting the regular Windows look-and-feel is good; it means users can be confident that there are consistent elements in your user interface, onto which they can map their experience using other software for the platform.</p>
<p>[I'm probably preaching to the converted, of course, but I thought... | 26,448 |
<p>I have 5 <a href="http://h10010.www1.hp.com/wwpc/us/en/sm/WF06a/12454-12454-321959-338927-89307-3341951.html" rel="nofollow noreferrer">HP Compaq t5530 Thin Clients</a> with Windows CE 6.0 installed in 'em. I have a Windows 2003 server. Those 6 PCs should be used for browsing. And a user can browse for an hour and b... | <p>So you are after a time-controlled browser application, and nothing else? First question: do you have the BSP (board support package) for this device? </p>
<p><strong>Yes</strong>: Modify the IESAMPLE source code, which is the browser that ships with CE, to have the display you want and remove things like the clos... | <p>Another thought I had - if you have the BSP, you could probably generate a custom shell that uses the RDP client, which could connect to the server and use a browser. You'd probably have easier control over the usage time, as it could be set up at the server, but you then have the task of getting the RDP session to... | 42,278 |
<p>I'm extracting an interface that I would like to retain the original name. The actual class will get a "Impl" suffix, in accordance with our naming conventions. I want to know how to best reflect that in subversion so that the history "AppPropertiesImpl.java" covers its life as "AppProperties.java". As for the new "... | <p>The answer is now to create a <code>@ClassRule</code> within your suite. The rule will be invoked before or after (depending on how you implement it) each test class is run. There are a few different base classes you can extend/implement. What is nice about class rules is that if you do not implement them as anonymo... | <p>As an aside, it's a bad idea to have unit tests actually calling external resources like webservices, databases, etc.</p>
<p>Unit tests should be super-quick to run and a delay of 'a couple of minutes' for each run of the suite will mean it won't be run as much as it should.</p>
<p>My advice:</p>
<p>Look at mocki... | 45,521 |
<p>I am developing console application in .Net and I want to change a behavior a little based on information that application was started from cmd.exe or from explorer.exe. Is it possible?</p>
| <pre><code>Process this_process = Process.GetCurrentProcess();
int parent_pid = 0;
using (ManagementObject MgmtObj = new ManagementObject("win32_process.handle='" + this_process.Id.ToString() + "'"))
{
MgmtObj.Get();
parent_pid = Convert.ToInt32(MgmtObj["ParentProcessId"]);
}
string parent_process_name = Proces... | <p>The <a href="http://msdn.microsoft.com/en-us/library/ms682489(VS.85).aspx" rel="nofollow noreferrer">CreateToolhelp32Snapshot Function</a> has a Process32First method that will allow you to read a <a href="http://msdn.microsoft.com/en-us/library/ms684839(VS.85).aspx" rel="nofollow noreferrer">PROCESSENTRY32 Structur... | 7,699 |
<p>I want to use the java.util.Preferences API but I don't want my program to attempt to read or write to the Windows registry. How would I go about this?</p>
| <p>I trust you have read the <a href="https://stackoverflow.com/questions/62289/readwrite-to-windows-registry-using-java">read/write to Windows Registry using Java</a> and you then want to have another back-end than the registry when using the <code>java.util.Preferences</code> API</p>
<p>You could extend the <a href=... | <p>It is always possible to extend java.util.prefs.AbstractPreferences.</p>
<p>An alternative could be to use The <a href="http://commons.apache.org/configuration/" rel="nofollow noreferrer">Configuration package</a> of Apache Commons allows you to read and write configuration data from/to different sources.</p>
| 25,540 |
<p>I have two different ways of displaying items in a WPF application. The first uses a WrapPanel and the second a vertical StackPanel. I can switch between the two ways of displaying my items by switching the host panel between the two types. This does work but you get an instance change in layout. </p>
<p>Instead I ... | <p>Have a look at the SwitchPanel from IdentityMine's <a href="http://www.blendables.com/products/productsLayoutmix.aspx" rel="nofollow noreferrer">Blendables Layout</a> and also read Dr WPF's article on CodeProject about <a href="http://www.codeproject.com/KB/WPF/ConceptualChildren.aspx" rel="nofollow noreferrer">Conc... | <p>I have posted another solution on codeproject that is free and ready to use <a href="http://www.codeproject.com/Articles/466118/WPF-Layout-to-Layout-Transitions" rel="nofollow">WPF Layout to Layout transitions</a></p>
| 16,035 |
<p>I have a .NET 2.0 Windows Forms application. Where is the best place the store user settings (considering Windows guidelines)?</p>
<p>Some people pointed to <code>Application.LocalUserAppDataPath</code>. However, that creates a folder structure like:</p>
<blockquote>
<p>C:\Documents and Settings\user_name\Local ... | <p>I love using the built-in <a href="http://msdn.microsoft.com/en-us/library/a65txexh.aspx" rel="noreferrer">Application Settings</a>. Then you have built in support for using the settings designer if you want at design-time, or at runtime to use: </p>
<pre><code>// read setting
string setting1 = (string)Settings.De... | <p>Settings are standard key-value pairs (string-string). I could wrap them in an XML file, if that helps.</p>
<p>I'd rather use the file system instead of the registry. It seems to be easier to maintain. In support scenarios, if the user needs to manually open/change the settings, that would be easier if it's in the ... | 4,594 |
<p>By default if you connect to a remote SQL Server via an account that has access to say 1 of the 10 databases. You will still see in the Object Explorer all other databases, obviously due to permissions you cannot actually query them, but you can see their names.</p>
<p>I have heard that there is a method that disa... | <p><a href="https://web.archive.org/web/20061014155556/http://blogs.msdn.com/euanga/archive/2006/05/04/585513.aspx" rel="nofollow noreferrer">This blog</a> talks about methods for hiding DBs for both SQL 2000 and SQL 2005.</p>
| <p>The short of it is:</p>
<pre><code>use master
go
deny VIEW any DATABASE to login1
go
</code></pre>
<p>where login1 is the login account that you want to limit.</p>
| 24,575 |
<p>I have a row of data that I need to modify in a database, using a stored procedure. But in order to call that stored procedure, I need to know the name of the each column. How do I determine the name of the columns? (Hardcoding is not an option as we are talking a LOT of columns whose names may change).</p>
<p>EDIT... | <p>To get the header text of the column you can use this:</p>
<p>string colText = grid.Columns[i].HeaderText;</p>
<p>Where i is the index of the column.</p>
| <pre><code> foreach (TableCell objCell in e.Row.Cells)
{
if (objCell is DataControlFieldHeaderCell)
{
string HEADERTEXT = objCell.Text;
}
}
</code></pre>
| 24,191 |
<p>Is there a distributed version control system (git, bazaar, mercurial, darcs etc.) that can handle files larger than available RAM?</p>
<p>I need to be able to commit large binary files (i.e. datasets, source video/images, archives), but I don't need to be able to diff them, just be able to commit and then update w... | <p>It's been 3 years since I asked this question, but, as of version 2.0 Mercurial includes the <a href="https://www.mercurial-scm.org/wiki/LargefilesExtension" rel="nofollow noreferrer">largefiles extension</a>, which accomplishes what I was originally looking for:</p>
<blockquote>
<p>The largefiles extension allow... | <p>I came to the conclusion that the best solution in this case would be to use the ZFS.</p>
<p>Yes ZFS is not a DVCS but:</p>
<ul>
<li>You can allocate space for repository via creating new FS</li>
<li>You can track changes by creating snapshots</li>
<li>You can send snapshots (commits) to another ZFS dataset</li>
<... | 9,577 |
<p>I'd be very grateful if you could compare the winning <a href="http://www.cs.ucsd.edu/~sorourke/wf.pl" rel="nofollow noreferrer">O’Rourke's Perl solution</a> to <a href="http://effbot.org/zone/wide-finder.htm" rel="nofollow noreferrer">Lundh's Python solution</a>, as I don't know Perl good enough to understand what'... | <p>Perl is heavily optimized for text processing. There are so many factors that it's hard to say what's the exact difference. Text is represented completely differently internally (utf-8 versus utf-16/utf-32) and the regular expression engines are completely different too. Python's regular expression engine is a cu... | <blockquote>
<p>The Perl implementation uses the mmap system call. </p>
</blockquote>
<p>This. It avoids buffer copying and provides async I/O.</p>
| 15,104 |
<p>I'd like to know what's the way to actually set the icon of a <code>.bat</code> file to an arbitrary icon.
How would I go about doing that programmatically, independently of the language I may be using.</p>
| <p>Assuming you're referring to MS-DOS batch files: as it is simply a text file with a special extension, a <code>.bat</code> file doesn't store an icon of its own.</p>
<p>You can, however, create a shortcut in the <code>.lnk</code> format that stores an icon.</p>
| <p>i recommand to use BAT to EXE converter for your desires </p>
| 3,626 |
<p>The Entity Framework does not support the <code>Expression.Invoke</code> operator. You receive the following exception when trying to use it:</p>
<blockquote>
<p>"The LINQ expression node type 'Invoke' is not supported in LINQ to Entities.</p>
</blockquote>
<p>Has anyone got a workaround for this missing functi... | <p><a href="http://www.albahari.com/nutshell/predicatebuilder.aspx" rel="noreferrer">PredicateBuilder</a> and <a href="http://www.albahari.com/nutshell/linqkit.aspx" rel="noreferrer">LINQKit</a> now support Entity Framework.</p>
<p>Sorry, guys, for not doing this earlier!</p>
| <p>The Entity framework converts LINQ expressions into Entity Command trees and within that only its canonical functions are supported. You'd have to use the command trees with canonical functions to do something like PredicateBuilder.</p>
| 3,172 |
<p>The latest makefiles we've received from a third party vendor contain rules with --depend on the end of build rules, so I thought I would look it up on Google, but try as I might, I can't persuade it to display any pages with exactly the characters --depend</p>
<p>I've tried surrounding it with quotes "--depend": I... | <p>You can specifiy literal symbols in a Google Code Search but not Google Web Search.</p>
<p>Examples;</p>
<p><a href="http://www.google.com/codesearch?hl=en&lr=&q=%2B%22--depend%22&sbtn=Search" rel="noreferrer">Google Code Search for +"--depend"</a></p>
<p><a href="http://www.google.com/search?hl=en&am... | <p>I remember to have <a href="http://www.caliban.org/ruby/APIs_Reference.html" rel="nofollow noreferrer">read somewhere</a> that google's web search does not index non alphanumeric characters, treating them as word separators, so that's not possible.</p>
| 16,016 |
<p>I keep hearing that Lisp is a really productive language, and I'm enjoying <a href="http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/" rel="noreferrer">SICP</a>. Still, I'm missing something useful that would let me replace PHP for server-side database interaction in web applications.</p>
<p>... | <p>newLisp has support for mysql5 and if you look at <a href="http://www.newlisp.org/code/modules/mysql5.lsp.html" rel="nofollow noreferrer">the mysql5 function calls</a>, you'll see that it's close to PDO.</p>
| <p>We use SBCL, UCW, CL-SQL and MySQL as our back-end for <a href="http://paragent.com" rel="nofollow noreferrer">Paragent.com</a>. It has worked very well for us. We also have a number of clients using UCW/CL-SQL/MySQL for custom sites we have built them through our consulting arm <a href="http://bitfauna.com" rel="no... | 9,062 |
<p>As some people probably know, this is the 3rd iteration of a SE site proposal whose scope covers 3D printers. The first 2 were <a href="http://area51.stackexchange.com/proposals/22246/personal-manufacturing">Personal Manufacturing</a>(before my time) and <a href="http://area51.stackexchange.com/proposals/41850/digit... | <p>Please look into <a href="/questions/147/hobbyist-machine-questions-on-topic">this question</a>, which is a similar question as you ask. </p>
<p>I think the general consensus is that CNC and laser cutting machines fall in the same category as 3D printers with respect to control, axis, modeling, etc. as the differen... | <p>Please look into <a href="/questions/147/hobbyist-machine-questions-on-topic">this question</a>, which is a similar question as you ask. </p>
<p>I think the general consensus is that CNC and laser cutting machines fall in the same category as 3D printers with respect to control, axis, modeling, etc. as the differen... | 61 |
<p>I'm new to PHP and I'm confused seeing some examples calling a function with a @ prefix like @mysql_ping().</p>
<p>What is it for? Googling / searching is not much of a help since @ gets discarded and 'alias' is not good enough keyword.</p>
| <p>@ suppresses errors, warnings and notices.</p>
<p>You can use it for good purpose if you complement it with a custom <a href="http://php.net/manual/en/function.set-error-handler.php" rel="nofollow noreferrer">error handler</a> or with due check of $php_errormsg variable so you can handle errors properly. </p>
<p>I... | <p>Suppress error messages:
<a href="http://bytes.com/forum/thread10951.html" rel="nofollow noreferrer">http://bytes.com/forum/thread10951.html</a></p>
| 16,721 |
<p>I'm trying to implement the "Writing Information to UserData" section of <a href="http://www.asp.net/LEARN/security/tutorial-03-cs.aspx" rel="nofollow noreferrer">this article</a>, but it doesn't work properly when the cookie is part of the URI.</p>
<p>My code:</p>
<pre><code>// Create the cookie that contains the... | <p>I found this to be an interesting problem, so I set about doing some digging, testing, and a little bit of debugging into the .net framework source.</p>
<p>Basically, what you are trying to do will not work. Anything you put into the Response.Cookies collection will just be ignored if the browser doesn't support co... | <p>Thank you for the great explanation, Stephen. In cases where the user does not allow cookies, I'm just going to have to avoid the UserData and load the data from the database.</p>
<p>Before the code listed above I'll do:</p>
<pre><code>if( !HttpContext.Current.Request.Browser.Cookies || !FormsAuthentication.Cooki... | 32,883 |
<p>I like the idea of having only one <code>return</code> statement per method.</p>
<p>What do you do in this situation though?</p>
<pre><code>public static string ChopText(string Text)
{
if (String.IsNullOrEmpty(Text))
{
// return here ?????
}
}
</code></pre>
<p>The only alternative I can think of is... | <p>It is OK to <a href="http://martinfowler.com/refactoring/catalog/replaceNestedConditionalWithGuardClauses.html" rel="noreferrer">replace nested conditional with guard clauses</a>.</p>
| <p>The rule is antiquated. Plain and simple. It exists to help bad programmers write more readable code... and it backfired. Make your code small and readable, and get rid of that silly rule.</p>
| 40,737 |
<p>I'm developing an application targeting .NET Framework 2.0 using C# for which I need to be able to find the default application that is used for opening a particular file type.</p>
<p>I know that, for example, if you just want to open a file using that application you can use something like:</p>
<pre><code>System.... | <p>All current answers are unreliable. The registry is an implementation detail and indeed such code is broken on my Windows 8.1 machine. The proper way to do this is using the Win32 API, specifically <a href="http://msdn.microsoft.com/en-us/library/bb773471.aspx" rel="noreferrer">AssocQueryString</a>:</p>
<pre><code>... | <p>You can just query the registry. First get the Default entry under HKEY_CLASSES_ROOT\.ext</p>
<p>That will give you the classname. For example .txt has a default of txtfile</p>
<p>Then open up HKEY_CLASSES_ROOT\txtfile\Shell\Open\Command</p>
<p>That will give you the default command used.</p>
| 19,636 |
<p>Whenever I try to access a NTLM authenticated intranet site, Safari takes forever to process and then comes back with "The sever is unavailable" or if allowed by the site, loads with out authenticating. I can access these same sites with no problems in both Firefox and Internet Explorer. The sites are hosted on IIS6... | <p>JBoss publishes JSR-77 statistics for all deployed EJBs. They are accessible through JMX. See the JavaDoc for: <a href="http://java.sun.com/j2ee/1.4/docs/api/javax/management/j2ee/statistics/EJBStats.html" rel="nofollow noreferrer" title="javax.management.j2ee.statistics.EJBStats">javax.management.j2ee.statistics.EJ... | <p>This looks like a promising solution: <a href="http://www.jboss.org/jbossprofiler/" rel="nofollow noreferrer">http://www.jboss.org/jbossprofiler/</a></p>
<p>It's not exactly an AOP solution, but it appears it would be fairly simple to set up, and would give you the data you're looking for. </p>
| 41,648 |
<p>I have seen that there is a NVL function for PL/SQL that substitutes a value when null is encountered.<br>
But what if I want to set a field to NULL, e.g. </p>
<pre><code>EXEC SQL UPDATE mytable SET myfield=NULL WHERE otherValue=1;
</code></pre>
<p>When I run this with C++ on HPUX, 0L is used for null while on Lin... | <p>Oh, now I realize what must be happening. The C++ system headers have <code>#define NULL 0L</code> (in HPUX) and so the hardcoded NULL is being replaced with that value by the preprocessor.</p>
<p>Several ideas:</p>
<ul>
<li>Simply change the case of NULL in the SQL statement. Oracle doesn't care about the case,... | <p>Yes - the problem is the way NULL is expanded in C++.
For informix there is rsetnull that sets the varialble to the appropriate value.
Is there anything like this for oracle?</p>
| 39,268 |
<p>I'm working on a blog application in Django. Naturally, I have models set up such that there are Posts and Comments, and a particular Post may have many Comments; thus, Post is a ForeignKey in the Comments model.</p>
<p>Given a Post object, is there an easy way (ideally, through a method call) to find out how many ... | <pre><code>Comments.objects.filter(post=post).count()
</code></pre>
<p>or:</p>
<pre><code>post.comment_set.count()
</code></pre>
| <p>You can add field CommentCount to you Post model, and update it in pre_save, pre_delete signals.
It's a hard for the db to calculate comments count at every view call and number of queries will be grow.</p>
| 46,221 |
<p>I have a C application that I've created in VS2008. I am creating a mock creation function that overrides function references in a struct. However if I try and do this in a straight forward fashion with something like:</p>
<pre><code>void *ptr = &(*env)->GetVersion;
*ptr = <address of new function>
</c... | <p>Then how about:</p>
<pre><code>void **ptr = (void **) &(*env)->GetVersion;
*ptr = <address of new function>
</code></pre>
<p>The right way to do this is to work with the type system, avoid all the casting and declare actual pointers to functions like:</p>
<pre><code>typedef int (*fncPtr)(void);
fncPt... | <p>Last time I played with void* & C under visual studio, VS didn't play nicely.
Here are some information datapoints: </p>
<p>A pointer is always the size of the system word(8/16/32/64)...(unless you have segmented memory, which I'm <em>assuming</em> you don't have). This is because it needs to point to anywhere... | 24,836 |
<p>I am looking out for some good practices on naming assemblies and versioning them. How often do you increment the major or minor versions?</p>
<p>In some cases, I have seen releases going straight from version 1.0 to 3.0. In other cases, it seems to be stuck at version 1.0.2.xxxx.</p>
<p>This will be for a shared ... | <p>Some good information from <a href="http://blogs.msdn.com/suzcook/archive/2003/05/29/57148.aspx" rel="nofollow noreferrer">this article</a> on Suzanne Cook's blog on MSDN (posted 2003-05-30): </p>
<blockquote>
<h1>When to Change File/Assembly Versions</h1>
<p>First of all, file versions and assembly versions... | <p>The first thing I would recommend is to become familiar with the differences between the Assembly version and the File version. Unfortunately, .NET tends to treat these as the same when it comes to the AssemblyInfo files in that it usually only puts AssemblyVersion and allows the FileVersion to default to the same v... | 24,367 |
<p>Is there a better way to write this code? </p>
<p>I want to show a default value ('No data') for any empty fields returned by the query:</p>
<pre><code>$archivalie_id = $_GET['archivalie_id'];
$query = "SELECT
a.*,
ip.description AS internal_project,
o.descript... | <p>You could use a small helper function</p>
<pre><code>function dbValue($value, $default=null)
{
if ($default===null) {
$default='<span class="no-data">No data</span>';
}
if (!empty($value)) {
return $value;
} else {
return $default;
}
}
</code></pre>
| <p>You can use standard SQL COALESCE function to return a special string instead of null, like this:</p>
<pre><code>$query = "SELECT
a.*,
COALESCE(ip.description,'NO_DATA') AS internal_project,
COALESCE(o.description,'NO_DATA') AS origin,
COALESCE(to_char(ad.origin_... | 34,196 |
<p>One way to give PLA prints a smooth finish is treatment with chloroform vapours (or other solvents, as mentioned in <a href="https://3dprinting.stackexchange.com/a/36/674">this</a> answer). This method is even featured on <a href="https://ultimaker.com/en/tips-tricks/17897-vapor-treating" rel="nofollow noreferrer">U... | <p><a href="https://www.reddit.com/r/3Dprinting/comments/25ej7d/does_anyone_have_experience_with_pla_thf_vapor/" rel="nofollow noreferrer">This Reddit post</a> seems to have some good trial and error dialog.</p>
<p><a href="http://www.thingiverse.com/thing:73120" rel="nofollow noreferrer">This Thingiverse post</a>, al... | <p>Beside vaporizing with heat, you can use an atomizer and do cold vapor. The time is around 1-5 minutes at 45ºC for a 10x10x20 mm piece like a Marvin or a bot. I have done only gangster tests with it, so I have no larger piece info.</p>
<p>Passive vapor polish does not work with chloroform since it tends to cra... | 198 |
<p>Using the PHP <a href="http://www.php.net/pack" rel="noreferrer">pack()</a> function, I have converted a string into a binary hex representation:</p>
<pre><code>$string = md5(time); // 32 character length
$packed = pack('H*', $string);
</code></pre>
<p>The H* formatting means "Hex string, high nibble first".</p>
... | <p>There's an easy way to do this with the <code>binascii</code> module:</p>
<pre><code>>>> import binascii
>>> print binascii.hexlify("ABCZ")
'4142435a'
>>> print binascii.unhexlify("4142435a")
'ABCZ'
</code></pre>
<p>Unless I'm misunderstanding something about the nibble ordering (high-ni... | <p>In Python you use the <a href="https://docs.python.org/2/library/struct.html" rel="nofollow noreferrer">struct</a> module for this.</p>
<pre><code>>>> from struct import *
>>> pack('hhl', 1, 2, 3)
'\x00\x01\x00\x02\x00\x00\x00\x03'
>>> unpack('hhl', '\x00\x01\x00\x02\x00\x00\x00\x03')
(1,... | 24,496 |
<p>I am developing a mobile app to run on a pocketpc. We have a mobile printer and card swipe that uses com1 to send and get info. I'm using the device emulator and want to test without the printer. How do I create a virtual com1 port to right to and read from? I tried com0com but the device emulator will not set t... | <p>This isn't a direct answer, but if you get desperate enough, I had a friend use <a href="http://research.microsoft.com/sn/detours/" rel="nofollow noreferrer">Detours</a> to redirect output relating to COM interfaces to where he wanted it when he couldn't edit another program's source.</p>
| <p>I did research on this about 2 days ago to emulate a GPS device. The only thing I was able to come up with was a bunch of low level assembly code. </p>
| 25,718 |
<p>When using <code>__import__</code> with a dotted name, something like: <code>somepackage.somemodule</code>, the module returned isn't <code>somemodule</code>, whatever is returned seems to be mostly empty! what's going on here?</p>
| <p>From the python docs on <code>__import__</code>:</p>
<blockquote>
<pre><code>__import__( name[, globals[, locals[, fromlist[, level]]]])
</code></pre>
<p>...</p>
<p>When the name variable is of the form
package.module, normally, the
top-level package (the name up till
the first dot) is returned, not... | <p>The way I did is </p>
<pre><code>foo = __import__('foo', globals(), locals(), ["bar"], -1)
foobar = eval("foo.bar")
</code></pre>
<p>then i can access any content from by </p>
<pre><code>foobar.functionName()
</code></pre>
| 25,928 |
<p>I'm looking for a way to create an online form that will update an Access database that has just a few tables. Does anyone know of a simple solution for this?</p>
| <pre><code>Convert.ToString(dr(columnName)).Replace("$", String.Empty)
</code></pre>
<p>--
If you are working with a data table, then you have to unbox the value (by default its Object) to a string, so you are already creating a string, and then another with the replacement. There is really no other way to get around ... | <p>Why don't you update the database query so that it doesn't return the dollar sign? This way you don't have to futz with it in your C# code.</p>
| 18,731 |
<p>I am using Java Struts, sending it to user using the following codes</p>
<pre><code>response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + fileFullName);
</code></pre>
<p>Firstly I hope that this is the correct place for my question... :) I hope
tha... | <p>Check Tools - Internet Options - General Tab - Temporary Internet files - Settings... - And check that you have enough space allocated to hold the csv file and that the path looks like the one you posted.</p>
| <p>Are you downloading over HTTPS? IE can be quite buggy if the headers aren't similar to <code>Expires: 0</code>, <code>Pragma: cache</code>, <code>Cache-Control: private</code></p>
| 27,486 |
<p>I'm a C/C++ developer, and here are a couple of questions that always baffled me.</p>
<ul>
<li>Is there a big difference between "regular" code and inline code?</li>
<li>Which is the main difference?</li>
<li>Is inline code simply a "form" of macros?</li>
<li>What kind of tradeoff must be done when choosing to inli... | <blockquote>
<ul>
<li>Is there a big difference between "regular" code and inline code?</li>
</ul>
</blockquote>
<p>Yes and no. No, because an inline function or method has exactly the same characteristics as a regular one, most important one being that they are both type safe. And yes, because the assembly code... | <p>If you are marking your code as inline in f.e. C++ you are also telling your compiler that the code should be executed inline, ie. that code block will "more or less" be inserted where it is called (thus removing the pushing, popping and jumping on the stack). So, yes... it is recommended if the functions are suitab... | 16,090 |
<p>WinAPI OpenFile function returns HFILE, and GetFileTime for instance needs HANDLE. When I feed it with (HANDLE)some_hFile it seems to work fine. Is there any difference in this types, or one of these is simply rudimental?</p>
| <p>OpenFile is a 16-bit Windows backward-compatibility function. CreateFile is the function to open files.</p>
| <p>The OpenFile returns a File Handle if succed or a HFILE_ERROR if it fails.</p>
| 41,510 |
<p>What do you think the future of GPU as a CPU initiatives like CUDA are? Do you think they are going to become mainstream and be the next adopted fad in the industry? Apple is building a new framework for using the GPU to do CPU tasks and there has been alot of success in the Nvidias CUDA project in the sciences. Wou... | <p>First of all I don't think this questions really belongs on SO.</p>
<p>In my opinion the GPU is a very interesting alternative whenever you do vector-based float mathematics. However this translates to: It will not become mainstream. Most mainstream (Desktop) applications do very few floating-point calculations.</p... | <p>With so much untapped power I cannot see how it would go unused for too long. The question is, though, how the GPU will be used for this. CUDA seems to be a good guess for now but other techologies are emerging on the horizon which might make it more approachable by the average developer.</p>
<p>Apple have recently... | 4,778 |
<p>The set up for apache-jmeter allows for a URL to be sent to a web-server on multiple threads. I'm interested in first determining if the response codes are 200-500 and then whether the returned content is the expected content. Is this detailed configuration possible?</p>
| <p>I believe so from what it states <a href="http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Response_Assertion" rel="noreferrer">here</a> </p>
| <p>Yes it does. You simply need to add two Response Assertions to your HTTP Sampler. </p>
<p>One which checks the Response Code, and a second which checks the response message.</p>
<p>Whether these passed or failed will then be visible in the Summary Report.</p>
| 14,937 |
<p>Can breakpoints be used in interrupt service routines (ISRs)?</p>
| <p>Yes - <strong>in an emulator</strong>.</p>
<p>Otherwise, no. It's difficult to pull off, and a bad idea in any case. ISRs are (usually) supposed to work with the hardware, and hardware can easily behave very differently when you leave a gap of half a second between each instruction.</p>
<p>Set up some sort of logg... | <p>In Windows, with a <a href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx" rel="nofollow noreferrer">kernel debugger</a> attached, you can indeed place breakpoints in interrupt handlers.</p>
| 42,191 |
<p>I started using <a href="http://www.codeplex.com/SHFB" rel="noreferrer">Sandcastle</a> some time ago to generate a Documentation Website for one of our projects. It's working quite well but we've always only written documentation for classes, methods, properties (...) in our project and had completely separate docum... | <p>Sandcastle also supports the ndoc-style namespace documentation, which allows you to stick the documentation in the source files:</p>
<p>Simply create a non-public class called NamespaceDoc in the namespace you want to document, and the xml doc comment for that class will be used for the namespace. </p>
<p>Adorn i... | <p>I see documentation for an "External XML Comments Files". Showing a schema like:</p>
<pre><code><doc>
<assembly/>
<members>
<member/>
</members>
</doc>
</code></pre>
<p>If this is placed in a separate file, what would the extension be (xml/aml) and can this b... | 18,945 |
<p>I want to convert a string like this:</p>
<pre><code>'10/15/2008 10:06:32 PM'
</code></pre>
<p>into the equivalent DATETIME value in Sql Server.</p>
<p>In Oracle, I would say this:</p>
<pre><code>TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM')
</code></pre>
<p><a href="https://stackoverflow.com/quest... | <p>Try this</p>
<pre><code>Cast('7/7/2011' as datetime)
</code></pre>
<p>and</p>
<pre><code>Convert(DATETIME, '7/7/2011', 101)
</code></pre>
<p>See <a href="https://msdn.microsoft.com/en-us/library/ms187928(v=sql.90).aspx" rel="noreferrer">CAST and CONVERT (Transact-SQL)</a> for more details.</p>
| <pre><code>dateadd(day,0,'10/15/2008 10:06:32 PM')
</code></pre>
| 25,386 |
<p>I found a story about someone <a href="http://www.fablabamersfoort.nl/en/node/534">3D-printing equipment for their Lego minifig</a>, using an Ultimaker. (Article is in Dutch, but accompanied by photographs).</p>
<p>I noticed that what they made weren't the actual connecting bricks, but the tools used by the minifig... | <p>It's really more about calibration than resolution -- a poorly calibrated printer will have dimension errors that prevent mating with true LEGO bricks or other printed bricks. </p>
<p>Also, "resolution" is an incredibly loaded term for 3d printers, because it can mean a lot of different things. But we don't need to... | <p>I have notes about printing Lego bricks here:</p>
<blockquote>
<p><a href="https://www.thingiverse.com/thing:3424550" rel="nofollow noreferrer">https://www.thingiverse.com/thing:3424550</a></p>
</blockquote>
<p>The upshot is, you want to align the wall thickness of your brick model edges to match an exact multip... | 159 |
<p>What is currying?</p>
<p>How can currying be done in C++?</p>
<p>Please Explain binders in STL container?</p>
| <p>In short, currying takes a function <code>f(x, y)</code> and given a fixed <code>Y</code>, gives a new function <code>g(x)</code> where</p>
<pre><code>g(x) == f(x, Y)
</code></pre>
<p>This new function may be called in situations where only one argument is supplied, and passes the call on to the original <code>f</... | <p>C++20 provides <a href="https://en.cppreference.com/w/cpp/utility/functional/bind_front" rel="nofollow noreferrer">bind_front</a> for doing currying.</p>
<p>For older C++ version it can be implemented (for single argument) as follows:</p>
<pre><code>template <typename TFunc, typename TArg>
class CurryT
{
priva... | 18,326 |
<p>I have a web application (asp.net) where work items are submitted and allocated to users according to their workload.</p>
<p>A user's workload is calculated using an algorithm based on the number of items currently allocated to the user (and some other factors). Each new item is allocated to the user with the lowes... | <p>This depends on many factors, when you refer to the cache do you mean the standard cache provided by Asp.Net? </p>
<p>Is it absolutely critical that you always have the most up to date information, or if two requests are made to be allocated is it ok for them to get allocated to the two least busy users at the mome... | <p>I would use a database to control this, as it's highly unlikely users will be completing work quickly enough to need a more real-time approach.</p>
<p>So I would have a series of tables, relating to work items, which you can query to calculate current work levels, and thus determine the next person to receive a par... | 24,800 |
<p>I have long been wondering why lazy evaluation is useful. I have yet to have anyone explain to me in a way that makes sense; mostly it ends up boiling down to "trust me".</p>
<p>Note: I do not mean memoization. </p>
| <p>Mostly because it can be more efficient -- values don't need to be computed if they're not going to be used. For example, I may pass three values into a function, but depending on the sequence of conditional expressions, only a subset may actually be used. In a language like C, all three values would be computed any... | <p>If by "lazy evaluation" you mean like in combound booleans, like in </p>
<pre><code> if (ConditionA && ConditionB) ...
</code></pre>
<p>then the answer is simply that the fewer CPU cycles the program consumes, the faster it will run... and if a chunk of processing instructions will have no impact on the... | 33,264 |
<p>I have an application on which I am implementing localization.</p>
<p>I now need to dynamically reference a name in the resouce file.</p>
<p>assume I have a resource file called Login.resx, an a number of strings: foo="hello", bar="cruel" and baz="world"</p>
<p>normally, I will refer as:
String result =Login.foo... | <p>You'll need to instance a <a href="http://msdn.microsoft.com/en-us/library/aa984408%28VS.71%29.aspx" rel="noreferrer"><code>ResourceManager</code></a> for the <code>Login.resx</code>:</p>
<pre><code>var resman = new System.Resources.ResourceManager(
"RootNamespace.Login",
System.Reflection.Assembly.GetExecu... | <p>If you put your Resource file in the App_GlobalResources folder like I did, you need to use</p>
<blockquote>
<p>global::System.Resources.ResourceManager
temp = new
global::System.Resources.ResourceManager("RootNamespace.Login",
global::System.Reflection.Assembly.Load("App_GlobalResources"));</p>
</blockquot... | 4,966 |
<p>I'm just starting with Mercurial and one of the things that I should do is select a merge tool. I was thinking to use WinMerge for that purpose, but I can't find the way to select this in particular. There are references for all the other merge tools around, but not for WinMerge.</p>
<p>So, should I use WinMerge or... | <p>Take a look at kdiff3: <a href="http://kdiff3.sourceforge.net/" rel="noreferrer">http://kdiff3.sourceforge.net/</a> </p>
<p>It was originally designed for KDE/linux but has been ported to Windows. It will diff/merge up to 3 files remarkably intelligently, it does a great job of highlighting differences and sugge... | <p>I've used <a href="http://www.sourcegear.com/diffmerge/" rel="nofollow noreferrer" title="DiffMerge">DiffMerge</a> which is available for free.</p>
<p>Take a look at the <a href="http://www.sourcegear.com/diffmerge/screenshots.html" rel="nofollow noreferrer">screenshots</a> to get an idea of how it works, I found t... | 29,178 |
<p>I want to search a table to find all rows where one particular field is one of two values. I know exactly what the values would be, but I'm wondering which is the most efficient way to search for them:</p>
<p>for the sake of example, the two values are "xpoints" and "ypoints". I know for certain that there will be ... | <p>As always with SQL queries, run it through the profiler to find out. However, my gut instinct would have to say that the IN search would be quicker. Espcially in the example you gave, if the field was indexed, it would only have to do 2 lookups. If you did a like search, it may have to do a scan, because you are ... | <p>Try it and see. Create a large amount of test data, Also, try it with and without an index on myfield. While you are at it, see if there's a noticeable difference between
LIKE '<em>points' and LIKE 'xpoint</em>'.</p>
<p>It depends on what the optimizer does with each query. </p>
<p>For small amounts of data, ... | 32,176 |
<p>I'm starting to learn about using Memcached with PHP and I was wondering; is there a point at which you should start using it? Is it always more efficient to cache data or does it only become effective once your site gets a certain number of hits? Presumably there is an overhead associated with Memcached, so when do... | <p>You should start using memcached when not using it starts to affect your site / server.</p>
<p>So when you just have 100 visitors a day and your site still responds quickly, don't bother using it.</p>
<p>But when you have running times somewhere near 200ms or more per page, and the site feels slow too, you should ... | <p>First think about <strong>what/when/if</strong> to cache, before you think about if you should be using Memcached to do the caching.</p>
<p>When you have some “object” that is used to respond to <strong>lots</strong> of requests that takes <strong>lots</strong> of database reads to create. And your site cannot kee... | 39,363 |
<p>I'd like to buy a new nozzle for my Anycubic i3 Mega because it's not precise enough - it fails to print small details like 1 mm eyebrows.</p>
<p>Currently it has a 0.4 mm nozzle and I'd like to buy a better one but I don't know how to choose one which is compatible with this printer.</p>
<p>If you have ... | <p>According to <a href="https://youtu.be/QnnPsoL5cHE?t=18" rel="nofollow noreferrer">Anycubic</a> this printer uses the E3D V5 type hotend as can be seen from the linked video of the AnyCubic Mega:</p>
<p><a href="https://i.stack.imgur.com/WSL8p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WSL8p... | <p>We select nozzles depending on what project we want to,do and it must match with the hot end as well.</p>
| 1,274 |
<p>Is there a simple way to parse a date that may be in MM/DD/yyyy, or M/D/yyyy, or some combination? i.e. the zero is optional before a single digit day or month.</p>
<p>To do it manually, one could use:</p>
<pre><code>String[] dateFields = dateString.split("/");
int month = Integer.parseInt(dateFields[0]);
int day ... | <p>Yep, use setLenient:</p>
<pre><code>DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
df.setLenient(true);
System.out.println(df.parse("05/05/1999"));
System.out.println(df.parse("5/5/1999"));
</code></pre>
| <p>Looks like my problem was using "MM/DD/yyyy" when I should have used "MM/dd/yyyy". Uppercase <strong>D</strong> is "Day in year", while lowercase <strong>d</strong> is "Day in month".</p>
<pre><code>new SimpleDateFormat("MM/dd/yyyy").parse(dateString);
</code></pre>
<p>Does the job. Also, "M/d/y" works interchange... | 28,171 |
<p>I have my own linq to sql database with a nice login method which gives me back a user.</p>
<p>I have followed the 101 examples there on the web as to how to add the cookie to the client.</p>
<pre><code> FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1,
... | <p>This particular error was caused because I had the browser set to erase cookies when it was closed.</p>
| <p>I have the same problem and I solve on login Page_Load<br/>
First validate User.Identity is correct<br/>
if true we have a valid user!!!.<br/>
if false remove old cookie (See this link <a href="http://forums.asp.net/t/1227365.aspx/1" rel="nofollow">http://forums.asp.net/t/1227365.aspx/1</a>)<br/>
<strong>this la... | 41,546 |
<p>I am building a simple HTTP server for a project.
Most websites have custom 404 error pages. Sometimes though, you'll see Firefox spitting a generic 404 page (or 405, etc...).
How does it decide what to do?
What should the HTTP response be?
Is "HTTP/1.0 404 NOT FOUND" enough?</p>
<p>Thanks</p>
| <p>If server can't find the requested resource (e.g. a webpage), it sends an <strong>HTTP/1.0 404 NOT FOUND</strong> in the HTTP header section. </p>
<p><strong>Servers can map</strong> an error page for this error, so you can get a readable error page. <strong>Browsers can also map</strong> an own error page, so you ... | <p>Usually it set up in the webserver, ie: When the server gets a 404, refer it to this page.</p>
| 25,287 |
<p>Is there a pattern that is good to use when saving and loading different file formats?</p>
<p>For example, I have a complicated class hierarchy for the document, but I want to support a few different file formats.</p>
<p>I thought about the Strategy pattern, but I'm not convinced because of the need to access ever... | <p>You could use a <a href="http://en.wikipedia.org/wiki/Visitor_pattern" rel="nofollow noreferrer">Visitor Pattern</a>, it allows to iterate over your hierachy doing different operations depending of the node the Visitor is currently processing.</p>
<p>Bad news: you probably need to add at least a virtual method at t... | <p>How about (something based on) the <a href="http://en.wikipedia.org/wiki/Template_method_pattern" rel="nofollow noreferrer">Template method pattern</a>?</p>
<p>One superclass knows how to rip apart the class hierarchy, but relies on its subclasses to actually do something useful with it.</p>
| 10,690 |
<p>I would like to assign a drive letter to a GMail drive so that I could script some output to it. Are they any hacks to get this to work?</p>
| <p>GMail Drive no longer works (well) -- Google put rate limits into Gmail to prevent this kind of (ab)use of Gmail. It's like being attached to a hard drive over a bad satellite connection to Rwanda*.</p>
<p>You might look into Amazon's S3, which is a cheap web-hosted data storage service; then ask this question aga... | <p>I use the SMEStorage service for this which works really well. The GMail package I signed up for enables you to use GMail as a Storage Cloud and it works really well. There are also some windows tools that you can use. I'm using the paid version which gives me a vitual (namespace) drive, sync, and shell tools as wel... | 29,351 |
<p>I wrote an application that currently runs against a local instance of MySql. I would like to centralize the DB somewhere on the Net, and share my application.</p>
<p>But, I'm cheap, and don't want to pay for it. Does anyone know of a free on-line relational DB service that I could connect to via C#?</p>
| <p>What about <a href="http://www.freesql.org" rel="nofollow noreferrer">http://www.freesql.org</a> ? Seems like you can't be too picky when you're asking for free, and this seems to offer something.</p>
| <p>Sounds like you need <a href="http://www.amazon.com/SimpleDB-AWS-Service-Pricing/b?ie=UTF8&node=342335011" rel="nofollow noreferrer">Amazon SimpleDB</a>...</p>
<p>It's not free, but pricing looks pretty good. I've not used it myself, but when I've got a bit of spare time I might use it for a project I'm working... | 3,037 |
<p>I am trying to print a tank to be used with my RC engine. The material that I have to use needs to have the following properties:</p>
<ul>
<li>It needs to be possible to seal the final print so that it is not leaking any fluid</li>
<li>It needs to resist methanol, nitromethane (a solvent like Acetone) and lubricatin... | <p>Most commercial blow-molded fuel tanks for model airplane fuel (methanol or ethanol, nitromethane or nitroethane, and some combination of castor, mineral, or synthetic lubricating oil) are made from HDPE. This material isn't commonly seen as filament, in my limited experience, but it ought to be possible to arrive ... | <p>As a supplement to the answer (doesn't fit well in the comments). This site <a href="https://www.filamentive.com/chemical-resistance-of-3d-printing-filament/" rel="nofollow noreferrer">https://www.filamentive.com/chemical-resistance-of-3d-printing-filament/</a> lists PETG has have a very high restance to alcohol, a... | 1,948 |
<p>I am programmatically creating PDFs, and a recent change to my generator is creating documents that crash both Mac Preview and Adobe Reader on my Mac. Before Adobe Reader crashes, it reports:</p>
<blockquote>
<p>There was an error processing a page.
There was a problem reading this document (18).</p>
</blockqu... | <p>Hold down the Ctrl key while pressing OK and you should be able to load past this point in the document and possibly get more details.</p>
<p>What tool are you using to create the PDF (Aspose)?</p>
| <p>I wasn't able to locate any info on the Adobe error code, so I ended up installing <a href="http://xpdf.darwinports.com/" rel="nofollow noreferrer">xpdf via Darwinports</a>. Loading my PDF with xpdf spit out much more useful error information and I was able to track down the problem. (I was creating a circular ref... | 10,270 |
<p>It's a really basic question but i can't think at the second. How do i set up a loop that asks each time the function inside runs whether to do it again. So it runs it then says something like;</p>
<p>"loop again? y/n"</p>
| <pre><code>while True:
func()
answer = raw_input( "Loop again? " )
if answer != 'y':
break
</code></pre>
| <pre><code>While raw_input("loop again? y/n ") != 'n':
do_stuff()
</code></pre>
| 34,472 |
<pre><code>string percentage = e.Row.Cells[7].Text;
</code></pre>
<p>I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound event. I am trying to get the value from a particular cell, which is a TemplateField. But the code above always seems to be returning an empty str... | <p>why not pull the data directly out of the data source.</p>
<pre><code>DataBinder.Eval(e.Row.DataItem, "ColumnName")
</code></pre>
| <pre><code>protected void gvbind_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';";
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
e.Row.Attributes[... | 14,800 |
<p>How can I get a PHP function go to a specific website when it is done running?</p>
<p>For example:</p>
<pre><code><?php
//SOMETHING DONE
GOTO(http://example.com/thankyou.php);
?>
</code></pre>
<p>I would really like the following...</p>
<pre><code><?php
//SOMETHING DONE
GOTO($url);
?>
</code>... | <pre><code><?
ob_start(); // ensures anything dumped out will be caught
// do stuff here
$url = 'http://example.com/thankyou.php'; // this can be set based on whatever
// clear out the output buffer
while (ob_get_status())
{
ob_end_clean();
}
// no redirect
header( "Location: $url" );
?>
</code></pre>
| <p>Here's a solution to the "headers were already sent" problem. Assume you are validating and emailing a form. Make sure the php code is the first thing on your page... before any of the doctype and head tags and all that jazz. Then, when the POST arrives back at the page the php code will come first and not encounter... | 46,087 |
<p>(I'm using Visual C++ 2008) I've always heard that main() is <em>required</em> to return an integer, but here I didn't put in <code>return 0;</code> and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named anything other than main()... | <blockquote>
<h1>3.6.1 Main function</h1>
<p>....</p>
<p>2 An implementation shall not predefine the <code>main</code> function. This function shall not be overloaded. It shall have a return type of type <code>int</code>, but otherwise its type is implementation-defined. All implementations shall allow both of the foll... | <p>I'm pretty sure VC++ just inserts a return 0 if you don't include one in main functions. The same thing can happen with functions too, but in those cases at least you'll get a warning.</p>
| 4,222 |
<p>Let's say you're printing a container or some other object with no infill. What's a good rule of thumb for how thick to make the outside? I'm looking for something along the lines of millimeters thick per square inch of area.</p>
<p>I'm thinking about PLA right now, but answers for ABS and other materials are welco... | <p>This totally depends on what you think is acceptable for your print, and what the usage of the print is: is it a structural/functional part or just for aesthetic purposes. There is no general rule of thumb for that. Basically this is a design issue.</p>
<p>If it has to be stiff and may not flex much you would requi... | <p>I make small objects (25mm^2) with 1 to 1.5 mm walls and larger objects (think coffee cups) with about 2.5 - 3 mm walls. I set the line width and number of perimeters to completely fill the thickness.
I use this for ABS and PLA.
The PLA objects have been electronics enclosures, with internal structures to suppor... | 992 |
<p>I'm working on a database that needs to represent computers and their users. Each computer can have multiple users and each user can be associated with multiple computers, so it's a classic many-to-many relationship. However, there also needs to be a concept of a "primary" user. I have to be able to join against t... | <p>Option 3, though it may feel strange, is the closest to what you want to model. You'd do something like:</p>
<pre><code>User {
UserId
PRIMARY KEY (UserId)
}
Computer {
ComputerId, PrimaryUserId
PRIMARY KEY (UserId)
FOREIGN KEY (ComputerId, PrimaryUserId)
REFERENCES Computer_User (Compute... | <p>Since the primary user is a function of the computer and the user I would tend to go with your approach of having the primaryUser being a column on the linking table.</p>
<p>The other alternative that I can think of is to have a primaryUser column directly on the computer table itself.</p>
| 19,359 |
<p>The <a href="http://dev.jquery.com/view/trunk/ui/demos/functional/#ui.dialog" rel="nofollow noreferrer">demos</a> for the jquery ui dialog all use the "flora" theme. I wanted a customized theme, so I used the themeroller to generate a css file. When I used it, everything seemed to be working fine, but later I found ... | <p>I think it is because you have the classes different.<br/>
<code><div id="SERVICE03_DLG" class="flora"></code> (flora)<br/>
<code><div id="SERVICE03_DLG" class="ui-dialog"></code> (custom)</p>
<p>Even with the flora theme, you would still use the ui-dialog class to define it as a dialog.</p>
<p>I've d... | <p>Man, this is a good one. I've tried doing a bunch of things on these two pages. Have you tried just leaving the CSS out altogether and trying both pages then? I used Firebug to remove the CSS from the header on both pages, and the input still worked on one and not on the other - but, I'm inclined to believe that ... | 6,752 |
<p>What exactly is a <a href="https://en.wikipedia.org/wiki/Geographic_information_system" rel="nofollow noreferrer">Geographic Information System</a>?</p>
| <p>Both the previous answers are correct, but I believe they're somewhat incomplete.</p>
<p><em>GIS</em> is the abbreviation for Geographic Information System. It does include information about location. Wikipedia <a href="http://en.wikipedia.org/wiki/Geographic_information_system" rel="noreferrer">GIS</a> does have... | <p>GIS can be either Geographic Information Science or Geographic Information Systems. I think of the System part to be a subset of the Science part. </p>
<p>GISci is more an academic versus I think of GISys as more practical.</p>
<p>The most visible use of GIS right now would be Google Earth, Virtual Earth and oth... | 32,282 |
<p>Does anyone know of any specific DSL implementations used to import legacy Oracle database schemas. I have tried to just run db:schema:dump on my existing db I want to port to a new ruby app. However, the rake dies about halfway through with out any error. It kinda just locks up. I started looking for the best way t... | <p>did you try <code>rake --trace</code>?</p>
<p>By the way Oracle legacy schemas is a small cottage industry.</p>
<p><a href="http://github.com/rsim/legacy_oracle_sample.git/README.txt" rel="nofollow noreferrer">http://github.com/rsim/legacy_oracle_sample.git/README.txt</a></p>
<p><a href="http://blog.rayapps.com/2... | <p><strong>update:</strong> this only fail if you use ", :require => false". Removing this param, work as expected.</p>
<p>This really should work?</p>
<pre><code>~/Projects/test (master) $ rake db:structure:dump
(in /Users/plentz/Projects/test)
rake aborted!
Task not supported by 'oracle_enhanced'
(See full trace b... | 31,176 |
<p>I'm updating some old AWStats config files to filter out some specific IP ranges. Here's the pertinent section of the config file:</p>
<pre><code># Do not include access from clients that match following criteria.
# If your log file contains IP addresses in host field, you must enter here
# matching IP addresses cr... | <p>Assuming that character classes are supported within REGEX[ ]:</p>
<pre><code>SkipHosts = "REGEX[^192\.168\.1\.(9[7-9]|10[0-9]|110)$]"
</code></pre>
| <p>Does AWStats run if you leave SkipHosts empty? Otherwise, try the commandline utility to check for errors. For example, using Windows:</p>
<pre><code>c:\perlpath\perl.exe awstats.pl config=yourconfigfile -update -logfile=yourlogfile
</code></pre>
<p>That should give more details.</p>
| 19,105 |
<p>How do I easily undo a git rebase? A lengthy manual method is:</p>
<ol>
<li>checkout the commit parent to both of the branches</li>
<li>create and checkout a temporary branch</li>
<li>cherry-pick all commits by hand</li>
<li>reset the faulty rebased branch to point to the temporary branch</li>
</ol>
<p>In my current... | <p>The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the <a href="https://git-scm.com/docs/git-reflog" rel="noreferrer">reflog</a>...</p>
<pre><code>git reflog
</code></pre>
<p>and to reset the current branch to it (with the usual caveats about being absol... | <p>If you mess something up within a git rebase, e.g. <code>git rebase --abort</code>, while you have uncommitted files, they will be lost and <code>git reflog</code> will not help. This happened to me and you will need to think outside the box here. If you are lucky like me and use IntelliJ Webstorm then you can <code... | 16,334 |
<p>For the following header I get the same two errors on all my sitemaps. It's confusing because, if Google can't read my sitemap, then how can they say that each URL has the same priority? The header counts as line 2, after the XML declaration. Google claims only to have indexed about 2% of the URLs from the maps. ... | <p>Have you validated your XML against the schema given here: <a href="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" rel="noreferrer">http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd</a></p>
<p>If yes, what was the result?</p>
<p>If not, what is the URL of your sitemap?</p>
<p>If you don't know how... | <p>Nottice that the schemaLocation has 2 URi's... (must have even number of URI's)</p>
<p>It should look like this:
**</p>
<blockquote>
<p>xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
<a href="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" rel="nofollow noreferrer">http://www.sitemaps... | 39,232 |
<p>I have created one sample PHP script to upload excel sheets of very bigger sizes. Also the process happening with each records given in the excel sheets is bit complex. To allow bigger sizes, I have added necessary PHP ini values in the Apache configuration file to override the actual PHP ini values.</p>
<p>The pro... | <p>My guess is that it's not Apache's fault and your browser just times out the connection. You could try some of <a href="http://fit.c2.com/wiki.cgi?PreventingBrowserTimeout" rel="nofollow noreferrer">these</a> techniques and see if that helps any.</p>
| <p>You can do two thing to avoid this problem</p>
<ol>
<li>Ask user to convert excel file into csv if possible in your situation. as csv are much lighter than excel sheet.</li>
<li>try using header("newpage.php") in the script to redirect user to new page</li>
</ol>
| 39,683 |
<p>I've got a lot of pages in my site, I'm trying to think of a nice way to separate these into areas that are a little more isolated than just simple directories under my base web project. Is there a way to put my web forms into a separate class library? If so, how is it done?</p>
<p>Thanks in advance.</p>
| <p>At first thought, I don't think this is possible, due to the way ASPX is non-precompiled..</p>
<p>However, you can create classes that inherit from <code>Page</code> and place them into a DLL to re-use code-behind functionality. This can of course include control instantiate logic if required, but there is no desig... | <p>I think it is possible, i have done it in one of my projects where aspx file will be physically placed in class library. And in the properties of the main project there is an option <strong>Build Events</strong> there you can put something like this</p>
<pre><code>if exist "$(TargetDir)WebForm1.aspx" move /Y "$(Tar... | 35,884 |
<p>Can someone please derive a concrete example from the following:</p>
<p><a href="http://www.urdalen.com/blog/?p=210" rel="nofollow noreferrer">http://www.urdalen.com/blog/?p=210</a></p>
<p>..that shows how to deal with <code>one-to-many</code> and <code>many-to-many</code> relationships?</p>
<p>I've emailed the a... | <p>The problem of ORM's (The impedance mismatch, as it's called) is precisely with relations. In an object graph (In-memory objects), relationships are pointers to other objects. In a relational database, relationships are reversed; This makes it impossible to do a simple mapping between the two models, and that is why... | <p>Given your response to Tom's answer, I would recommend that you look at something like Zend Framework. Its ORM has a take it or leave it architecture that can be implemented in stages.</p>
<p>When I came to my present employer, they had an application that had just been completed months previously but had been thro... | 34,590 |
<p>How do you make your application multithreaded ?
Do you use asynch functions ?
or do you spawn a new thread ?
I think that asynch functions are already spawning a thread so if your job is doing just some file reading, being lazy and just spawning your job on a thread would just "waste" ressources...
So is there some... | <p>Spawning threads is only going to waste resources if you start spawning tons of them, one or two extra threads isn't going to effect the platforms proformance, infact System currently has over 70 threads for me, and msn is using 32 (I really have no idea how a messenger can use that many threads, exspecialy when its... | <p>The use of threads makes you think more about the way your application needs threading and can in the long run make it easier to improve / control your performance.<br>
Async methods are faster to use but they are a bit magic - a lot of things happen to make them possible - so it's probable that at some point you wi... | 8,651 |
<p>There are <a href="http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks" rel="noreferrer">lots of web application frameworks</a> available these days, for pretty much every language out there. In your experience, what are their strengths, weaknesses, and unique features? Assuming the luxury of cho... | <p>I am going to briefly address each area for three popular Python frameworks. This is only based on my personal experiences and observations.</p>
<h2>Development speed and convenience</h2>
<p>For <strong>TurboGears</strong>, <strong>Pylons</strong>, and <strong>Django</strong>, development speed is roughly equal. B... | <p>This is an incredibly subjective question.. and that's a tag you ought to add to your question. As several comments have already suggested, you've already specified a pretty good guide; what are you actually asking? There's a billion opinions about this sort of thing and definitely no right answer!</p>
<p>Personall... | 17,219 |
<p>In our administration team everyone has root passwords for all client servers.
But what should we do if one of the team members is not longer working with us?
He still has our passwords and we have to change them all, every time someone leave us. </p>
<p>Now we are using ssh keys instead of passwords, but this is n... | <p>The systems I run have a <a href="http://www.sudo.ws/" rel="noreferrer">sudo</a>-only policy. i.e., the root password is <code>*</code> (disabled), and people have to use sudo to get root access. You can then edit your <code>sudoers</code> file to grant/revoke people's access. It's very granular, and has lots of con... | <p>If you have ssh access via your certificates, can't you log in via ssh and change the <code>root</code> password via <code>passwd</code> or <code>sudo passwd</code> when you need to do something else that requires the password?</p>
| 25,505 |
<p>One of the files in my current head revision got corrupted. I want to make an older revision of that file the head revision as usually people sync to head revsion in my project. How to do that?</p>
| <p>You should revert all changes since that old reversion. In principle,</p>
<pre><code>svn merge -rHEAD:oldrev filename
svn commit -m "rolled back to oldrev"
</code></pre>
<p>should do. The later revisions are still there, but reverted.</p>
| <p>You should do a <a href="http://svnbook.red-bean.com/en/1.2/svn.branchmerge.commonuses.html#svn.branchmerge.commonuses.undo" rel="noreferrer">reverse merge</a>.</p>
| 34,128 |
<p>I am trying to setup a TFS Team Build and am new to MSBuild. I have a solution that contains a few projects (MyProject1, MyProject2, ..). I find that setting up the team build I could only select which solution should be built and when performing the build the build target for all the projects becomes the same and t... | <p>You could create an additional solution configuration in your solution, e.g. called "Build". In that configuration only build the projects you want. In the teambuild project file use the element to specify that only your "Build" configuration should be built.</p>
<p>Another option would be to create a separate sol... | <p>In the build menu select "batch build" and this will allow you to rebuild only the projects you select plus it has the ability to do them in different modes (like release and debug)</p>
| 43,326 |
<p>What limits exist on the amount of data one can publish to a custom Windows performance counter category?</p>
<p>I understand there is no hard limit on the number of counters or the number of instances, but rather there is a memory limit for the entire category. What is that limit?</p>
<p>Is there a limit on the t... | <p>Under what circumstances would you need to publish tens of thousands of counters.</p>
<p>Remember that the tools that read those perf counters typically aren't designed for such massive data sets (althought they might be). As a result, it is possible that while you'll be able to author such a data set, the tools t... | <p>Is there actually a limit though? I thought you basically just published a block of shared memory - why not just increase the size of the block? What makes you think there is a limit?</p>
| 33,313 |
<p>When you use composition, then you can mock the other objects
from which your class-under-test depends, but when you use
inheritance, you can't mock the base class. (Or can you?)</p>
<p>I generally try to <a href="https://stackoverflow.com/questions/49002/prefer-composition-over-inheritance">prefer composition over... | <p>Use a suite of unit tests that mirrors the class hierarchy. If you have a base class Base and a derived class Derived, then have test classes BaseTests and derived from that DerivedTests. BaseTests is responsible for testing everything defined in Base. DerivedTests inherits those tests and is also responsible for te... | <p>No, you don't. You just have to check that the overriden methods do what they should. It should in NO WAY impact the behaviour of your parent methods. If your parent methods start to fail, then it means that you missed bound conditions when testing them at the parent level.</p>
| 12,608 |
<p>In our web applications, we seperate our Data Access Layers out into their own projects.</p>
<p>This creates some problems related to settings. </p>
<p>Because the DAL will eventually need to be consumed from perhaps more than one application, web.config does not seem like a good place to keep the connection strin... | <p>System.Configuration.ConfigurationManager.ConnectionStrings and System.Configuration.ConfigurationManager.AppSettings
Contain settings from the executing application so in your DAL you can get the settings stored in your web.config file.</p>
<p>For your system you can create a custom configuration section that will... | <p>You could have a Interface that mapped you settings that is used on your DAL. Then on the App you could just use IoC to feed the settings to the DAL.</p>
| 39,386 |
<p>IMHO Radio buttons should retire. The ComboBox (Drop-Down list mode) should always be preferred.<br>Drop-Down list takes minimal screen space, and you can add/remove items programmatically.<br>No need to resize anything (hard), or disable irrelevant options (ugly).</p>
<p>Can you think of a situation when a Radio ... | <p>Radio buttons should be used: </p>
<ul>
<li>When you need to use standard visual
representation </li>
<li>When you need to
visually present groups of choices
as groups </li>
<li>When you need to present
all choices together (in terms of
accessibility)</li>
</ul>
<p>Generally, according Jakob Nielsen's guidelines, ... | <p>Radio buttons are a great way to get one option from a user. </p>
<p>So you make a report manager for your users that lets them see sales this year, last year, this month or last month. </p>
<p>Put these at the top of your manager so you user chooses only one. Then fills in drop downs etc for extra filtering</p>
| 33,619 |
<p>I know there is built-in Internet explorer, but what I'm looking for is to open Firefox/Mozilla window (run the application) with specified URL. Anyone can tell me how to do that in C# (.nET) ?</p>
| <p>This will launch the system defined default browser:</p>
<pre><code>string url = "http://stackoverflow.com/";
System.Diagnostics.Process.Start(url);
</code></pre>
<p>Remember that Process.Start(url) might throw exceptions if the browser is not configured correctly.</p>
| <p>Use the Process class (System.Diagnostics) using the URL as the process name. This will use the system default browser to open the URL. If you specify a browser, you run the risk that the browser doesn't exist.</p>
| 27,559 |
<p>I have used the smtp class to send emails through code. <br /></p>
<p>Can I use the classes in the .net framework to display emails received on a page without having to use something like exchange sdk? <br /></p>
<p>How would I go about using gmail pop and smtp server information in .net web apps (with the .net cl... | <p>Yes, it's possible. You'll probably find it easier to use one of the many third-party components which are available and encapsulate much of the logic you would otherwise need to develop.</p>
<p>I like Chilkat's <a href="http://www.chilkatsoft.com/email-features.asp" rel="nofollow noreferrer">email component</a>. T... | <p>Read this</p>
<p><a href="http://www.developerfusion.com/article/4071/how-to-pop3-in-c/" rel="nofollow noreferrer">How to POP3 in C#</a></p>
| 41,555 |
<p>Is there a library or acceptable method for sanitizing the input to an html page?</p>
<p>In this case I have a form with just a name, phone number, and email address. </p>
<p>Code must be C#.</p>
<p>For example:</p>
<p><code>"<script src='bobs.js'>John Doe</script>"</code> should become <code>"John ... | <p>We are using the <a href="https://github.com/mganss/HtmlSanitizer" rel="nofollow noreferrer">HtmlSanitizer</a> .Net library, which:</p>
<ul>
<li>Is open-source (MIT) - <a href="https://github.com/mganss/HtmlSanitizer" rel="nofollow noreferrer">GitHub link</a></li>
<li>Is fully customizable, e.g. configure which ele... | <p>If by sanitize you mean REMOVE the tags entirely, the RegEx example referenced by Bryant is the type of solution you want.</p>
<p>If you just want to ensure that the code DOESN'T mess with your design and render to the user. You can use the HttpUtility.HtmlEncode method to prevent against that!</p>
| 22,907 |
<p>I have an application running in tomcat that has a bunch of configuration files that are different for each environment it runs in (dev, testing, and production). But not every line in a config file will be different between environments so there's invariably duplicated information that doesn't get updated if someth... | <ol>
<li>Assign reasonable default values for all properties in the properties files distributed within your .war file.</li>
<li>Assign environment-specific values for the appropriate properties in webapp context (e.g. conf/server.xml or conf/Catalina/localhost/yourapp.xml)</li>
<li>Have your application check the cont... | <p>The duplication is not really a problem, having a central config file the the other files 'extend' is likely to casue more of a headache in the long term.</p>
<p>My advice is to use ant to load (copy and move) the appropriate file(s) into place and then launch the app (bundle into war?). Just have a different task ... | 24,371 |
<p>I noticed that Google maps is providing directions in my local language (hungarian) when I am using google chrome, but English language directions when I am using it from IE. </p>
<p>I would like to know how chrome figures this out and how can I write code that is always returning directions on the user's language.... | <p><code>HTTP</code>requests` include an <strong>Accept-Language header</strong> which is set according to your locale preferences on most OS/browser combinations. Google uses a combination of that, the local domain you use (eg 'google.it', 'google.hu') and any preferences you set with the Preferences link in the home ... | <p>I could be way off but I think it's fairly safe to assume that google, is using gears.</p>
| 9,261 |
<p>I am a .NET webdev using ASP.NET, C# etc... I "learned" javascript in college 5+ years ago and can do basic jobs with it. But I wonder if it is useful to become proficient in it.</p>
<p>Why should I learn Javascript?
Is it more advantageous then learning JQuery or a different <a href="https://stackoverflow.com/ques... | <p>Yes, definitely learn Javascript before you learn one of the libraries about. It's the whole walk-before-you-can-run thing.</p>
| <p>Learning a second programming language is always good.
By the sound of it, JavaScript is a language that you use, to it will be of practical use too. As a web dev, it has been recommended to me in a review that i learn at least basic JavaScript.</p>
<p>A library such as jQuery is essential for web development thse... | 14,009 |
<p>What is the best resource for learning the features and benefits of windbg? I want to be able to discuss investigate memory issues (handles, objects), performance issues, etc . . .</p>
| <p>These are some I like:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/magazine/cc163528." rel="noreferrer">Maoni Stephens and Claudio Caldato's article on MSDN</a></li>
<li><a href="http://blogs.msdn.com/maoni/" rel="noreferrer">Maoni's blog</a> (it is not updated recently but it contains a lot of useful mat... | <p>Of course the <a href="http://msdn.microsoft.com/en-us/library/bb190764.aspx" rel="nofollow noreferrer">SOS Debugging Extension reference</a> is very good too!</p>
| 47,836 |
<p>I was messing around with <a href="http://www.ayende.com/projects/rhino-mocks.aspx" rel="nofollow noreferrer">RhinoMocks</a> this morning and couldn't run my tests because RhinoMocks.dll was not in a "trusted location". The assembly is in my c:\documents and settings\\My Documents\Visual Studio 2008\Projects (and so... | <p>Did you download a zip file from the internet and then extract it using the standard explorer tools. I think this marks the directory as untrusted and Visual studio detects this.</p>
| <p>Right click the file or location and choose Properties. At the very bottom, you should see the button "Unblock". Click it and press OK.</p>
| 8,310 |
<p>Is it possible to connect PHP to a SQL Server Compact Edition database? What would be the best driver?</p>
<hr>
<p>I need it for a desktop application where SQL Server Express is too heavy.</p>
| <p>Short Answer : <strong>No.</strong></p>
<p>Long Answer : To my knowledge, unlike PostgreSQL / MySQL / MS-SQL, there is no native driver to connect PHP to SQL Server Compact Edition.</p>
<p>If you want to connect to it, your best bet is to use PHP ODBC connections to talk to a ODBC Driver connected to the SQL Compa... | <p>The question is Why? Why not just use an Express Version?</p>
<p>I must say that I'm curious, but I can't say that I've used a C.E. data base for anything outside of a .Net application that had the assemblies in the application folder.</p>
| 20,317 |
<p>What should I do if I want to release a .net assembly but wish to keep its internals detailed in the manifest private (from a utility such as <a href="https://learn.microsoft.com/en-us/dotnet/framework/tools/ildasm-exe-il-disassembler" rel="nofollow noreferrer">ildasm.exe</a>) ?</p>
| <p>I think what you're talking about is "obfuscation".
There are lots of articles about it on the net:</p>
<p><a href="http://en.wikipedia.org/wiki/Obfuscation" rel="noreferrer">http://en.wikipedia.org/wiki/Obfuscation</a></p>
<p>The "standard" tool for obfuscation on .NET is by Preemptive Solutions:</p>
<p><a href=... | <p>The CLR cannot directly load modules that contain no manifest. So you can't make an assembly completely private unless you also want to make it unloadable ;)</p>
<p>You can however, as Mark noted above, use obfuscation tools to hide the parts you would like to keep truly internal. </p>
<p>It's too bad the <strong>... | 4,937 |
<p>I know its possible to get the top terms within a Lucene Index, but is there a way to get the top terms based on a subset of a Lucene index?</p>
<p>I.e. What are the top terms in the Index for documents within a certain date range?</p>
| <p>Ideally there'd be a utility somewhere to do this, but I'm not aware of one. However, it's not too hard to do this "by hand" in a reasonably efficient way. I'll assume that you already have a <code>Query</code> and/or <code>Filter</code> object that you can use to define the subset of interest.</p>
<p>First, buil... | <p>Counting up the TermVectors will work, but will be slow if there are a lot of documents to iterate. Also note if you mean docFreq by top terms, then don't use the count in the TermFreqVector just count the terms as binary.</p>
<p>Alternatively, you could iterate the terms like facet counts. Use a <a href="http://... | 23,739 |
<p>I have a Flashforge Creator Dual.</p>
<p>One corner of my print bed is warped down. I am thinking about having a steel print bed made so it would tend to stay flat. </p>
<p>Has anyone tried this?</p>
| <p>Whether you should use steel or aluminum depends on the construction of your print bed stack. Either will work, but there are trade-offs involved.</p>
<p>Various considerations that may come into play:</p>
<ul>
<li>A flat sheet of aluminum has better <strong>stiffness/weight ratio</strong> than a flat sheet of ste... | <p>I would consider getting another aluminum build plate for the following reasons:</p>
<ul>
<li><strong>Lightweight</strong>. Aluminum is a very lightweight metal, making it suitable for most machines that have injection molded platform arms. This reduces potential sagging of the arms and overall load on the -Z- axis... | 287 |
<p>We have a set of nightly builds that build of full suite of software using Embedded Visual C++ batch files. There is probably a total of 30 builds that are done. Every night at least one or two builds fail with something like the following error:</p>
<blockquote>
<p>c:\lc\trunk\server\can\svcangettracedriveleng... | <p>Try running it all in the visual IDE; it will be easier to catch this way.</p>
<p>You sure you don't have multiple compiler instances working on several builds at once? One building a project/lib/whatever while another trying to access it?</p>
| <p>Generally speaking we do not see this error when running inside of the IDE (EVC++ 4.0). We cannot run our nightly builds using the GUI, however. </p>
<p>As far as we know the build machine is idle while the nightly builds are running.</p>
| 14,808 |
<p>I want to query Active Directory from Windows PE 2.0, which is not supported "out of the box." Microsoft seems to suggest that this is possible, but not with any tools they provide. What do you recommend?</p>
| <p>There seem to be instructions here, and the author claims to query AD from WinPE.
<a href="http://www.clientarchitect.com/blog1.php/2008/06/18/windows-pe-2-0-ad-scripting-requirements" rel="nofollow noreferrer">http://www.clientarchitect.com/blog1.php/2008/06/18/windows-pe-2-0-ad-scripting-requirements</a></p>
| <p>There seem to be instructions here, and the author claims to query AD from WinPE.
<a href="http://www.clientarchitect.com/blog1.php/2008/06/18/windows-pe-2-0-ad-scripting-requirements" rel="nofollow noreferrer">http://www.clientarchitect.com/blog1.php/2008/06/18/windows-pe-2-0-ad-scripting-requirements</a></p>
| 15,734 |
<p>Basically, I would like to build a list comprehension over the "cartesian product" of two iterators. Think about the following <a href="http://www.haskell.org/haskellwiki/List_comprehension" rel="noreferrer">Haskell code</a>:</p>
<pre><code>[(i,j) | i <- [1,2], j <- [1..4]]
</code></pre>
<p>which yields</p>
... | <p>Are you asking about this?</p>
<pre><code>[ (i,j) for i in range(1,3) for j in range(1,5) ]
</code></pre>
| <p>This seems to do what you describe:</p>
<p>[[a,b] for a in range(1,3) for b in range(1,5)]</p>
<p>UPDATE: Drat! Should have reloaded the page to see S.Lott's answer before posting. Hmmm... what to do for a little value-add? Perhaps a short testimony to the usefulness of interactive mode with Python. </p>
<p>I com... | 42,734 |
<p>I came across this code and wanted others to provide their point of view... is it good or bad ? ;)</p>
<pre><code>Class ReportClass
{
public string ReportName {get; set;}
}
</code></pre>
<p>Then it was used as follows in code:</p>
<pre><code>displayReport(ReportClass.ReportName = cmbReportName.SelectedValue.ToSt... | <p>I tend to avoid in-place assignment - or indeed any side effects like this - except for one common idiom:</p>
<pre><code>string line;
while ((line = reader.ReadLine()) != null)
{
// Do something with line
}
</code></pre>
<p>(And variants for reading streams etc.)</p>
<p>I'm also okay with using object ini... | <p>Seems fine to me. It is probably compiled with C# 3.0 and that allows <a href="http://msdn.microsoft.com/en-us/library/bb384054.aspx" rel="nofollow noreferrer">C# automatic properties</a>.</p>
| 33,943 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.