instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I feel like I’ve tried everything. I’ve had an Ender 3 for seven months now printing in PLA. </p>
<p>I’ve modded it plenty including BLTouch. I’m now doing a project that really requires ABS so I have the white hatch box ABS. It wasn’t sticking at first but I got that well under control with glue tape and proper le... | <p>Welcome Fox_89 to the SE 3D Printing site. Thank you for bringing your question, and I hope you contribute both questions and answers in the years ahead.</p>
<p>I understand that you've tried everything, so I have nothing new to suggest.</p>
<p>Never the less, I would suggest some possibilities, perhaps one of wh... | <p>I'd second printing slow and near as hot as your filament can stand and still hold shapes in test runs.</p>
<p>Extruding thin has worked well for me in cases with ABS pull/shrinkage. I've also had luck heating up the environment my printer is in. ABS stays gummy above 105C (its Tg is around there), so I've had good... | 1,367 |
<p>I have a bunch of log files. I need to find out how many times a string occurs in all files.</p>
<pre><code>grep -c string *
</code></pre>
<p>returns</p>
<pre><code>...
file1:1
file2:0
file3:0
...
</code></pre>
<p>Using a pipe I was able to get only files that have one or more occurrences:</p>
<pre><code>grep -... | <pre><code>cat * | grep -c string
</code></pre>
| <p>Another oneliner using basic command line functions handling multiple occurences per line. </p>
<pre><code> cat * |sed s/string/\\\nstring\ /g |grep string |wc -l
</code></pre>
| 48,498 |
<p>I've read some about .egg files and I've noticed them in my lib directory but what are the advantages/disadvantages of using then as a developer?</p>
| <p>From the <a href="http://peak.telecommunity.com/DevCenter/PythonEggs" rel="noreferrer">Python Enterprise Application Kit community</a>:</p>
<blockquote>
<p><em>"Eggs are to Pythons as Jars are to Java..."</em></p>
<p>Python eggs are a way of bundling
additional information with a Python
project, that all... | <p>Whatever you do, do not stop distributing your application, also, as a tarball, as that is the easiest packagable format for operating systems with a package sysetem.</p>
| 7,029 |
<p>From the help for the Overflow Error in VBA, there's the following examples:</p>
<pre><code>Dim x As Long
x = 2000 * 365 ' gives an error
Dim x As Long
x = CLng(2000) * 365 ' fine
</code></pre>
<p>I would have thought that, since the Long data type is supposed to be able to hold 32-bit numbers, that the first exa... | <p>2000 and 365 are Integer values. In VBA, Integers are 16-bit signed types, when you perform arithmetic on 2 integers the arithmetic is carried out in 16-bits. Since the result of multiplying these two numbers exceeds the value that can be represented with 16 bits you get an exception. The second example works bec... | <p>In VBA, literals are integer by default (as mentioned). If you need to force a larger datatype on them you can recast them as in the example above or just append a type declaration character. (The list is here: <a href="http://support.microsoft.com/kb/191713" rel="nofollow noreferrer">http://support.microsoft.com/kb... | 40,840 |
<p>What is the best way to count the time between two datetime values fetched from MySQL when I need to count only the time between hours 08:00:00-16:00:00.</p>
<p>For example if I have values 2008-10-13 18:00:00 and 2008-10-14 10:00:00 the time difference should be 02:00:00.</p>
<p>Can I do it with SQL or what is th... | <p>The <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timediff" rel="noreferrer">TIMEDIFF</a> function</p>
<blockquote>
<p>TIMEDIFF() returns expr1 – expr2
expressed as a time value. expr1 and
expr2 are time or date-and-time
expressions, but both must be of the
same typ... | <p>You may want to try it in PHP, but I'm thinking it'll be faster in DB</p>
<p><a href="http://www.gidnetwork.com/b-16.html" rel="nofollow noreferrer">code to return difference in an array</a></p>
| 24,478 |
<p>I have the following code that I need to run over a matrix with over 20000 rows. It takes several minutes to run and the datenum and str2double functions appear to be the bottlenecks. Since no calculation depends on previous ones is there a way to break the loop into multiple parts and have them execute in parallel?... | <p>Hmm. I'm more of a MATLAB person than Octave but maybe I can help (if you are still looking for a solution) </p>
<p>This looks like the I'm-reading-in-a-file-but-I-need-to-do-something-different-than-the-tool-provides problem (otherwise you could get away with dlmread which should be pretty fast).</p>
<p>If there ... | <p>The fastest thing to do, if your data is in a text file, is use <code>textread</code>.</p>
<pre><code>function [DJI2] = InterpretFile(datafile)
[txtdates, c2, c3, c4, c5, c6] = textread(datafile, '%* %s %f %f %f %f %f');
dates = datenum(strvcat(txtdates),'yyyy-mm-dd');
DJI2 = [dates c2 c3 c4 c5 c6];
</c... | 45,339 |
<p>How can I go about storing a vb.net user defined object in a sql database. I am not trying to replicate the properties with columns. I mean something along the lines of converting or encoding my object to a byte array and then storing that in a field in the db. Like when you store an instance of an object in session... | <p>You can use <a href="http://msdn.microsoft.com/en-us/library/ms973893.aspx" rel="nofollow noreferrer">serialization</a> - it allows you to store your object at least in 3 forms: binary (suitable for BLOBs), XML (take advantage of MSSQL's XML data type) or just plain text (store in varchar or text column) </p>
| <p>@aku, lomaxx and bdukes - your solutions are what I was looking for. </p>
<p>@1800 INFORMATION - while i appreciate your stance on the matter, this is a special case of data that I get from a webservice that gets refreshed only about once a month. I dont need the data persisted in db form because thats what the web... | 6,216 |
<p>Why does UDP have a length field in the header and TCP does not?</p>
<p>I am guessing that the length of the segment in TCP is inferred from the IP header but one should be able to do the same for a UDP datagram</p>
| <p>According to <em>TCP/IP Illustrated Volume 1</em>, the length field is redundant. That's all Stevens says on the matter.</p>
<p>I personally believe it was to make the UDP header length (in bits) divisible by 32 :)</p>
| <p>It's just the way UDP was originally specified. UDP could work without a length field in the header in the same way TCP does.</p>
<p>How is the length of each segment obtained in TCP? It is really up to the specific implementation (OS). The RFC for TCP just states:</p>
<blockquote>
<p>Any lower level protocol will h... | 35,641 |
<p>I have two routes:</p>
<pre><code>routes.MapRoute(
"FetchVenue",
"venue/fetchlike/{q}",
new { controller = "venue", action = "fetchlike" }
);
routes.MapRoute(
"venue", ... | <p>Just off the top of my head, shouldn't your URL look like <code>/venue/fetchlike?q=test</code>, instead of <code>/venue/fetchlike/?q=test</code></p>
| <p>Just off the top of my head, shouldn't your URL look like <code>/venue/fetchlike?q=test</code>, instead of <code>/venue/fetchlike/?q=test</code></p>
| 49,281 |
<p>On the latest Ubuntu, I have a functioning PHP 5.2.4 installation. I want to use a remote Oracle server from PHP using OCI.</p>
<p>I've downloaded the <em>"Instant Client Package - Basic Lite"</em> (<a href="http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html" rel="nofollow noref... | <p>You need the PHP extension, try the following on your Ubuntu:</p>
<pre><code>(sudo) pecl install oci8
</code></pre>
<p>Make sure your php.ini's (there should be one for your Apache and one for cli php) contain <code>extension=oci8.so</code> afterwards. Finally, you have to restart Apache and can confirm via <code>... | <p>I think you'll need to make sure that the $ORACLE_HOME/lib32 is in your $LD_LIBRARY_PATH, or else add that directory to the /etc/ld.so.conf file.</p>
| 29,563 |
<p>A little example</p>
<pre><code>TTest<T> = class
private
f : T;
public
function ToString : string;
end;
</code></pre>
<p>If is an object then this should work</p>
<pre><code>TTest<T>.ToString;
begin
Result := f.ToString;
end;
</code></pre>
<p>But what happens when is say an integer? This woul... | <p>There are three reasons why Delphi doesn't let you do what you are trying to do in your second example - call the ToString method on a value of an unconstrained type parameter type (or at least that's what I think you were trying to show, since TObject.ToString is an instance method, not a class method, so T.ToStrin... | <p>I guess I could wrap my simple types in objects, and override the ToString function, but it does defeat the purpose of generics.</p>
| 32,525 |
<p>I have just started learning Erlang and am trying out some Project Euler problems to get started. However, I seem to be able to do any operations on large sequences without crashing the erlang shell.</p>
<p>Ie.,even this:</p>
<pre><code>list:seq(1,64000000).
</code></pre>
<p>crashes erlang, with the error:</p>
... | <p>Your OS may have a default limit on the size of a user process. On Linux you can change this with ulimit.</p>
<p>You probably want to iterate over these 64000000 numbers without needing them all in memory at once. Lazy lists let you write code similar in style to the list-all-at-once code:</p>
<pre><code>-module(l... | <p>Possibly a noob answer (I'm a Java dev), but the JVM artificially limits the amount of memory to help detect memory leaks more easily. Perhaps erlang has similar restrictions in place?</p>
| 23,422 |
<p>How do you automatically set the focus to a textbox when a web page loads?</p>
<p>Is there an HTML tag to do it or does it have to be done via Javascript?</p>
| <p>If you're using jquery:</p>
<pre><code>$(function() {
$("#Box1").focus();
});
</code></pre>
<p>or prototype:</p>
<pre><code>Event.observe(window, 'load', function() {
$("Box1").focus();
});
</code></pre>
<p>or plain javascript:</p>
<pre><code>window.onload = function() {
document.getElementById("Box1").fo... | <p>Use the below code. For me it is working</p>
<pre><code>jQuery("[id$='hfSpecialty_ids']").focus()
</code></pre>
| 6,784 |
<p>What is the most efficient way to write the old-school:</p>
<pre><code>StringBuilder sb = new StringBuilder();
if (strings.Count > 0)
{
foreach (string s in strings)
{
sb.Append(s + ", ");
}
sb.Remove(sb.Length - 2, 2);
}
return sb.ToString();
</code></pre>
<p>...in LINQ?</p>
| <p><strong>This answer shows usage of LINQ (<code>Aggregate</code>) as requested in the question and is not intended for everyday use. Because this does not use a <code>StringBuilder</code> it will have horrible performance for very long sequences. For regular code use <code>String.Join</code> as shown in the other <a ... | <p>I blogged about this a while ago, what I did seams to be exactly what you're looking for:</p>
<p><a href="http://ondevelopment.blogspot.com/2009/02/string-concatenation-made-easy.html" rel="nofollow noreferrer">http://ondevelopment.blogspot.com/2009/02/string-concatenation-made-easy.html</a></p>
<p>In the blog pos... | 26,768 |
<p>I'm working with a small FAT16 filesystem, and I want to generate CRC values for indidual XML files which store configuration information. In case the data changes or is corrupted, I want to be able to check the CRC to determine that the file is still in it's original state.</p>
<p>The question is, how do I put the... | <p>You could append the CRC value to the end of the file. Then, when computing the CRC value later for checking, omit the last four bytes.</p>
| <p>There is no way to do this. You could make the first x bytes (CRC uses a 32 bit integer, so 4 bytes) of the file contain the CRC, and then when calculating your CRC, you could only consider the bytes that come after that initial 4 bytes. </p>
<p>Another solution would be to include the CRC into the file name. So... | 30,416 |
<p>My designer keeps throwing out the term "liquid" layout. What does this mean?</p>
<p><strong>Thanks for the clarification, I have always just called this a percentage layout, and thought he was saying that the pieces could be moved around, and that was liquid</strong></p>
| <p>A "liquid" layout is a site layout that expands to fill the entire available area as the browser window is resized. Typically this is done using CSS. Liquid layouts can be quite helpful for certain types of sites, but they also tend to be significantly more effort than fixed width layouts, and their usefulness depen... | <p>Liquid Layouts refer to the design concept of a website. A liquid layout will move in and out when you resize your browser window, due to is having percentages and relative widths in the CSS.</p>
| 8,772 |
<p>Is there a better way of getting this result? This function fails if num has more digits than digits, and I feel like it should be in the library somewhere (like Integer.toString(x,"%3d") or something)</p>
<pre><code>static String intToString(int num, int digits) {
StringBuffer s = new StringBuffer(digits);
... | <p>String.format (<a href="https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html#syntax" rel="noreferrer">https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html#syntax</a>)</p>
<p>In your case it will be: </p>
<pre><code>String formatted = String.format("%03d", num);
</code></pre>
<u... | <p>In case of your jdk version less than 1.5, following option can be used.</p>
<pre><code> int iTest = 2;
StringBuffer sTest = new StringBuffer("000000"); //if the string size is 6
sTest.append(String.valueOf(iTest));
System.out.println(sTest.substring(sTest.length()-6, sTest.length()));
</code></pre>
| 34,754 |
<p>recently I was given the task to discover a C# solution I have never seen before, and give suggestions on refactoring it. I think I will use NDepend (for the first time ever) to see the overall picture, and also to check a lot of code metrics to figure out what could be refactored. NDepend is pretty good at showing ... | <p>Code Discovery is much more easy with NDepend. This tool provides a top-down approach on dependencies and layering between assemblies, namespaces and classes. This is done with some graph and depednencies matrix generated from the code.</p>
<p>You'll also get dependencies on tier code assemblies, which is really us... | <p>I frequently use <a href="http://reflector.red-gate.com/" rel="nofollow noreferrer">Reflector</a> to study third-party assemblies as well as .NET assemblies. Not so much for a bird's-eye view of the relations between classes, but a more for close-up detail of exactly what is going on.</p>
| 23,637 |
<p>I have a medium sized application written in c++ using Qt. I wanted to profile things to see where my least performant code was so I compiled everything with <code>-pg</code>.</p>
<p>However, my application makes use of a <em>lot</em> of plugins using the QTPlugin mechanism (boils down to a dlopen and a dlsym of a ... | <p>If you can use it, I think <a href="http://valgrind.org/" rel="nofollow noreferrer">Valgrind's</a> callgrind only needs debug symbols (-g) to profile code. I'm not sure if it works with dynamically linked objects, though.</p>
| <p>Valgrind(callgrind with kcachegrind as a viewer) is a good choice as strager said. You can also try using <a href="http://oprofile.sourceforge.net/" rel="nofollow noreferrer">http://oprofile.sourceforge.net/</a> </p>
| 40,852 |
<p>C# FileSystemWatcher does not catch a Perforce revert. It works fine when the same file is modified. This causes a problem because the revert changes the file, but FileSystemWatcher does not get notified.</p>
<p>How do you watch for a Perforce revert?</p>
<p>Thank you.</p>
| <p>In addition to checking the NotifyFilters, make sure you're attaching handlers to all of the events that the FileSystemWatcher has. FileSystemWatcher has events for Changed, Created, Deleted and Renamed.</p>
<p>If you're only attaching to the Changed event and not catching any events, then it sounds like Perforce ... | <p>I tried a sample executable from CodeProject, it seems to work, must be my code that's bad...</p>
| 46,245 |
<p>I have Windows File sharing enabled on an OS X 10.4 computer. It's accessible via \rudy\myshare for all the Windows users on the network, except for one guy running Vista Ultimate 64-bit edition. </p>
<p>All the other users are running Vista or XP, all 32-bit. All the workgroup information is the same, all login wi... | <p>Try changing the local security policy on that Vista box for "Local Policies\Security Options\Network Security: LAN manager authentication level" from “Send NTLMv2 response only” to “Send LM & NTLM - use NTLMv2 session security if negotiated”.</p>
| <p>No I have successfully done this with my Vista 64-bit machine. You may want to try using the IP Address of the machine and try connecting that way. Or maybe check out the log files on the Mac to see what the rejection error was.</p>
| 2,602 |
<p>What are those bad habits you've developed since you've started coding in Cocoa?</p>
<p>I think making a list of bad habits and actively adding to it and, more importantly, breaking those habits is a good technique to produce your code quality. So start now, get your bad habits off your chest. Maybe other people sh... | <p>Passing <code>nil</code> to arguments that call for <code>NSError**</code>, pure lazy.</p>
| <p>I often find myself forgetting to type the <code>return self;</code> part of my constructors. Luckily I've begun to break this particular habit.</p>
| 25,164 |
<p>Conditions: do not modify the original lists; JDK only, no external libraries. Bonus points for a one-liner or a JDK 1.3 version.</p>
<p>Is there a simpler way than:</p>
<pre class="lang-java prettyprint-override"><code>List<String> newList = new ArrayList<String>();
newList.addAll(listOne);
newList.addA... | <p>In Java 8:</p>
<pre><code>List<String> newList = Stream.concat(listOne.stream(), listTwo.stream())
.collect(Collectors.toList());
</code></pre>
<p>Java 16+:</p>
<pre><code>List<String> newList = Stream.concat(listOne.stream(), listTwo.stream()).toList();
</code></pre>
| <p>I can't improve on the two-liner in the general case without introducing your own utility method, but if you do have lists of Strings and you're willing to assume those Strings don't contain commas, you can pull this long one-liner:</p>
<pre><code>List<String> newList = new ArrayList<String>(Arrays.asLi... | 22,997 |
<p>I have a Win-CGI application I am currently converting to ISAPI.</p>
<p>The application uses the TDataset descendants for Extended Systems Advantage Database Server.</p>
<p>As there can be only one instance of a TAdsSettings object, this must be
in the main thread.</p>
<p>TAdsQuery objects are needed in the requ... | <p>Yes, it will work. The TAdsSettings component modifies settings in the Advantage Client Engine (ACE), and with ISAPI there will be one instance of ACE loaded that all threads use.</p>
<p>I wouldn't recommend it, however. Depending on the settings you are changing it would make more sense to just call the ACE APIs d... | <p>Make sure the AdsQueries use Synchronize to access the TAdsSettings directly (or use a messaging system to comunicate between worker threads and main thread instead of accessing directly) if they are not in the main thread (i.e. <code>System.MainThreadID <> Windows.GetCurrentThreadID</code>) </p>
| 11,836 |
<p>I have a Tevo Tarantula with a MKS Base 1.5 board and dual extruders. I am running Marlin RC8 Tevo Community build for the dual extruder, large bed and SN04 sensor. </p>
<p>All temperature sensors work and give accurate reading but <code>E1</code> when activated runs at 100% until the overtemps kicks in and shuts... | <p>I am not sure what the hardware config is for the <strong>Tevo Tarantula</strong></p>
<p>Make sure your <code>configuration.h</code> file is setup for your hardware.
The extruder defines are describe in <a href="https://github.com/JimBrown/MarlinTarantula/blob/bugfix-1.1.x/Marlin/Conditionals_LCD.h" rel="nofollow n... | <p>So, following on from <a href="https://3dprinting.stackexchange.com/questions/4177/dual-extruder-setup-in-marlin/4179#4179">Mark's answer</a>, in <a href="https://github.com/JimBrown/MarlinTarantula/blob/bugfix-1.1.x/Marlin/Conditionals_LCD.h#L298" rel="nofollow noreferrer">line 298</a> of <a href="https://github.co... | 616 |
<p>I have a macro which refreshes all fields in a document (the equivalent of doing an <kbd>F9</kbd> on the fields). I'd like to fire this macro automatically when the user saves the document.</p>
<p>Under options I can select "update fields when document is printed", but that's not what I want. In the VBA editor I on... | <p>The Team Build has a "bootstrap" phase where everything in the Team Build Configuration folder (the folder with TFSBuild.proj) is downloaded from version control. This is performed by the build agent before the build agent calls MSBuild.exe telling it to run TFSBuild.proj.</p>
<p>If you move your targets file from... | <p>If you create an overrides target file to import and call it something like TeamBuildOverrides.targets and put it in the same folder in source control where TFSBuild.proj lives for your Build Type, it will be pulled first and be available for import into the TFSBuild.proj file. By default, the TFSBuild.proj file is... | 12,283 |
<p>How do you restore a database backup using SQL Server 2005 over the network? I recall doing this before but there was something odd about the way you had to do it.</p>
| <p>The database is often running as a service under an account with no network access. If this is the case, then you wouldn't be able to restore directly over the network. Either the backup needs to be copied to the local machine or the database service needs to run as a user with the proper network access.</p>
| <pre><code>EXEC sp_configure 'show advanced options', 1
GO
</code></pre>
<p>-- Update currently configured values for advanced options.</p>
<pre><code>RECONFIGURE
GO
-- To enable xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 1
GO
</code></pre>
<p>-- Update currently configured values for advanced options.</p>
<pre><... | 3,723 |
<p>Which is the simplest way to check if two integers have same sign? Is there any short bitwise trick to do this?</p>
| <p>What's wrong with</p>
<pre><code>return ((x<0) == (y<0));
</code></pre>
<p>?</p>
| <p>Thinking back to my university days, in most machine representations, isn't the left-most bit of a integer a 1 when the number is negative, and 0 when it's positive?</p>
<p>I imagine this is rather machine-dependent, though.</p>
| 9,243 |
<p>I'm using the StAX event based API's to modify an XML stream. The stream represents an HTML document, complete with DTD declaration. I would like to copy this DTD declaration into the output document (written using an <code>XMLEventWriter</code>). When I ask the factory to disregard DTD's it will not download the DT... | <p>You should be able to implement a custom XMLResolver that redirects attempts to fetch external DTDs to a local resource (if your code parses only a specific doc type, this is often a class resource right in a JAR).</p>
<pre><code>class CustomResolver implements javax.xml.stream.XMLResolver {
public Object resolv... | <p>Also: your original approach (setting SUPPORT_DTD to false) might work with Woodstox, if so far you have been using the default Sun stax parser bundled with JDK 1.6.</p>
| 39,881 |
<p>I work a lot with serial communications with a variety of devices, and so I often have to analyze hex dumps in log files. Currently, I do this manually by looking at the dumps, looking at the protocol spec, and writing down the results. However, this is tedious and error-prone, especially whem messages contain hun... | <p><a href="http://www.wireshark.org/" rel="nofollow noreferrer">Wireshark</a> is quite good at opening network protocols.</p>
| <p>I'm pretty sure I saw something like that on CPAN. I could be more vague if you like. :-)</p>
<p><strong>Update:</strong> It's not exactly what you want, but have a look at <a href="http://cpan.uwinnipeg.ca/htdocs/Parse-Binary/Parse/Binary/FixedFormat.html" rel="nofollow noreferrer">Parse::Binary::FixedFormat</a><... | 23,275 |
<p>How do implement the iterator pattern in <a href="http://en.wikipedia.org/wiki/Visual_Basic_.NET" rel="nofollow noreferrer">VB.NET</a>, which does not have the <code>yield</code> keyword?</p>
| <p>This is now supported in VS 2010 SP1, with the Async CTP, see: <a href="http://msdn.microsoft.com/en-us/vstudio/gg497937" rel="noreferrer">Iterators (C# and Visual Basic) on MSDN</a> and <a href="http://www.microsoft.com/en-us/download/details.aspx?id=9983" rel="noreferrer">download Visual Studio Async CTP (Version ... | <p>Below gives output: 2, 4, 8, 16, 32</p>
<p>In VB.NET</p>
<pre><code>Public Shared Function setofNumbers() As Integer()
Dim counter As Integer = 0
Dim results As New List(Of Integer)
Dim result As Integer = 1
While counter < 5
result = result * 2
results.Add(result)
count... | 31,231 |
<p>I haven't been around Java development for 8 years, but am starting to build a NetBeans Web Application. When I walk through the Web Application wizard, it asks for the server I'm going to be using. </p>
<p>What would be the best and simplest server for me to start using with NetBeans?</p>
| <p>Since the NetBeans IDE is a Sun product, I would assume that the Glassfish application server would be a natural fit.</p>
<p>That said, one of the pluses of developing a web application in Java is that the interface for working with the http is standardized (i.e. the Servlet specification), so that you can pick any... | <p>Unless you are deploying to a full J2EE application server, I would recommend using Tomcat. Tomcat can run as a standalone web/servlet/jsp server and avoids some of the complexities of a full J2EE app server.</p>
<p>The web development bundle for Netbeans will include installers for and automated integration with G... | 17,486 |
<p>I have been playing with this for a while, but the closest I have gotten is a button that opens the <code>Paste Special</code> dialog box and requires another couple of mouse clicks to paste the contents of the clipboard as unformatted text. </p>
<p>So often I am doing a <code>copy-paste</code> from a web site into... | <p>Make the button call the macro:</p>
<pre><code>public sub PasteSpecialUnformatted()
selection.pastespecial datatype:=wdpastetext
end sub
</code></pre>
| <p>I use <a href="http://www.getfingertips.com/" rel="nofollow noreferrer">FingerTips</a> for this. By default it will make CTRL+W -> Paste Special. Furthermore it supports macro text and a lot of useful start-programs-quick things and some Microsoft Outlook tricks to support Getting Things Done.</p>
| 9,989 |
<p>I know that we can get the MAC address of a user via IE (ActiveX objects).</p>
<p>Is there a way to obtain a user's MAC address using JavaScript?</p>
| <p>I concur with all the previous answers that it would be a privacy/security vulnerability if you would be able to do this directly from Javascript. There are two things I can think of:</p>
<ul>
<li>Using Java (with a signed applet)</li>
<li>Using signed Javascript, which in FF (and Mozilla in general) gets higher pr... | <p>No you can't obtain a user's MAC address using JavaScript in another way, just by using active X op for Microsoft in IE browser</p>
| 2,551 |
<p>My issue is below but would be interested comments from anyone with experience with xlrd.</p>
<p>I just found xlrd and it looks like the perfect solution but I'm having a little problem getting started. I am attempting to extract data programatically from an Excel file I pulled from Dow Jones with current component... | <p>FWIW, I'm the author of xlrd, and the maintainer of xlwt (a fork of pyExcelerator). A few points:</p>
<ol>
<li><p>The file ComponentReport-DJI.xls is misnamed; it is not an XLS file, it is a tab-separated-values file. Open it with a text editor (e.g. Notepad) and you'll see what I mean. You can also look at the not... | <p>Do you have to use xlrd? I just downloaded 'UPDATED - Dow Jones Industrial Average Movers - 2008' from that website and had no trouble reading it with <a href="http://sourceforge.net/projects/pyexcelerator" rel="nofollow noreferrer">pyExcelerator</a>.</p>
<pre><code>import pyExcelerator
book = pyExcelerator.parse_... | 14,426 |
<p>Is there is any way to change the datasource location for a report and all of it's subreports without having to open each of them manually?</p>
| <p>Here is how I set my connections at runtime. I get the connection info from a config location.</p>
<pre><code> #'SET REPORT CONNECTION INFO
For i = 0 To rsource.ReportDocument.DataSourceConnections.Count - 1
rsource.ReportDocument.DataSourceConnections(i).SetConnection(crystalServer, crys... | <p>I'm guessing you're talking about .rdl files from Reporting Services? (If not, my answer might be wrong)</p>
<p>They're basically just XML, so you could load each one of them in and do an XPath query to get the node that contains the datasource and update it.</p>
| 6,178 |
<p>I picked up a roll of Overture matte black PLA, and the surface of both the filament and the printed object <em>feel like</em> paper. This made me wonder if it contains wood-based fibers like "wood PLA" does, and if so, whether it's abrasive and harmful to the nozzle. In the past I wouldn't have cared, but... | <p>You may be experiencing the feel of paper, which is typically a matte surface, when feel testing the printed item, as both would be matte. A search for your focus found one purchaser of this product (via Amazon) has <a href="https://www.amazon.com/ask/questions/asin/B089S2QDHD/2/ref=ask_dp_iaw_ql_hza?isAnswered=true... | <p>At least one filament manufacturer, Protopasta, documents their <a href="https://www.proto-pasta.com/collections/all/products/high-performance-htpla-matte-fiber" rel="nofollow noreferrer">"matte fiber HTPLA"</a> as "containing plant fibers" but also documents that</p>
<blockquote>
<p>Matte Fiber ... | 2,105 |
<p>In VB.net I'm using the TcpClient to retrieve a string of data. I'm constantly checking the .Connected property to verify if the client is connected but even if the client disconnects this still returns true. What can I use as a workaround for this?</p>
<p>This is a stripped down version of my current code:</p>
... | <p>When NetworkStream.Read returns 0, then the connection has been closed. <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.networkstream.read(VS.71).aspx" rel="noreferrer">Reference</a>:</p>
<blockquote>
<p>If no data is available for reading, the NetworkStream.Read method will block until data i... | <p>Instead of polling client.connected, maybe use of the NetworkStream's properties to see if there's no more data available?</p>
<p>Anyhow, there's an <a href="http://www.ondotnet.com/pub/a/dotnet/2003/07/07/netstreams.html" rel="nofollow noreferrer">ONDotnet.com</a> article with TONS of info on listeners and whatnot... | 12,716 |
<p>How to get all the database names and corresponding table names together ?</p>
| <pre><code>CREATE TABLE #dbs ( DatabaseName VARCHAR(256), TableName VARCHAR(256) )
EXEC sp_msforeachdb 'INSERT INTO #dbs
SELECT ''?'', [name] FROM dbo.SysObjects WHERE XType = ''U'''
SELECT * FROM #dbs
DROP TABLE #dbs
</code></pre>
| <p>You will have to write a store procedure.</p>
<p>First get the database name</p>
<pre><code>SELECT Name FROM master.sys.databases
</code></pre>
<p>For each database</p>
<pre><code>SELECT %DatabaseName%, Name FROM %DatabaseName%.SysObjects WHERE type = 'U'
</code></pre>
<p>Edit here's the store procedure</p>
<p... | 31,529 |
<p>I have a web page with 3 forms on it. Not nested, just one after the other (they are almost identical, just one hidden variable that's different). A user will only fill in one form, and I'd like to validate/etc all the forms with only one JS script.</p>
<p>So how, when a user clicks the submit button of form#1, d... | <p>You can select the form like this:</p>
<pre><code>$("#submit").click(function(){
var form = $(this).parents('form:first');
...
});
</code></pre>
<p>However, it is generally better to attach the event to the submit event of the form itself, as it will trigger even when submitting by pressing the enter key f... | <p>Eileen: No, it is not <code>var nameVal = form.inputname.val();</code>. It should be either...</p>
<p>in jQuery:</p>
<pre><code>// you can use IDs (easier)
var nameVal = $(form).find('#id').val();
// or use the [name=Fieldname] to search for the field
var nameVal = $(form).find('[name=Fieldname]').val();
</co... | 40,148 |
<p>I am having trouble with a very simple Perl process. I am basically querying an Oracle database and I want to load it into Excel. I have been able to use DBIx::Dump and it works. However, I need to be able to use a variety of Excel formatting tools. And I think <a href="http://search.cpan.org/dist/Spreadsheet::W... | <p>I would guess that it is coming out as a string, and when you try to insert it into the date column, there is no implicit conversion for it.</p>
<p>Try selecting the date like this, and it will turn it into a char that you can use to do compares.</p>
<pre><code>to_char(date, 'YYYY/MM/DD HH24:MI:SS')
</code></pre>
... | <p>I would guess that it is coming out as a string, and when you try to insert it into the date column, there is no implicit conversion for it.</p>
<p>Try selecting the date like this, and it will turn it into a char that you can use to do compares.</p>
<pre><code>to_char(date, 'YYYY/MM/DD HH24:MI:SS')
</code></pre>
... | 33,849 |
<p>I need to validate a date/time field on a webpage but want it to do it without reloading the page and would like 'instant' feedback for the users.</p>
<p>What's the best/easiest solution.
BTW: easiest scores 65% of total points</p>
<p>Edit:
What if best was 65% of total points?</p>
| <p>Check out this <a href="http://www.expertsrt.com/scripts/Rod/validate_date.php" rel="nofollow noreferrer">javascript date validation</a> function.</p>
<p>It uses javascript, regular expressions and the 'onblur' event of a text input.</p>
| <p>A simple javascript method that reads what's in the input field on submit and validates it. If it's not valid, return false so that the form is not submitted to the server.</p>
<pre><code>... onSubmit="return validateForm();" ...
</code></pre>
<p>Make sure you validate on the server side too, it's easy to bypass j... | 3,179 |
<p>I recently switched to a RAMPS 1.4 on an Arduino Mega 2560.
Ever since I have extruder temperature swings a couple of minutes into the print, but it looks like a problem reading the temp rather than actual fluctuations in the temperature (as can be seen in the attached pic).
Also, I've noticed that the MOSFET is get... | <p>For the overheating, you may need to turn the juice down a little on your Power Supply. Typically, there is a potentiometer inside that trims the voltage level coming from there. Some things can heat up if it's over-volting and needing to drop more voltage for the board.</p>
<p>For the temperature reading stuff, ma... | <p>For the really hot mosfet I would say it might be a good idea to get one of those external mosfet module boards. It just seems like a good idea to me, to not have the huge current of the bed-heater flowing through the ramps board. And for the thermistor wires, do you have them twisted together? If not, try tightly t... | 706 |
<p>I have a simple web application that provides daily financial data. Users subscribe, and we send them an email every day. However, Gmail is marking all of our emails as spam. What should we be looking out for?</p>
| <p>Chiefly, to avoid a spam engine classifying your messages as spam you should:</p>
<ul>
<li>Make sure they aren't spam (i.e. ensure that only users who have really opted in get mailed - make sure you keep an opt-in audit log)</li>
<li>Make sure they don't look too much like spam - $$$ MAKE MONEY FAST is not a good s... | <p>Why not have something on the signup form along the lines of.</p>
<blockquote>
<p>Some email providers may automatically mark the emails as spam. All automated emails will be sent from dailyupdate@mysite.com, please add this to your safe list</p>
</blockquote>
<p>Whatever you do it is likly that your emails will... | 48,419 |
<p>We have a Cash flow report which is basically in this structure:</p>
<pre><code>Date |Credit|Debit|balance|
09/29| 20 | 10 | 10 |
09/30| 0 | 10 | 0 |
</code></pre>
<p>The main problem is the balance, and as we are using a DataSet for the Data, it's kinda hard to calculate the balance on the DataSet, ... | <p>This may be too big a change or off the mark for you, but a cash flow report indicates to me that you are probably maintaining, either formally or informally, a general ledger arrangement of some sort. If you are, then maybe I am naive about this but I think you should maintain your general ledger detail as a singl... | <p>On the code side of things, you've got two relatively easy options, but they both involve iterating through the dataset.</p>
<p>option 1: For loop prior to databinding.
For each row in the datatable, add/subtract the credit/debits to the previous row's balance and assign it to the appropriate cell of your datatable... | 18,077 |
<p>I want to pass an enum value as command parameter in WPF, using something like this:</p>
<pre><code><Button
x:Name="uxSearchButton"
Command="{Binding Path=SearchMembersCommand}"
CommandParameter="SearchPageType.First"
Content="Search">
</Button>
</code></pre>
<p><code>SearchPageType<... | <p>Try this</p>
<pre><code><Button CommandParameter="{x:Static local:SearchPageType.First}" .../>
</code></pre>
<p><code>local</code> - is your <a href="http://msdn.microsoft.com/en-us/library/ms747086.aspx#The_WPF_and_XAML_Namespace_Declarations" rel="noreferrer">namespace reference</a> in the XAML</p>
| <p>Try this<a href="https://i.stack.imgur.com/dyAae.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dyAae.png" alt="enter image description here" /></a></p>
<p>CommandParameter="{x:Static "Class namespace e.g(<strong>Models</strong>)":SearchPageType.First}"</p>
| 46,923 |
<p>I'm making a report in Access 2003 that contains a sub report of related records. Within the sub report, I want the top two records only. When I add "TOP 2" to the sub report's query, it seems to select the top two records before it filters on the link fields. How do I get the top two records of only those record... | <p>I've got two suggestions:<br>
1) Pass your master field (on the parent form) to the query as a parameter (you could reference a field on the parent form directly as well)<br>
2) You could fake out rownumbers in Access and limit them to only rownum <= 2. E.g., </p>
<pre><code>SELECT o1.order_number, o1.order_dat... | <p>I've got two suggestions:<br>
1) Pass your master field (on the parent form) to the query as a parameter (you could reference a field on the parent form directly as well)<br>
2) You could fake out rownumbers in Access and limit them to only rownum <= 2. E.g., </p>
<pre><code>SELECT o1.order_number, o1.order_dat... | 22,117 |
<p>How can I count the number of elements in an array, because contrary to logic array.count(string) does not count all the elements in the array, it just searches for the number of occurrences of string.</p>
| <p>The method len() returns the number of elements in the list.</p>
<p>Syntax:</p>
<pre><code>len(myArray)
</code></pre>
<p>Eg:</p>
<pre><code>myArray = [1, 2, 3]
len(myArray)
</code></pre>
<p>Output:</p>
<pre><code>3
</code></pre>
<p></p>
| <p>Or,</p>
<pre><code>myArray.__len__()
</code></pre>
<p>if you want to be oopy; "len(myArray)" is a lot easier to type! :)</p>
| 22,700 |
<p>we have a problem with an application we're developing. Very seldom, like once in a hundred, the application crashes at start up. When the crash happens it brings down the whole system, the computer starts to beep and freezes up completely, the only way to recover is to turn off the power (we're using Windows XP). T... | <p>For Visual C++ <a href="http://msdn.microsoft.com/en-us/library/c63a9b7h.aspx" rel="nofollow noreferrer">_penter() and _pexit()</a> can be used to instrument your code.</p>
<p>See also <a href="http://www.codeguru.com/cpp/misc/misc/logandtracefiles/article.php/c11065/" rel="nofollow noreferrer">Method Call Intercep... | <p>GCC (including the version <a href="http://www.mingw.org/" rel="nofollow noreferrer">MingGW for Windows development</a>) has a code generation switch called <a href="http://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-finstrument_002dfunctions-1914" rel="nofollow noreferrer">-finstrument-functions</a> that... | 18,342 |
<p>Are there any good (preferably free) tools out there? </p>
<p>Can they give accurate estimates that reflect production results when the app goes live?</p>
| <p>WebLoad is open source:</p>
<p><a href="http://www.webload.org/" rel="noreferrer">http://www.webload.org/</a></p>
| <p>If you want to visualize performance instead of just look at the numbers you might try Engulf. It's Open Source Software, distributed, and high-performance. <a href="http://engulf-project.org/#usage" rel="nofollow">http://engulf-project.org/#usage</a> Disclaimer: It's a project I work on.</p>
| 40,195 |
<p>Ok, i have done a bunch of asp as well as asp.net right when it came out. A friend is starting a non profit organization and he wants me to put together a site for him. I figured i would kill 2 birds with one stone and look to freshen up my skills on the latest that the web has to offer in asp.net, web 2.0, etc.<... | <p>Have a look at ASP.Net MVC and JQUERY also take a look at S#Arp as a nice platform to build your site upon. It setups ASP.Net MVC, with nHibernate and has really good guidance on a good DDD structure.</p>
| <p>In case you've overlooked it, <a href="http://www.codeplex.com/AjaxControlToolkit" rel="nofollow noreferrer">The AJAX Control Toolkit</a> -</p>
<blockquote>
<p>addresses three needs. First it gives website developers a place to get components to make their web applications spring to life, second it gives a set of... | 45,380 |
<p>I wrote a small <code>PHP</code> application several months ago that uses the <code>WordPress XMLRPC library</code> to synchronize two separate WordPress blogs. I have a general "RPCRequest" function that packages the request, sends it, and returns the server response, and I have several more specific functions tha... | <p>@Novak: Thanks for your suggestion. The problem turned out to be a memory issue; by retrieving all the posts from the remote location, the response exceeded the amount of memory PHP was allowed to utilize, hence the unclosed token error.</p>
<p>The problem with the cryptic and incomplete error message was due to ... | <p>Expat is the XML parser in PHP. Error code 5 is one of many expat error constants, in this case: <code>XML_ERROR_UNCLOSED_TOKEN</code>. Sounds to me like there's an error in the result returned from the RPC call. You might want to do some error checking in RPCRequest after <code>file_get_contents</code> and before <... | 12,768 |
<p>Does Information Hiding mean I should minimize the number of properties my classes have? Is that right? Do you tend to make your classes private fields with methods?</p>
| <p>Information hiding has to do with how much data in your class (fields, properties) is accessible to outside classes. The more you hide, the easier it is to change your implementation later without affecting dependent classes (i.e. your "public interface"). This ultimately leads to more stable designs.</p>
| <p>Declaring something private in scope does not really "hide" the information. </p>
<p>I believe hiding information refers to isolating your logic from the consumer via an interface, so you can change the logic without affecting the consumer.</p>
| 12,416 |
<p>I have a large number of Enums that implement this interface:</p>
<pre><code>/**
* Interface for an enumeration, each element of which can be uniquely identified by its code
*/
public interface CodableEnum {
/**
* Get the element with a particular code
* @param code
* @return
*/
publi... | <p>You could factor the duplicated code into a <code>CodeableEnumHelper</code> class:</p>
<pre><code>public class CodeableEnumHelper {
public static CodeableEnum getByCode(String code, CodeableEnum[] values) {
for (CodeableEnum e : values) {
if (e.getCode().equalsIgnoreCase(code)) {
... | <p>It seems like you are actually implementing run time type information. Java provides this as a language feature. </p>
<p>I suggest you look up RTTI or reflection.</p>
| 10,279 |
<p>I want to set the font color of a cell to a specific RGB value.</p>
<p>If I use</p>
<pre><code>ActiveCell.Color = RGB(255,255,0)
</code></pre>
<p>I do get yellow, but if I use a more exotic RGB value like:</p>
<pre><code>ActiveCell.Color = RGB(178, 150, 109)
</code></pre>
<p>I just get a grey color back.</p>
<... | <p>Excel only uses the colors in the color palette. When you set a cell using the RGB value, it chooses the one in the palette that is the closest match. You can update the palette with your colors and then choose your color and that will work.</p>
<p>This will let you see what is currently in the palette:</p>
<pre... | <p>Thank you for the answers and the comments as well.</p>
<p>It really gave me great trouble because my client had other plugins installed into Excel which also tampered with the color palette.</p>
<p>I ended up replacing a few colors in the palette an then asigning my elements the specific ColorIndex, but boy, it's... | 49,501 |
<p>I have a flash project that I'm trying to export as a single SWF. There's a main SWF file that loads about 6 other SWFs, and both the main and the child SWFs reference other external assets (images, sounds, etc). I'd like to package everything as a single .swf file so I don't have to tote the other assets around w... | <p>You <em>might</em> be able to decompile your swfs into XML with swfmill/mtasc and use a fancy XSLT to recombine them and recompile with swfmill/mtasc.</p>
<p>If that doesn't work and if you're using MovieClip.loadMovie or MovieClipLoader.loadMovie you can overload their methods and intercept the url:</p>
<pre><cod... | <p>HI Justin,</p>
<p>It sounds like you need to look into using shared libraries. Check out:</p>
<p><a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14767" rel="nofollow noreferrer">http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14767</a></p>
| 24,126 |
<p>I would like to understand the differences between rafts, skirts and brims. They appear in the software which I'm using to edit my 3D objects.</p>
<p>Can anybody elaborate what are these and what are the main differences between them?</p>
| <p><strong>Rafts:</strong></p>
<p>Rafts are a few layers of plastic a placed on the printing surface before the object is printed. If non water dissoluble filament is used, a bit of an air gap will be placed between the raft and the print itself so it can be removed easily. A raft can help a print stick to the printi... | <p>All three of these features are used to improve the quality and success rate of prints, especially those failing due to issues on the first few layers, or due to the small size of the first layer.</p>
<h1>Raft</h1>
<p>A raft is a horizontal feature made as the first few layers of a print, and is used to help with be... | 94 |
<p>I'd like something like this:</p>
<pre><code>each[i_, {1,2,3},
Print[i]
]
</code></pre>
<p>Or, more generally, to destructure arbitrary stuff in the list you're looping over, like:</p>
<pre><code>each[{i_, j_}, {{1,10}, {2,20}, {3,30}},
Print[i*j]
]
</code></pre>
<p>Usually you want to use <code>Map</code> o... | <p>I'm years late to the party here, and this is perhaps more an answer to the "meta-question", but something many people initially have a hard time with when programming in Mathematica (or other functional languages) is approaching a problem from a functional rather than structural viewpoint. The Mathematica language ... | <p>Mathematica have map functions, so lets say you have a function <code>Func</code>taking one argument. Then just write</p>
<pre><code>Func /@ list
Print /@ {1, 2, 3, 4, 5}
</code></pre>
<p>The return value is a list of the function applied to each element in the in-list.</p>
<pre><code>PrimeQ /@ {10, 2, 123, 555}... | 19,375 |
<p>I have a list of n GUIDs and I need to hash them into a single value. This value could be the size of a Guid object or the size of an Int32, it doesn't really matter, but it does need to be statistically unique (say with a probably similar to MD5).</p>
<p>So one approach could be to sort them, concatenate the byte... | <p>If you want the hash to be valid for the <em>set</em> (i.e. order doesn't matter) then XORing the hashcode of each GUID is a good choice.</p>
<p>If you've actually got a <em>sequence</em> of GUIDs and the order matters then I'd suggest using the same approach I wrote about <a href="https://stackoverflow.com/questio... | <p>Don't XOR the GUIDs and then hash the result. You gain nothing this way over simply XORing the GUIDs, unless you use a hash smaller than a GUID.</p>
<p>Since you seem to really care about performance for this, a little more information would be useful -- in particular, are you using different combinations of the GU... | 37,059 |
<p>Does anyone know if you can and how to start off a scheduled Windows task on a Remote Server from within a SQL Server Integration Services (SSIS) package?</p>
| <p>Assuming you run it on Windows Server 2003/2008 or Vista, use SSIS Execute Process Task to start SCHTASKS.EXE with appropriate params (<strong>SCHTASKS /Run /?</strong> to see details).</p>
| <p>It should be possible as the Task Scheduler has a scriptable <a href="http://msdn.microsoft.com/en-us/library/aa383614%28VS.85%29.aspx" rel="nofollow noreferrer">COM API</a> that can be used for interacting with tasks.</p>
<p>You could therefore either create a custom task that uses COM interop to call the Task Sch... | 5,826 |
<p>How do I deploy an ADF business component to the middle tier and call it using <a href="http://en.wikipedia.org/wiki/Java_remote_method_invocation" rel="nofollow noreferrer">RMI</a>?</p>
<p>I just cannot find any good documentation on this!</p>
| <p>Select the ADF BC application module and use your right button to create a business components deployment and select <a href="http://en.wikipedia.org/wiki/Enterprise_JavaBean" rel="nofollow noreferrer">EJB</a> session bean. This will create different <a href="https://en.wikipedia.org/wiki/EAR_%28file_format%29" rel=... | <p>I guess you mean something like:</p>
<ul>
<li><em><a href="http://blog.fekw.de/2008/08/23/howto-install-adf-10-runtime-and-deploy-adf-bc-app-to-oracle-weblogic-103-running-on-linux/" rel="nofollow noreferrer">How to install ADF 10 runtime and deploy ADF BC app to Oracle WebLogic 103 running on Linux</a></em></li>
<... | 17,391 |
<p>What do you think of this kind of code-to-files-mapping?</p>
<pre><code>~/proj/MyClass.ext
~/proj/MyClass:constructors.ext
~/proj/MyClass:properties.ext
~/proj/MyClass:method-one.ext
~/proj/MyClass:method-two:int.ext
~/proj/MyClass:method-two:string.ext
</code></pre>
<p>In a language which is more function... | <p>Perhaps the better question to ask in response is: What is the problem you would hope to solve with this approach?</p>
<p>The .NET languages support some level of this idea with partial classes, although I've never seen it carried to that extreme and the editing experience is not as seamless as you describe in your... | <p>Personally I would find that that type of separation, although possible in some languages, would be a nightmare to maintain, and would make following the code really hard. I personally find that with .NET languages regions in code are far more helpful.</p>
<p>I would be concerned on large projects with the sheer n... | 24,092 |
<p>I am writing a DLL with mixed C/C++ code. I want to specify the ordinals of the functions I'm exporting. So I created a .DEF file that looks like this</p>
<pre><code>LIBRARY LEONMATH
EXPORTS
sca_alloc @1
vec_alloc @2
mat_alloc @3
sca_free @4
vec_free @5
mat_free @6
...... | <p>Well, I don't have experience with ordinals (which look like some ugly, compiler-specific thing), but I can help you with making C++/C code compatible.</p>
<p>Suppose, in C++, that your header file looks like this:</p>
<pre><code>class MyClass
{
void foo(int);
int bar(int);
double bar(double);
void... | <p>You said "Using the ordinals has the advantage of letting me call exported C++ functions from C code." , I am sorry to say that this is incorrect.</p>
<p>C++ class member functions have special calling convention which requires an invisible <strong>this</strong> value passed in an implementation-specific register/p... | 49,599 |
<p>I'm writing a LINQ to SQL statement, and I'm after the standard syntax for a normal inner join with an <code>ON</code> clause in C#.</p>
<p>How do you represent the following in LINQ to SQL:</p>
<pre><code>select DealerContact.*
from Dealer
inner join DealerContact on Dealer.DealerID = DealerContact.DealerID
</co... | <p>It goes something like:</p>
<pre><code>from t1 in db.Table1
join t2 in db.Table2 on t1.field equals t2.field
select new { t1.field2, t2.field3}
</code></pre>
<p>It would be nice to have sensible names and fields for your tables for a better example. :)</p>
<p><strong>Update</strong></p>
<p>I think for your query... | <p>One Best example</p>
<p>Table Names : <code>TBL_Emp</code> and <code>TBL_Dep</code></p>
<pre><code>var result = from emp in TBL_Emp join dep in TBL_Dep on emp.id=dep.id
select new
{
emp.Name;
emp.Address
dep.Department_Name
}
foreach(char item in result)
{ // to do}
</code></pre>
| 5,798 |
<p>There are several plugin options for building a search engine into your Ruby on Rails application. Which of these is the best?</p>
<ul>
<li><a href="http://ts.freelancing-gods.com/" rel="noreferrer">Thinking Sphinx</a></li>
<li><a href="http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html" rel=... | <p>Thinking Sphinx has more concise syntax to define which fields and which models are indexed.</p>
<p>Both UltraSphinx and Thinking Sphinx (recently) have ultra-cool feature which takes into account geographical proximity of objects. </p>
<p>UltraSphinx has annoying problems with how it loads models (it does not loa... | <p>I've used Thinking Sphinx and it seems pretty good, but I haven't had the time to evaluate all of the options.</p>
| 9,926 |
<p>Is it possible to do a cross table join in mysql spaning different tables? in different databases.</p>
<p>This seem to be easily possible in MSSQL, and greatly speeds up data transfer?</p>
<p>How about mysql, do you need to use a powerful IDE to achieve this? or do you have to write a program to do something like ... | <p>Sure, very easy. Prefix the table name with the database name, like you show. We do cross-database joins on a regular basis. For example:</p>
<blockquote>
<p>SELECT COUNT(*) FROM newusers1.users
JOIN newusers2.users</p>
</blockquote>
<p>It certainly won't speed up data transfer compared to having both table... | <p>MySQL doesn't actually care if the tables are in the same "database", it's just a logical collection of tables for convenient administration, permissions etc.</p>
<p>So you can do a join between them just as easily as if they were in the same one (see ChrisInEdmonton's answer)</p>
| 38,530 |
<p>I am attempting to update a project from ASP.NET MVC Preview 3 to Preview 5 and it seems that Controller.ReadFromRequest(string key) has been removed from the Controller class. Does anyone know of any alternatives to retrieving information based on an identifier from a form?</p>
| <p>Looks like they've added controller.UpdateModel to address this issue, signature is:</p>
<pre><code>UpdateModel(object model, string[] keys)
</code></pre>
<p>I haven't upgraded my app personally, so I'm not sure of the actual usage. I'll be interested to find out about this myself, as I'm using <code>controller.Re... | <p>could you redo that link in something like tinyurl.com?</p>
<p>I need this info too but can get that mega-link to work.</p>
| 5,670 |
<p>On an ASP.NET page, I have a GridView populated with the results of a LINQ query. I'm setting the DataSource in code, then calling DataBind on it. In the GridView's RowDataBound event, I'm selectively hiding links in some GridView fields based on the query results. (For instance, I hide the "Show Parent" link of ... | <p>Here's how I ended up solving this:</p>
<ol>
<li>I created a serializable class with readonly properties: PK of a row, and a boolean for each link indicating whether it's enabled or not. We'll call it <code>LinkVisibility</code>.</li>
<li>I created a serializable class inheriting from KeyedCollection to hold insta... | <p>I would have expected the viewstate to also reflect the fact that you have removed some of the links (assuming that they were removed before viewstate was saved).</p>
<p>Maybe thats the question you need to ask 'why do the removed links still appear in viewstate?'.</p>
| 35,315 |
<p>Have a standard smart client application that we want to autostart when a user logs into their machine on our network. I've tried the following keys:</p>
<p>HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Micrisoft\Windows\CurrentVersion\Run
HKCU\Software\Micrisoft\Windows\CurrentVersion\Policy\Ex... | <p>My guess is that it has something to do with the network not being available directly at startup. Those batch (delayed) files, are they running from the computer's own harddrive? if not, you can try that.</p>
| <p>If you are on a domain, you can use group policy to launch your app.</p>
| 28,618 |
<p>Trying to add an onclick handler to my tabs, and can't seem to get the DOM selection right. Can you guys help?</p>
<pre><code> <div id="tabstrip">
<ul>
<li id="a" class="selected"><a href="#">A</a></li>
<li id="b"><a href="#">B</a></li>
... | <p>Seems like your closure is wrong.
Try </p>
<pre><code>as[j].onclick = function(items, i)
{
return function()
{
changeTab(items[i].id);
return false;
};
}(items, i);
</code></pre>
<p>If it works then the question is a dupe of <a href="https://stackoverflow.com/questions/359467/jquery-clo... | <p>I agree to RoBorg and suggest reading about JavaScript scopes. It will explain a lot.</p>
| 48,000 |
<p>I've got a question about references between projects in a solution. Most of my previous applications have just had one or two projects in the Solution, but this time I want to divide the application further. </p>
<p>I'm starting a new Solution in Visual Studio 2008 now, and have created several underlying projects... | <p>Indeed you can't have circular references, but to be honest what would be the benefit of splitting the solution into small project if you had interdependencies between all of them?</p>
<p>Usually before I even open Visual Studio I take a piece of paper and split my problem into logical functional areas. You can dra... | <p>It's a bit old-fashioned, but for help in deciding how to split into projects, you could look up "Coupling" and "Cohesion" in wikipedia.</p>
<p>Also, while we sometimes think of these decisions as "style" rather than "substance", we should remember that assembly boundaries do have meaning, both to the compiler and ... | 39,216 |
<p>How to validate iscontrolkeys in textbox keydown event in .net?</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.keypresseventargs.aspx" rel="nofollow noreferrer">This msdn page should do the trick</a> - check the keypresseventsargs returned in the keypress or <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.keyeventargs(VS.80).aspx" rel... | <p>in C#, </p>
<pre><code> private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.ControlKey)
{
//Do some work
}
}
</code></pre>
<p>in VB.NET,</p>
<pre><code> Private Sub textBox1_KeyDown(ByVal sender As Object, ByVal e As KeyEven... | 30,211 |
<p>Is there a tool/plugin/function for Firefox that'll dump out a memory usage of Javascript objects that you create in a page/script? I know about Firebug's profiler but I'd like something more than just times. Something akin to what Yourkit has for Java profiling of memory usage.</p>
<p>Reason is that a co-worker is... | <p>I haven't tried the Sofware verify tools, but Mozilla has tools that track overall memory consumed by firefox for the purpose of stemming leaks:</p>
<p><a href="http://www.mozilla.org/performance/tools.html" rel="noreferrer">http://www.mozilla.org/performance/tools.html</a></p>
<p>and:</p>
<p><a href="https://wik... | <p>You can use Mozilla’s Developer Tools. In order to use advanced developer tools of Firefox you need to create a debug build instead of a release build. For more on building process, see <a href="https://developer.mozilla.org/en-US/docs/Simple_Firefox_build#Building" rel="nofollow">the page</a>. Also, more informatio... | 20,683 |
<p>I love list comprehensions in Python, because they concisely represent a transformation of a list.</p>
<p>However, in other languages, I frequently find myself writing something along the lines of:</p>
<pre><code>foreach (int x in intArray)
if (x > 3) //generic condition on x
x++
//do other processin... | <p>The increment in the original <code>foreach</code> loop will not affect the contents of the array, the only way to do this remains a <code>for</code> loop:</p>
<pre><code>for(int i = 0; i < intArray.Length; ++i)
{
if(intArray[i] > 3) ++intArray[i];
}
</code></pre>
<p>Linq is not intended to modify existi... | <p>Depends on the language and what you need to do, a "map" as it's called in many languages could be what you're looking for. I don't know C#, but according to <a href="http://blogs.msdn.com/devdev/archive/2006/06/30/652802.aspx" rel="nofollow noreferrer">this</a> page, .NET 2.0 calls map "ConvertAll".</p>
<p>The mea... | 3,433 |
<p>I have an XML document with a DTD, and would love to be able to access the XML model, something like this:</p>
<pre><code>title = Thing.Items[0].Title
</code></pre>
<p>Is there a way, in Ruby, to generate this kind of object model based on a DTD? Or am I stuck using REXML?</p>
<p>Thanks!</p>
| <p>if you include the active_support gem (comes with rails) it adds the method from_xml to the Hash object. You can then call Hash.from_xml(xml_content) and it'll return a hash that you can use to access the data.</p>
<p>I don't know of an easy way to map an xml to an object, but you could create a wrapper class that... | <p>You can use the ruby version of xml-simple.</p>
<p>You shouldn't need to install the gem as I believe it's already installed with rails.
<a href="http://xml-simple.rubyforge.org/" rel="nofollow noreferrer">http://xml-simple.rubyforge.org/</a></p>
| 4,796 |
<p>I have written code that automatically creates CSS sprites based on the IMG tags in a page and replaces them with DIV's with (what I thought was) appropriate CSS to position the sprite image as a background letting the appropriate part show through -- the problem is that I cannot get DIVs to behave as drop in replac... | <p>Did you try <code>display: inline-block;</code> ?</p>
<p>you may have to also use <code>display: -moz-inline-block;</code> for firefox2</p>
| <p>Display: inline-block is supposed to work in this situation. Did you try it?</p>
| 35,362 |
<p>How do I load MS Word document (.doc and .docx) to memory (variable) without doing this?:</p>
<p><em>wordApp.Documents.Open</em> </p>
<p>I don't want to open MS Word, I just want that text inside. </p>
<p>You gave me answer for DOCX, but what about DOC? I want free and high performance solution - not to open 12.0... | <p>You can use wordconv.exe which is part of the Office Compatibility Pack to convert from doc to docx.</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang=en" rel="nofollow noreferrer">http://www.microsoft.com/downloads/details.aspx?familyid=94... | <p>I don't mean to be an antagonist, but why?</p>
<p>I've extracted data from Word Documents on Linux servers using Word2X or AbiWord and depending on the number and the variety of docments there will always be errors with the extraction. It's worse the more bullets, page breaks, document sections and other "special"... | 26,501 |
<p>We have a Microsoft web stack web site, we have a members database.</p>
<p>We want to start doing mass-emails to our (opted in) membership.</p>
<p>I don't <em>particularly</em> want to re-invent the wheel with a system for having a web form submit and then mass send emails looping through thousands of records with... | <p>I agree with acrosman, third parties that host email lists are a good way to go. A very reliable site I've found for mass emailing is <a href="http://mailing-list-services.com/" rel="nofollow noreferrer">http://mailing-list-services.com/</a>. They do a good job to make sure their servers are never black listed or ... | <p>(not a sales pitch)
<a href="http://www.acsysinteractive.com" rel="nofollow noreferrer">my company</a> offers <a href="http://www.acsysinteractive.com/product/default.aspx" rel="nofollow noreferrer">mail manager</a>, but it's a hosted service. It has a full API though.</p>
| 11,224 |
<p>I have a few C# <code>.dll</code> projects which are common to many applications. Currently, I have one big repository. I have each DLL stored as a separate project within the repository and every application project stored as a project within the same repository.</p>
<p>I recently switched to Subversion for sourc... | <p>Subversion repositories are typical sub-divided into:</p>
<pre><code>branch/
tags/
trunk/
</code></pre>
<p>You would either place all of your DLL and application projects into the <strong>trunk</strong> and then use <strong>branch</strong> and <strong>tags</strong> for all of them as necessary too:</p>
<pre><code... | <p>if your sub projects can be released at different versions (like controls, web parts, ect...) then it may make sense to build your structure like this:</p>
<p><strong>Solution</strong><br>
Project 1 </p>
<blockquote>
<ul>
<li>Branch </li>
<li>Tags </li>
<li>Trunk </li>
</ul>
</blockquote>
<p>Project... | 3,638 |
<p>I'm using mySQL to set up a database of stock options. There are about 330,000 rows (each row is 1 option). I'm new to SQL so I'm trying to decide on the field types for things like option symbol (varies from 4 to 5 characters), stock symbol (varies from 1 to 5 characters), company name (varies from 5 to 60 characte... | <p>In MyISAM, there is some benefit to making fixed-width records. VARCHAR is variable width. CHAR is fixed-width. If your rows have only fixed-width data types, then the whole row is fixed-width, and MySQL gains some advantage calculating the space requirements and offset of rows in that table. That said, the adva... | <p>I would definitely not recreate the database each time. Instead I would do the following:</p>
<ul>
<li>read in the update/snapshot file and create some object based on each row. </li>
<li>for each row get the symbol/option name (unique) and set that in the database</li>
</ul>
<p>If it were me I would also have a... | 45,576 |
<p>Let's take a very simple example:</p>
<ul>
<li>In my window1.xaml, i have a label
control named 'lblProduct'.</li>
<li>In my window1.xaml.cs, i have a
public method called
CalculateProduct(Int Var1, Int
Var2). CalculateProduct will, as
you may have guessed, calculate the
product of the variables passed in.</li>
</... | <p>Yes, there is a way. It's not pretty. You have to add an xmlns:Commands attribute to your window1.xaml tag. I ended up bastardizing some code I found in <a href="http://www.codeproject.com/KB/WPF/CentralizingWPFCommands.aspx" rel="nofollow noreferrer">this Code Project article</a>.</p>
<p>Is the product that yo... | <p>aogan: The idea here is to leverage the flexibility of WPF databinding. I could set the entire UI in the code behind, but MS has developed this binding system and i wanted to easily take advantage of it. Also, this was a simple example for a more complicated problem.</p>
<p>To everyone else involved, i've gone wi... | 35,241 |
<p>Can someone explain what are the benefits of using the @import syntax comparing to just including css using the standard link method?</p>
| <p>If you use <code><link></code>s in your HTML files, all those files have to keep track of all the CSS files. This obviously makes changes and additions (both for CSS and HTML files) harder.</p>
<p>Using <code>@import</code>, you reduce a theoretically infinite number of changes down to one.</p>
| <p>Say you work for Massive Dynamics, Corp.. It has a Widgets division. The Widgets division has an Accounts department. Accounts is divided into Accounts Payable and Accounts Receivable.</p>
<p>Using @include, you start the website with one top-level <strong>global.css</strong> stylesheet, which applies to everything... | 19,643 |
<p>This is slightly off topic of programming but still has to do with my programming project. I'm writing an app that uses a custom proxy server. I would like to write the server in C# since it would be easier to write and maintain, but I am concerned about the licensing cost of Windows Server + CALS vs a Linux serve... | <p>This really is an OT question. In any case, there is nothing easier than <strong>contacting your local MS distributor</strong>. As stackoverflow is by nature an international site, asking a question like that, where the answer is most likely to vary by location (<strong>MS license prices really are highly variable a... | <p>Like said above, if you are using your own connections and nothing else on the server you wont need the cals.</p>
| 13,524 |
<p>I'm writing a simulator in Python, and am curious about options and opinions regarding basic 2D animations. By animation, I'm referring to rendering on the fly, not displaying prerendered images.</p>
<p>I'm currently using matplotlib (Wxagg backend), and it's possible that I'll be able to continue using it, but I s... | <p>I am a fan of <a href="http://pyglet.org" rel="nofollow noreferrer">pyglet</a> which is a completely self contained library for doing graphical work under win32, linux, and OS X. </p>
<p>It has very low overhead, and you can see this for yourself from the tutorial on the website. It <em>should</em> play well with w... | <p><a href="https://arcade.academy/" rel="nofollow noreferrer">Arcade</a> works on any platform with OpenGL 3.3+ (i.e. not the Raspberry Pi, but most other platforms). Although it's intended for simple games, Arcade offers great bitmap and sprite handling, as well as simple graphics primitives such as rectangles, arcs ... | 20,491 |
<p>I'll start off on a good note and congratulate everyone in the community for continually supporting each other. We have maintained a great answer rate here on 3D Printing SE with a answer rate of 96%. I believe this rate has been maintained since day one and it's hard to keep up, especially with fluctuations in user... | <p>I have the feeling that a lot of the questions with non-accepted answers are users that came in for one or two questions and then left for good without ever accepting an answer. They might even have forgotten about this place.</p>
<p>For the note: we have (according to <a href="https://area51.stackexchange.com/prop... | <p>Hands up, guilty as charged. In my defence sometimes using the answer as given raises even more questions. In mitigation, from the knowledge gained (from helpful folk or simply own stupidity), I now contribute to others starting out. Will try harder.</p>
<p>P.S. Is there anywhere in the forum with a cure for life i... | 38 |
<p>I am working on a business problem in C#.NET. I have two classes, named C and W that will be instantiated independently at different times.</p>
<p>An object of class C needs to contain references to 0 ... n objects of class W, i.e. a C object can contain up to n W objects.</p>
<p>Each W object needs to contain a ... | <p>If you have the Martin Fowler's Refactoring book, just follow the "Change Unidirectional Association to Bidirectional" refactoring.</p>
<p>In case you don't have it, here's how your classes will look like after the refactoring:</p>
<pre><code>class C
{
// Don't to expose this publicly so that
// no one can ge... | <p>One option for this would be to implement the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.icontainer.aspx" rel="nofollow noreferrer">IContainer</a> and <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.icomponent.aspx" rel="nofollow noreferrer">IComponent</a> interface... | 30,970 |
<p>How do I ignore files in Subversion?</p>
<p>Also, how do I find files which are not under version control?</p>
| <p>(This answer has been updated to match SVN 1.8 and 1.9's behaviour)</p>
<p>You have 2 questions:</p>
<h1>Marking files as ignored:</h1>
<p>By "ignored file" I mean the file won't appear in lists even as "unversioned": your SVN client will pretend the file doesn't exist at all in the filesystem.</p>
<p>Ignored fi... | <ol>
<li>open you use JetBrains Product(i.e. Pycharm)</li>
<li>then click the 'commit' button on the top toolbar or use shortcut 'ctrl + k'
<a href="https://i.stack.imgur.com/lwwNN.png" rel="nofollow noreferrer">screenshot_toolbar</a></li>
<li>on the commit interface, move your unwanted files to another change list as ... | 11,156 |
<p>I want to do something sort of like this:</p>
<pre><code>let x = 5
let y = 10
let expr = Console.ReadLine()
expr
</code></pre>
<p>Where one might type <code>"x+y"</code> in the console to store in expr.</p>
<p>How does one evaluate a statement like this in F#?</p>
<p>Ultimately, I want a user to be able to ent... | <p>F# doesn't have eval, as mentioned, but if you can define the grammar, you can utilize the Lex and Yacc implementations in F# (fslex and and fsyacc).</p>
<p><em>EDIT:</em></p>
<p>As a quick follow up, I know in ocaml you can exploit the interactive console to your users with <code>ocamlmktop</code>. I am unsure of... | <p>F# doesn't have an eval function like Lisp's (AFAIK), if that's what you're wondering. You could build up an expression tree yourself though, based on string input.</p>
| 48,631 |
<p>I've gone on quite a few sites (thingiverse, grabcad, etc) in search for a coiled tube, but I have yet to find anything suitable. There are a few coils ("springs") but no coiled tubes (i.e. the springs are hollow). Maybe my searching hasn't been good enough! But I was wondering if this is a limitation to 3D printing... | <p>I managed to do it in the end using AutoDesk 123D.</p>
<p><a href="https://i.stack.imgur.com/izeeR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/izeeR.png" alt="enter image description here"></a></p>
<p>Did it by making two coils of differing radius, then subtracting the smaller from the large... | <p>No, this is not a limitation. You should be able to create a coiled tube in almost every 3D design software package. However, how to do this depends on the specific 3D design software in use.</p>
<p>You'd generally do so by creating a cross-sectional profile (i.e. a hollow circle) and then sweeping it along a helic... | 644 |
<p>What particular method/application are you using to communicate between your application and a database? Custom code with stored procedures? SubSonic? nHibernate? Entity Framework? LINQ?</p>
| <p>I primarily use <a href="http://msdn.microsoft.com/en-us/library/cc309504.aspx" rel="nofollow noreferrer">Microsoft Enterprise Library Data Access Block</a> to access stored procedures in MS SQL Server databases.</p>
| <p>At work our code base is C++ and Perl and we talk to a MySQL database. For our interface we have some fairly thin custom classes wrapped around the basic MySQL client libraries for our C++ code and the DBI module for our Perl scripts.</p>
| 6,695 |
<p>In Python map() works on any data that follows the sequence protocol. It does The Right Thing^TM whether I feed it a string or a list or even a tuple.</p>
<p>Can't I have my cake in OCaml too? Do I really have no other choice but to look at the collection type I'm using and find a corresponding List.map or an Arr... | <p>The closest you will get to this is the module <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha1/batteries/html/api/Data.Mutable.Enum.html" rel="noreferrer"><code>Enum</code></a> in <a href="http://batteries.forge.ocamlcore.org/" rel="noreferrer">OCaml Batteries Included</a> (formerly of <a ... | <p>As long as you define a type t and val compare (: t->t->int) in your module, Map.Make will give you the map you want. </p>
| 33,861 |
<p>An advantage by using Windows Authentication is that I do not need to provide a username and password to log into the server as the user currently logged into Windows. But in a specific case I would like to log into the SQL Server as another user, using the same Windows Authenticated ODBC connection.</p>
<p>So, the... | <p>The simple answer to your question is no, without a dialog being presented, it's not possible to login to SQL Server using another Windows account.</p>
<p>The slightly more complex answer is; You can login as another user (WITH a dialog being presented) by right-clicking the Query Analyser icon and choosing "Run As... | <p>Runas does not let you provide a password on the command line and will produce a popup to gather it. A little searching let me to an artical on technet that may help out while not it's intended use.. </p>
<p><a href="http://technet.microsoft.com/en-us/library/bb727155.aspx" rel="nofollow noreferrer">http://techne... | 21,976 |
<p>I have three custom build configurations { Dev, Qs, Prd }. So, I have three app configs { Dev.config, Qs.config, Prd.config }. I know how to edit the .csproj file to output the correct one based on the current build configuration.</p>
<pre><code><Target Name="AfterBuild">
<Delete Files="$(TargetDir)$(Ta... | <p>Something along the lines of</p>
<pre><code><PropertyGroup Condition="'$(Configuration)'=='Dev_Debug' OR '$(Configuration)'=='Dev_Release'" >
<CfgFileName>Dev</CfgFileName>
</PropertyGroup>
<!-- similar for Qs & Prd -->
<Target ...>...$(CfgFileName).config...
</code></pre... | <p>The last solution I would like to employ is to create 6 app configs, 1 per custom configuration </p>
<p>{ <code>Dev_Debug.config</code>, <code>Dev_Release.config</code>, <code>Qs_Debug.config</code>, <code>...</code> , <code>Prd_Release.config</code> }.</p>
<p>Although, with that setup, I could maintain the generi... | 45,606 |
<p>I have created a client-server program with Perl using IO::Socket::INET. I access server through CGI based site. My server program will run as daemon and will accept multiple simultaneous connections. My server process consumes about 100MB of memory space (9 large arrays, many arrays...). I want these hashes to res... | <p>Instead of forking there are two other approaches to handle concurrent connections. Either you use threads or a polling approach.</p>
<p>In the thread approach for each connection a new thread is created that handles the I/O of a socket. A thread runs in the same virtual memory of the creating process and can acces... | <p>Instead of forking there are two other approaches to handle concurrent connections. Either you use threads or a polling approach.</p>
<p>In the thread approach for each connection a new thread is created that handles the I/O of a socket. A thread runs in the same virtual memory of the creating process and can acces... | 46,831 |
<p>How does reverse proxy server work? Is it used to secure the main server? Is it used as a firewall? What are the reasons for using a proxy server? Could someone give a real world example?</p>
| <p>Typically a normal proxy server looks at requests going from an internal network out to the internet and caches them so that if another client requests the same page, the proxy can give it to them much quicker than a brand new request to a remote server.</p>
<p>A reverse proxy works in the opposite way.</p>
<p>Gen... | <p>“A proxy server is a go‑between or intermediary server that forwards requests for content from multiple clients to different servers across the Internet. A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backen... | 27,216 |
<p>i need to redirect all of the stdout of a program except the first line into a file. </p>
<p>Is there a common unix program that removes lines from stdin and spits the rest out to stdout?</p>
| <p>Others have already mentioned "tail". sed will also work:</p>
<pre><code>sed 1d
</code></pre>
<p>As will Awk:</p>
<pre><code>awk 'NR > 1'
</code></pre>
| <p>sed -e 1d < input > output</p>
| 29,941 |
<p>This is related to some other questions, such as: <a href="https://stackoverflow.com/questions/34987/how-to-declare-an-array-of-strings-in-c">this</a>, and some of my other questions.</p>
<p>In <a href="https://stackoverflow.com/questions/34987/how-to-declare-an-array-of-strings-in-c">this question</a>, and others,... | <p>Use the keyword static and external initialization to make the array a static member of the class:</p>
<p>In the header file:</p>
<pre><code>class DataProvider : public SomethingElse
{
static const char* const mStringData[];
public:
DataProvider();
~DataProvider();
const char* const GetData()
... | <p>This is not possible in C++. You cannot directly initialize the array. Instead you have to give it the size it will have (4 in your case), and you have to initialize the array in the constructor of DataProvider:</p>
<pre><code>class DataProvider {
enum { SIZEOF_VALUES = 4 };
const char * values[SIZEOF_VALUE... | 36,147 |
<p>We're using HAProxy as a load balancer at the moment, and it regularly makes requests to the downstream boxes to make sure they're alive using an OPTIONS request:</p>
<blockquote>
<p>OPTIONS /index.html HTTP/1.0</p>
</blockquote>
<p>I'm working with getting nginx set up as a reverse proxy with caching (using nca... | <p>I'm probably late, but I had the same problem, and found two solutions to it.</p>
<p>First is tricking Nginx that a 405 status is actually a 200 OK and then proxy_pass it to your HAProxy like this:</p>
<pre><code>error_page 405 =200 @405;
location @405 {
root /;
proxy_pass http://yourproxy:8080;
}
</code><... | <p>In the httpchk option, you can specify the HTTP method like this:</p>
<pre><code>httpchk GET http://example.com/check.php
</code></pre>
<p>You can also use POST, or a plain URI like /. I have it check PHP, since PHP runs external to Nginx.</p>
| 28,209 |
<p>I recently bought an Anet A8 (<a href="https://pevly.com/anet-a8-3d-printer-review/" rel="noreferrer">https://pevly.com/anet-a8-3d-printer-review/</a>). I've managed to get everything up and running, leveled the board, but am now running into a problem.</p>
<p>At the start of the print, the printer moves to 0,0,0, ... | <p>I switched to different firmware (the latest Marlin), now the problem has been resolved. So it seems to me that those random movements are not in fact normal, but a flaw in the firmware.</p>
| <p>Formating SD card fixes issue for me.
I think that writing many times to the same block of SD card corrupt some block of flash SD card memory.</p>
| 757 |
<p>I've got a BPG file that I've modified to use as a make file for our company's automated build server. In order to get it to work I had to change </p>
<pre>
Uses * Uses
unit1 in 'unit1.pas' * unit1
unit2 in 'unit2.pas' * unit2
... * ...
</pre>
<p>in ... | <p>It could come from the fact, that the search path in the IDE and the search path of the command line compiler are not the same. If you change the serach path of the command line compiler you might be able to use the exactely same source code as within the IDE.</p>
<p>One possibility to configure the search path for... | <p>Every time I have to put conditionals into a project file I do this:</p>
<pre><code>program a;
uses
ACondUnits;
...
</code></pre>
<p><br/></p>
<pre><code>unit ACondUnits;
interface
uses
{$IFDEF UseD7MM}
Delphi7MM;
{$ELSE}
FastMM4;
{$ENDIF}
implementation
end.
</code></pre>
<p>Maybe this trick works i... | 15,959 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.