instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>The use of weak references is something that I've never seen an implementation of so I'm trying to figure out what the use case for them is and how the implementation would work. When have you needed to use a <code>WeakHashMap</code> or <code>WeakReference</code> and how was it used?</p>
| <blockquote>
<p>One problem with strong references is
caching, particular with very large
structures like images. Suppose you
have an application which has to work
with user-supplied images, like the
web site design tool I work on.
Naturally you want to cache these
images, because loading them from disk... | <p>you can use weakhashmap to implement a resource-free caching for expansive object creation. </p>
<p>but note that it is not desireable to have mutable objects.
i used it to cache query results (which take about 400 ms to execute) to a text-search engine, which is rarely updated.</p>
| 18,710 |
<p>I'm looking for some information and a little history. I am writing a program and I want to save some data without using a database. I'm assuming I could use XML but what else can I use? How do you save data to files and then retrieve them without XML and without plain text? What is Binary formatting, can that be us... | <p>"Binary formatting" is a pretty vague term. Basically it's "anything other than plain text formatting."</p>
<p>You can pick whatever format you want to write your data to disk. If you use an existing format (XML, ini-file, Protocol Buffers, Thrift etc) you benefit from there already being code to write/parse the da... | <p>I am using C#. I am probably going to use XML but I am just learning and I wanted to know some alternatives. Basically, I wanted my program to be similar to a program like Office, where you add something and then save it to a file for future retrieval. If you were to look at the Office file in a text editor, it woul... | 47,000 |
<p>We have a number of MS SQL Server 2005 installations (both Standard and Enterprise editions) on our webservers. From time to time I need to administrate them from home. Right now I'm using Remote Desktop to connect to my work machine, but I'd prefer to install SQL Server Management Studio on my home machine so that ... | <p>See this question:<br>
<a href="https://stackoverflow.com/questions/117347/whats-the-difference-between-sql-server-management-studio-and-the-express-versi">What's the difference between SQL Server Management Studio and the Express edition?</a></p>
<p>Also, if you have any trouble doing anything from Managment S... | <p>I'm not sure if you can create backup schedules and maintenance plans in Management Studio Express.</p>
| 40,844 |
<p>I am learning and using Emacs. What I found annoying is that Ctrl-Space input will be stolen by Windows XP to switch the language bar instead of setting the mark in Emacs. The "language bar" is the native input languages selection such as Chinese keyboard other than English keyboard. Is there a way to temporarily... | <p>Found the solution to this problem as I just experienced it. So here goes even if the question is old.</p>
<p>Applies to Windows 7 and maybe others. I had added Chinese, Japanese and Korean input languages as I needed these for some development. After that I removed them again via Control Panel "Change keyboards...... | <p>After looking at and trying out Richard C's answer with the regedit...</p>
<p>I found that, after changing all my key sequences in the language settings window, that the registry values specified above were already changed.... So without editing the registry, I restarted and the Ctrl-Space sequence was disabled!!</... | 21,601 |
<p>I have a menu with an animation going on, but I want to disable the click while the animation is happening.</p>
<pre><code><div></div>
<div></div>
<div></div>
$("div").click(function() {
$(this).animate({height: "200px"}, 2000);
return false;
});
</code></pre>
<p>However,... | <pre><code>$("div").click(function() {
if (!$(this).parent().children().is(':animated')) {
$(this).animate({height: "200px"}, 2000);
}
return false;
});
</code></pre>
| <p>You could do something like this...</p>
<pre><code>$(function() {
$("div").click(function() {
//check to see if any of the divs are animating
if ($("div").is(":animated")) {
alert("busy");
return;
}
//whatever your animation... | 32,605 |
<p>We are trying to duplicate one of our informix database on a test server, but without Informix expertise in house we can only guess what we need to do. I am learning this stuff on the fly myself and nowhere near the expertise level needed to operate Informix efficiently or even inefficiently. Anyhow...
We managed ... | <p>You've asked a pretty complicated question without realizing it. Informix is architected as a shared everything database engine, meaning all resources available to the instance are available to every database in that instance. This means that more than one database can store data in any given dbspace, .dat or .idx f... | <p>I don't have any Informix-specific advice but for situations like this you can usually find the answer by looking up how to move a database (a common admin task, and usually well described in the manual) and just skipping the steps that would remove the old database.</p>
<p>Also, be careful of problems caused by di... | 13,870 |
<p>I'm using <a href="http://www.grinninglizard.com/tinyxml/" rel="nofollow noreferrer">TinyXML</a> to parse/build XML files. Now, according to <a href="http://www.grinninglizard.com/tinyxmldocs/" rel="nofollow noreferrer">the documentation</a> this library supports multibyte character sets through UTF-8. So far so goo... | <p>First, utf-8 is stored in const char * strings, as @quinmars said. And it's not only a superset of 7-bit ASCII (code points <= 127 always encoded in a single byte as themselves), it's furthermore careful that bytes with those values are never used as part of the encoding of the multibyte values for code points ... | <p>By using between 1 and 4 chars to encode one Unicode code point. </p>
| 17,679 |
<p>I'd like to have a blank line after my bash prompt and before the output on my Mac. It should look like this would:</p>
<pre><code>echo; ls
</code></pre>
<p>Can I add a newline to my bash prompt and then go back up one line to wait for user input? Is there something obvious I'm missing?</p>
| <p>I know this is old but for someone like me who came across this while googling for it. This is how you do this...
It's actually pretty simple!</p>
<p>Check out this link --> <a href="http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html" rel="noreferrer">Cursor Movement</a></p>
<p>Basically to move up N number of line... | <p>In general, if you want to find out the codes to do anything a terminal can do, read the <code>terminfo</code> man page.</p>
<p>In this case, the <em>cursor up one line</em> code can be determined by:</p>
<pre><code>tput cuu1
</code></pre>
<p>If you redirect the tput output to a file, you can see what control cha... | 35,158 |
<p>Could someone simply explain the 3 phases in the Flash Event framework, please? </p>
<p>By event phases, I mean:</p>
<ul>
<li><code>CAPTURING_PHASE</code></li>
<li><code>AT_TARGET</code></li>
<li><code>BUBBLING_PHASE</code></li>
</ul>
<p>To be clear, I'm talking about <code>flash.events.Event</code> and subclasse... | <blockquote>
<p>With event propagation you're dealing with three "phases" of an event (see Figure 2). Each phase represents a path or the location of an event as it works itself through the display objects in Flash that relate to that event. The three phases of an event are capturing, at target, and bubbling:</p>
</b... | <p>A while back I wrote a few articles on events propagation, custom events in Flash etc.</p>
<p>You can find the article here along with source code and working examples:</p>
<p><a href="http://www.popamihai.com/2010/10/flex/event-propagation-capturing-phase-targeting-phase-and-bubbling-phase/" rel="nofollow">http:/... | 45,341 |
<p>I need to call a web service written in .NET from Java. The web service implements the WS-Security stack (either WSE 2 or WSE 3, it's not clear from the information I have). </p>
<p>The information that I received from the service provider included WSDL, a policyCache.config file, some sample C# code, and a sampl... | <p>This seems to be a popular question so I'll provide an overview of what we did in our situation.</p>
<p>It seems that services built in .NET are following an older ws-addressing standard (<a href="http://schemas.xmlsoap.org/ws/2004/03/addressing/" rel="noreferrer">http://schemas.xmlsoap.org/ws/2004/03/addressing/</... | <p><a href="http://cwiki.apache.org/CXF20DOC/ws-support.html" rel="nofollow noreferrer">CXF</a> - I'd look into CXF. I've used it to create a web service and client in java using ws-secuirty. I also connected a .net web service to it.</p>
<p>They have pretty good documentation too. I had more luck with it than axis.</... | 3,717 |
<p>For some reason the system admin changed my user name from XxXx to XxXx1 in the source control system. Then the problems started. I had to delete all local files and re-download them from source control just to open the project.</p>
<p>And after I had rebooted the computer, I can't do much to my files. Whenever I t... | <p>After giving up on everything else, I deleted the local workspace and created a new one. Now everything works fine.</p>
| <p>Have you checked to make sure that the Active Directory change has propagated to TFS? I've seen issues before where users information is changed and TFS doesn't pick up the change and gets confused about your user.</p>
<p>Also take a look at the following blog post. It details how to sync up TFS with a user name ... | 40,577 |
<p>window.scrollMaxY can be set via that property in IE and older versions of Firefox, but when trying in FF3 it says "Cannot set this property as it only has a getter".</p>
<p>What is my alternative?</p>
<p>EDIT:</p>
<p>The reason why I'm asking is that I'm fixing some very horrible JS written by someone else, it h... | <p>First, I'm not sure that naming your function <code>t</code> is helping as 't' is used as the <a href="http://www.mcs.vuw.ac.nz/cgi-bin/info2www?(elisp)nil+and+t" rel="noreferrer">truth value</a> in lisp.</p>
<p>That said, the following code works for me:</p>
<pre><code>(defun test-func-1 () "test-func-1"
(int... | <p>Above answers are okey, but you can do something more interesting with defmacro, wich evaluates functions later for some reason:</p>
<pre><code>(defun n1 ()
"n1")
(defmacro call-n (n)
(apply n))
(call-n (n1))
</code></pre>
<p>A practical example with a for loop that takes any amount of functions and ... | 26,214 |
<p>Is there a standard way for a web server to be able to determine a user's timezone within a web page? </p>
<p>Perhaps from an HTTP header or part of the <code>user-agent</code> string?</p>
| <p>There are no HTTP headers that will report the clients timezone so far although it has been suggested to include it in the HTTP specification.</p>
<p>If it was me, I would probably try to fetch the timezone using clientside JavaScript and then submit it to the server using Ajax or something.</p>
| <p>There's no such way to figure the timezone in the actual HTML code or any <code>user-agent</code> string, but what you can do is make a basic function getting it using JavaScript.</p>
<p>I don't know how to code with JavaScript yet so my function might take time to make.</p>
<p>However, you can try to get the actual... | 2,234 |
<p>I'm looking to create <code>favicon.ico</code> files programatically from Python, but PIL only has support for reading <code>ico</code> files.</p>
| <p>You can use <a href="http://pillow.readthedocs.org" rel="noreferrer">Pillow</a>:</p>
<pre><code>from PIL import Image
filename = r'logo.png'
img = Image.open(filename)
img.save('logo.ico')
</code></pre>
<p>Optionally, you may specify the icon sizes you want:</p>
<pre><code>icon_sizes = [(16,16), (32, 32), (48, 48... | <p>I don't know if this applies for all cases, but on WinXP an .ico can be a bmp of size 16x16, 32x32 or 64x64. Just change the extension to ico from bmp and you're ready to go.</p>
| 6,740 |
<p>I am trying to add different styles within a textarea eg bold, different colors etc</p>
<p>WYSIWYG editors (eg tinyMCE) used in web pages typically do this but I am having trouble working out how they do it.</p>
<p>You cannot do this:</p>
<p><a href="http://www.yart.com.au/test/html.gif">alt text http://www.yart.... | <p>Owen has the right idea. Those libraries replace the textarea with an iframe and then put the iframe's document into <code>designMode</code> or <code>contentEditable</code> mode. This literally enables you edit the html document in the iframe while the browser then handles the cursor and all keystrokes for you and... | <p>I believe tinymce specifically uses a table/iframe for display purposes (which is substituted in place of the existing textarea). Once you're ready to save it copies all the info back to the textarea for processing.</p>
| 30,456 |
<p>Can someone explain to me the advantages of using an IOC container over simply hardcoding the default implementation into a default constructor?</p>
<p>In other words, what is wrong about this code?</p>
<pre><code>public class MyClass
{
private IMyInterface _myInterface;
public MyClass()
{
_my... | <p>The idea of IoC is to delegate part of your component's functionality to another part of the system. In IoC world, you have components that don't know about each other. Your example violates this, as you're creating tight coupling between MyClass and some implementation of IMyInterface. <strong>The main idea</strong... | <p>I don't see why your technique of hardcoding the default implementation could not be used together with an IOC container. Just, the dependencies you don't specify in the configuration would take the default implementation.</p>
<p>Or am I missing something?</p>
| 12,623 |
<p>Given the schema:</p>
<pre>
MACHINE_TYPE { machine_type }
MACHINE { machine, machine_type }
SORT_PLAN { sort_plan, machine_type }
SCHEDULE { day_of_week, machine, sort_plan }
</pre>
<p>and the business rule:</p>
<blockquote>
<p>A sort plan can be assigned to any
machine of the same machine_type.</p>
</blockqu... | <p>I'd use an insert trigger on the SCHEDULE table.</p>
| <p>I'd use an insert trigger on the SCHEDULE table.</p>
| 46,890 |
<p>I'm trying to add parameters to an objectDataSource at runtime like this:</p>
<pre><code> Parameter objCustomerParameter = new Parameter("CustomerID", DbType.String, customerID);
Parameter objGPDatabaseParameter = new Parameter("Database", DbType.String, gpDatabase);
//set up object data sou... | <p>Add them to the event for the operation you are trying to use. For example, if these parameters are part of the SELECT command then add them to the Selecting event, if they need to go with the UPDATE command then add them on the Updating event.</p>
<p>The ObjectDataSource raises an event before it performs each op... | <p>Add as early as possible; at the <code>PreInit</code> event. This is part of initialization so should be done there.</p>
<p>See the <a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="nofollow noreferrer">ASP.NET Page Life Cycle Overview</a> for more information.</p>
| 29,106 |
<p>How can I find the location of exe that runs as a windows service in run-time?</p>
| <p>.NET - <code>Assembly.GetExecutingAssembly().Location</code> (others have suggested <code>Application.ExecutablePath</code>, but this requires a reference to <code>System.Windows.Forms</code>, which a service normally doesn't need)</p>
<p>Native - <code>GetModuleFileName(NULL, ...)</code></p>
| <p>Usually they run under windows\system32 even though you may have installled it on another drive </p>
| 38,241 |
<p>What is the power consumption of your heatbed (size) and hotend (model)?</p>
<p>I want to verify that it is possible to use a battery to power them.</p>
| <p>I have a Kill-A-Watt meter so I got a pretty good measurement for you with my Anet A6. Like Petar said each model is different but this should give you a idea. When heating both the nozzle and heat bed the printer consumes 160 W of power, once to temp it backs down to 9 W (it also uses 9 W when just "... | <p>To answer the underlying (X-Y) question, yes it is possible to power a small 3D printer from a battery pack. <a href="https://www.3ders.org/articles/20171005-naomi-sexycyborg-wu-3d-prints-on-the-go-with-awesome-wearable-3d-printer.html" rel="nofollow noreferrer">This Article</a> describes a printer built by Naomi Wu... | 831 |
<p>I have an asp:DropDownList on a page that, due to the 1024x768 development standard can truncate some of the text values in the dropdown (not enough of them, apparently, to redesign the layout ), so I need to display a tooltip of the selected value <em>when</em> a dropdown item is being selected (i.e. when the dropd... | <pre><code>foreach (ListItem _listItem in this.DropDownList1.Items)
{
_listItem.Attributes.Add("title", _listItem.Text);
}
</code></pre>
<p>// add a tooltip for the selected item also</p>
<pre><code>DropDownList1.Attributes.Add("onmouseover", this.title=this.options[this.selectedIndex].title");
</code></... | <p>Add the "Title" attribute to your list items with your tooltip info in there. It's not an existing item in the intellisense, but it should work. It does on my system. Now, I'm not exactly sure how to do this if you're DataBinding your drop down list to a data source. But if you're hard coding in the ASPX or in t... | 45,344 |
<p>I want to be able to compare Dates and Times in Rails without always having to call the to_time or to_date method. So I wrote the following code:</p>
<pre><code>class Date
def ==(other)
if other.kind_of?(Time)
self.to_time == other
else
super(other)
end
end
end
</code></pre>
<p>I know t... | <p>The easiest way to make any old Ruby class comparable is to implement the <=> instance method and include the <a href="http://www.ruby-doc.org/core/classes/Comparable.html" rel="noreferrer">Comparable</a> mixin. You'll get the >, <, >=, <=, ==, etc. methods for free then.</p>
<p>One way of approaching this... | <p>Your example looks okay, but I wouldn't use <code>kind_of?</code> - if <code>other</code> doesn't implement <code>to_time</code> you get an exception anyway!</p>
<p>Update: What you are looking for is probably the <code><=></code> operator!</p>
| 34,995 |
<p>I'd like to be able to create a parameterized query in MS Access 2003 and feed the values of certain form elements to that query and then get the corresponding resultset back and do some basic calculations with them. I'm coming up short in figuring out how to get the parameters of the query to be populated by the fo... | <p>References to the controls on the form can be used directly in Access queries, though it's important to define them as parameters (otherwise, results in recent versions of Access can be unpredictable where they were once reliable).</p>
<p>For instance, if you want to filter a query by the LastName control on MyForm... | <p>Let's take an example. the parameterized query looks like that:</p>
<pre><code>Select Tbl_Country.* From Tbl_Country WHERE id_Country = _
[?enter ISO code of the country]
</code></pre>
<p>and you'd like to be able to get this value (the [?enter ... country] one) from a form, where you have your controls and so... | 12,088 |
<p>I put together a sample scenario of my issue and I hope its enough for someone to point me in the right direction.</p>
<p>I have two tables</p>
<p>Products</p>
<p><img src="https://i.stack.imgur.com/ktnI0.gif" alt="alt text"></p>
<p>Product Meta</p>
<p><img src="https://i.stack.imgur.com/dBrc0.gif" alt="alt tex... | <p>We've successfully used the following approach in the past...</p>
<pre><code>SELECT [p].ProductID,
[p].Name,
MAX(CASE [m].MetaKey
WHEN 'A'
THEN [m].MetaValue
END) AS A,
MAX(CASE [m].MetaKey
WHEN 'B'
THEN [m].MetaValue
... | <pre><code>Select a.ProductId
,a.Name
,(Select c.MetaValue
From [Product Meta] c
Where c.ProductId = a.ProductId
And c.MetaKey = 'A') As 'A'
,(Select d.MetaValue
From [Product Meta] d
Where d.ProductId = a.ProductId
And d.MetaKey = 'B') As 'B'
,(Select e.MetaValue
From [Product M... | 40,321 |
<p>I have been a VB.net developer for a few years now but I am currently applying to a few companies that use C#. I have even been told that at least one of the companies doesn't want VB.net developers. </p>
<p>I have been looking online trying to find real differences between the two and have asked on crackoverflow. ... | <p>I've had to interview people for a few C# positions and this is my general advice for VB.Net developers interviewing for a C# position:</p>
<ul>
<li>Make sure you are clear that you have been working VB.Net. This seems obvious but is something that apparently isn't (in my experience).</li>
<li>Try to give a code s... | <p>VB or C# both are syntax only diffrent but if you are applying way of logic is same.</p>
| 3,557 |
<p>Does someone know if it is possible to modify the JVM settings at runtime (e.g. -dname=value)?
I need this little trick to run my Java stored procedure (oracle 10g).</p>
| <p>Assuming you mean system properties (-D...; -d picks data model) System.setProperty(...) may do what you want.</p>
| <p>You can definitely set system properties in a Java stored procedure using System.setProperty(). But, they will only be available to the current Oracle session.</p>
<p>For example, if you connect to Oracle, and run a Java stored procedure that sets system properties, then disconnect from Oracle. When you next conn... | 11,869 |
<p>What are the other types of database systems out there. I've recently came across couchDB that handles data in a non relational way. It got me thinking about what other models are other people is using.</p>
<p>So, I want to know what other types of data model is out there. (I'm not looking for any specifics, just w... | <p><a href="http://www.db4o.com" rel="nofollow noreferrer">db4o</a></p>
<p>Quote from the "about" page:</p>
<blockquote>
<p>db4o is the open source object database that enables Java and .NET developers to store and retrieve any application object with only one line of code, eliminating the need to predefine or main... | <h1>4. Navigational. Includes Tree/Hierarchy and Graph/Network.</h1>
<p>File systems, the semantic web, XML, Object databases, CODASYL, and many others all fit into this category.</p>
<p>Those 4 are pretty much it.</p>
| 7,389 |
<p>In order to debug an asp.net web app I have to have IE Script debugging enabled. Unfortunately, in the past week or so google's analytics javascript has developed a problem. So that when I browse to a site that has google analytics I receive the little pop up "A runtime error has occurred. Do you wish to debug?"<... | <p>I would suggest using IE for debugging purposes only, and <a href="http://www.mozilla.com/en-US/firefox/" rel="nofollow noreferrer">Firefox</a> for darn near everything else. Your life will benefit from this.</p>
| <p>You could write some code to make a change to the following key in the Registry</p>
<p><em>HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Disable Script Debugger</em></p>
<p>Depending on how you have your project you might be able to tie it to the actual build (via a Macro), or if anything just put it... | 17,023 |
<p>I have a .net 1.1 project in VS.Net 2003 (using C#) in which I can set a breakpoint in one method, and step through code just fine, but when I hit one specific method (which we also wrote), the breakpoints and code pointers go "whacky", for lack of a better term. If the breakpoint is on line 100, the execution poin... | <p>Yes. Your debug symbols (.pdb files) are out of synch with the actual code. Close Visual Studio and delete the "bin" and "obj" folders from all of the affected projects. Then reopen Visual Studio and rebuild. This should resolve the problem.</p>
| <p>Found it... my PDB files got out of sync with the DLL files... cleaned the /bin/ folder and rebuilt, and the problem goes away.</p>
<p>Thanks me. :)</p>
| 35,664 |
<p>More detail to my question:</p>
<p>HTML and JavaScript are called "client-side code".</p>
<p>C# and VB in the code behind files are termed "server-side code".</p>
<p>So what is inline-asp, and 'runat=server' code blocks called?</p>
<pre><code><!-- This is called "client-side" -->
<p>Hello World</p... | <p>To be explicit, Microsoft calls them Embedded Code Blocks.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms178135.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms178135.aspx</a> </p>
<p>They are code blocks embeded into the page lifecycle by being called during the Render phase.</p>
| <p>Code in the aspx file is called <strong>"the markup".</strong> That includes static html, as well. If you want to narrow it down to code within <code><% %></code> tags just say "code blocks".</p>
<p>The <code><% %></code> tags themselves and similar are called "Bee Stings". Note that this is just for... | 40,560 |
<p>We have two client apps (a web app and an agent app) accessing methods on the same service, but with slightly different requirements. My team wants to control behaviour on the service side by passing in a ApplicationType parameter to every method - which is essentially an enum containing the name of the calling cli... | <p>In a layered solution, you should always consider your layers as onion-like layers, and dependencies should always go inwards, never outwards.</p>
<p>So your GUI/App layer should depend on the businesslogic layer, the businesslogic layer should depend on the data access layer, and similar.</p>
<p>Unless you catego... | <p>From a design perspective, this is no different than having users with different profiles. From a security perspective, I hope your applications are doing something to identify themselves, lest users of one application figure out a way to invoke the other applications logic as a hack. (Image a HR application being ... | 43,720 |
<p>I am trying to get a list of all unit test assemblies under the root of my project. I can do this as follows:</p>
<pre><code><CreateItem Include="**\bin\**\*.UnitTest.*.dll">
<Output TaskParameter="Include" ItemName="Items"/>
</CreateItem>
</code></pre>
<p>However, this will find the same DLLs... | <p>The <a href="https://github.com/mikefourie/MSBuildExtensionPack" rel="nofollow noreferrer">MSBuild Extension Pack</a> contains the task <em>MSBuildHelper</em>, supporting the command <em>RemoveDuplicateFiles</em>.</p>
<pre><code><CreateItem Include="**\bin\**\*.UnitTest.*.dll">
<Output TaskParameter="I... | <p>I had a good search online and couldn't find any way of doing this. If anyone knows a clean built-in way then please let me know. In the meantime, I wrote a simple task to do the job. The usage looks like this:</p>
<pre><code><NormalizeByMetadata Items="@(ItemsToNormalize)" MetadataName="Filename">
<Ou... | 47,382 |
<p>My customer is replacing MS Office with OpenOffice in some workstations. My program export a file to Excel using the .xml extension (using open format) and opens it using the current associated program (using ShellExecute)</p>
<p>The problem is that OpenOffice does not register the .xml extension associated with it... | <p>The real association is stored in the key that <code>"HKEY_CLASSES_ROOT\.xml"</code> points to.</p>
<p>On my machine, the default value of that key says <code>"xmlfile"</code>, most likely that is the same for yours.</p>
<p>So let's go to <code>"HKEY_CLASSES_ROOT\xmlfile"</code>. There you can see (and change) wha... | <p>I just came across this whilst searching for the same answer. I found a better solution using the Windows FindExecutable API, that can be used from C# using PInvoke.</p>
<p><a href="http://www.pinvoke.net/default.aspx/shell32.findexecutable" rel="nofollow noreferrer">http://www.pinvoke.net/default.aspx/shell32.find... | 26,168 |
<p>Currently I have an application that receives an uploaded file from my web application. I now need to transfer that file to a file server which happens to be located on the same network (however this might not always be the case).</p>
<p>I was attempting to use the webclient class in C# .NET.</p>
<pre><code> st... | <p>Just use </p>
<pre><code>File.Copy(filepath, "\\\\192.168.1.28\\Files");
</code></pre>
<p>A windows fileshare exposed via a UNC path is treated as part of the file system, and has nothing to do with the web.</p>
<p>The credentials used will be that of the ASP.NET worker process, or any impersonation you've enable... | <p>when you manually open the IP address (via the RUN command or mapping a network drive), your PC will send your credentials over the pipe and the file server will receive authorization from the DC.</p>
<p>When ASP.Net tries, then it is going to try to use the IIS worker user (unless impersonation is turned on which ... | 32,994 |
<p>Is it possible to share a single 'god' instance among everyone that links to this code, to be placed in a shared object?</p>
<pre><code>god* _god = NULL;
extern "C"
{
int set_log_level(int level)
{
if(_god == NULL) return -1;
_stb->log_level(level);
return 0;
}
int god_init(){
if(_god == NULL)... | <p><a href="http://www.boost.org/doc/libs/1_37_0/doc/html/interprocess.html" rel="nofollow noreferrer">Boost Interprocess</a> library has high(er) level, portable shared memory objects.</p>
| <p>I have feeling that <em>god</em> will be a server of some kind. Consider using a proper client/server architecture, so as to keep god away from the masses.</p>
| 35,569 |
<p>In IOC's what does <code>ResolveAll</code> do?? I know that the offical answer is "Resolve all valid components that match this type." Does that mean that it will return any class that implements a given interface?</p>
| <p>It will return all classes that were registered for a given interface.</p>
<p>...and are not waiting on any references to be resolved. This bit me today!</p>
| <p>If I have:</p>
<p>container.ResolveAll(new { argument = something}).Where(...)</p>
<p>it seems like all components of T gets instantiated with 'something' even though not all of the components full fill the where clause.... who takes care of Releasing these extra components?</p>
| 44,609 |
<p>My Rails-app has a sign in box with a "remember me" checkbox. Users who check that box should remain logged in even after closing their browser. I'm keeping track of whether users are logged in by storing their id in the user's session. </p>
<p>But sessions are implemented in Rails as session cookies, which are not... | <p>You should almost certainly not be extending the session cookie to be long lived.</p>
<p>Although not dealing specifically with rails <a href="http://fishbowl.pastiche.org/2004/01/19/persistent_login_cookie_best_practice" rel="noreferrer">this article</a> goes to some length to explain 'remember me' best practices.... | <p>This worked like a charm for me:</p>
<p><a href="http://squarewheel.wordpress.com/2007/11/03/session-cookie-expiration-time-in-rails/" rel="nofollow noreferrer">http://squarewheel.wordpress.com/2007/11/03/session-cookie-expiration-time-in-rails/</a></p>
<p>Now my CookieStore sessions expire after two weeks, whereb... | 2,290 |
<p>Recently my team has spent too many hours setting up machines with previous product releases or database servers with specific patches. In some cases, we have taken a developers machine down for up three days as a result. Clearly, this would be an ideal case for using a virtual machine. I am trying to champion the p... | <p><a href="http://www.vmware.com" rel="nofollow noreferrer">VMWare</a> is the best out there IMHO.</p>
| <p>I am just starting with virtualization...i am using the book Microsoft Virtualization 4.6...Its been pretty helpful till now...u can check it out..may be you'll find what u looking for...
the link is <a href="https://www.packtpub.com/getting-started-microsoft-application-virtualization-46/book" rel="nofollow">https:... | 33,319 |
<p>I want to delete foo() if foo() isn't called from anywhere.</p>
| <p><a href="http://www.mono-project.com/Gendarme" rel="nofollow noreferrer">Gendarme</a> will detect private methods with no upstream callers. It is available cross platform, and the latest version handles "<a href="http://www.mono-project.com/Gendarme.Rules.Performance" rel="nofollow noreferrer">AvoidUncalledPrivateCo... | <p><a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">Resharper</a> does this, and not just with methods. It also does it with using statements, variables etcetera.</p>
| 9,132 |
<p>I know that I can make a setter that checks to see if a value is NULL and do something. Example:</p>
<pre><code><TextBlock>
<TextBlock.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding SomeField}" Value="{x:Null}">
<Setter Property="TextBlo... | <p>This is a bit of a cheat but I just set a default style and then overrode it using a DataTrigger if the value is null...</p>
<pre><code> <Style>
<!-- Highlight for Reviewed (Default) -->
<Setter Property="Control.Background" Value="PaleGreen" />
<Style.Triggers>
... | <p>Converter:</p>
<pre><code>public class NullableToVisibilityConverter: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? Visibility.Collapsed : Visibility.Visible;
}
}
</code></pre>
<p>Binding:</p>
<pre><code>V... | 46,442 |
<p>I have the following method in my code:</p>
<pre><code>private bool GenerateZipFile(List<FileInfo> filesToArchive, DateTime archiveDate)
{
try
{
using (ZipOutputStream zipStream = new ZipOutputStream(File.Create(GetZipFileName(archiveDate))))
{
zipStream.SetLevel(9); // max... | <p>I used to use SharpZipLib until I switched to <a href="http://www.codeplex.com/DotNetZip" rel="nofollow noreferrer">DotNetZip</a> You may want to check it out as an alternative.</p>
<p>Example:</p>
<pre><code>try
{
using (ZipFile zip = new ZipFile("MyZipFile.zip")
{
zip.AddFile("c:\\photos\\per... | <p>For the benefit of anyone having the same problem in the future: My problem turned out to be that I was using a truly ancient version of WinZip (8.0, I think) to view the files. Using a modern viewer (12.0) solved the problem.</p>
| 41,146 |
<p>Heads up: I'm not good with electronics and only have a vague idea of it's inner workings.</p>
<p>I have a <a href="https://ru.aliexpress.com/item/3D-Printer-V6-Wade-Short-distance-J-head-Hotend-12V-for-1-75mm-3-0mm-Extruder/32810022530.html?spm=a2g0v.10010108.1000016.1.197a7c35uzmRpw&isOrigTitle=true" rel="nor... | <p>Electrical engineering can be quite complex, but in this case you can save yourself with same simple equations/relations. Using the following formulae:</p>
<ul>
<li><strong><em>Voltage (<span class="math-container">$\ U$</span>) equals current (<span class="math-container">$I$</span>) multiplied by the electrical r... | <p>It will take longer to heat up. However if you use a <a href="https://rads.stackoverflow.com/amzn/click/com/B06XWSV89D" rel="nofollow noreferrer" rel="nofollow noreferrer">boost converter</a> (like I did on my Anet A8 when I upgraded to a <a href="https://www.hot-end.com/" rel="nofollow noreferrer">Maxiwatt</a> 24&n... | 1,207 |
<p>I have a SQL statement similar to this:</p>
<pre><code>SELECT COUNT(*) AS foo, SUM(foo) AS foo_sum FROM bar
</code></pre>
<p>But MySQL doesn't allow this because foo is an alias. Does anyone have an idea of how this could be accomplished in SQL?</p>
| <p>No, you can't use an alias in the select-list or a WHERE clause. You can only use the alias in a GROUP BY, HAVING, or ORDER BY. </p>
<p>You can also use aliases defined in a subquery:</p>
<pre><code>SELECT foo, SUM(foo) AS foo_sum
FROM (
SELECT COUNT(*) AS foo
FROM bar
);
</code></pre>
| <p>I think it's not a good idea. If you want to make a big query, it's better to do it without a subquery. Use <code>COUNT(*)</code> and bigger functions without alias, if you need it. </p>
<p>I made a query with aliases and subqueries. It took about an hour! Then I reproduced the query without the alias. It went down... | 48,764 |
<p>I'm wondering if there is a quick and easy function to clean get variables in my url, before I work with them.( or $_POST come to think of it... )</p>
<p>I suppose I could use a regex to replace non-permitted characters, but I'm interested to hear what people use for this sort of thing?</p>
| <p>I use the PHP <a href="http://us2.php.net/manual/en/function.filter-input.php" rel="nofollow noreferrer">input filters</a> and the function <a href="http://php.net/urlencode" rel="nofollow noreferrer">urlencode</a>.</p>
| <p>I use the below method to sanitize input for MYSQL database use. To summarize, iterate through the $_POST or $_GET array via foreach, and pass each $_POST or $_GET through the DBSafe function to clean it up. The DBSafe could easily be modified for other uses of the data variables (e.g. HTML output etc..).</p>
<pr... | 35,178 |
<p>Does SQL Server CheckSum calculate a CRC? If not how can I get SQL Server to calculate a CRC on an arbitrary varchar column?</p>
| <p>I apologize for the crudity of the model, but this seems to do a correct CRC32 calculation.
I'm not a TSQL expert, and I'm sure that this could be improved mightily by a real SQL Server pro...</p>
<p>@input is the variable to calculate the CRC32 on.
It should be trivial to package this as a sproc or a udf, and the ... | <p>I don't think T-SQL gives you the option to specify using a proper CRC as your checksum function. FYI, SQL Server Integration Services (SSIS) does have a "Checksum" transformation that gives you a choice of what checksum algorithm to use, and one of the choices is:</p>
<blockquote>
<p>CRC32 - Using a standard 32-... | 42,894 |
<p>If I just want to know if a domain name is reserved; is it sufficient to use this command and see if any domain name servers turn up, in which case it's reserved?</p>
<pre><code>host -t NS example.com
</code></pre>
<p>It's a lot faster than visiting <a href="http://www.internic.net/whois.html" rel="nofollow norefe... | <p>Absolutely not.</p>
<p>A past employer registered theirname.biz solely for use on the internal network: it had DNS entries on the inward-facing network DNS server, but nowhere on the internet.</p>
<p>I'm not sure the trick was particularly essential, but "imap.theirname.biz" has the advantage over just "imap" that... | <p>I don't believe that you have to have a DNS pointing to your domain. Even if you had to have a DNS set up, there is no assurance that the box acting as the DNS server isn't down. </p>
| 46,231 |
<p>So my goal is to be able to add a user from one Active Directory Domain to another group in a separate Active Directory Domain.</p>
<p>I'd like to do this in C#. I know there is a System.DirectoryServices namespace with classes to communicate with AD, but I can't find any information on adding users across domains... | <p>What worked for me when I wrote code to do this a couple years back:</p>
<ol>
<li>Get a DirectoryEntry for the group to which you want to add a member. </li>
<li>Call Invoke on the group DirectoryEntry passing arguments "Add" as the method name and the <a href="http://msdn.microsoft.com/en-us/library/aa746384(VS.8... | <p>You need to create a DirectoryEntry object to the Group. Then you add the DN off the user you want to add to the group to the member attribute on the group. For example:</p>
<pre><code>DirectoryEntry group = new DirectoryEntry("LDAP://child.domain.com/cn=group,ou=sample,dc=child,dc=domain,dc=com");
string userDN... | 40,695 |
<p>My application connects to an FTP server with a username and password. I can create an encryption routine to encrypt and decrypt the password, but anybody with access to the source code and the encrypted password can decrypt the password.</p>
<p>Is there an easy way to prevent every human being from knowing the en... | <p>No. All an app user has to do is sniff their own network traffic (easy to do with Wireshark or such).</p>
<p>You really need a way to give each user a unique token of some sort.</p>
<p>Edit - more info:</p>
<p>Any system that relies on "secret" login information that is the same for every copy of the application ... | <p>In essence, no. You can make it difficult, but any scheme which has code running on someone else's computer is suspectible to attack. How does the FTP server know that it is talking to <em>your</em> application, and not someone who has hacked what they need out of your application.</p>
| 22,857 |
<p>I found an example on registering DLLs, <em><a href="http://blogs.msdn.com/robmen/archive/2004/04/28/122491.aspx" rel="noreferrer">Registering an Assembly for COM Interop in a MSI file with the Windows Installer XML toolset.</a></em>, and WiX complains about the "AssemblyRegisterComInterop" attribute.</p>
<p>I remo... | <p>The easiest way (and Rob M will rant and rave about how this is <em>wrong</em>) is just to use <code>SelfRegCost=1</code> on the File tag for the DLL.</p>
<p>This is wrong, because we should be explicitly controlling the registration of the DLL, not allowing it just to run arbitrary code via DllRegisterServer. The... | <p>Use the heat.exe program that comes with the WiX toolset, to generate the wxs registration fragment:</p>
<pre><code> heat.exe file <filename> -out <output wxs file>
</code></pre>
<p>eg.</p>
<pre><code> heat.exe file my.dll -out my.wxs
</code></pre>
<p>Copy the contents of the <code><Component></cod... | 47,545 |
<p>From what I can gather, there are three categories:</p>
<ol>
<li>Never use <code>GET</code> and use <code>POST</code></li>
<li>Never use <code>POST</code> and use <code>GET</code></li>
<li>It doesn't matter which one you use.</li>
</ol>
<p>Am I correct in assuming those three cases? If so, what are some examples f... | <p>Use <code>POST</code> for destructive actions such as creation (I'm aware of the irony), editing, and deletion, because you can't hit a <code>POST</code> action in the address bar of your browser. Use <code>GET</code> when it's safe to allow a person to call an action. So a URL like:</p>
<pre><code>http://myblog.or... | <p>Gorgapor, <code>mod_rewrite</code> still often utilizes <code>GET</code>. It just allows to translate a friendlier URL into a URL with a <code>GET</code> query string.</p>
| 6,876 |
<p>Are there any open source real time operating systems out there? I've heard of real-time Linux, but most implementations seem to really be a proprietary RTOS (that you have to pay for) that run Linux as a process -- much the same way Ardence's RTX real-time system works for Windows.</p>
<p>EDIT: I should clarify t... | <p>Check out <a href="http://ecos.sourceware.org/" rel="nofollow noreferrer">eCos</a> free, open source and real-time operating system. (Supports x86, not sure about multi-core)</p>
<p><a href="http://www.rtlinuxfree.com/" rel="nofollow noreferrer">RTLinux</a> is also available</p>
| <p><a href="http://prex.sourceforge.net/" rel="nofollow noreferrer">Prex</a> is under BSD License.</p>
| 48,899 |
<p>I have a project that I'm working on and I need to be able to print out ID cards from the program. Are there any products out there that are reasonably priced so I can design a document for print and use it in .NET? I'm trying to avoid using System.Drawing from having to do it manually because when the company I wor... | <p>You could use Adobe Acrobat and one of the libraries out there for writing PDFs. That would let you design the document template in Adobe Acrobat, fill it out in code, and print it in code. There are some open source PDF writers and some commercial ones. The differences lie in the feature sets.</p>
<p>I've used <a ... | <p>I've done something similar using a PowerPoint document as a template. I put fields or labels on the PP document and then programmatically fill them in. Obviously, adding or removing fields would require code changes, but the layout of the PP document could be changed easily.</p>
| 22,078 |
<p>From time to time I get a System.Threading.ThreadStateException when attempting to restart a thread. The code in question is as follows:</p>
<pre><code>// Make sure the thread is done stopping
while (this.mThread.ThreadState == ThreadState.Running)
{
Thread.Sleep(0);
}
// Respawn a thread if the current one is... | <p>It's possible for a thread to be in more than one state at once therefore the ThreadState property is actually a bitmap of possible states. So testing for equality with just one state will not give you the right result. You would need to do something like:</p>
<pre><code>if((mThread.ThreadState & ThreadState.Ru... | <p>A ThreadStateException is thrown because you're trying to start a thread that's not in a startable state. The most likely situations would be that it's already running, or that it has fully exited.</p>
<p>There are potentially a couple things that might be happening. First is, the thread might have transitioned fro... | 3,417 |
<p>We were having a problem with our build server not checking out modifications from source control despite recognizing that there had been changes.</p>
<p>It was traced to the control folder (not sure what it's real name is), the existing working builds were using _svn. Clearing the working folder forced a new compl... | <p>The business about _svn vs. .svn was an issue with Visual Studio web projects only (and I'm fairly sure it was fixed in VS2005 anyway), it's not a general "_svn works better with VS" thing.</p>
<p>It's also only a working-copy issue, not a repository issue - i.e. it doesn't matter if some users of SVN are using cli... | <p>As far as I know _svn is needed, because WebApplications have problems when one of their directories begins with a point.</p>
| 3,320 |
<p>I've just got a fresh Drupal 6 install. The CSS didn't work. Then I realized that a "?U" was appended, and Drupal couldn't find it. Does anyone know where to unset this? </p>
<pre><code><link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?U" />
<link type="text/css" rel="styl... | <p>the ?U (or really any alphabet) is just a method drupal uses to cache information. it has no relevance to the location of the file (ie, node.css and node.css?U is in the same location to drupal).</p>
<p>it sounds like you may have a different issue. perhaps you enabled your cache and moved things around? you may ne... | <p>Did you install Drupal into a sub-directory? Like:</p>
<pre><code>http://domain.com/drupal
</code></pre>
<p>This would certainly cause the problems you speak of, though Drupal should have properly accommodated for that.</p>
| 22,961 |
<p>Does anyone have an example AUTORUN.INF which can launch an MSI installer automatically when the user inserts the CD.</p>
<p>I'm sure this can be done but I've been Googling around for ages and have not found any working solution.</p>
<p><strong>UPDATE:</strong> I have an AUTORUN.INF similar to this but it won't l... | <p>Try shellexecute= instead of open=</p>
<pre>[autorun]
shellexecute=MyInstaller-1.0.0.msi
label=My CD Label
icon=MyIcon.ico</pre>
| <p>I can answer my own question. After reading the articles linked by Ray, I have created the following AUTORUN.INF which works:</p>
<pre><code>[autorun]
shellexecute=MyInstaller-1.0.0.msi
label=My CD Label
icon=MyIcon.ico
</code></pre>
<p>The AUTORUN.INF file is placed in the root directory of the CD along with the ... | 41,358 |
<p>I am looking for a way to create a ZIP file from a folder in Windows C/C++ APIs. I can find the way to do this in VBScript using the Shell32.Application CopyHere method, and I found a tutorial explaining how to do it in C# also, but nothing for the C API (C++ is fine too, project already uses MFC).</p>
<p>I'd be re... | <p>EDIT: This answer is old, but I cannot delete it because it was accepted. See the next one</p>
<p><a href="https://stackoverflow.com/a/121720/3937">https://stackoverflow.com/a/121720/3937</a></p>
<p>----- ORIGINAL ANSWER -----</p>
<p>There is sample code to do that here</p>
<p>[EDIT: Link is now broken]</p>
<p... | <p>You could always statically link to the freeware zip library if you don't want to ship another library...</p>
| 14,434 |
<p>I have a tomcat instance setup but the database connection I have configured in <code>context.xml</code> keeps dying after periods of inactivity.</p>
<p>When I check the logs I get the following error:</p>
<p>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
The last packet successfully received from the s... | <p><a href="http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html" rel="noreferrer">Tomcat Documentation</a></p>
<p>DBCP uses the Jakarta-Commons Database Connection Pool. It relies on number of Jakarta-Commons components:</p>
<pre><code>* Jakarta-Commons DBCP
* Jakarta-Commons Collections
* Jak... | <p>I do not know whether the above answer does basically the same thing, but some of our systems use the DB connection about once a week and I've seen that we provide a -Otimeout flag or something of that sort to mysql to set the connection timeout.</p>
| 3,672 |
<p>If I strong name a class library with a .snk file, do I need to replace this .snk file with a new if I create a new version of the same library?</p>
| <p>No. The class library assembly is signed with the public key from the SNK file.</p>
<p>You can use the same SNK file for any and all assemblies you create. That way, target systems can be configured to allow a particular public key to be trusted (i.e. all of you assemblies). This can be done through Control Panel -... | <p>no you don't you can reuse a key file across different files/projects too</p>
| 49,381 |
<p>Our team is working on SAP and getting a website frontend written with PHP and MySQL to connect with the recruitment database on SAP ...
we've tried making SOAP clients and everything but it seems we're missing something.. what are the steps to ensure that they can synchronize with or without a wsdl..</p>
| <p>The standard PHP SOAP module has always worked for me.... <a href="http://no.php.net/manual/en/function.soap-soapclient-construct.php" rel="nofollow noreferrer">http://no.php.net/manual/en/function.soap-soapclient-construct.php</a></p>
| <p>it might make more sense to use RFC's instead, that way</p>
<ul>
<li>List item</li>
<li>No marshalling and unmarshalling</li>
<li>You can use standard delivered and supported SAP code</li>
<li><p>You dont need to create web services for function modules or groups</p>
<p>Link for the adapter : <a href="http://saprf... | 24,366 |
<p>Not very technical, but... I have to implement a bad words filter in a new site we are developing. So I need a "good" bad words list to feed my db with... any hint / direction? Looking around with google I <a href="http://urbanoalvarez.es/blog/2008/04/04/bad-words-list/" rel="noreferrer">found this</a> one, and it's... | <p>Beware of <a href="http://thedailywtf.com/Articles/The-Clbuttic-Mistake-.aspx" rel="noreferrer">clbuttic mistakes</a>.</p>
<blockquote>
<p>"Apple made the clbuttic mistake of forcing out their visionary - I mean, look at what NeXT has been up to!"</p>
<p>Hmm. "clbuttic".</p>
<p>Google "clbuttic" - thous... | <p>In researching this topic I determined that what was needed was more than just a list that does arbitrary replacements. I have built a web service that allows you to identify the level of 'cleanliness' you desire. It also makes an effort to identify false positives - i.e. where a word may be bad in one context but n... | 4,412 |
<p>Take any social website like <a href="http://en.wikipedia.org/wiki/Digg" rel="nofollow noreferrer">Digg</a> or Stack Overflow that somehow lets users reward points for stories, questions, etc..</p>
<p>What happens is quite similar to the process that lead to the rise of tabloid newspapers that feed only headli... | <p>The most important lesson with regard to the design of any social computing is that community dynamics problems cannot be solved purely by technological means.</p>
<p>In other words, whatever the solution you implement, if you have users to whom getting points (or trolling or getting involved in flame wars or whate... | <blockquote>
<p>People will swamp more general and more entertaining questions with answers. Answering more specific questions requires actual domain knowledge.</p>
</blockquote>
<p>First of all, I challenge your assertion that this is a problem. More general questions will have a more general audience and will be r... | 14,658 |
<p>I need to stream a file to the Response for saving on the end user's machine. The file is plain text, so what content type can I use to prevent the text being displayed in the browser?</p>
| <p>To be on the safe side and ensure consistent behavior in all browsers, it's usually better to use both:</p>
<pre><code>Content-Type: application/octet-stream
Content-Disposition: attachment;filename=\"My Text File.txt\"
</code></pre>
| <p>I don't think it works that way.</p>
<p>Use a <code>Content-Disposition: attachment</code> header, but stick with the correct Content-Type.</p>
| 22,619 |
<p>Can anyone give me details of </p>
<blockquote>
<p>runtime error 3734</p>
</blockquote>
<p>in Access vba.</p>
<p>For reference i am getting it from a code in the following thread</p>
<p><a href="https://stackoverflow.com/questions/233026/how-to-run-a-loop-of-queries-in-access">How to run a loop of queries in a... | <p>It seems that you are using ADO in the current database without saving. You must save before running code that contains ADO.</p>
| <p>It seems that you are using ADO in the current database without saving. You must save before running code that contains ADO.</p>
| 36,930 |
<p>I want to assign a resource I already have a second name, similar to using the BasedOn property of Styles. Specifically I have a brush that I use for a group of elements called ForegroundColor and I would like to use it in a control template (a ComboBox) calling it MouseOverBackgroundBrush. I would like to do someth... | <p>This is a feature that doesn't have very good support in XAML. I believe that you'll either need to repeat yourself (and change both locations anytime you need to change the brush) <em>or</em> if you don't mind a bit of code behind, you can accomplish the duplication like this:</p>
<pre><code>Resources["MouseOverBa... | <p>I don't know about how to copy a resource in xaml (can it even be done?) like you are asking ... but here is one way to accomplish what you are trying to do:</p>
<pre><code><Color x:Key="firstColor">#FFD97A7A</Color>
<Color x:Key="secondColor">#FFF4BFBF</Color>
<LinearGradientBrush x:Key=... | 32,475 |
<p>I am trying to do a Windows Forms application in an MVP style and - not having done much with threading before - am getting all confused.</p>
<p>My UI is a set of very simple forms. Each of the forms implements an interface and contains a reference to a mediator class which lives in the Business Logic Layer and vi... | <p>Have you looked into the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">BackgroundWorker</a> class? It's great for doing a lot of the simplified processing in the background type procedures and gives events that can be listned to do have your G... | <p>You <strong>can</strong> manipulate WinForms controls from another thread, but you need to use <code>Control.Invoke()</code>, and you will pay a considerable performance penalty for every cross-thread call, due to the context switch and associated behind-the-scenes CLR voodoo.</p>
<p>If you want to segregate the GU... | 19,918 |
<p>Given a model</p>
<pre><code>class BaseModel < ActiveRecord::Base
validates_presence_of :parent_id
before_save :frobnicate_widgets
end
</code></pre>
<p>and a derived model (the underlying database table has a <code>type</code> field - this is simple rails STI)</p>
<pre><code>class DerivedModel < BaseMod... | <p>I like to use the following pattern:</p>
<pre><code>class Parent < ActiveRecord::Base
validate_uniqueness_of :column_name, :if => :validate_uniqueness_of_column_name?
def validate_uniqueness_of_column_name?
true
end
end
class Child < Parent
def validate_uniqueness_of_column_name?
false
e... | <p>Again poking around in the source, it seems that validations can be run either on every save, or updates/creates only. This maps to</p>
<p><code>:validate</code> => all saves<br>
<code>:validate_on_create</code> => creations only<br>
<code>:validate_on_update</code> => updates only</p>
<p>To clear them, you can us... | 35,321 |
<p>I've followed the <a href="http://incubator.apache.org/couchdb/index.html" rel="noreferrer">CouchDB</a> project with interest over the last couple of years, and see it is now an Apache Incubator project. Prior to that, the CouchDB web site was full of <em>do not use for production code</em> type disclaimers, so I'd ... | <p>I use the CouchDB to power a Facebook application (over 35k monthly active users). For a while it was using MySQL but after porting the entire project over from Perl to Erlang, I decided to go for the gold and migrate all of the data into CouchDB and use that instead.</p>
<p>CouchDB has been a great data store to w... | <p>I used couchdb twice in production. First was the wiki likes project and I think that couchdb was perfect candidate for that role. Saving the version of all docs helps a lot.
The second project was quite query loaded and idea was dumping social data first, then query it with various filters. It was looked like stand... | 4,865 |
<p>What would be the easiest way to detach a specific JPA Entity Bean that was acquired through an EntityManager. Alternatively, could I have a query return detached objects in the first place so they would essentially act as 'read only'?</p>
<p>The reason why I want to do this is becuase I want to modify the data wit... | <p>(may be too late to answer, but can be useful for others)</p>
<p>I'm developing my first system with JPA right now. Unfortunately I'm faced with this problem when this system is almost complete.</p>
<p>Simply put. Use Hibernate, or wait for JPA 2.0.</p>
<p>In Hibernate, you can use 'session.evict(object)' to remo... | <p>I think you can also use method EntityManager.refresh(Object o) if primary key of the entity has not been changed. This method will restore original state of the entity.</p>
| 5,138 |
<p>Tag-based web sites often suffer from the delicacy of language such as synonyms, homonyms, etc. For programmers looking for information, say on Stack Overflow, concrete examples are:</p>
<ul>
<li>Subversion or SVN (or svn, with case-sensitive tags)</li>
<li>.NET or Mono</li>
<li>[Will add more]</li>
</ul>
<p>The p... | <p>Recognizing synonyms and semantic connections is something that <i>humans are good at</i>; a solution to organizing an open-ended taxonomy like what SO is featuring would probably be well served by finding a way to leave the matching to humans.</p>
<p>One general approach: someone (or some team) reviews <i>new</i... | <p>Tags are basically our admission that search algorithms aren't up to snuff. If we can get a computer to be smart enough to identify that things tagged "Subversion" have similar content to things tagged "svn", presumably we can parse the contents, so why not skip tags altogether, and match a search term directly t... | 4,158 |
<p>I've been working with jQuery for a pair of weeks and I've noticed it works fine with objects that are in the original HTML document, but when I generate a new element using jQuery the library doesn't get any of its events.</p>
<p>Let's say I try to run something like this:</p>
<pre><code>$('.whatever').click(func... | <p>Thats because the :
<sub>(corrected)</sub></p>
<pre><code>$('.whatever').click(function() {
alert("ALERT!");
});
</code></pre>
<p>Means, in literal terms: </p>
<pre>
Find all elements currently on the page that have the class ".whatever"
Foreach element in that result set, bind this function to its click eve... | <p>You need to rebind it.</p>
<pre><code>function bindme(){
$('.whatever').click(function(){
alert('binded');
});
};
bindme();
//function that will generate something
function foo(){
$('.whatever').val('oryt');
bindme();//rebind itagain
}
</code></pre>
| 37,526 |
<p>Based on this question <a href="https://stackoverflow.com/questions/19746/views-in-seperate-assemblies-in-aspnet-mvc">here</a> and using code found <a href="http://www.codeproject.com/KB/aspnet/ASP2UserControlLibrary.aspx" rel="nofollow noreferrer">here</a> I'm trying to load views that are embedded resources in a s... | <ol>
<li>You must register your <code>VirtualPathProvider</code> within the <code>Global.asax</code> <code>Application_Start</code> handler.</li>
<li>You must call the view in your DLL using the special path like so: <code>return View("~/Plugin/YOURDLL.dll/FULLNAME_YOUR_VIEW.aspx");</code></li>
</ol>
<p>Here's an arti... | <p>The built-in WebFormsViewEngine uses VirtualPathProviders, so if you write a VPP and register it, you won't need to make any changes to the view engine.</p>
| 29,317 |
<p>What is the shortcut to open a file within your solution in Visual Studio 2008 (+ Resharper)?</p>
| <p><kbd>Ctrl</kbd> + <kbd>T</kbd> (ReSharper, Goto, type) will open a class file for you.</p>
<p>Looks like <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>T</kbd> opens files.</p>
| <p>It depends on the key mapping that you have set.
With default keymapping: Do <kbd>Ctrl</kbd> + <kbd>T</kbd> to open a type and <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>T</kbd> to open a file.
With IntelliJ like mapping : Do <kbd>Ctrl</kbd> + <kbd>N</kbd> to open a type and <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd... | 7,536 |
<p>Is there an .net c# wrapper for the libFLAC library? If not, how can I read FLAC tags using the libFLAC in a .net framework c# application? If neither, are there other opensource libraries to read flac tags in c#? </p>
<p>Thanks!</p>
| <p>There is <a href="http://www.codeproject.com/KB/audio-video/cyber_sinh.aspx" rel="nofollow noreferrer">an article on CodeProject</a> that could be of use to you.</p>
| <p>I know I'm late to the party, but in case somebody wants that specific information, here's the Wayback machine's link:</p>
<p><a href="http://web.archive.org/web/20140122195044/http://www.codeproject.com/Articles/15332/Assembly-to-Read-and-Write-Ogg-Tags-Vorbis-FLAC-an" rel="nofollow noreferrer">http://web.archive.... | 36,622 |
<p>I have XML that looks like</p>
<pre><code><answers>
<answer>
<question-number>1</question-number>
<value>3</value>
<mean xsi:nil="1" />
</answer>
<answer>
<question-number>2</question-number>
<value>2<... | <p>do any of the answer elements have a non-null mean value?
based on roberts example</p>
<pre><code><xs:if test="(count(/answers/answer/mean[not(@xsi:nil)])>0"><xs:if>
</code></pre>
<p>EDIT:</p>
<pre><code><xs:if test="//answer/mean[not(text())]"><xs:if>
</code></pre>
<p>LAST EDIT (befor... | <p>Something like this should work. if you have any means it will return true</p>
<pre><code><xs:if test="/answers/answer/mean">You have a mean</xs:if>
</code></pre>
<p>I think this is what you mean.</p>
<p>Edit: maybe this?</p>
<pre><code><xs:if test="(count(/answers/answer/mean)==1)">You have a ... | 22,751 |
<p>Is there a sort of php script which will run a series of URLs and then direct the user to the final destination? the use of this is:
creating a checkout cart on a site that doesn't have a robust "wishlist" feature. </p>
<p>The script runs a series of "add item to cart" urls, and then the final destination takes the... | <p>Yes you can do this with ajax.</p>
<p>Use <a href="http://jquery.com" rel="nofollow noreferrer">jQuery</a> to do your ajax requests.</p>
<p>e.g</p>
<pre><code>$.get("http://mywebsite.com/json/cart_add.php?pid=25");
$.get("http://mywebsite.com/json/cart_add.php?pid=27");
</code></pre>
<p>If you use sessions then ... | <p>it really depends on specifics of your site.</p>
<p>if its oo, you may be able to call the relevant methods one after the other to add items to the basket? or you may be able to do this with includes?</p>
<p>or it may be that the site has some include files you can use?</p>
<p>or it may have a mechanism to redire... | 43,468 |
<p>I am working on a WinForms application programmed in C# .NET 2.0 and VS2008. I am just about to start translating the app into several languages. Before I start, is it a good idea to use the VS2008 itself for all the localization? Or is it better to use some external tool right away? This is my first .NET app, so I ... | <p>Who will be localizing it? Most external localization companies have utilities for this. If its yourself or your team the simplest thing is probably to use Visual Studio or something like what's mentioned here to convert it to and from a word doc:</p>
<p><a href="http://blog.vermorel.com/?p=73" rel="nofollow norefe... | <p>I finished the work on a site (<a href="http://refulog.de" rel="nofollow noreferrer">REFULOG</a>) and I generated the .resx files for every page (Tools/Generate Local Resource; Make sure you are in design or split mode, otherwise the menu item does not appear).
After this I tested the app called <a href="http://resx... | 14,762 |
<p>The following code works for 90+ % of global security groups, but for one very large global security group, it returns an enumerator, but no member objects of the group, even though the group has many thousands.</p>
<pre><code>DirectoryEntry group = groupResult.GetDirectoryEntry();
filter = "member;range=0-20";
gro... | <p>The problem may not be with your code, but with access security in your directory - you may not have rights to enumerate the members of that group.</p>
| <p>Is it possible that the LDAP server has limits set on how large a return set, or amount of time it may spend, in a single response?</p>
<p>As always, test with a third party LDAP Browser and see if you can get it that way. That tests the authentication and rights issue, as well as whether the server is limiting th... | 40,811 |
<p>I'm trying to load spring beans using XmlWebApplicationContext setConfigLocations method. However, I keep getting a </p>
<pre><code>BeanIsAbstractException
</code></pre>
<p>I know that the bean is abstract, I have it configured this way, so Spring should know not to try to instantiate it.</p>
<p>I'm using Spring... | <pre><code>map.put(beansName[mnCnt], factory.getBean(beansName[mnCnt]));
</code></pre>
<p>There's your problem, isn't it? By calling getBean with the name of the abstract bean, you try to instantiate it, which will generate an exception.</p>
| <p>Spring bean:</p>
<pre><code><bean id="ThreadPool" abstract="true" class="com.sample.ThreadPoolFactoryBean"/>
</code></pre>
<p>Code:</p>
<pre><code>ctx = appContext;
appContext.refresh();
BeanFactory factory = appContext.getBeanFactory();
String[] beansName = appContext.getBeanFactory()
... | 38,710 |
<p>I am application developer and don't know much about virtual machine(VM).
however, our application is resided on a VM. frequent patch need be apply to fix/update this application. For diaster recovery, It was suggest to backup every thing on the server. so, once server is restored, no application need be re-install... | <p>Cloning is perfectly acceptable.</p>
<p>You don't have to backup to tape... It can be done to a NAS for example, and with the proper security and setup, backups cannot be deleted by unauthorized people.</p>
| <p>You can use any NAS and VM replication software like Veeam, Acronis or <a href="https://www.nakivo.com/" rel="nofollow noreferrer">Nakivo</a>. It will totally solve your problems. All software has various permission settings so you can control who can and who can not delete your data.</p>
| 22,290 |
<p>I wanna get the Timedate value from another page using request.querystring and then use it an query to compare and pull up the matching datas. The function for the query in linq is:</p>
<pre><code> protected void User_Querytime()
{
DataClasses2DataContext dc1 = new DataClasses2DataContext();
String D... | <p>Do you mean Convert.ToDateTime? This returns DateTime (not bool).
Do you mean DateTime.TryParse? Simply use any of:</p>
<pre><code>DateTime when = DateTime.Parse(data);
DateTime when = DateTime.ParseExact(data);
DateTime when = Convert.ToDateTime(data);
</code></pre>
<p>Then use "when" in the query. I'm not sure t... | <p>the TryParse indeed results a bool (as the success of the parsing):</p>
<pre><code>Dim DateText = Request.QueryString("date")
Dim MyDate As DateTime = Nothing
If DateTime.TryParse(DateText, MyDate) Then
'--Date was passed correctly
End If
</code></pre>
<p>regards
Christoph</p>
| 27,051 |
<p>Grasping at straws here... I work with a VB6 desktop system using several 2003-style Access databases (.MDB). Recently, I changed the first function from VB6 to VB.NET, still using an Access database. This is more than a conversion, but a rewrite with additional functionality. It is still fairly simple functional... | <p>Rebooting while updating an access database can trash it.</p>
<p>You need some more info so that you have a better understanding of what is going on. They need to collect some information for you on a workstation that is having the problem. Using task manager you can have them get the following info:</p>
<ul>
<l... | <p>Sounds like a big memory leak to me. </p>
<p>Some customers will leave your application running for longer than others, and will be harder hit.</p>
<p>Using Access where there are more than a few concurrent users inevitably results in pain.</p>
| 35,627 |
<p>The single timing column in the weblog naturally includes client transmission timing. For anamoly analysis, I want to differentiate pages that took excessive construction time from requests that simply had a slow client.</p>
<p>For buffered pages, I've looked at the ASP.NET page lifecycle model and do not see wher... | <p>You could use a Stopwatch in the BeginRequest and the PreSendRequestContent as mentioned in the other two answers, or you could just use the request's Timestamp in the PreSendRequestContent.</p>
<p>For example, on <a href="http://www.singingeels.com/" rel="nofollow noreferrer">SingingEels</a>, I added this to the b... | <p>the easist way would probably be to use the follow events in the global.asax file:</p>
<p>protected void Application_BeginRequest(Object sender, EventArgs e)<br>
protected void Application_EndRequest(Object sender, EventArgs e)</p>
<p>You could also implement a custom httpmodule</p>
| 9,678 |
<p>In Delphi 2009 whereabouts do you turn on the option to treat warnings as errors?</p>
| <p>Just found the answer soon after I posted this! Might be useful for other people.</p>
<p>Navigate to '<code>Project -> Options - > Delphi Compiler -> Hints and Warnings</code>' and change the value of '<code>Output Warnings</code>' to '<code>as errors</code>'</p>
<p>I was looking for an option similar to... | <p>The point about -W^ being problematic within BAT files is a good one. Using -W^^ works if you are modifying the compile line directly. Otherwise, I found that using surrounding double quotes "-W^" works, for example when building an env var that contains all compiler parameters, that env var being subsequently pas... | 33,632 |
<p>So am I crazy for considering doing a beta/production release on Glassfish V3 Prelude?
Since all of my content is dynamic, I'm not even thinking of bothering to set up apache in front either. Doing so complicates the setup by requiring something like AJP or mod_jk and will not offer us much in terms of capability.<... | <p>They use the MPVolumeView, simple add it and it's makes the rest when the user touch it. Note: Doesn't work in iPhone Simulator. I think the release note also mentioned do not use it direct in Interface Builder. </p>
<pre><code>MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(25, 378, 270, ... | <p>Here is another (complete) example of setting the hardware volume AND retrieving the volume after pressing the hardware keys:</p>
<pre><code>// AVAudiosession Delegate Method
- (void)endInterruptionWithFlags:(NSUInteger)flags
{
// When interruption ends - set the apps audio session active again
[[AVAudioSe... | 26,491 |
<p>I am making a "fun button", with a dome-shaped top. The vertical sides, top center, and raised lettering seem fine, but the more sloped outer parts of the dome are very thin, with some gaps and the infill pattern is quite visible. It's almost like the slicer isn't recognizing the sloped part as an exterior shell. </... | <p>Slice with more solid top layers. I always use five with low-density infill.</p>
| <p>You can either increase the shells, or you can increase the infill density. In addition different fill patterns will help. I would do 4 minimum for such a print.</p>
| 497 |
<p>Is it possible to have a C static library API, which uses C++ internally and hide this from users of the library?</p>
<p>I have writen a portable C++ library I wish to statically link to an iPhone application.</p>
<p>I have created an Xcode project using the Max OS X 'static library' template, and copied the sourc... | <p>It's too hard to do this in comments, so I'm just going to demonstrate for you quickly what the linking issues are that you're having. When Xcode encounters files, it uses build rules based on the suffix to decide which compiler to use. By default, gcc links the files to the standard C library, but does not link wit... | <p>Basically when you compile the C functions with a C++ compiler it mangles the function names and uses the C++ ABI.</p>
<p>When you use the *.cpp or *.mm extension you are using the C++ compiler.</p>
<p>What you want to do is force the compiler to generate C functions with un-mangles names and using the C ABI.</p>
... | 49,351 |
<p>I've added a jpg file to the App_localResources folder and in the document properites specified the photo in the Background propery. In the designer it shows up as the background but when i run the page i still get the white page background.</p>
| <p>There's no distinctly ASP.Net way of doing this.</p>
<p>The canonical HTML way is to include this CSS:</p>
<pre><code>body { background-image: url('background.jpg'); }
</code></pre>
<p>If you defined the body tag with <code>runat="server"</code> you could add the style inline using the Attributes property, but th... | <p>Guessing that perhaps you have a stylesheet which might be overriding the background?</p>
| 41,246 |
<p>We're using CruiseControl.NET to manage our builds and we're in the process of obtaining a new build server. I've been tasked with coming up with the spec for the new server.</p>
<p>This server will need to run multiple builds concurrently and as effeciently as possible.</p>
<p>What would you consider the ideal sp... | <p>I would also point out that all of the above recommendations depend on what you are using to compile. If you are using the VisualStudio command line for instance, you will be very sad the first time you try concurrent builds. Also how many builds will be going on, if they are concurrent. Most people try beefing up b... | <p>Make sure the spec includes a multi-core processor, and fast HDDs (10000RPM). </p>
| 22,367 |
<p>I have a table in my database the records start and stop times for a specific task. Here is a sample of the data:</p>
<pre><code>Start Stop
9/15/2008 5:59:46 PM 9/15/2008 6:26:28 PM
9/15/2008 6:30:45 PM 9/15/2008 6:40:49 PM
9/16/2008 8:30:45 PM 9/15/2008 9:20:29 PM
9/16/2... | <pre><code>SELECT SUM( CASE WHEN Stop = '31 dec 9999'
THEN DateDiff(mi, Start, Stop)
ELSE DateDiff(mi, Start, GetDate())
END ) AS TotalMinutes
FROM task
</code></pre>
<p>However, a better solution would be to make the <code>Stop field nullable, and make it null... | <p>The <a href="http://msdn.microsoft.com/en-us/library/ms189794.aspx" rel="nofollow noreferrer">datediff function</a> can display the elapsed minutes. The if statement for the 12/31/9999 check I'll leave as an excercise for the reader ;-)</p>
| 10,762 |
<p>I have a toolstrip containing, among other things, a ToolStripComboBox and a ToolStripButton. I want to add a ContextMenuStrip to both of them, but I don't have direct access to the toolstrip or its other contents, so I can't set the context menu of the toolstrip.</p>
<p>Setting the ContextMenuStrip for the ToolSt... | <p>What Jeff Yates has suggested should work. </p>
<p>However, another alternative is to create your own derived classes (MyToolSTripButton, MyToolStripTextBox ...etc) give these items a ContextMenuStrip property that you can set at design time, and have your derived classes detect the right mouse down, or whatever ot... | <p>It's because a ToolStripComboBox contains "System.Windows.Forms.ComboBox" control, but "ToolStripButton" does not contains "System.Windows.Forms.Control". Its special toolstrip item, which's button is maintained by toolstip.</p>
<p>You should use ContextMenu on toolstip or you can add dropdown to toolstripbutton it... | 35,924 |
<p>Is there a reliable way to detect whether or not WinHelp is installed on Windows Vista or newer versions of Windows? If possible, I'd like a solution that's not specific to any particular version of Windows.</p>
<p>I've posted this question to other message boards and got back answers regarding the size of Winhlp32... | <p>The download for WinHelp from Microsoft appears to be a hotfix (.msu) that enables the WinHelp program. This would explain why the size/registry keys don't change as the hotfix is just a "delta" change from the orginal file. </p>
<p>Since it's a hotfix, this means that you should be able to query the installed ho... | <p>I hate to say it, but move on from WinHelp. It's been deprecated for a reason. We were able to migrate to a .chm in only a few hours. It's pretty straight-forward to use the newer help authoring tools, and newer formats like .chm give you benefits like cascading style sheets. </p>
| 9,114 |
<p>Any XPath like /NodeName/position() would give you the position of the Node w.r.t it's parent node.</p>
<p>There is no method on the XElement (Linq to XML) object that can get the position of the Element. Is there?</p>
| <p>Actually NodesBeforeSelf().Count doesn't work because it gets everything even of type XText</p>
<p>Question was about XElement object.
So I figured it's </p>
<pre><code>int position = obj.ElementsBeforeSelf().Count();
</code></pre>
<p>that should be used,</p>
<p>Thanks to Bryant for the direction.</p>
| <pre><code>static int Position(this XNode node) {
var position = 0;
foreach(var n in node.Parent.Nodes()) {
if(n == node) {
return position;
}
position++;
}
return -1;
}
</code></pre>
| 19,863 |
<p>I have a list of tables i.e. student, teacher, staff, dept. and so on and each of these tables have comments specific to them. Now one record in a table can have one or many comments that shows it's a one to many relation from any table to comments table. I don't know what the best way is to relate comments table to... | <p>Lets assume that your tables (student, teacher, staff, dept) all have a int primary key named Id.</p>
<p>For your comments table you could create a table.</p>
<pre><code>Id int
CommentType enum (student, teacher, staff, dept)
LinkId int
Comment
</code></pre>
<p>A row in Comments might look like this</p>
<pre><co... | <p>is a student or teacher or staff not just a type of person..</p>
<p>so you have a person and a person can have many comments? so you have a personscomments table with a relation to that person and why have a remarks table..is a remark not just a type of comment..</p>
<p>its hard to see without a more in-depth sche... | 38,184 |
<p>I'm trying to import a large SQL file; created by mysqldump on one server, then converted with iconv; using these commands:</p>
<pre><code>$ mysqldump -uxxx -p xxx > data.sql
$ iconv -f UTF-8 -t ISO-8859-1//TRANSLIT data.sql data.iconv.sql
</code></pre>
<p>I noticed that the "\x91" in the database had turned in... | <p>On my system, mysqld defaults to saving data in latin1 with swedish collation. Similarly, the mysql command-line client defaults to providing data in latin1. mysqldump, on the other hand, defaults to utf-8.</p>
<p>This causes problems when exporting data via mysqldump and then importing using the mysql command-li... | <p>Try:-</p>
<p>iconv -f IBM-1252 -t ISO-8859-1</p>
<p>Not sure why my previous reply was marked down.
utf-8 is not ASCII! All the 7bit utf chars are identical to the 7 bit ASCI character set but the first bit b'1000000' has special meaning in UTF-8 and indicates that the character is a unicode two three or four byte... | 38,227 |
<p>Is having to recycle an App-Pool in ASP.NET indicative of a larger problem in the Web-App? Or is this just 'the way things are' for ASP.NET and IIS? </p>
<p>Edit: Since one of the errors is an 'OutOfMemory' exception, what would be your suggestions for courses of action? Would you add memory? Profile the app? (It's... | <p>The health monitoring features of IIS enable automatic recycling of an app pool. So an app pool just recycling itself is not necessarily indicative of a problem; it could just be the preventive feature of IIS is turned on. The idea is that if your application has a memory leak or forgets to deallocate something, we ... | <p>Personally, I think it's a sign of bigger problems. I have apps that run for weeks without recycling. The only reason they do recycle is because we push code updates. I think you should look into your event log to see if you can find any reason why the app pool is recycling. I've seen it happen quite often with ... | 46,734 |
<p>I want to see the stack trace in any function of my code, so i made somthing like this to call it and print the stack trace:</p>
<pre><code>public function PrintStackTrace() {
try {
throw new Error('StackTrace');
} catch (e:Error) {
trace(e.getStackTrace());
}
}
</code></pre>
<p>I like ... | <p>As far as I know, the only way to make the stack trace available to your own code is via the <a href="http://livedocs.adobe.com/flex/3/langref/Error.html#getStackTrace()" rel="noreferrer">getStackTrace()</a> method in the Error class, just like you're already doing. In response to the example in your question, thoug... | <p>The <code>getStackTrace</code> method returns the stack trace only on the debug flash player (<a href="https://www.adobe.com/support/flashplayer/debug_downloads.html" rel="nofollow">https://www.adobe.com/support/flashplayer/debug_downloads.html</a>), on the release player returns <code>null</code>. Make sure you hav... | 17,967 |
<p>I'm developing a cart that needs to calculate tax and am looking for a 3rd party tax service to handle the calculations. </p>
<p>I've used Avalara in another app, but it's somewhat miserable since I have to use the Rjb gem with their java library.</p>
<p>Does anyone have a recommendation for a tax service that wo... | <p>I don't know what capabilities for tax calculations are in the library, but ActiveMerchant is an awesome utility for E-Commerce applications. It is well documented and in active development. </p>
<p>Its variety of payment processors might provide you with the calculations you need.</p>
<p><a href="http://www.activ... | <p>We use <a href="http://strikeiron.com/" rel="nofollow">StrikeIron</a> in our applications.</p>
<p>To be honest, it's <em>not</em> the most awesome interface to interact with (unless you really love SOAP). You still have to handle all tax logic in your application, of course, but if you need tax rates broken down by... | 22,299 |
<p>Is there a way of wrapping text in a non-rectangular container in WPF?</p>
<p><a href="http://www.photoshopessentials.com/photoshop-text/text-effects/text-wrap/page-3.php" rel="noreferrer">Here is how it is done in photoshop</a></p>
| <p>Unfortunately there isn't a straightforward way without making a complete implementation of a TextFormatter. <a href="http://msdn.microsoft.com/en-us/library/ms754036.aspx" rel="noreferrer">MSDN article on the basics of an Advanced TextFormatter</a>: </p>
<blockquote>
<p>The text layout and UI controls in WPF pro... | <p>Have you looked at the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.clip.aspx" rel="nofollow noreferrer">UIElement.Clip</a> property?</p>
<p>For non-rectangular text wrapping, you could try setting a TextBlock.Clip property to a non-rectangular Geometry object. I haven't tried this; eit... | 13,403 |
<p>Currently I use this reg ex:</p>
<pre><code>"\bI([ ]{1,2})([a-zA-Z]|\d){2,13}\b"
</code></pre>
<p>It was just brought to my attention that the text that I use this against could contain a "<code>\</code>" (backslash). How do I add this to the expression?</p>
| <p>Add <code>|\\</code> inside the group, after the <code>\d</code> for instance.</p>
| <p>Both @slavy13 and @dreftymac give you the basic solution with pointers, but...</p>
<ul>
<li>You can use <code>\d</code> inside a character class to mean a digit.</li>
<li>You don't need to put blank into a character class to match it (except, perhaps, for clarity, though that is debatable).</li>
<li>You can use <co... | 46,216 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.