instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Is it possible to break at runtime when a particular file has been modified? </p>
<p>ie. monitor the file and break into a debugger once a change has been made to it.</p>
<p>This is for a windows app...is this possible in visual studio or windbg?</p>
<p>edit: i should have mentioned that this is for a Win32 app... | <p>you can use the System.IO.FileSystemWatcher class.</p>
<pre><code>FileSystemWatcher watcher = = new FileSystemWatcher();
watcher.Filter = @"myFile.ini";
watcher.Changed += new FileSystemEventHandler(watcher_Changed);
</code></pre>
<p>and then you implement the delegate of type FileSystemEventHandler:</p>
<pre><co... | <p>Assuming this is .NET, the System.IO.<strong>FileSystemWatcher</strong> class is what you need.</p>
<pre><code>FileSystemWatcher watcher = new FileSystemWatcher("c:filename.txt");
watcher.Changed += new FileSystemEventHandler(watcher_Changed);
//
void watcher_Changed(object sender, FileSystemEventArgs e)
{
// ... | 23,505 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/203616/why-does-c-sharp-not-provide-the-c-style-friend-keyword">Why does C# not provide the C++ style ‘friend’ keyword?</a> </p>
</blockquote>
<p>I'd like the private member variables of a class to be accessibl... | <p>There's no direct equivalent of "friend" - the closest that's available (and it isn't very close) is <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx" rel="noreferrer">InternalsVisibleTo</a>. I've only ever used this attribute for testing - where it's ... | <p>You can simulate a friend access if the class that is given the right to access is inside another package and if the methods you are exposing are marked as internal or internal protected. You have to modify the assembly you want to share and add the following settings to AssemblyInfo.cs :</p>
<pre><code>// Expose t... | 25,068 |
<p>I decided to make a system for a client using <a href="https://web.archive.org/web/20080517021542/http://www.castleproject.org/activerecord/index.html" rel="nofollow noreferrer">Castle ActiveRecord</a>, everything went well until I found that the transactions do not work, for instance;</p>
<pre><code> ... | <p>Ben's got it. That doc is a little confusing. Refer to the last block <a href="https://web.archive.org/web/20080417014143/http://www.castleproject.org/ActiveRecord/documentation/v1rc1/usersguide/scopes.html" rel="nofollow noreferrer">on the page</a>, "Nested transactions". </p>
| <p>I finally fixed, it happened that I was doing wrong, I overrode the Save method of the Member class and made sessionScope inside and inside of it a transaction scope, so when a involved all of that in a transaction scope it saved in the database, so when I threw the exception everything was already saved, I think th... | 5,968 |
<p>I'm trying to bind controls in a WPF form to an interface and I get a runtime error that it can't find the interface's properties.</p>
<p>Here's the class I'm using as a datasource:</p>
<pre><code>public interface IPerson
{
string UserId { get; set; }
string UserName { get; set; }
string Email { get; s... | <p>I'm not familiar with entlib's policy injection, but I'm pretty sure that your problem lies there, and not in the fact that you're using an interface.<br>
If you were to replace</p>
<pre><code>var person = PolicyInjection.Wrap<IPerson>(new Person());
</code></pre>
<p>with </p>
<pre><code>IPerson person = n... | <p>I don't see much wrong with the code. Technically you're binding an instance of the Person class (ie it doesn't make sense to try and bind to an interface anyway) I don't know what your PolicyInjection.Wrap method does, but I'm assuming it returns a concrete Person class? Anyway, I just tried this on my end and it w... | 10,134 |
<p>I'd like to add dvd burning functionality to my .Net app (running on Windows Server 2003), are there any good components available? I've used the NeroCOM sdk that used to come with Nero but they no longer support the sdk in the latest versions of Nero. I learned that Microsoft has created an IMAPI2 upgrade for Win... | <p>I've used the code from the codeproject <a href="http://www.codeproject.com/KB/miscctrl/imapi2.aspx" rel="nofollow noreferrer">article</a> and it works pretty well. It's a nice wrapper around the IMAPI2, so as longs as IMAPI2 supports what you need to do, the .NET wrapper will do it.</p>
| <p>Did your cdrecord methodology support dvd burning? And is there an easy way to redistribute/install cygwin with an application? StarBurn looks pretty good at first glance, although I'm a little hesitant to go with unproven libraries that have to handle something this complicated (especially with the number of type... | 5,292 |
<p>I'm trying to polish up my Ruby by re writing Kent Beck's xUnit Python example from "Test Driven Development: By Example". I've got quite far but now I get the following error when I run which I don't grok.</p>
<pre><code>C:\Documents and Settings\aharmel\My Documents\My Workspace\TDD_Book\TDDBook_xUnit_RubyVersio... | <p>It's your print statement:</p>
<pre><code> puts "test was run? (true expected): #{test.wasRun}"
</code></pre>
<p>should be</p>
<pre><code> puts "test was run? (true expected): #{@test.wasRun}"
</code></pre>
<p>without the '@' you are calling Kernel#test, which expects 2 variables.</p>
| <p>One thing that leaps out is that the <code>send</code> method expects a symbol identifying the method name, but you're trying to use an instance variable.</p>
<p><a href="http://www.ruby-doc.org/core/classes/Object.html#M000334" rel="nofollow noreferrer">Object.send documentation</a></p>
<p>Also, shouldn't lines l... | 14,207 |
<p>I want to write a regular expression that will replace the word Paris by a link, for only the word is not ready a part of a link.</p>
<p>Example:</p>
<pre><code> i'm living <a href="Paris" atl="Paris link">in Paris</a>, near Paris <a href="gare">Gare du Nord</a>, i love Paris.
</code></... | <p>This is hard to do in one step. Writing a single regex that does that is virtually impossible.</p>
<p>Try a two-step approach.</p>
<ol>
<li>Put a link around every "Paris" there is, regardless if there already is another link present.</li>
<li>Find all incorrectly nested links (<code><a href="..."><a href... | <p>Regexes don't replace. Languages do.</p>
<p>Languages and libraries would also read from the database or file that holds the list of words you care about, and associate a URL with their name. Here's the easiest substitution I can imagine possible my a single regex (perl is used for the <em>replacement</em> syntax.)... | 34,798 |
<p>I want to build two-dimentional array of strings where length of one dimention is 2. Similar to this</p>
<pre><code>string[,] array = new string[,]
{
{"a", "b"},
{"c", "d"},
{"e", "f"},
{"g", "h"}
}
</code></pre>
<p>Doing</p>
<pre><code>List<string[]> list = new List<string[]>();
list... | <p>You can do this.</p>
<pre><code>List<KeyValuePair<string, string>>
</code></pre>
<p>The idea being that the Key Value Pair would mimic the array of strings you replicated.</p>
| <p>This isn't possible with a <code>List<string[]></code>, as the type <code>string[,]</code> is different from <code>string[]</code>.</p>
| 36,393 |
<p>I'm matching identifiers, but now I have a problem: my identifiers are allowed to contain unicode characters. Therefore the old way to do things is not enough:</p>
<pre><code>t_IDENTIFIER = r"[A-Za-z](\\.|[A-Za-z_0-9])*"
</code></pre>
<p>In <a href="http://freehg.org/u/cheery/aml/" rel="nofollow noreferrer">my mar... | <p>the <a href="http://docs.python.org/library/re#regular-expression-syntax" rel="noreferrer">re</a> module supports the \w syntax which:</p>
<blockquote>
<p>If UNICODE is set, this will match the
characters [0-9_] plus whatever is
classified as alphanumeric in the
Unicode character properties database.</p>
</... | <p>Probably <a href="http://www.regular-expressions.info/posixbrackets.html" rel="nofollow noreferrer">POSIX character classes</a> are right for you?</p>
| 29,465 |
<p>Here's the situation: I need to bind a WPF <code>FixedPage</code> against a <code>DataRow</code>. Bindings don't work against <code>DataRows</code>; they work against <code>DataRowViews</code>. I need to do this in the most generic way possible, as I know nothing about and have no control over what is in the <cod... | <p>Not Exactly a sexy piece of code but their doesn't seem to be an automated way to find the row without just looping the table.</p>
<pre><code> DataRowView newRowView = null;
foreach (DataRowView tempRowView in myDataTable.DefaultView)
{
if (tempRowView.Row == rowToMatch)
... | <pre><code>row.Table.DefaultView[row.Table.Rows.IndexOf(row)]
</code></pre>
<p>This is an okay answer. But if you find yourself in this situation, you should consider learning more about DataViews and how they are used, then refactor your code to be view-centric rather than table-centric.</p>
| 5,240 |
<p>I'm getting some weird behaviour recompiling some applications in 2009 that used widestrings at various points. </p>
<p>In a Delphi 2009 App is Widestring identical to String?</p>
| <p>No, they are not idenitical.</p>
<p><code>WideString</code> is just a wrapper for the ActiveX/COM <code>BSTR</code> type. You need it when working with with strings in ActiveX/COM.</p>
<p><code>String</code> in Delphi 2009 and later is an alias for <code>UnicodeString</code>, which can hold Unicode characters, jus... | <p>See this paper by Marco Cantu which outlines the workings of string (i.e. UnicodeString) in Delphi 2009:</p>
<p>"White Paper: Delphi and Unicode"</p>
<p><a href="http://dn.codegear.com/article/38980" rel="nofollow noreferrer">http://dn.codegear.com/article/38980</a></p>
<p>Basically, it's what Roddy said, but tak... | 48,972 |
<p>I have a file that apparently contains some sort of dump of a keep-alive HTTP conversation, i.e. multiple GET requests and responses including headers, containing an HTML page and some images. However, there is some binary junk in between - maybe it's a dump on the TCP or even IP level (I'm not sure how to determine... | <p>Use <a href="http://www.wireshark.org/" rel="nofollow noreferrer">Wireshark</a>.</p>
<p>Look into the file format for its dumps and convert your dump to it. Its very simple. Its called the <a href="http://wiki.wireshark.org/Development/LibpcapFileFormat" rel="nofollow noreferrer">pcap file format</a>. Then you can ... | <p>The Net tab in the Firebug plugin for Firefox might be of use.</p>
| 46,673 |
<p>Now that I know <code>C++</code> I want to get into desktop application that have a UI instead of <code>Command Prompt</code> stuff, where should I start?, and what are some good <strong>online</strong> resources?</p>
| <p><a href="http://www.wxwidgets.org/" rel="nofollow noreferrer">wxWidgets</a> is a cross platform GUI library for C++ (and other languages). The main site should have enough pointers to resources to get going.</p>
<p>You might also want to check out <a href="https://stackoverflow.com/questions/4347/where-is-a-good-pl... | <p>On Linux and maybe Windows, you can use <a href="http://gtk.org" rel="nofollow noreferrer">Gtk+</a> with <a href="http://glade.gnome.org/" rel="nofollow noreferrer">Glade</a>. Gtk+ is the GUI toolkit. Glade is a GUI drag and drop GUI editor. If you came from Windows or Java and thought GUI programming is hard, this ... | 7,071 |
<p>I have a <em>JComboBox</em> and would like to have a separator in the list of elements. How do I do this in Java?</p>
<p>A sample scenario where this would come in handy is when making a combobox for font-family-selection; similar to the font-family-selection-control in Word and Excel. In this case I would like to ... | <p>There is a pretty short tutorial with an example that shows how to use a custom ListCellRenderer on java2s
<a href="http://www.java2s.com/Code/Java/Swing-Components/BlockComboBoxExample.htm" rel="noreferrer">http://www.java2s.com/Code/Java/Swing-Components/BlockComboBoxExample.htm</a></p>
<p>Basically it involves ... | <p>You can use a custom <code>ListCellRenderer</code> which would draw the separator items differently. See <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComboBox.html#setRenderer(javax.swing.ListCellRenderer)" rel="nofollow noreferrer">docs</a> and a small <a href="http://www-eleves-isia.cma.fr/documen... | 16,806 |
<p>I'm setting up CruiseControl.NET and during the build I want to modify my version.txt file and have it checked in. When I do this, CruiseControl.NET doesn't know this checkin was done by the build and so the next time it checks sources, it sees there were modifications and rebuilds again (I have IfModificationExist... | <p>You can use exclusionFilters in the project to exclude the version.txt file from triggering a build.</p>
<pre><code><sourcecontrol type="filtered">
<sourceControlProvider type="svn">
...
</sourceControlProvider>
<exclusionFilters>
<pathFilter>
... | <p>I'm not using Subversion, i'm using TFS.</p>
<p>Version.txt contains "1.0.5.3" which is the current build number. When someone checks out to build, they'll use 1.0.5.3 as their revision. On the server, it will rev the build number, store it in version.txt and check it back in so that everyone's version is moved u... | 38,995 |
<p>I have a web application which i deploy in Tomcat. I want to secure all pages under the url path <em>administration/*</em>. </p>
<p>I have set up container-managed security entering the next snippet in the web.xml file:</p>
<pre><code><security-role>
<role-name>administrator</role-name>
</... | <p>Yes, <a href="http://tomcat.apache.org/tomcat-4.1-doc/realm-howto.html#DataSourceRealm" rel="nofollow noreferrer">it is possible</a>.</p>
| <p>Or for the current Release <a href="http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html" rel="nofollow noreferrer">Tomcat 6 Realm Howto</a></p>
| 47,295 |
<p>I'm running <code>Django 1.0</code> and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False.</p>
<p>With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-and-paste the errors and easily email them to the de... | <p>Automatically log your 500s, that way:</p>
<ul>
<li>You know when they occur.</li>
<li>You don't need to rely on users sending you stacktraces.</li>
</ul>
<p>Joel recommends even going so far as automatically creating tickets in your bug tracker when your application experiences a failure. Personally, I create a (... | <p>I know this is an old question, but these days I would recommend using a service such as <a href="https://getsentry.com/welcome/" rel="nofollow">Sentry</a> to capture your errors.</p>
<p>On Django, the steps to set this up are incredibly simple. From <a href="https://docs.getsentry.com/hosted/clients/python/integra... | 14,770 |
<p>Does anyone have a Powershell script to change the credentials used by a Windows service?</p>
| <p>Bit easier - use WMI.</p>
<pre><code>$service = gwmi win32_service -computer [computername] -filter "name='whatever'"
$service.change($null,$null,$null,$null,$null,$null,$null,"P@ssw0rd")
</code></pre>
<p>Change the service name appropriately in the filter; set the remote computer name appropriately.</p>
| <p>What I cannot find in the default PS stack, I find it implemented in <code>Carbon</code>:</p>
<p><a href="http://get-carbon.org/help/Install-Service.html" rel="nofollow">http://get-carbon.org/help/Install-Service.html</a></p>
<p><a href="http://get-carbon.org/help/Carbon_Service.html" rel="nofollow">http://get-car... | 40,434 |
<p>Just wondering if there is any way to do the following:</p>
<pre><code>public Interface IDataField
{
object GetValue();
}
public Interface IComplexDataField : IDataField
{
object GetDefaultValue();
}
public class MyBase
{
private IDataField _DataField;
public MyBase()
{
this._DataFie... | <p>What you want is <em>covariance of return types</em>. This doesn't exist in C#.</p>
<p>Could you perhaps make <code>MyBase</code> generic:</p>
<pre><code>public class MyBase<T> where T : IDataField
{
public virtual T CreateDataField()
{
... etc ...
}
}
</code></pre>
<p>Alternatively, you... | <p>What you're trying to do is called Covariant return types. They don't exist in the the current version C#, but there's talk of it being introduced for the next version.</p>
<p>Your best approach explained here: <a href="http://srtsolutions.com/blogs/billwagner/archive/2005/06/17/covaraint-return-types-in-c.aspx" re... | 33,465 |
<p>I want to get the overall total CPU usage for an application in C#. I've found many ways to dig into the properties of processes, but I only want the CPU usage of the processes, and the total CPU like you get in the TaskManager.</p>
<p>How do I do that?</p>
| <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter(VS.80).aspx" rel="noreferrer">PerformanceCounter</a> class from <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.aspx" rel="noreferrer">System.Diagnostics</a>.</p>
<p>Initialize like this:</p>
... | <p>I did not like having to add in the 1 second stall to all of the <code>PerformanceCounter</code> solutions. Instead I chose to use a <code>WMI</code> solution. The reason the 1 second wait/stall exists is to allow the reading to be accurate when using a <code>PerformanceCounter</code>. However if you calling this me... | 35,105 |
<p>Is there a good <strong>cross-browser</strong> way to set a <code>max-height</code> property of a DIV and when that DIV goes beyond the <code>max-height</code>, it turns into an overflow with scrollbars?</p>
| <p>Sadly IE6 doesn't so you have to use an expression for IE6, then set the max-height for all other browsers:</p>
<pre><code> div{
_height: expression( this.scrollHeight > 332 ? "333px" : "auto" ); /* sets max-height for IE6 */
max-height: 333px; /* sets max-height value for all standards-compliant b... | <p>I found this from <a href="http://www.tutorialspoint.com/css/css_scrollbars.htm" rel="nofollow">http://www.tutorialspoint.com/css/css_scrollbars.htm</a> and modified a bit. It seems working for both IE9 and FF19</p>
<pre><code><style type="text/css">
.scroll{
display:block;
border: 1px solid red;
... | 38,098 |
<p>Say you are writing an application that must implement the HTTP protocol. Protocols are quite complex and may allow several commands depending on which stage of a transaction they are in.</p>
<p>As an example, look at SMTP. An SMTP server must throw an error if the "data" command is sent before receiving "rcpt" and... | <p><strong>State Machines</strong></p>
<p>To my mind, a state machine is the easiest way to model and handle protocols. A state would be reached by several transitions relating to valid commands received. Each state would then allow only a certain subset of commands.</p>
<p>State machines are used in compiler constru... | <p>I agree with a28, the best way is to either:</p>
<ul>
<li>Use a library which implements the protocol server</li>
<li>Write your application as an extension to an existing server (e.g. web server extension via IIS, Apache APIs etc, Sendmail Milter etc) OR</li>
<li>Modify an existing server to make RPC calls to your... | 31,020 |
<p>I am looking for a way to pull the first 100 characters from a string variable to put in another variable for printing. </p>
<p>Is there a function that can do this easily?</p>
<p>For example:</p>
<pre><code>$string1 = "I am looking for a way to pull the first 100 characters from a string variable to put in anot... | <pre><code>$small = substr($big, 0, 100);
</code></pre>
<p>For <a href="http://ca3.php.net/manual/en/ref.strings.php" rel="noreferrer">String Manipulation</a> here is a page with a lot of function that might help you in your future work.</p>
| <p>Without php internal functions:</p>
<pre><code>function charFunction($myStr, $limit=100) {
$result = "";
for ($i=0; $i<$limit; $i++) {
$result .= $myStr[$i];
}
return $result;
}
$string1 = "I am looking for a way to pull the first 100 characters from a string variable to put in a... | 40,990 |
<p>I've been using usenet searches since about 1995 to get programming information, mostly for microsoft APIs. First searching via dejanews, and now google "groups" which bought out dejanews. Over the last few years I've noticed a steady decline in the quantity of search results for usenet from google, and today I find... | <p><a href="http://groups.google.com/groups/search?safe=off&q=database+group%3Amicrosoft" rel="nofollow noreferrer">http://groups.google.com/groups/search?safe=off&q=database+group%3Amicrosoft</a>*&btnG=Rechercher&as_mind=1&as_minm=1&as_miny=1996&as_maxd=1&as_maxm=1&as_maxy=1999&... | <p>It appears to be problem with the advanced search form. I can't get the one at
<a href="http://groups.google.fr/advanced_search?hl=fr&q=&hl=fr&" rel="nofollow noreferrer">http://groups.google.fr/advanced_search?hl=fr&q=&hl=fr&</a>
to work either. But I can use the basic form with "database ... | 34,711 |
<p>I'm trying to convert the below SQL query to HQL and am having a few issues. A straight line by line conversion doesn't work, I am wondering if I should be using an Inner Join in the HQL?</p>
<pre><code> SELECT (UNIX_TIMESTAMP(cosc1.change_date) - UNIX_TIMESTAMP(cosc2.change_date))
FROM customer_ord... | <p>Typically you HQL joins are specified using the property on the object, eg, if class Foo and Bar and Foo.bar is of type Bar, then <code>from Foo f inner join f.bar as b</code> is the join. As far as I know, there's no way of performing a self-join in HQL (I could be wrong here).</p>
<p>That said, Hibernate allows ... | <p>Ended up changing to use native SQL and a PreparedStatement as it seems that Hibernate's session.createSQLQuery() will only work for Managed Entities.</p>
| 33,492 |
<p>I've created a UserObject and RoleObject to represent users in my application. I'm trying to use hibernate for CRUD instead of raw JDBC. I've successfully retrieved the information from the data base, but I can not create new users. I get the following error.</p>
<pre><code>org.springframework.web.util.NestedSe... | <p>You are defining two different relationships inside of your "set" element. What you probably want is just the many-to-many element.</p>
<p>If this still doesn't work, try saving the UserRole itself to see if you can persist it on its own. If you can, then the ConstraintViolationException is being thrown while try... | <p>The contraint violation on UserRole might be a cause of trying to insert a row with a duplicate key. Maybe experiment with using other types of generators, such as "sequence".</p>
| 41,714 |
<p>We have encountered a very strange situation when we deployed an application at a customer site. This application is implemented as a service using C# on .NET 3. The application communicates with a web service that is written using gSOAP. In our .NET application, the classes that wrap the web service were created by... | <p>Come to think of it, never mind. I just noticed that if I use "am" and "pm" instead of "a" and "p", it works fine. It assumes today's date, instead of the default 1/1/0001, but that's not a problem for my purposes.</p>
<p>(Still, any reasonably easy solution to get the "a" and "p" to work is welcome.)</p>
| <p>You may be able to use the validating or validated event to capture the text and add the 'm'.</p>
| 35,740 |
<p>How do you give a C# auto-property an initial value?</p>
<p>I either use the constructor, or revert to the old syntax. </p>
<p><strong> Using the Constructor:</strong></p>
<pre><code>class Person
{
public Person()
{
Name = "Initial Name";
}
public string Name { get; set; }
}
</code></pre>... | <p>In C# 5 and earlier, to give auto implemented properties an initial value, you have to do it in a constructor.</p>
<p>Since <a href="https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-60" rel="noreferrer">C# 6.0</a>, you can specify initial value in-line. The syntax is:</p>
<p... | <p>I think this would do it for ya givng SomeFlag a default of false.</p>
<pre><code>private bool _SomeFlagSet = false;
public bool SomeFlag
{
get
{
if (!_SomeFlagSet)
SomeFlag = false;
return SomeFlag;
}
set
{
if (!_SomeFlagSet)
_SomeFlagSet... | 6,199 |
<p>I'm new to mocking, I have a new .net web project that is in UI->BLL->DAL->DB structure, I use NUnit to do some testing currently. I intent to use it to test middle tier so I don't have to actually write to DB.</p>
<p>Now, I've never done any mocking, don't quite know where to start, so I am looking for a mocking f... | <p>You should check out some videos about mocking on Dimecasts.net, it's a quick way to get a feel over what mocking is about and get started on your own code.</p>
<p><a href="http://dimecasts.net/Casts/ByTag/Moq" rel="nofollow noreferrer">Introduction to Moq</a></p>
<p><a href="http://dimecasts.net/Casts/ByTag/Rhino... | <p>You might be interested in our book in progress <a href="http://www.mockobjects.com/book" rel="nofollow noreferrer">http://www.mockobjects.com/book</a>. It's Java, but the principles are the same.</p>
| 40,766 |
<p>I have the following HTML (note the CSS making the background black and text white)</p>
<pre><code><html>
<select id="opts" style="background-color: black; color: white;">
<option>first</option>
<option>second</option>
</select>
</html>
</code></pre>
<p>... | <p>Must be a <code>Vista</code> problem. I have <code>XP SP 2</code> and it looks normal. </p>
| <blockquote>
<p>I dropped that code into a file and pushed it to ff3 and I don't see what you see...the arrow is default color with gray background and black arrow.</p>
<p>Are you styling scrollbars too?</p>
</blockquote>
<p>I've updated the post, the HTML in there is now literally <em>all</em> the html that is being l... | 4,891 |
<p>My relative is studying programming and has a hard time understanding classes. He has trouble understanding for example that you need to instantiate it, that methods cannot access variables in other methods and if you change a variable in one instance of a class it doesn't change for other instances.</p>
<p>I've tr... | <p>Seriously use Animals, it works great. And that's what nailed the concept for me years ago. Just found this C# code. It seems good</p>
<pre><code> // Assembly: Common Classes
// Namespace: CommonClasses
public interface IAnimal
{
string Name
{
get;
}
st... | <p>Object-oriented programming is one technique of raising the level of abstraction by means of which the programmer communicates with the computer: from the level of flipping individual bits on and off, from the level of punching holes in paper cards, from the level of extraordinarily complex sequences of basic instru... | 46,379 |
<p>How do I use the ofstream to write text to the end of a file without erasing its content inside?</p>
| <p>You can pass the flag <code>ios::app</code> when opening the file:</p>
<pre><code>ofstream ofs("filename", ios::app);
</code></pre>
| <p>Use ios::app as the file mode.</p>
| 19,069 |
<p>For a poor man's implementation of <em>near</em>-collation-correct sorting on the client side I need a JavaScript function that does <em>efficient</em> single character replacement in a string.</p>
<p>Here is what I mean (note that this applies to German text, other languages sort differently):</p>
<pre>
native sort... | <p>Here is a more complete version based on the Unicode standard.</p>
<pre><code>var Latinise={};Latinise.latin_map={"Á":"A",
"Ă":"A",
"Ắ":"A",
"Ặ":"A",
"Ằ":"A",
"Ẳ":"A",
"Ẵ":"A",
... | <p><strong>I've solved it another way, if you like.</strong></p>
<p>Here I used two arrays where <strong><em>searchChars</em></strong> containing which will be replaced and <strong><em>replaceChars</em></strong> containing desired characters.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="... | 36,489 |
<p>I read this <a href="http://smartprogrammer.blogspot.com/2006/04/15-exercises-for-learning-new.html" rel="nofollow noreferrer">article</a> and try to do the exercise in D Programming Language, but encounter a problem in the first exercise.</p>
<blockquote>
<p>(1) Display series of numbers
(1,2,3,4, 5....etc) in... | <p>Here's how you do it in the D programming language:</p>
<pre><code> import std.c.stdio;
import std.c.linux.termios;
termios ostate; /* saved tty state */
termios nstate; /* values for editor mode */
// Open stdin in raw mode
/* Adjust output channel ... | <p>D generally has all the C stdlib available (Tango or Phobos) so answers to this question for GNU C should work in D as well.</p>
<p>If tango doesn't have the needed function, generating the bindings is easy. (Take a look at CPP to cut through any macro junk.)</p>
| 12,476 |
<p>I'm working on an integration testing project in .NET. The testing framework executable starts a service and then needs to wait for the service to complete an operation.</p>
<p>What is the best approach for the exe to wait on the service to complete its task (the service itself will not exit upon task completion)?<... | <p>You can pass a <code>Semaphore</code> name to the service on the command line (or via some other mechanism, like <em>hard coding</em>), and then wait on the service to <code>Release()</code> it, by calling <code>WaitOne()</code> in your exe.</p>
<p>App code:</p>
<pre><code>Semaphore s = new Semaphore(1, 1, "MyName... | <p>You could use IPC Channels: <a href="https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6143016.html" rel="nofollow noreferrer">https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6143016.html</a></p>
<p>Or maybe two way remoting: <a href="http://ww... | 20,152 |
<p>The more I learn about WPF and XAML, the more I realize that you can do pretty much all of your GUI initialization and event handling glue in either XAML or in code (say C# code or VB.Net code). </p>
<p>My question is to those who have been working on WPF for longer and ideally those who have shipped apps with it ... | <p>One tip is to not declare event handlers in XAML. Instead, name your elements and attach events handlers in the code-behind. That helps keep a clean separation between the designer and developer.</p>
| <p>I would say use as much xaml possible, using <code>Binding</code>, <code>commands</code>, <code>styles</code>, <code>templates</code> etc. I had to support functionality of saving and loading templates using XAMLReader/XAMLWriter and it more easier for controls having more xaml.</p>
| 21,979 |
<p>I have a wooden first generation Replicator with dual extruders and I'm trying to get an X, Y, Z position from the printer to the computer in real time. Is that even possible? </p>
<p>The firmware used by the replicator is version 5.5 I believe, and I've been doing tests with ReplicatorG but I'm not married to that... | <p>I had mistakenly left the setting "one at a time" in print sequence. This meaning the printhead needs a lot of room since it will go back and forth in z.</p>
<p>Cura allocates this extra space even if there's only one object.</p>
| <p>That looks like you've got the "brim" set to a very wide value. I know you said it's not explained by skirts --which, as Greenonline pointed out, is not the same as a brim--, but you didn't post that setting. At the same time, make sure you don't have a 'raft' set up. </p>
<p>One other possibility is that your so... | 613 |
<p>I can't find any proper documentation on how to specify relations
using the declarative syntax of SQLAlchemy.. Is it unsupported? That is, should I use the "traditional" syntax?<br>
I am looking for a way to specify relations at a higher level, avoiding having to mess with foreign keys etc.. I'd like to just declare... | <p>Assuming you are referring to <a href="http://www.sqlalchemy.org/docs/04/plugins.html#plugins_declarative" rel="nofollow noreferrer">the declarative plugin</a>, where everything I am about to say is documented with examples:</p>
<pre><code>class User(Base):
__tablename__ = 'users'
id = Column('id', Integer... | <p>Look at the "Configuring Relations" section of the <a href="http://www.sqlalchemy.org/docs/05/reference/ext/declarative.html" rel="nofollow noreferrer">Declarative docs</a>. Not quite as high level as "OneToMany" but better than fully specifying the relation. </p>
<pre><code>class Address(Base):
__tablename__... | 31,152 |
<p>We are using SQL Server 2005, but this question can be for any <a href="http://en.wikipedia.org/wiki/Relational_database_management_system" rel="noreferrer">RDBMS</a>.</p>
<p>Which of the following is more efficient, when selecting all columns from a view?</p>
<pre><code>Select * from view
</code></pre>
<p>or </... | <p>NEVER, EVER USE "SELECT *"!!!!</p>
<p>This is the cardinal rule of query design!</p>
<p>There are multiple reasons for this. One of which is, that if your table only has three fields on it and you use all three fields in the code that calls the query, there's a great possibility that you will be adding more field... | <p>If you're really selecting all columns, it shouldn't make any noticeable difference whether you ask for * or if you are explicit. The SQL server will parse the request the same way in pretty much the same amount of time.</p>
| 15,623 |
<p>Why does this javascript return 108 instead of 2008? it gets the day and month correct but not the year?</p>
<pre><code>myDate = new Date();
year = myDate.getYear();
</code></pre>
<p>year = 108?</p>
| <p>It's a <a href="http://en.wikipedia.org/wiki/Y2K" rel="noreferrer">Y2K</a> thing, only the years since 1900 are counted.</p>
<p>There are potential compatibility issues now that <code>getYear()</code> has been deprecated in favour of <code>getFullYear()</code> - from <a href="http://www.quirksmode.org/js/introdate.h... | <p>it is returning 4 digit year - 1900, which may have been cool 9+ years ago, but is pretty retarded now. Java's java.util.Date also does this.</p>
| 12,361 |
<p>At my workplace I'm stuck with Visual Basic 6, but after reading the answer to
"<a href="https://stackoverflow.com/questions/268648/how-do-i-sort-arrays-using-vbscript">How do I sort arrays using vbscript?</a>" I got my hopes up, that at least some of the missing VB6 features can be supplemented by .NET features. (... | <p>There's lot's of information available at the <a href="http://msdn.microsoft.com/en-us/vbrun/ms788241.aspx" rel="noreferrer">VB Fusion Developer Center on MSDN</a>. Of particular interest will be <a href="http://msdn.microsoft.com/en-us/library/aa719110(VS.71).aspx" rel="noreferrer">Using the .NET Framework Class Li... | <p>You should only use interop as a mechanism for pushing data between systems - not for core logic code; the performance hit of all the marshalling etc will be too much. I suggest you look at using the more recent VB variants in VS2008 etc. It is a big shift, but if you can afford to make the change, you won't regret ... | 49,380 |
<p>In the spirit of questions like <a href="https://stackoverflow.com/questions/224059/do-your-loops-test-at-the-top-or-bottom">Do your loops test at the top or bottom?</a>:</p>
<p>Which style do you use for an <em>infinite</em> loop, and why?</p>
<ul>
<li>while (true) { }</li>
<li>do { } while (true);</li>
<li>for (... | <pre><code>while(true) {}
</code></pre>
<p>It seems to convey the meaning of the loop most effectively.</p>
| <p>Infinite loops are a bad idea, but in practice that doesn't always hold up.</p>
<p>I prefer while(1) { } but make sure something within the loop can cause it to break out.</p>
| 27,688 |
<p>We were having a debate if enums should have uninitialized values. For example. We have </p>
<pre><code>public enum TimeOfDayType
{
Morning
Afternoon
Evening
}
</code></pre>
<p>or </p>
<pre><code>public enum TimeOfDayType
{
None
Morning
Afternoon
Evening
}
</code></pre>
<p>I think that t... | <p>Speaking of nullable types - I think they can be used to solve the problem of forcing/not forcing the initialization of an enum. Say we have</p>
<pre><code>enum Color { Red, Blue }
</code></pre>
<p>And let's say you have a function:</p>
<pre><code>void Draw(Color c);
</code></pre>
<p>That function says that it <... | <p>Depends how the type is used. It's often easier for users of the type not to have an "undefined" value, because you don't have to special-case one value. But if you need one (because values sometimes need to be in a state which is otherwise not any of the enumerated values) then you need one. You usually don't save ... | 44,987 |
<p>I'm a 2-week newbie at 3D printing, working on a new Qidi Xpro machine (that is solid and one that I like). So, I do not want to believe that this issue is caused by my printer itself. I'm hoping that my settings have something to do with it.</p>
<p>The problem is all the filament lines (travel lines, I think) that... | <p>You can Z-hop what you like, but if it is oozing it is oozing, you will always see the effects of that as it just drops down.</p>
<p>Basically you have <strong>multiple issues</strong>, <strong>first the oozing</strong>, <strong>second the line markings on the top</strong>.</p>
<h1><strong>First</strong></h1>
<p>Ooz... | <p>Having run into this type of problem at the library makerspace, under a different slicer, I had a good idea where to start the search. It is, in your case, "z-hop cura slicer" and the best return came from <a href="https://polar3d.freshdesk.com/support/discussions/topics/9000021981" rel="nofollow noreferrer">Polar3D... | 1,047 |
<p>Our library system just put a 3D printer in one of the branches. I have used SketchUp on the library computers for a number of years just to do artsy things. Suddenly, I have the opportunity to actually print something. (I'm really not sure why the libraries have SketchUp installed. But, I have enjoyed using it.)</p... | <p>Here is what I suggest you try. If you have a file that you can view/edit in blender I would export it as both STL and OBJ formats. Then take those files and upload them to Netfabb (<a href="https://netfabb.azurewebsites.net/" rel="nofollow">https://netfabb.azurewebsites.net/</a>) and get a "repaired" file. Have the... | <p>Makerbot will accept obj files also.
Is there an error while importing the obj file?
Also you can see errors of your imported file in your makerbot
It will be marked in black.</p>
<p><a href="https://i.stack.imgur.com/pggIz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pggIz.png" alt="enter im... | 201 |
<p>ASP.NET MVC has been <a href="https://stackoverflow.com/questions/tagged/mvc">discussed</a> on this forum a few times. I'm about to do a large <strong>migration</strong> of several websites from classic ASP/ASP.NET WebForms to ASP.NET MVC and was wondering what kind of advice those of you with experience in both tec... | <blockquote>
<p>Any pointers, tips, tricks, or
gotchas to be aware of?</p>
</blockquote>
<p>Well, I think you're probably a little ways away from thinking about tricks & gotchas :) As I'm sure you're aware, ASP.NET MVC is not some new version of ASP.NET, but a totally different paradigm from ASP.NET, you won't... | <p>My opinion is that the two technologies are so different that if you have tightly coupled code in the original Web Form applications that the best approach is to start by picking one of them and converting it by creating a new ASP.NET MVC application and ripping out code into their respective layers. Which will put... | 3,463 |
<p>Can I Print models from Sources like <a href="https://www.thingiverse.com/" rel="noreferrer">Thingiverse</a> and sell them ?
I will be only charging the print costs and will provide full credits and attributes to the original creator of the model (with links to their profiles) in my web-page.</p>
<p>There are websi... | <p>I've informed myself a bit about this and found out the following:</p>
<p><strong>It is good that you state the Name/Website or any Reference about original creator</strong>
Creative Commons absolutely requires this, even if you don't charge anything for your prints.
So, whether you are trying selling your print or... | <p>According to <a href="https://www.publicknowledge.org/files/What%27s%20the%20Deal%20with%20Copyright_%20Final%20version2.pdf" rel="nofollow noreferrer">Weinberg, 2013</a>, artistic works are copyrightable: if you're printing an action figure or such a useless pretty piece of art, it's protected by copyright.</p>
<p... | 1,150 |
<p>When I debug a C# program and I get an exception throwed (either thrown by code OR thrown by the framework), the IDE stops and get me to the corresponding line in my code.</p>
<p>Everything is fine for now.</p>
<p>I then press "F5" to continue. From this moment, it seams like I'm in an infinite loop. The IDE alway... | <p>You probably have the option "<strong>Unwind the callstack on unhandled exceptions</strong>" checked in Visual Studio. When this option is on Visual Studio will unwind to right before the exception, so hitting <kbd>F5</kbd> will keep ramming into the same exception.</p>
<p>If you uncheck the option Visual ... | <p>Once you get an exception Visual Studio (or whatever IDE you might be using) will not let you go any further unless the exception is handled in your code.</p>
<p>This behaviour is by design.</p>
| 19,884 |
<p>I'm fairly new to the AJAX methodologies (I only recently discovered <a href="http://jquery.com/" rel="noreferrer">jQuery</a> a short time ago). I am interested to know if there is anyway to authenticate a user on a PHP setup; securely.</p>
<p>Does jQuery have any special options to allow use of HTTPS (or any other... | <p>To use Ajax over HTTPS, you have to load the originating page over HTTPS.</p>
<p><a href="http://en.wikipedia.org/wiki/Same_origin_policy" rel="noreferrer">Same origin policy</a></p>
<p>So, in a sense, yes -- but, not on its own.</p>
| <p>Unless jQuery already does this (I use MooTools so I wouldn't know) I'd highly suggest that you link the AJAX login to the PHP session by using a <code>$_GET</code> variable in the query string. This way even though it's through HTTPS, you'll still know what session its tied to for an added layer of protection.</p>... | 17,838 |
<p>I'm just finishing up a computer architecture course this semester where, among other things, we've been dabbling in MIPS assembly and running it in the MARS simulator. Today, out of curiosity, I started messing around with NASM on my Ubuntu box, and have basically just been piecing things together from tutorials an... | <p>Without knowing the actual answer or having the time to look it up, I'm guessing that the environment variables get stored in memory after the command line arguments. Your code is simply buffer overflowing into the environment variable strings and printing them too.</p>
<p>This actually makes sense, since the comma... | <p>As long as you're being curious, you might want to work out how to print the address of your string (I think it's passed in and you popped it off the stack). Also, write a hex dump routine so you can look at that memory and other addresses you're curious about. This may help you discover things about the program s... | 43,849 |
<p>As the name suggests I am trying to group rows in a datatable. To go into further detail this table has identical rows except for one field(column). Basically what I am trying to do is put all the different fields of the identical rows and put them in single field whilst deleting the other rows.</p>
<p>Here is the ... | <p>Well, I can help with the looping structure. This doesn't match what you're doing exactly (it leaves the table intact and just builds a big string, and also assumes the table is sorted a particular way), but it will demonstrate classic control-break processing using your actual data. For this to work the table nee... | <p>I had to do something similar recently with a <a href="http://en.wikipedia.org/wiki/Control_break" rel="nofollow noreferrer">control-break</a> style report. </p>
<p>I ended binding the data to a repeater control where the item template was just a literal control. Then I handled the OnItemDataBound event and had c... | 47,381 |
<p>I want to use the macports version of python instead of the one that comes with Leopard.</p>
| <p>I have both installed:</p>
<pre><code>$ which python
/usr/bin/python
$ which python2.5
/opt/local/bin/python2.5
</code></pre>
<p>I also added the following line to my <code>.profile</code>:</p>
<pre><code>export PATH=/opt/local/bin:/opt/local/sbin:$PATH
</code></pre>
| <p>Instead of uninstalling the built-in Python, install the MacPorts version and then modify your <code>$PATH</code> to have the MacPorts version first.</p>
<p>For example, if MacPorts installs <code>/usr/local/bin/python</code>, then modify your <code>.bashrc</code> to include <code>PATH=/usr/local/bin:$PATH</code> a... | 14,461 |
<p>I'd like to stress test some of my SQL queries and find out about bad query plans and bottlenecks. I plan to <strong>fill some tables with random test data</strong>.</p>
<p>Are there tools or a set of scripts available for this purpose, preferably for SQL Server?</p>
<p><em>Thanks!</em></p>
<p><strong><em>UPDATE:... | <p><a href="http://www.generatedata.com/#about" rel="nofollow noreferrer">This website</a> will generate reams of customized data for you.</p>
<p>From that site:</p>
<blockquote>
<p>Ever needed custom formatted sample / test data, like, bad? Well, that's the idea of the Data Generator. It's a free, open source scri... | <p>I've use <a href="http://www.generatedata.com/#generator" rel="nofollow noreferrer">this data generator</a> with success in the past - may not be big enough for your needs though.</p>
| 35,129 |
<p>Is there any way to change Firefox system icon (the one on the left top of the window)? </p>
<p>Precision : I want to change the icon of a bundled version of Firefox with apache/php and my application. So manual operation on each computer is not a solution.
I try Resource Hacker and it's the good solution. The add ... | <p>Resource hacker does the job of swapping application icons in Windows (up to XP, not tested with Vista yet).</p>
<p>Available at:
<a href="http://www.angusj.com/resourcehacker/" rel="nofollow noreferrer">http://www.angusj.com/resourcehacker/</a></p>
| <p>I think you mean the system icon, not the site icon as someone else thought. On a Mac, you can hold-Click -> Get Info on Firefox.app, then drag or paste an image on top of the icon.</p>
<p>I'm not sure about Windows, but I think you may need to compile from source to change it.</p>
| 8,966 |
<p>I have an object in a multi-threaded environment that maintains a collection of information, e.g.:</p>
<pre><code>public IList<string> Data
{
get
{
return data;
}
}
</code></pre>
<p>I currently have <code>return data;</code> wrapped by a <code>ReaderWriterLockSlim</code> to protect the ... | <p>If your underlying data is stored as list you can use <a href="http://msdn.microsoft.com/en-us/library/e78dcd75.aspx" rel="noreferrer">List(T).AsReadOnly</a> method.<br>
If your data can be enumerated, you can use <a href="http://msdn.microsoft.com/en-us/library/bb342261.aspx" rel="noreferrer">Enumerable.ToList</a> ... | <p>One should note that <a href="https://stackoverflow.com/questions/55502/return-collection-as-read-only#55507">aku</a>'s answer will only protect the list as being read only. Elements in the list are still very writable. I don't know if there is any way of protecting non-atomic elements without cloning them before ... | 7,928 |
<p>I'm curious to hear the experiences of those who are currently running their SVN server on Windows. </p>
<p>Jeff Atwood has a post on <a href="https://blog.codinghorror.com/setting-up-subversion-on-windows/" rel="nofollow noreferrer">how to setup SVN as a Windows service</a>. It's a great first step, but it doesn't... | <p>Use <a href="http://www.visualsvn.com/" rel="nofollow noreferrer">VisualSVN Server</a>. It integrates with Windows authentication and it handles all the apache setup. It's as painless as SVN can be on Windows.</p>
| <p>I think you are seeing the difference betweeen the svn protocol and hosting the svn protocol on another.<br>
Similar performance decreases when using svn+ssh compared to svn. </p>
<p>The ease of setup, has made it a no brainer for my team, we just threw it on a vm and ran.</p>
| 4,414 |
<p>As 3D printers become more and more reliable, their prints get better and better. But FDM printers do have their problems too: you print tiny ovals that smooch together at the edges, and infill makes it awkward at times. So, how do I make a 3D-printed die fair (as in: not favoring one side too much)?</p>
| <p>This is going to become a 3-step answer, as 3D Printing uses 3 different steps:
<em>Design, Slicing & Material choice</em> before I elaborate alternate ways to some fair dice. Yet, we start with the material, as we need to know about it first. In this case it does impact everything from design to slicing and the... | <h2>Honestly, I wouldn't.</h2>
<p>You can find dice templates at places like <a href="https://www.thingiverse.com/" rel="nofollow noreferrer">thingiverse</a>, but with my (admittedly limited) experience of affordable 3D printers, I would be highly skeptical that the machine tolerances are up to snuff for producing a f... | 721 |
<p>I use a MacBook, but I've got a usual keyboard attached to it.</p>
<p>The problem is that the keys don't exactly map 1-to-1. One thing is the APPLE and ALT keys. They map to WIN and ALT, but they are usually physically inverted, so if you want to use them with the same layout you have to invert them in the OS.
The ... | <p>In OS X 10.5 they allow you to have different keyboard setups for different keyboards. This works most of the time. I've had issues with very old keyboards that are plugged in via a PS2 to USB but otherwise it works fine.</p>
| <p>You could investigate DoubleCommand, it may do what you need.</p>
<p>There's an experimental version that allows for different properties for different keyboards.</p>
| 8,050 |
<p>I have this function in my head:</p>
<pre><code><head>
window.onload = function(){
var x = new Array(0,2,3,4,5,6,7,8);
var y = new Array(20,10,40,30,60,50,70,10);
drawGraph(y,x);
}
</head>
</code></pre>
<p>Can I declare the function drawGraph() somewhere in the ... | <p>The order does matter. You'll need to have the drawGraph() function declared before it's called.</p>
| <p>Keep in mind that many web platforms already use the window.onload method, and owing to the fact that window.onload can be called only once, you could have a script collision. You might consider using a different method for loading your script that builds the window.onload or waits for the page load to complete.</p... | 46,083 |
<p>I'm a student in software engineering in Montreal. For the last 3 years I've had a few interships (once per year). The first two (in the same company) were mostly sysadmin jobs, but I did get to do a few Perl programs (mostly log file analysing and statistics generation).</p>
<p>My other intership was in the IT sec... | <p>no offense, but from your description it would appear that you're not really qualified for a 'real' OO programming job. Academic classes are a good introduction to a language but no substitute for solving real problems with fluctuating deadlines, finicky users, cholicky managers, et al ;-)</p>
<p>this leaves three ... | <p>Contribute patches to some <a href="http://search.cpan.org" rel="nofollow noreferrer">CPAN</a> distribution. This will show that you: 1) use CPAN - managers love peoples that can write code faster 2) can read and modify someones code.</p>
<p>Study <a href="http://search.cpan.org/dist/Moose" rel="nofollow noreferrer... | 9,404 |
<p>I am using the <code>OpenArgs</code> parameter to send a value when using <code>DoCmd.OpenForm</code>:</p>
<pre><code>DoCmd.OpenForm "frmSetOther", acNormal, , , acFormAdd, acDialog, "value"
</code></pre>
<p>I then use <code>Me.OpenArgs</code> inside the opened form to grab the <strong><em>value</em></strong>. It... | <p>This often happens during developpment whem the form is already oppened (in edit mode for example) and you invoke the docmd.OpenForm function. In this case, the form is placed in normal (view) mode and the OnOpen and OnLoad events are raised, but the OpenArgs property is set to null no mater what you passed to docmd... | <p>Is the value taken from a user completed control? Do you ensure that the focus is moved from the control before you run the openform line? </p>
<p>EDIT: The value property of the control will be equal to the previous value, which may be null, unless you do this.</p>
| 32,278 |
<p>I've got a structure as follows:</p>
<pre><code>typedef struct
{
std::wstring DevAgentVersion;
std::wstring SerialNumber;
} DeviceInfo;
</code></pre>
<p>But when I try to use it I get all sorts of memory allocation errors.</p>
<p>If I try to pass it into a function like this:</p>
<pre><code>GetDeviceInf... | <p>You should use <code>new</code> instead of <code>malloc</code>, to assure the constructor gets called for the <code>DeviceInfo</code> and its contained <code>wstring</code>s.</p>
<pre><code>DeviceInfo *info = new DeviceInfo;
</code></pre>
<p>In general, it's best to avoid using <code>malloc</code> in C++.</p>
<p>... | <p>std::wstring creates an object, and objects need to be constructed. By using malloc, you bypassed the constructor for your structure, which would include constructors for all the members.</p>
<p>The error you're getting is from std::wstring trying to use one of its own members that is still uninitialized.</p>
<p>... | 41,163 |
<p>The vast majority of applications does not handle "disk full" scenarios properly. </p>
<p>Example: an installer doesn't see that the disk is full, ignores all errors, and finally happily announces "installation complete!", or an email program is unaware that the message it has just downloaded could not be saved, a... | <p>As a user, I want software to:</p>
<ol>
<li>Preserve my data.</li>
<li>Validate my environment as early as possible, <em>before</em> I do any real work.</li>
<li>If <code>#2</code> is impossible, <em>tell me</em> about any special requirements.</li>
<li>Clean up after itself.</li>
</ol>
<p>As a developer, techniqu... | <p>You are totally right. Software should handle gracefully this kind of situation.</p>
<p>You can always check on an IOException to see if the disk is full or if the user have rights to write to that location.</p>
<p>SQL Server does handle this situation but doesn't recover from it. When the disk is full... it stops... | 31,780 |
<p>I'm writing an app for Blackberry that was originally implemented in standard J2ME. The network connection was done using <code>Connector.open("socket://...:80/...")</code> instead of <code>http://</code></p>
<p>Now, I've implemented the connection using both methods, and it seems like some times, the socket metho... | <p>Blackberry's implementation of <code>http</code> and <code>https</code> provide more options for connecting to the target server than <code>socket</code>, and, of course, implement all the HTTP protocol stuff for you. I've not benchmarked them, but it makes a certain amount of sense that direct <code>TCP</code> vi... | <p>In theory sockets will be faster, but then you're responsible for managing the overhead of rolling your own protocol (depending on complexity). Though sockets are more lightweight, I've found that HTTP and all the comes with it greatly reduces the headache.</p>
| 36,366 |
<p>Is it possible to use Mark of the Web in XML file which is parsed by a local XSL file?</p>
<p>When I insert MOTW mark:</p>
<pre><code><!-- saved from url=(0014)about:internet -->
</code></pre>
<p>i get following message:<br>
Access is Denied. Error Processing Resource.</p>
<hr>
<p>Ok, I see that I was try... | <p>From the looks of it - no. MOTW here forces the "Internet" Zone upon the whole process, so accessing local resources is off limits. The error message you get expresses this fact.</p>
<p>If <em>testing</em> your page is what you try to do, you will have to fetch it from a web server, alongside with the XSL. The IIS ... | <p>Adding the MOTW (Mark of the web) will only help you when loading a local page with JavaScript to not see the silly yellow warning bar. (AFAIK)</p>
<p>If this is your intention, can you not just use:</p>
<pre><code><xsl:comment> saved from url=(0014)about:internet </xsl:comment>
</code></pre>
<p>as th... | 48,422 |
<p>I've got a lot of similar oracle jobs I need to create, and I'd like to do it programatically. </p>
<p>Where does the Oracle store the job library (schema/table)?</p>
<p>(yes, I know I might be running with scissors)</p>
| <p>For <a href="http://www.psoug.org/reference/dbms_job.html" rel="nofollow noreferrer">DBMS_JOBS</a> you can use...</p>
<pre><code>dbms_job.submit(
JOB OUT BINARY_INTEGER,
WHAT IN VARCHAR2,
NEXT_DATE IN DATE DEFAULT SYSDATE,
INTERVAL IN VARCHAR2 DEFAULT 'NULL',
NO_PARSE IN BOOLEAN ... | <p>Views: USER_JOBS, DBA_JOBS or ALL_JOBS</p>
| 29,800 |
<p>I sent 3 emails last week as replies from our website. None received them! One was yahoo, hotmail and an overseas domain. I am wondering if it's not a good idea to open a yahoo account with our domain name as the user just to reply to prospective buyers. </p>
| <p>Your mail server's IP may have been black listed. This is common on shared servers.
<a href="http://www.mxtoolbox.com/blacklists.aspx" rel="nofollow noreferrer">http://www.mxtoolbox.com/blacklists.aspx</a> </p>
| <p>You could also try looking at <a href="http://www.google.com/apps/intl/en/business/index.html" rel="nofollow noreferrer">gmail for domains</a>. It's what I use and so far I haven't had a problem withany spam filters. Also make sure that you are not writing the content of the message to where a spam filter could flag... | 9,398 |
<p>One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it?</p>
| <p>Yes, it is a hash mapping or hash table. You can read a description of python's dict implementation, as written by Tim Peters, <a href="http://mail.python.org/pipermail/python-list/2000-March/048085.html" rel="noreferrer" title="Tim Peters">here</a>.</p>
<p>That's why you can't use something 'not hashable' as a dic... | <p>To expand upon nosklo's explanation:</p>
<pre><code>a = {}
b = ['some', 'list']
a[b] = 'some' # this won't work
a[tuple(b)] = 'some' # this will, same as a['some', 'list']
</code></pre>
| 14,013 |
<p>I can't tell you how many times I've run into situations where a higher-up says 'Look, just do it'. This is obviously at the expense of rigidity in the planning process, and will (probably) affect product quality.</p>
<p>By now, I have more experience with this, and with that, I have the confidence to stand up for ... | <p><strong>The most likely cause</strong> of being told "look just do it" by a superior is information asymmetry: either of you or both of you know something that other party doesn't. The manager might not be telling you that in the grand scheme of issues this specific problem is fairly unimportant or they just looking... | <p>Some of these problems are caused by bad specifications. </p>
<p>However you also need to consider does the manager actually know best? (yes it can happen sometimes!) they may be privy to some info you do not have.</p>
<p>Ultimatly if you have to deal with this all the time you may want to look for another positio... | 20,290 |
<p>Is it worth designing a system to expect test accounts and products to be present and active in production, or should there be no contamination of production databases with test entities, even if your shipping crew knows not to ship any box addressed to "Test Customer"?</p>
<p>I've implemented messaging protocols t... | <p>Having testing accounts in production is something I usually frown upon because it opens up a potential security hole. One should strive to duplicate as much of the production environment in testing as possible but there are obviously cases where that isn't possible. Expensive production only hardware is a prime e... | <p>I wouldn’t put any test data in a production system nor would I want to have access to this system as a developer.</p>
<p>I’m working in an industry with very sensitive medical and financial information and having such information would make it impossible to distinguish productive from data out of the testing syste... | 14,756 |
<p>I seem to be having an issue with iPhone SDK 2.1 in as far as being
able to establish a relationship between a ViewController and a View
window. In as far as a Cocoa Touch Class, I went forward and added a
<code>UIViewController</code> subclass. I made sure that the target is part of the
existing project. Right afte... | <p>Are the two partial classes in the same namespace? That could be an explanation.</p>
| <p>Just for reference (VS 2020)... Error CS0103 => All same but different folder.</p>
<p>But classes should have same namespace AND ALSO BE in same folder !!!</p>
<p>Although they could be defined in the same namespace, both files should be in the same folder. I know that the folder structure should reflect the name... | 22,370 |
<p>Having recently introduced an overload of a method the application started to fail.
Finally tracking it down, the new method is being called where I did not expect it to be.</p>
<p>We had</p>
<pre><code>setValue( const std::wstring& name, const std::wstring& value );
std::wstring avalue( func() );
setValu... | <p>First, the cause of this issue: C++ Standard <a href="http://eel.is/c++draft/over.ics.rank#2.1" rel="nofollow noreferrer"><code>[over.ics.rank]/2.1</code></a><sup>1</sup> defines an order for conversion sequences. It says that a user defined conversion sequence is worse than a standard conversion sequence. What happ... | <p>You could make the new function take some other type than bool--maybe just a proxy for bool--which is not convertible from a literal string. But really I'd just rename the bool-taking function and be done with it.</p>
| 40,824 |
<p>I wanted to do something like this:</p>
<pre><code><asp:Label ID="lblMyLabel" onclick="lblMyLabel_Click" runat="server">My Label</asp:Label>
</code></pre>
<p>I know that in Javascript I can do:</p>
<pre><code><span onclick="foo();">My Label</span>
</code></pre>
<p>So I'm wondering why I c... | <p>You can use Attributes to add onclick client side callback.</p>
<p>I didn't know you can do this on span tags, but if it works you can add 'onclick' by <code>lblMyLabel.Attributes.Add("onclick", "foo();");</code> </p>
<p>But <code>foo();</code> would need to be a client side javascript function.</p>
<p><code>Syst... | <p>you could always roll out your own control which produces a span, with the .net's standard postback javascript, but as stated earlier using a linklabel with a CSS class would be easier</p>
| 21,853 |
<p>How do I tell Subversion (svn) to treat a file as a binary file?</p>
| <p>It is possible to manually identify a file located within a repository as <em>binary</em> by using:</p>
<pre><code>svn propset svn:mime-type application/octet-stream <filename>
</code></pre>
<p>This is generally not necessary, as Subversion will attempt to determine whether a file is binary when the file is ... | <p>It usually does this by default for you, but if it isn't you need to look into file properties and propset. </p>
| 9,950 |
<p>What is the simplest way to identify and separate GET and POST parameters from a controller in Ruby on Rails, which will be equivalent to $_GET and $_POST variables in PHP?</p>
| <p>You can use the <code>request.get?</code> and <code>request.post?</code> methods to distinguish between HTTP Gets and Posts.</p>
<ul>
<li>See <a href="http://api.rubyonrails.org/classes/ActionDispatch/Request.html" rel="noreferrer">http://api.rubyonrails.org/classes/ActionDispatch/Request.html</a></li>
</ul>
| <p>I think what Jesse Reiss is talking about is a situation where in your <code>routes.rb</code> file you have</p>
<pre><code>post 'ctrllr/:a/:b' => 'ctrllr#an_action'
</code></pre>
<p>and you POST to <strong>"/ctrllr/foo/bar?a=not_foo"</strong> POST values <strong>{'a' => 'still_not_foo'}</strong>, you will have ... | 18,411 |
<p>Should I use Named Pipes, or .NET Remoting to communicate with a running process on my machine?</p>
| <p>WCF is the best choice. It supports <a href="https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-3.0/ms733769%28v=vs.85%29" rel="nofollow noreferrer">a number of different transport mechanisms</a> (<a href="https://web.archive.org/web/20121019154711/http://blogs.charteris.com:80/blogs/chrisdi/ar... | <p>.net remoting is built into .net to do inner process communication. If you use that, they will continue to support and possibly enhance it in future versions. Named pipes doesn't give you the promise of enhancements in future versions of .net</p>
| 11,037 |
<p>I got a life size model of a signaling post (trains) where I scale it down to 1/87 model (in SketchUp). When I send the model to my 3D printer (with Cura 2.4) some parts of the model are lost in translation even when their dimensions exceed the printer minimal dimension of 0.7 mm. </p>
<p>Is this a known probl... | <p>Yes, with the proper equipment.</p>
<p>Printing wax filament (at 51 seconds): <a href="https://youtu.be/tibkVZB_n9c?t=51s" rel="noreferrer">https://youtu.be/tibkVZB_n9c?t=51s</a></p>
<p>There are also options for melting wax, filling a heated reservoir head, and printing with that. I recommend doing this with a co... | <p>Just make a silicone mold of any of your prints and pour you wax in the silicone,you silicone putty is pretty cheap so is wax ,no need to break the bank as printers have become less expensive and can do a pretty good job </p>
| 632 |
<pre><code>template <class T>
bool BST<T>::search(const T& x, int& len) const
{
return search(BT<T>::root, x);
}
template <class T>
bool BST<T>::search(struct Node<T>*& root, const T& x)
{
if (root == NULL)
return false;
else
{
if (ro... | <p>Okay, <code>bool BST<T>::search(struct Node<T>*& root, const T& x)</code> should probably have const after it like so: <code>bool BST<T>::search(struct Node<T>*& root, const T& x) const</code>. Basically, you've called a non-const function from a const function and this is a n... | <p><strong>Algorithm :</strong></p>
<ol>
<li>Take node value data;</li>
<li>Repeat step 3 to step 5 until we find the value or we go beyond the tree.</li>
<li>If data is equal to root node value , searching is successful and terminate the algorithm.</li>
<li>If data is less than root node value , we have to search the... | 30,471 |
<p>I want my Qt application to be able to save simple vector graphics to clipboard in a compatible way. On windows I want to be able to paste the graphics into Microsoft Word or Powerpoint. On Linux I want to be compatible with the Open Office. </p>
<p>Which format would you recommend? Can Qt generate EMF in an easy w... | <p><a href="http://doc.qt.io/qt-5/qgraphicsview.html" rel="nofollow noreferrer">The QGraphicsView</a> class and its associated helpers can render to a QT metafile format through the <a href="http://doc.qt.io/qt-5/qpicture.html" rel="nofollow noreferrer">QPicture</a> class (for which you could write a translator to EMF)... | <p>I have an EMF-generating PyQt QPaintEngine class here: <a href="https://github.com/jeremysanders/veusz/blob/master/document/emf_export.py" rel="nofollow">https://github.com/jeremysanders/veusz/blob/master/document/emf_export.py</a>. It uses the pyemf library, but I think it would be fairly easy to port to C++. Unfor... | 29,281 |
<p>I'm a hesitant upgrader when it comes to development tools. For roughly half of my product I still use D7, and for others D2006.</p>
<p>The truth is, although Unicode support is more than welcomed and very useful, it could cause me more troubles than gains with my current projects (they are more-or-less Unicode rea... | <p>To put things in to perspective, look at the things that were added between Delphi 7 and Delphi 2007. This was a significant high water mark.</p>
<p><a href="http://blogs.codegear.com/nickhodges/2007/03/28/33579" rel="nofollow noreferrer">http://blogs.codegear.com/nickhodges/2007/03/28/33579</a></p>
<p><a href="h... | <p>The by far most important incentive to me was the overall speed of the IDE in comparison with Delphi 2006 and the same project.</p>
| 39,221 |
<p>I am tasked with developing a web application and am thinking of using the Struts framework as it seems to be a standard and is easy to implement.</p>
<p>However, before making a decision I need to know the security features available in Struts. </p>
<p>Are there effective ways to handle the <a href="http://www.o... | <p>Struts is there to offer you an MVC framework, and it has limited security features, e.g. you can map roles to actions. I will recommend you to look into something more full-fledged like the <a href="http://static.springframework.org/spring-security/site/" rel="nofollow noreferrer">Spring Security</a> (formerly Aceg... | <p>The best way to handle the OWASP Top ten in struts is to look at the OWASP Enterprise Security API...</p>
| 38,819 |
<p>I am using <strong>0.97-pre-SVN-unknown</strong> release of Django.</p>
<p>I have a model for which I have not given any primary_key. Django, consequently, automatically provides an AutoField that is called "id". Everything's fine with that. But now, I have to change the "verbose_name" of that Au... | <p>Hmm... and what about explicitly write <em>id</em> field in the model definition? Like this for example:</p>
<pre><code>class Entry(models.Model):
id = models.AutoField(verbose_name="custom name")
# and other fields...
</code></pre>
<p>It doesn't require any underlying database changes.</p>
| <p>Look into the command-line options for <code>manage.py</code>; there's a command to dump all of the model data to JSON, and another command to load it back in from JSON. You can export all of your model data, add your new field to the model, then import your data back in. Just make sure that you set the <code>db_col... | 32,309 |
<p>We use Perl for GUI test automation. It has been very successful. We have written a very lightweight DSL kind of language for GUI testing. The DSL is very similar to a object model.</p>
<p>For example, we have an Application object at the root. Each property sheet in the application is a View object. Each page unde... | <p>You can do almost anything in Perl. But you have to do some <em>strange</em> stuff to get Perl to perform with syntax that is just not Perl. </p>
<ul>
<li><p>To handle exactly what you have there, you would have to a lot of <em>advanced</em> tricks, which are by definition not that maintainable. You would have to:<... | <p>An alternative to overriding <code>'.'</code> or using <code>-></code> syntax might be using package syntax (::), i.e. creating packages like App::View2 and App::View2::Page2 when View2 / Page 2 get created, adding an AUTOLOAD sub to the package which delegates to an App::View::Page or App::View method, something... | 44,589 |
<p>I want to download and parse webpage using python, but to access it I need a couple of cookies set. Therefore I need to login over https to the webpage first. The login moment involves sending two POST params (username, password) to /login.php. During the login request I want to retrieve the cookies from the respons... | <pre><code>import urllib, urllib2, cookielib
username = 'myuser'
password = 'mypassword'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_data = urllib.urlencode({'username' : username, 'j_password' : password})
opener.open('http://www.example.com/login.php', login_data)... | <p>Here's a version using the excellent <a href="http://docs.python-requests.org/en/latest/index.html" rel="noreferrer">requests</a> library:</p>
<pre><code>from requests import session
payload = {
'action': 'login',
'username': USERNAME,
'password': PASSWORD
}
with session() as c:
c.post('http://exa... | 22,995 |
<p>So I have the following:</p>
<pre><code>public class Singleton
{
private Singleton(){}
public static readonly Singleton instance = new Singleton();
public string DoSomething(){ ... }
public string DoSomethingElse(){ ... }
}
</code></pre>
<p>Using reflection how can I invoke the DoSomething Method? </p... | <p>Untested, but should work...</p>
<pre><code>string methodName = "DoSomething"; // e.g. read from XML
MethodInfo method = typeof(Singleton).GetMethod(methodName);
FieldInfo field = typeof(Singleton).GetField("instance",
BindingFlags.Static | BindingFlags.Public);
object instance = field.GetValue(null);
method.In... | <p>Great job. Thanks. </p>
<p>Here's the same approach with slight modification for cases that one can't have a reference to the remote assembly. We just need to know basic things such as the class fullname (i.e namespace.classname and the path to the remote assembly). </p>
<pre><code>static void Main(string[] args)
... | 25,027 |
<p>I have a database (NexusDB (supposedly SQL-92 compliant)) which contains and Item table, a Category table, and a many-to-many ItemCategory table, which is just a pair of keys. As you might expect, Items are assigned to multiple categories. </p>
<p>I am wanting to all the end user to select all items which are </p>... | <p>You could try with EXCEPT</p>
<pre><code>SELECT ItemID FROM Table
EXCEPT
SELECT ItemID FROM Table
WHERE
CategoryID <> 12
</code></pre>
| <p>For the simple case that you have with a low and known number of categories you can simply use several joins to check for existence and non-existence:</p>
<pre><code>SELECT
ItemID
FROM
Items I
INNER JOIN ItemCategories IC1 ON IC1.ItemID = I.ItemID AND IC1.CategoryID = '01'
INNER JOIN ItemCategories IC2 ON... | 47,655 |
<p>I have minified my javascript and my css.</p>
<p>Now, Which is better?</p>
<pre><code><script type="text/javascript">
<?
$r = file_get_contents('min.js');
if($r) echo $r;
?>
</script>
</code></pre>
<p>OR</p>
<pre><code><script type="text/javascript" src="min.js"></script>
</code... | <pre><code><script type="text/javascript" src="min.js"></script>
</code></pre>
<p>...is better, as the user's browser can cache the file.</p>
<p>Adding a parameter to the <code>src</code> such as the file's last modified timestamp is even better, as the user's browser will cache the file but will always r... | <p>Remember that the browser can download AT MOST two files in parallel from the same domain (that's the default on the modern browsers - i'm certain about IE6 and IE7, not sure about others). This means that if your page references 20 tiny javascript files, many will get downloaded sequentially. </p>
<p>To add to wha... | 21,478 |
<p>I want to pixelate and/or blur an image.
I've found the command for the blurring:</p>
<pre><code>$convert image.jpg -blur 18,5 newimage.jpg
</code></pre>
<p>to work but I cannot blur the image any more.
And how do I pixelate the image? I couldn't find a sound example around the net.</p>
<p>Thx</p>
| <p>To get a proper square pixellation, try:</p>
<pre><code>convert -scale 10% -scale 1000% original.jpg pixelated.jpg
</code></pre>
| <p>I don't know anything about ImageMagick, but you can try resizing the image using bicubic to a much smaller dimension, then resizing the image back to a bigger one.</p>
<p>The trick works using .net's System.Drawing object.</p>
| 42,907 |
<p>Does anyone know of any eclipe plugin that lets you easily change and use file encodings? I sometimes need to edit template files to do small tweaks, but the files are sometimes ISO, sometimes UTF8, sometimes others, so using eclipse for this leads to disaster :)</p>
| <p>Try this for converting one file:</p>
<ol>
<li>Copy the whole Content of your file to the clipboard (by pressing <code>ctrl+c</code> or <code>cmd+c</code> on Mac) </li>
<li>Right-Click on the file, then open "Properties" and change the text file encoding to the preferred one</li>
<li>Press <code>ctrl-a</code> (or <... | <p>I just found a <strong>plugin</strong> for Eclipse "<strong>Autodetect Encoding</strong>" - you can detect/convert the encoding in files. It can be found in the Help->Marketplace...</p>
<p>I just started testing, but it works so far.</p>
<p>Hint: sometimes you need to change the detector to ICU4j</p>
<p>And even ... | 46,610 |
<p>As title, I need that to run an import script generated by SQL Server DB Publishing Tool. Would that work on Sql2000 server too? Also I have seen ppl reporting missing library issues related to GAC, which libraries I precisely need to include if I am not controlling the deployment server?</p>
<p>To know how this th... | <p>Yes, SMO works on SQL Server 2000:</p>
<p><a href="https://stackoverflow.com/questions/33457/smo-and-sql-server-70">SMO and Sql Server 7.0</a></p>
| <p><a href="http://msdn.microsoft.com/en-us/library/ms162130(SQL.90).aspx" rel="nofollow noreferrer">Partially</a>... so both the "yes" and "no" answers are correct</p>
| 28,378 |
<p>The examples I've seen online seem much more complex than I expected <em>(manually parsing &/?/= into pairs, using regular expressions, etc).</em> We're using asp.net ajax <em>(don't see anything in their client side reference)</em> and would consider adding jQuery if it would really help.</p>
<p>I would think... | <p>There is indeed a <a href="http://plugins.jquery.com/project/query-object" rel="noreferrer">QueryString plugin</a> for jQuery, if you're willing to install the jQuery core and the plugin it could prove useful.</p>
| <p>Use the String utility from prototypejs.org, called toQueryParams().</p>
<p>Example from their site: <a href="http://prototypejs.org/api/string/toQueryParams" rel="nofollow noreferrer">http://prototypejs.org/api/string/toQueryParams</a></p>
<blockquote>
<p>'section=blog&id=45'.toQueryParams();<br/>
// -> {... | 18,124 |
<p>Should I learn <a href="http://code.google.com/p/nhaml/" rel="nofollow noreferrer">NHaml</a>?</p>
<p>What does it provide me over a classic ASP.NET MVC view? What are the pros and cons?</p>
<p>Are you using it via the <a href="http://www.codeplex.com/MVCContrib/Wiki/View.aspx?title=NHaml&referringTitle=Documen... | <p>It should only take a few hours if you're familiar with the MVC framework, so I'd say yes, learn it. NHaml is a compact way to write HTML code. It is pretty easy to read and write once you get used to it. The downsides are that you lose the ASP.NET controls, so server-side processing is more difficult. Your team may... | <p>Absolutely, learning NHAML is really easy and it is much easier to write than the web forms syntax.</p>
| 21,619 |
<p>I'm just wondering if it exists better solution for this.</p>
<pre><code>BitConverter.ToInt32(sample_guid.ToByteArray(), 0)
</code></pre>
| <p>I don't think there's a better solution than this. </p>
| <p>Dunno about a better solution, but I hope you don't intend to use that Int32 as a random (or unique) value. </p>
<p>You cannot depend on any sub part of a Guid to be unique. Guid is assumed to be unique, only in its entirety.</p>
| 6,749 |
<p>So this is IT more than programming but Google found nothing, and you guys are just the right kind of geniuses.</p>
<p><strong>My Exchange Server 2007 and Entourage clients don't play nice.</strong></p>
<p>Right now the big issue is that the entourage client will not connect to Exchange 2007 ( Entourage 2004 or 2... | <p>Try it without using the /exchange in the server properties field. Here's a link with relevant <a href="http://www.robichaux.net/blog/2006/09/using_entourage_with_exchange_2007.php" rel="nofollow noreferrer">info</a>.</p>
| <p>davex.dll is the legacy webdav component for Exchange server, which Entourage uses. Your first step should be investigating why the application pool crashes. My guess is that Entourage can't do anything when the dll isn't present because webdav is not responding to any requests.</p>
| 2,970 |
<p>in Config.groovy I see this:</p>
<pre><code>// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
}
</code></pre>
<p>what is the correct way to access that at runtime?</p>
| <p>In more recent versions of grails ConfigurationHolder has been deprecated.</p>
<p>Instead you should use the grailsApplication object.</p>
<pre><code>grailsApplication.config.grails.serverURL
</code></pre>
<p>If in a Controller or Service then use dependency injection of grailsApplication object.
e.g.</p>
<pre><... | <p>As mentioned in a few of the comments, another option is the <a href="http://grails.org/doc/latest/api/grails/util/Holders.html"><code>grails.utils.Holders</code></a> class which was added in Grails 2.0. I prefer this approach since you can use it in classes that aren't configured with dependency injection.</p>
<p... | 24,165 |
<p>I have a Printrboard rev. D which includes Allegro A4982 drivers. I would like to replace them, but it appears that newer TMC drivers all require several pins for proper operation.</p>
<p><a href="https://i.stack.imgur.com/ZnRf5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZnRf5.png" alt="ente... | <p>The developers from the Klipper firmware confirmed that Klipper doesn't care about the native functions of each pin, therefore it is indeed possible to use the expansion pins for controlling (including UART) TMC stepper drivers.</p>
<p>At this point I cannot confirm, but maybe Marlin allows the same by updating the... | <p>You can't. In fact, pretty much all boards with directly soldered drivers are not upgradable.</p>
<p>I'd recommend to buy a proper, contemporary, customizable board like the SKR 1.3 for TMCs.
The Fysetc F6 would also work, but uses "custom" connectors and is still AVR based.</p>
| 1,498 |
<p>During execution, how can a java program tell how much memory it is using?</p>
<p>I don't care how efficient it is!</p>
| <p>VonC's answer is an interactive solution - if you want to know programatically, you can use <a href="http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#totalMemory()" rel="noreferrer">Runtime.totalMemory()</a> to find out the total amount used by the JVM, and <a href="http://java.sun.com/javase/6/docs/api/... | <p>java.lang.Runtime.totalMemory() will give you the required info: <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html" rel="nofollow noreferrer">http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html</a></p>
| 29,592 |
<p>Does the MySQL command :</p>
<pre><code>FLUSH TABLES;
</code></pre>
<p>flush every table in the current database, or every table on the server ?</p>
<p>I'm using MySQL 5.0 - the <a href="http://dev.mysql.com/doc/refman/5.0/en/flush.html" rel="noreferrer">documentation</a> is unclear, although it does mention tha... | <p>It's all databases.</p>
| <p><code>FLUSH TABLES</code> is done for all databases, except if you specify tables one by one.</p>
<p>the syntax is:</p>
<pre><code>FLUSH TABLES tbl_name [, tbl_name] ...
</code></pre>
<p>with <code>READ LOCK</code>:</p>
<pre><code>FLUSH TABLES tbl_name [, tbl_name] ... WITH READ LOCK
</code></pre>
<p>and to contain ... | 43,713 |
<p>The company I used to work with has two developers working fulltime, and a handful of freelancers. They're in the process of hiring a new lead developer to try to bring order and management to the development.</p>
<p>But, currently, one of the developers has seen the light of Django (the company has only developed ... | <p>I recently introduced Python to my company, which does consulting work for the Post Office. I did this by waiting until there was a project for which I would be the only programmer, then getting permission to do this new project in Python. I then did another small project in Python with similarly impressive result... | <p>Well, python is a high level language.. its not hard to learn and if the guys already have programming knowledge it should be much easier to learn.. i like django.. i think it should be a nice try to use django .. </p>
| 4,006 |
<p>Objective-C is getting wider use due to its use by Apple for Mac OS X and iPhone development. What are some of your favourite "hidden" features of the Objective-C language?</p>
<ul>
<li>One feature per answer.</li>
<li>Give an example and short description of the feature, not just a link to documentation.</li>
<li>... | <h2>Posing</h2>
<p>Objective-C permits a class to <strong>entirely replace another class</strong> within an application. The replacing class is said to "pose as" the target class. All messages sent to the target class are then instead received by the posing class. There are some restrictions on which classes can pose:... | <p>I like the verbose method naming like <code>[myArray writeToFile:myPath atomically:YES]</code>, where every argument has a label.</p>
| 26,008 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.