instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I am trying to improve the performance of a web application. I have metrics that I can use to optimize the time taken to return the main HTML page, but I'm concerned about the external CSS and JavaScript files that are included from these HTML pages. These are served statically, with HTTP Expires headers, but are ... | <p><strong>Context:</strong> While it's true that HTTP overhead is more significant than parsing JS and CSS, ignoring the impact of parsing on browser performance (even if you have less than a meg of JS) is a good way to get yourself in trouble.</p>
<p>YSlow, Fiddler, and Firebug are not the best tools to monitor pars... | <p>I believe <a href="http://developer.yahoo.com/yslow/" rel="nofollow noreferrer">YSlow</a> does, but be aware that unless all requests are over a loopback connection you shouldn't worry. The HTTP overhead of split-up files will impact performance <em>far</em> more than parsing, unless your CSS/JS files exceed several... | 6,916 |
<p>How can I write an insert statement which includes the & character? For example, if I wanted to insert "J&J Construction" into a column in the database.</p>
<p>I'm not sure if it makes a difference, but I'm using Oracle 9i.</p>
| <p>I keep on forgetting this and coming back to it again! I think the best answer is a combination of the responses provided so far.</p>
<p>Firstly, & is the variable prefix in sqlplus/sqldeveloper, hence the problem - when it appears, it is expected to be part of a variable name.</p>
<p>SET DEFINE OFF will stop ... | <p>If you are using sql plus then I think that you need to issue the command </p>
<pre><code>SET SCAN OFF
</code></pre>
| 18,440 |
<p>Is there a destructor for Java? I don't seem to be able to find any documentation on this. If there isn't, how can I achieve the same effect?</p>
<p>To make my question more specific, I am writing an application that deals with data and the specification say that there should be a 'reset' button that brings the app... | <p>Because Java is a garbage collected language you cannot predict when (or even if) an object will be destroyed. Hence there is no direct equivalent of a destructor.</p>
<p>There is an inherited method called <code>finalize</code>, but this is called entirely at the discretion of the garbage collector. So for classes... | <p>I used to mainly deal with C++ and that is what lead me to the search of a destructor as well. I am using JAVA a lot now. What I did, and it may not be the best case for everyone, but I implemented my own destructor by reseting all the values to either 0 or there default through a function.</p>
<p>Example:</p>
<pr... | 20,731 |
<p>I've never actually used greasemonkey, but I was considering using it.
Considering that GreaseMonkey allows you to let random people on the Internet change the behavior of your favorite websites, how safe can it be?
Can they steal my passwords? Look at my private data? Do things I didn't want to do?
How safe is Grea... | <p><em>Considering that GreaseMonkey allows you to let random people on the Internet change the behavior of your favorite websites, how safe can it be?</em></p>
<p>It's as safe as you allow it to be - but you aren't very clear, so let's look at it from a few perspectives:</p>
<h2>Web Developer</h2>
<p>Greasemonkey c... | <p>When used with discretion, Greasemonkey should be perfectly safe to install and use. While it is definitely possible to do all manners of mischief with carte-blanche Javascript access to pages, Greasemonkey scripts are restricted to specific URLs, and will not run on sites that are not specified by the URL patterns ... | 40,850 |
<p>So is there a way to initialize and start a command line Spring app without writing a main method. It seems like all such main methods have the same form</p>
<pre><code>public static void main(final String[] args) throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("context.xml", Boot... | <p>I'll try to answer the question as I understand it: </p>
<blockquote>
<p>How to package a jar containing a spring configuration such as I just need to use <code>java -jar myjar.jar</code>?</p>
</blockquote>
<p>The code snippet you have in your question simply works. You don't have to parameterise the <code>conte... | <p>Yes. Write a simple <code>SpringMain</code> which takes an arbitrary number of <code>xml</code> and <code>properties</code> files as the arguments. You can then (in the main method) initialize an application from these files. Starting your program is then simply a matter of:</p>
<pre><code>java -cp myapp.jar util.S... | 20,639 |
<p>I have an entity that maps to an external oracle table which is one of the primary data sources of my application. This entity is modelled using hibernate.</p>
<p>The oracle table now has a complex function defined the calculates some special values. I need to call this function somehow - almost as another accessor... | <p>I have a solution using the @Formula annotation</p>
| <p>You could call the function directly using a stored procedure with HQL. Unless, of course, you're going to have to call this function for every entry in the table. But if you do it within the same hibernate session, as long as you aren't doing to many calls at the same time, this should work without a significant pe... | 41,905 |
<p>Whats the best way to round in VBA Access?</p>
<p>My current method utilizes the Excel method</p>
<pre><code>Excel.WorksheetFunction.Round(...
</code></pre>
<p>But I am looking for a means that does not rely on Excel.</p>
| <p>Be careful, the VBA Round function uses Banker's rounding, where it rounds .5 to an even number, like so: </p>
<pre><code>Round (12.55, 1) would return 12.6 (rounds up)
Round (12.65, 1) would return 12.6 (rounds down)
Round (12.75, 1) would return 12.8 (rounds up)
</code></pre>
<p>Whereas the Excel Worksheet... | <pre><code>VBA.Round(1.23342, 2) // will return 1.23
</code></pre>
| 16,588 |
<p>I'm aware of things like <code>onchange</code>, <code>onmousedown</code> and <code>onmouseup</code> but is there a good reference somewhere that lists all of them complete with possibly a list of the elements that they cover?</p>
| <p>W3Schools seems to have a good Javascript events reference: <a href="http://www.w3schools.com/jsref/dom_obj_event.asp" rel="noreferrer">HTML DOM Events</a></p>
| <p>Here is a pretty good JavaScript event reference with the elements they are for:<br>
<a href="http://www.globalguideline.com/JavaScript_Guide/Java_Script_Events.php" rel="nofollow noreferrer">JavaScript Tutorial >> JavaScript Events</a></p>
| 2,840 |
<p>So standard Agile philosophy would recommend making your domain classes simple POCOs which are Persisted using a separate proxy layer via data access objects (like NHibernate does it). It also recommends getting as high unit test coverage as possible. </p>
<p>Does it make any sense to write tests for these simple ... | <p>Typically a value object like that doesn't need to have its own tests. You'll get coverage from the classes that use it to actually do something.</p>
<p>The unit tests are designed to test behavior. No behavior? No need for a test.</p>
| <p>I'd argue that this isn't even an object - and object is defined by its behavior, and this class doesn't have any. It's a pure data container. It's ok to have those, too - and they typically don't need any tests -, but Beware that you don't end up with an <a href="http://www.martinfowler.com/bliki/AnemicDomainModel.... | 37,402 |
<p>I'm thinking about building my own 3D printer/Laser Engraver/CNC. Since all use a standard Cartesian axis I wanted to be able to swap out tool heads depending on the purpose. I have everything thought out except the coding aspect of the project.</p>
<p>I currently own a 3D printer and am familiar with some of the c... | <p>The foundation of any 3D printer is the controller and the firmware. Many devices are based on Arduino type controllers, with stepper motor driver boards either integrated or added as a plug-in component.</p>
<p>Some manufacturers will use in-house or outside resources and develop their own boards and firmware.</p>... | <p>this is an extension to fred_dot_u answer.
As I am in the process of building my own printer, I decided to use RAMPS Arduino shield for electronics and Marlin firmware + Arduino mega2560 as a logic controller. </p>
<p>As above are battle-tested, I don't need to discover wheel again, but rather focus on the mechani... | 884 |
<p>As I browse through the site, I find a lot of terms that many developers just starting out (and even some advanced developers) may be unfamiliar with.</p>
<p>It would be great if people could post here with a term and definition that might be unknown to beginners or those from different programming backgrounds. </p... | <p>You need to decorate the ListView property with the DesignerSerializationVisibility attribute, like so:</p>
<pre><code>[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ListView MyListView { get { return this.listView1; } }
</code></pre>
<p>This tells the designer's code generator t... | <p>Just so I'm clear, you've done something like this, right?</p>
<pre><code>public ListView MyListView { get { return this.listView1; } }
</code></pre>
<p>So then you are accessing (at design time) the MyListView property on your UserControl?</p>
<p>I think if you want proper design-time support you're better off c... | 3,654 |
<p>I have a table where I store customer sales (on periodicals, like newspaper) data. The product is stored by issue. Example</p>
<pre>
custid prodid issue qty datesold
1 123 2 12 01052008
2 234 1 5 01022008
1 123 1 5 01012008
2 444 2 ... | <p>Assuming that "latest" is determined by date (rather than by issue number), this method is usually pretty fast, assuming decent indexes:</p>
<pre><code>SELECT
T1.prodid,
T1.issue
FROM
Sales T1
LEFT OUTER JOIN dbo.Sales T2 ON
T2.custid = T1.custid AND
T2.prodid = T1.prodid AND
T2.dateso... | <p>To query on existing growing historical table is way too slow!</p>
<p>Strongly suggest you create a new table tblCustomerSalesLatest which stores the last issue data of each customer. and select from there. </p>
| 47,127 |
<p>I want alwaysPositive to be assigned a positive number with all possible values for lareValue1 and largeValue2 (these are at least 1).</p>
<p>The following statement causes a buffer overflow:</p>
<pre><code>int alwaysPositive = (largeValue1 + largeValue2) / 2;
</code></pre>
<p>I know I can prevent it by substract... | <p>You can do it this way: </p>
<pre><code> x = largeValue1;
y = largeValue2;
return (x&y)+((x^y)/2);
</code></pre>
<p>That's a bit-twiddling way to get the average of two integers without overflow.</p>
<p>If you want you can replace the division by two with a bit-shift, but the compiler will do that for y... | <p>You could use uints:</p>
<pre><code>uint alwaysPositive = (uint)(largeValue1 + largeValue2) / 2;
</code></pre>
| 14,305 |
<p>I have code similar to this filtering entries in an Array of Objects:</p>
<pre><code>var filterRegex = new RegExp(".*blah.*","ig");
if (filterRegex.test(events[i].thing) && events[i].show) {
console.log("SUCCESS: filtering thing " + i + " " + events[i].thing);
events[i].show = false;
numevents--... | <p>Ok, i see it now. The key to your problem is the use of the <code>g</code> (global match) flag: when this is specified for a regex, it will be set up such that it can be executed multiple times, beginning each time at the place where it left off last time. It keeps a "bookmark" of sorts in its <code>lastIndex</code>... | <p>I just can't imagine there is any situation where two JavaScript expressions evaluate to true individually, but not when combined.</p>
<p>Are you sure both expressions actually produce a boolean value every time? (Okay, to make <code>regex.test()</code> not produce a boolean value is difficult, but how about <code>... | 25,738 |
<p>I have an AppleScript program which creates XML tags and elements within an Adobe InDesign document. The data is in tables, and tagging each cell takes .5 seconds. The entire script takes several hours to complete.</p>
<p>I can post the inner loop code, but I'm not sure if SO is supposed to be generic or specific. ... | <p>I figured this one out.</p>
<p>The document contains a bunch of data tables. In all, there are about 7,000 data points that need to be exported. I was creating one root element with 7,000 children.</p>
<p>Don't do that. Adding each child to the root element got slower and slower until at about 5,000 children Apple... | <blockquote>
<p>I can post the inner loop code, but I'm not sure if SO is supposed to be generic or specific. I'll let the mob decide.</p>
</blockquote>
<p>The code you post as an example can be as specific as you (or your boss) is comfortable with - more often than not, it's easier to help you with more specific de... | 3,266 |
<p>We have a application where users enter prices all day. These prices are recorded in a table with a timestamp and then used for producing charts of how the price has moved... Every now and then the user enters a price wrongly (eg. puts in a zero to many or to few) which somewhat ruins the chart (you get big spikes).... | <p>Calculate and track the <a href="http://en.wikipedia.org/wiki/Standard_deviation" rel="nofollow noreferrer">standard deviation</a> for a while. After you have a decent backlog, you can disregard the outliers by seeing how many standard deviations away they are from the mean. Even better, if you've got the time, you ... | <p>You could measure the standard deviation in your existing population and exclude those that are greater than 1 or 2 standard deviations from the mean?</p>
<p>It's going to depend on what your data looks like to give a more precise answer...</p>
| 11,666 |
<p>I would like to use databinding when displaying data in a TextBox. I'm basically doing like:</p>
<pre><code> public void ShowRandomObject(IRandomObject randomObject) {
Binding binding = new Binding {Source = randomObject, Path = new PropertyPath("Name")};
txtName.SetBinding(TextBox.TextProperty, bin... | <p>When available</p>
<pre><code>BindingOperations.ClearBinding(txtName, TextBox.TextProperty)
</code></pre>
<p>For older SilverLight versions, but not reliable as stated in comments:</p>
<pre><code>txtName.SetBinding(TextBox.TextProperty, null);
</code></pre>
<p>C# 6.0 features enabled</p>
<pre><code>this.btnFini... | <p>How about just</p>
<pre><code>txtName.Text = txtName.Text;
</code></pre>
<p>You would have to set the value after clearing it anyways.
This works in SL4 at least.</p>
| 22,561 |
<p>I'm developing a web app. In it I have a section called categories that every time a user clicks one of the categories an update panel loads the appropriate content. </p>
<p>After the user clicked the category I want to change the browser's address bar url from</p>
<pre><code>www.mysite.com/products
</code></pre>... | <p>With HTML5 you can modify the url without reloading:</p>
<p>If you want to make a new post in the browser's history (i.e. back button will work)</p>
<pre><code>window.history.pushState('Object', 'Title', '/new-url');
</code></pre>
<p>If you just want to change the url without being able to go back</p>
<pre><code... | <p>This cannot be done the way you're saying it. The method suggested by somej.net is the closest you can get. It's actually very common practice in the AJAX age. Even Gmail uses this.</p>
| 45,876 |
<p>Does anyone know how to iterate over a generic list if the type of that list isn't known until runtime?</p>
<p>For example, assume <code>obj1</code> is passed into a function as an <code>Object</code>:</p>
<pre><code>Dim t As Type = obj1.GetType
If t.IsGenericType Then
Dim typeParameters() As Type = t.GetGener... | <p>If you know that obj is a <a href="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx" rel="nofollow noreferrer">Generic List</a>. Then you're in luck.</p>
<p>Generic List implements IList and IEnumerable (both are non-generic). So you could cast to either of those interfaces and then For Each over them.</p>
<... | <p>If you know that obj is a <a href="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx" rel="nofollow noreferrer">Generic List</a>. Then you're in luck.</p>
<p>Generic List implements IList and IEnumerable (both are non-generic). So you could cast to either of those interfaces and then For Each over them.</p>
<... | 33,880 |
<p>I have a piece of an application that is written in C, it spawns a JVM and uses JNI to interact with a Java application. My memory footprint via Process Explorer gets upto 1GB and runs out of memory. Now as far as I know it should be able to get upto 2GB. One thing I believe is that the memory the JVM is using is... | <p>There could be a leak in the JNI code.</p>
<p>Remember to use (*jni)->DeleteLocalRef() for any object references you get once you are done with them. If you use any native C buffers to create new Java objects, make sure you free them off once the object is created. Check the JNI Specification for further guidelin... | <p>Write a C test harness and use valgrind/alleyoop to check for leakage in your C code, and similarly use the java jvisualvm tool.</p>
| 13,003 |
<p>I have an Infopath 2007 form hosted on MOSS 2007. The code behind the form is written in C#. In this context, <code>System.Environment.MachineName</code> return the server name.</p>
<p>How can I get the name of the computer from which the client is filling this form?</p>
| <p>Would ASP.NET's Request.ServerVariables("REMOTE_ADDR") help?</p>
| <p>You can simply add a rule and assign any field you like the value from this xpath: <strong>xdUser:get-UserName()</strong>. This returns the users login name.</p>
| 25,967 |
<p>I want to run program on background . pref C#
I want put icon in the tray.
On specified time it’s synchronizes folders (I know how to sync folders) .
How to run it on background and start sync ( for example at 2am)?</p>
| <p>You need to consider using the <a href="http://msdn.microsoft.com/msdnmag/issues/07/10/WindowsCPP/" rel="nofollow noreferrer">windows scheduler service</a>.</p>
| <p>To run "in background"</p>
<pre><code>Form.Visible = False
Form.ShowInTaskbar = False
</code></pre>
<p>To start the synchronization, use a Timer and...</p>
<ul>
<li>Check the time every minute, start synch if the time matches</li>
<li>OR calculate the interval Now->TimeToStart, set it, start the Timer, and reset ... | 40,444 |
<p>Does the HTML "select" element have an on select event? what exactly is the name of the event?</p>
| <p>Is <a href="http://www.w3.org/TR/html401/interact/scripts.html#adef-onchange" rel="noreferrer"><code>onchange</code></a> what you're looking for?</p>
| <p>Regardless of input type, whenever a form input changes value, an <code>onchange</code> event should always be thrown. (With the exception of buttons, as they are not really input devices as such.)</p>
| 30,092 |
<p>Does any one know how do I get the current open windows or process of a local machine using Java? </p>
<p>What I'm trying to do is: list the current open task, windows or process open, like in Windows Taskmanager, but using a multi-platform approach - using only Java if it's possible.</p>
| <p>This is another approach to parse the the process list from the command "<strong>ps -e</strong>":</p>
<pre><code>try {
String line;
Process p = Runtime.getRuntime().exec("ps -e");
BufferedReader input =
new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.r... | <pre><code>package com.vipul;
import java.applet.Applet;
import java.awt.Checkbox;
import java.awt.Choice;
import java.awt.Font;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Batc... | 7,828 |
<p>I am am trying to load a SQL table from a flat file. The flat i am talking about is a comma separated file. This has all the data required to populate a table will each column separated by a comma ",". I need some way by which i can load this content into the table faster.</p>
| <p>If you are using SQL Server, use <a href="http://msdn.microsoft.com/en-us/library/ms188365.aspx" rel="nofollow noreferrer"><code>BULK INSERT</code></a></p>
<p>If you are using Oracle, see my answer <a href="https://stackoverflow.com/questions/120001/load-excel-data-sheet-to-oracle-database#120021">here</a></p>
| <p>This sounds a little bit old-fashioned, but I use an editor which has the capability to record and replay macros for such works.</p>
<p>I use Textpad (<a href="http://www.textpad.com" rel="nofollow noreferrer">www.textpad.com</a>) for this (yes, I bought a license), you might also use UltraEdit (<a href="http://www... | 17,863 |
<p>After building a Delta printer, I noticed that my whole prints are slightly tilted around the Z-axis in comparison to the slicer (e.g. Cura). There is no twist layer wise. This means, the prints themself look actually perfect. </p>
<p>I just don't know what could be the reason of the rotation. I do not believe it i... | <p>I figured out that the reason is probably a slightly translated slider construction. Instead of using a proper centered slider as shown in <strong>red</strong>, I used a slider construction like illustrated in <strong>yellow</strong>. When all sliders are translated on each tower like this, the print should be tilte... | <p>If I am reading this correctly, your prints are being either stretched or your prints are shifting / leaning on more complicated prints. </p>
<p>In this case, given that you are on a Delta printer, my answer is the same for all. I usually do Cartesian based 3d printing but the concept is the same for any drifting o... | 1,077 |
<p>Postgres 8.3 is installed on a windows 2008 server.
Ruby 1.8-6 installed.
gem install ruby-postgres.</p>
<p>When trying a simple connect I get </p>
<h2>ruby.exe - Ordinal Not Found</h2>
<h2>The ordinal 284 could not be located in the dynamic link library SSLEAY32.dll.</h2>
<h2>OK</h2>
<p>There seems to be some ... | <p>Any even better solution, in so far as using the latest binaries for OpenSSL, is to rename both libeay32.dll and ssleay32.dll in both the ruby\bin folder and also the posgresql\lib folder and install the latest OpenSSL from <a href="http://www.slproweb.com/products/Win32OpenSSL.html" rel="noreferrer">http://www.slpr... | <p>To get a minimal thing without doing to much stuff under windows.</p>
<p>use: gem install ruby-postgres</p>
<p>then install the windows version of pgadmin and use all the needed files from there
(cp from pgadmin\bin to ruby\bin or by setting PATH to the pgadmin\bin) </p>
| 49,468 |
<p>What tools are available for metamodelling? </p>
<p>Especially for developing diagram editors, at the moment trying out <a href="http://www.eclipse.org/modeling/gmf/" rel="nofollow noreferrer">Eclipse GMF</a></p>
<p>Wondering what other options are out there?
Any comparison available?</p>
| <p>Your question is simply too broad for a single answer - due to many aspects.</p>
<p>First, meta-modelling is not a set term, but rather a very fuzzy thing, including modelling models of models and reaching out to terms like MDA.</p>
<p>Second, there are numerous options to developing diagram editors - going the Ec... | <p>Although generally a UML tool, I would look at <a href="http://staruml.sourceforge.net/en/" rel="nofollow noreferrer">StarUML</a>. It supports <a href="http://staruml.sourceforge.net/en/modules.php" rel="nofollow noreferrer">additional modules beyond what are already built in</a>. If it doesn't have what you need bu... | 7,485 |
<p>What are some of the ways you have implemented models in the Zend Framework?</p>
<p>I have seen the basic <code>class User extends Zend_Db_Table_Abstract</code> and then putting calls to that in your controllers: </p>
<p><code>$foo = new User;</code></p>
<p><code>$foo->fetchAll()</code></p>
<p>but what about ... | <p>I personally subclass both <code>Zend_Db_Table_Abstract</code> and <code>Zend_Db_Table_Row_Abstract</code>. The main difference between my code and yours is that explicitly treat the subclass of <code>Zend_Db_Table_Abstract</code> as a "table" and <code>Zend_Db_Table_Row_Abstract</code> as "row". Very rarely do I s... | <p>You can do more complicated queries, check the <a href="http://framework.zend.com/manual/en/zend.db.table.html#zend.db.table.advanced.usage" rel="nofollow noreferrer">Advanced usage</a> section in the <a href="http://framework.zend.com/manual/en/zend.db.table.html" rel="nofollow noreferrer"><code>Zend_Db_Table</code... | 37,646 |
<p>We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to "replay" the transaction, we use HTTP codes to forward you to get a new transaction ticket. This works fine for a majority of use... | <p>You'll get a more comprehensive overview of Download Accelerators at <a href="http://en.wikipedia.org/wiki/Download_accelerator" rel="noreferrer">wikipedia</a>.</p>
<h2>Acceleration is multi-faceted</h2>
<h3>First</h3>
<p>A substantial benefit of managed/accelerated downloads is the tool in question remembers St... | <p>From: <a href="http://askville.amazon.com/download-accelerator-protocol-work-advantages-benefits-application-area-scope-plz-suggest-URLs/AnswerViewer.do?requestId=9337813" rel="nofollow noreferrer">http://askville.amazon.com/download-accelerator-protocol-work-advantages-benefits-application-area-scope-plz-suggest-UR... | 11,919 |
<p>I have two machines... a development machine and a production machine. When I first brought my rails app onto the production server, I had no problem. I simply imported schema.rb by running rake db:schema:load RAILS_ENV=production. All was well.</p>
<p>So, then on my development machine, I made some more changes... | <p>This is a guess, I admit: I think that because you first ran db:schema:load instead of db:migrate in your production environment, you got the structure of your db, but not the data that migrate populates into your schema_info table. So now, when you run migrate in the production environment, there is no data in sc... | <pre><code>rake db:migrate RAILS_ENV=production
</code></pre>
<p>Use the <code>db:schema:load</code> task just for the first creation, incremental changes should be migrated.</p>
| 28,990 |
<p>I would like to ask you which automated build environment you consider better, based on practical experience. I'm planning to do some .Net and some Java development, so I would like to have a tool that supports both these platforms.</p>
<p>I've been reading around and found out about <a href="http://www.cruisecontr... | <p>I have worked on and with Continuous Integration tools since the one that spawned Cruise Control (java version). I've tried almost all of them at some point. I've never been happier than I am with TeamCity. It is very simple to set up and still provides a great deal of power. The build statistics page that shows bui... | <p>I have been using Teamcity for the last 1 and a half years, and having a great experience. I have integrated a number of .Net and Java projects and used tools like MSBuild, Maven etc. I found Teamcity pretty simple to set up and work with. I have managed to get CI running for some sql projects as well which was a bi... | 23,798 |
<p>I am using VB.NET. In Visual Studio, if I right-click a property name and click "Find All References", it searches for all instances of the property being used.</p>
<p>However, a property is always used either for assignment (Set method) or retrieval (Get method). Is there any way of searching for only one of these... | <p>Use the compiler to turn what you want to find into errors. Remove the setter to find all the places were it was going to be used.</p>
| <p>You can also use <a href="http://reflector.red-gate.com/" rel="nofollow noreferrer">Reflector</a> to browse through your assembly.</p>
| 21,365 |
<p>So I have some old filament that I originally got for a 3D pen. The problem is it's unlabeled and I haven't been able to find anything that might help me distinguish whether it's PLA or ABS. The bag it all came in says that wherever this filament came from only makes PLA and ABS so it's got to be on of those two.</p... | <p>Mick's suggestion is a good one. PLA may shed some color in acetone, but ABS will dissolve completely in a suitable amount of time. If you have dark filament, you can test by flexing the filament until it breaks. ABS will sometimes/often/usually fatigue with a white break line, while PLA does not exhibit this tenden... | <p>Just burn it and check flame color.</p>
<p>I know you mentioned that you would like to avoid heat test, but this method is much faster and easier then other techniques.</p>
<ul>
<li><a href="https://www.youtube.com/watch?v=bNKno20GMMQ" rel="nofollow noreferrer">3D printing filament burn test</a></li>
<li><a href="ht... | 1,750 |
<p>Can the alignment of a structure type be found if the alignments of the structure members are known? </p>
<p>Eg. for:</p>
<pre><code>struct S
{
a_t a;
b_t b;
c_t c[];
};
</code></pre>
<p>is the alignment of S = max(alignment_of(a), alignment_of(b), alignment_of(c))?</p>
<p>Searching the internet I found that ... | <p>There are two closely related concepts to here: </p>
<ol>
<li>The alignment required by the processor to access a particular object</li>
<li>The alignment that the compiler actually uses to place objects in memory</li>
</ol>
<p>To ensure alignment requirements for structure members, the alignment of a structure mu... | <p>I don't think memory layout is guaranteed in any way in any C standard. This is very much vendor and architect-dependent. There might be ways to do it that work in 90% of cases, but they are not standard.</p>
<p>I would be very glad to be proven wrong, though =)</p>
| 47,582 |
<p>I need to solve a few mathematical equations in my application. Here's a typical example of such an equation:</p>
<pre><code>a + b * c - d / e = a
</code></pre>
<p>Additional rules:</p>
<ul>
<li>b % 10 = 0</li>
<li>b >= 0</li>
<li>b <= 100</li>
<li>Each number must be integer</li>
<li>...</li>
</ul>
<p>I woul... | <p>Solving <a href="http://en.wikipedia.org/wiki/Linear_systems" rel="nofollow noreferrer">linear systems</a> can <em>generally</em> be solved using linear programming. I'd recommend taking a look at <a href="http://www.boost.org/doc/libs/1_36_0/libs/numeric/ublas/doc/index.htm" rel="nofollow noreferrer">Boost uBLAS</a... | <p>Pretty sure <a href="http://www.nr.com/" rel="nofollow noreferrer">Numerical Recipes</a> will have something</p>
| 21,750 |
<p>I am building an open search add-on for Firefox/IE and the image needs to be Base64 Encoded so how can I base 64 encode the favicon I have?</p>
<p>I am only familiar with PHP</p>
| <p>As far as I remember there is an xml element for the image data. You can use this <a href="http://www.motobit.com/util/base64-decoder-encoder.asp" rel="noreferrer">website</a> to encode a file (use the upload field). Then just copy and paste the data to the XML element.</p>
<p>You could also use PHP to do this like... | <p>Google led me to <a href="http://fr.php.net/base64_encode" rel="nofollow noreferrer">this</a> solution (base64_encode). Hope this helps!</p>
| 5,646 |
<p>What are they and how do they work?</p>
<p>Context happens to be SQL Server</p>
| <p>Both on Windows and POSIX systems, named-pipes provide a way for inter-process communication to occur among processes running on the same machine. What named pipes give you is a way to send your data without having the performance penalty of involving the network stack.</p>
<p>Just like you have a server listening... | <p>Named pipes is a windows system for inter-process communication. In the case of SQL server, if the server is on the same machine as the client, then it is possible to use named pipes to tranfer the data, as opposed to TCP/IP.</p>
| 21,159 |
<p>I need to add some intervals and use the result in Excel. </p>
<p>Since </p>
<pre><code>sum(time.endtime-time.starttime)
</code></pre>
<p>returns the interval as "1 day 01:30:00" and this format breaks my Excel sheet, I thought it'd be nice to have the output like "25:30:00" but found no way to do it in the Pos... | <p>Since there is not an exact solution for the topic:</p>
<pre><code>=> SELECT date_part('epoch', INTERVAL '1 day 01:30:00') * INTERVAL '1 second' hours;
hours
-----------
25:30:00
(1 row)
</code></pre>
<p>Source: <a href="http://www.postgresql.org/docs/9.3/static/functions-datetime.html">Documentation</a></p>... | <p>It can be done, but I believe that the only way is through the following monstrosity (assuming your time interval column name is "ti"):</p>
<pre><code>select
to_char(floor(extract(epoch from ti)/3600),'FM00')
|| ':' || to_char(floor(cast(extract(epoch from ti) as integer) % 3600 / 60), 'FM00')
... | 44,373 |
<p>I am overriding a Grid, adding some customer features. One of the features is a drop-down to adjust page size. I am extending the grid using a customer server control, which works great for what I've done so far. Now, however I am having a bit of trouble getting the dynamically added control to do a postback. Th... | <p>The first thing I noticed was you'd be missing this:</p>
<pre><code>pageSizeDropdown.AutoPostBack = true
</code></pre>
<p>but I'm not sure if that's all you need for it to work</p>
| <p>You need to set "AutoPostBack" to true for a dropdown list to postback. Otherwise, another control will have to post the form back (however, the SelectedIndexChanged event will fire when that does happen).</p>
| 37,909 |
<p>I was going to ask what the best way to do this is, but then decided I should ask whether or not it is even necessary. I have never seen it done in <code>JSP</code> development, but it appears to be common practice in <code>PHP</code>. What is the reasoning behind this, and if I do not protect against this, what els... | <p>The reason this is more common in PHP than other similar languages has to do with PHP's history. Early versions of PHP had the "register_globals" setting on as a default (in fact, it may not have even been a setting in really early versions). Register_globals tells PHP to define global variables according to the que... | <p>It also isn't just a security feature in php but more of how many MVC based PHP sites function. If for example in SugarCRM you were to call a module file directly the page load would fail because the controller, view and model were not previously loaded and you'd have no db config/connection information either, so t... | 13,367 |
<p>I am trying to set the permissions of a folder and all of it's children on a vista computer. The code I have so far is this.</p>
<pre><code> public static void SetPermissions(string dir)
{
DirectoryInfo info = new DirectoryInfo(dir);
DirectorySecurity ds = info.GetAccessControl(); ... | <p>So the answer is two fold. First off a sub folder was being created before the permissions were set on the folder and I needed to or in one more flag on the permissions to make it so both folders and files inherited the permissions.</p>
<pre><code>public static void SetPermissions(string dir)
{
... | <p>This may be a dumb question, but have you tried performing the same action manually (e.g. using Explorer)? Vista has some directories that not even users in the Administrators group can modify without taking additional steps. I think there are two steps you need to take first.</p>
<p>First, use Explorer to make t... | 30,242 |
<p>I have a text file of this format: </p>
<pre><code>L O A D C A S E 1 O F 2 ...
J O I N T D I S P L A C E M E N T S (global)
Joint X-dsp Y-dsp Z-dsp X-rot Y-rot Z-rot
1 0.0 0.0 0.0 0.0 0.0 -0.... | <p><a href="http://schotime.net/blog/index.php/2008/03/18/importing-data-files-with-linq/" rel="nofollow noreferrer">Here</a> is a very interesting approach about importing tabulated data using Linq.</p>
<p>It's simple and elegant, you only need an Enumerable method that yields the lines from the file:</p>
<pre><code... | <p>Looks like a fixed length format?</p>
<p>With a bit of pre-processing, you could use an OLEDB driver to get the data out using standard APIs:</p>
<ul>
<li><a href="http://www.codeproject.com/KB/database/ReadTextFile.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/database/ReadTextFile.aspx</a></li>
<... | 26,726 |
<p>I want to use libgadu (library of instant messaging protocol) under Visual Studio 2008.
I have downloaded libgadu <a href="http://toxygen.net/libgadu/files/libgadu-1.8.2.tar.gz" rel="nofollow noreferrer">http://toxygen.net/libgadu/files/libgadu-1.8.2.tar.gz</a> and under cygwin I've compiled it - ./configure , make ... | <p>You need to locate the compiled DLL and LIB file, or just LIB file if it was compiled into a static library. The files will probably be named libgadu.dll and libgadu.lib.</p>
<p>Once you have those, you can instruct Visual Studio to link with the LIB file by selecting Project Properties and locating the Additional ... | <p>It's strange, because during ./configure, make in Cygwin, it doesn't create any .dll and .lib files.</p>
| 44,946 |
<p>Are you working on a (probably commercial) product which uses RDF/OWL/SPARQL technologies? If so, can you please describe your product?</p>
| <p>O'Reilly's Practical RDF has a chatper titled <a href="http://safari.oreilly.com/0596002637/pracrdf-CHP-15-SECT-1" rel="noreferrer">Commercial Uses of RDF/XML</a>. The table at the left lists the subsections: <a href="http://chandlerproject.org/" rel="noreferrer">Chandler</a>, <a href="http://www.intellidimension.co... | <p><a href="http://www.microsoft.com/imm" rel="nofollow noreferrer">Microsoft Interactive Media Manager</a> is a metadata management system developed on the Microsoft SharePoint platform that heavily leverages RDF, OWL, and SPARQL. It has some big customers in the broadcast space and is an excellent example of enterpr... | 5,862 |
<p>I have a multi-column text file ( tab delimited ) that I use for localized text in my project. </p>
<p>I picked this format since it can easily be edited by anyone in most text editors (and excel too). </p>
<p>My makefile processes it into a bunch of defines and binary data for including directly into my app. </p>... | <p>It is line by line.</p>
<ol>
<li>The person who tries to commit later will get 'out of date' error, and when they try to update it, they will get a conflict in changed lines.</li>
<li>Same with the merge. The one who merges later will have to sort out conflicts manually.</li>
</ol>
| <p>SVN merge is line by line, so in the situation you outline, conflicts would be created and would have to be merged by hand. However, with decent merge tools, the translators themselves could probably handle this - the tools can show differences character by character.</p>
<p><a href="http://tortoisesvn.tigris.org/"... | 20,254 |
<p>C# MDI application with separate GUI threads for each child in MDI is that possible ?</p>
<p>For example if one of the child forms is blocked by some synchronous request it freezes the entire container ( MDI Parent ) and the other windows open also become in accessible.</p>
<p>In general , is it possible to have ... | <p>Rather than trying to force multiple threads into the GUI layer, make the GUI layer defer all its work to a background thread. That way if some background thread becomes unresponsive the whole GUI including the MDI child that is reflecting the unresponsive background thread is responsive.</p>
| <p>NO. You can not use multiple UI threads in .NET.
You'd better use background threads to process time consuming operations there.
If you need to block window while operation is running it is better to create some workaround.</p>
| 27,576 |
<p>Does anyone know of a definitive list of LINQ to SQL query limitations that are not trapped at compile time, along with (where possible) workarounds for the limitations?</p>
<p>The list we have so far is:</p>
<ul>
<li>Calling methods such as <code>.Date</code> on <code>DateTime</code>
<ul>
<li>no workaround found... | <p>Basically, that list is huge... it is everything outside of the relatively <a href="http://msdn.microsoft.com/en-us/library/bb386970.aspx" rel="nofollow noreferrer">small set of things that <strong>are</strong> handled</a>. Unfortunately, the <a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html" re... | <p>I had exactly this issue with DateTimes, and found that currently the following workaround works for me, but I realise that with larger result sets, it could get to be an issue as the processing is now in my app rather than on the database:</p>
<pre><code>BlogPosts post = (from blogs in blogPosts
where b... | 41,909 |
<p>I am looking for simple straightforward solution for accessing EXIF information of jpeg images in .Net. Does anybody has experience with this?</p>
| <p>If you're willing to use an open-source library, may I humbly suggest one of my own creation?</p>
<p>The <em>metadata-extractor</em> project has been alive and well since 2002 for Java, and is now available for .NET.</p>
<ul>
<li>Open source (Apache 2.0)</li>
<li>Heavily tested and widely used</li>
<li>Supports ma... | <p>Several years ago, I started a little JPEG EXIF app with Omar Shahine to work on JPEG EXIF files, called JpegHammer.</p>
<p>He extracted from that project a library and called it PhotoLibrary, it was an easy .NET wrapper for the EXIF 2.2 tags. Unfortunately, the GotDotNet site is gone, CodePlex doesn't have it, Oma... | 6,343 |
<p>What are the steps and techniques to debug an apparent hang due to a deadlock in a Win32 production process. I heard that WinDbg can be used for this purpose but could you please provide clear hints on how this can be accomplished?</p>
| <p>This <a href="http://blogs.msdn.com/carloc/archive/2007/10/08/ok-now-how-do-i-capture-my-dump.aspx" rel="noreferrer">post</a> should get you started on the various options..Check the posts tagged with Debugging..</p>
<p>Another useful article on <a href="http://www.debuginfo.com/articles/easywindbg.html#debugdeadlo... | <p>Debugging deadlocks can be tricky. I usually do some kind of logging and see where the log stops. I either log to a file or to the debug console using OutputDebugString().</p>
| 11,470 |
<p>I have a problem related to graph.
I am not a computer science grad hence needed a some quick intro on what is graph and were can i read about graph and how to solve graph related problem in c++ or in general.</p>
| <p>The <a href="http://www.boost.org/doc/libs/1_37_0/libs/graph/doc/index.html" rel="nofollow noreferrer">boost graph library</a> may be a starting point and give you some code for solving your graph related problems.</p>
| <p>This is a <a href="http://mark-shepherd.com/blog/2006/12/03/recent-improvements-to-springgraph-graph-visualizer" rel="nofollow noreferrer">very cool tool for representing graphs</a></p>
| 40,898 |
<p>Is there any way to launch IE Mobile's "Favorites" screen directly by
specifying any command line parameter?</p>
| <p>How about running IE with the HTML favorites file as a parameter?</p>
<blockquote>
<p>IExplore file://\windows\fav.htm</p>
</blockquote>
| <p>I think this is going to be quite difficult without code. </p>
<p>Two options come to mind:</p>
<ul>
<li>Find out what Windows messages IE sends to open the favorites screen and replay these in your application. You would first need to see if IE is running and if it is bring it to the foreground. If not then start... | 2,289 |
<p>I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object:</p>
<pre><code>public class SafeDictionary<TKey, TValue>: IDictionary<TKey, TValue>
{
private readonly object syncRoot = new object();
private Dictionary<TKey, TValue>... | <p>The .NET 4.0 class that supports concurrency is named <a href="http://msdn.microsoft.com/en-us/library/dd287191.aspx" rel="noreferrer"><code>ConcurrentDictionary</code></a>.</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/573ths2x(VS.80).aspx" rel="nofollow noreferrer">Collections And Synchronization</a></p>
| 19,098 |
<p>Within an event, I'd like to put the focus on a specific TextBox within the ListViewItem's template. The XAML looks like this:</p>
<pre><code><ListView x:Name="myList" ItemsSource="{Binding SomeList}">
<ListView.View>
<GridView>
<GridViewColumn>
<Gr... | <p>To understand why <code>ContainerFromItem</code> didn't work for me, here some background. The event handler where I needed this functionality looks like this:</p>
<pre><code>var item = new SomeListItem();
SomeList.Add(item);
ListViewItem = SomeList.ItemContainerGenerator.ContainerFromItem(item); // returns null
</... | <p>We use a similar technique with WPF's new datagrid:</p>
<pre><code>Private Sub SelectAllText(ByVal cell As DataGridCell)
If cell IsNot Nothing Then
Dim txtBox As TextBox= GetVisualChild(Of TextBox)(cell)
If txtBox IsNot Nothing Then
txtBox.Focus()
txtBox.SelectAll()
... | 11,774 |
<p>What algorithm taught you the most about programming or a specific language feature?</p>
<p>We have all had those moments where all of a sudden we know, just know, we have learned an important lesson for the future based on finally understanding an algorithm written by a programmer a couple of steps up the evolutio... | <p>"To iterate is human, to recurse divine" - quoted in 1989 at college. </p>
<p>P.S. Posted by Woodgnome while waiting for invite to join</p>
| <p>For me, the simple swap in Kelly & Pohl's <em>A Book on C</em> to demonstrate call-by-reference flipped me out when I first saw it. I looked at that, and pointers snapped into place. Verbatim. . .</p>
<pre><code>void swap(int *p, int *q)
{
int temp;
temp = *p;
*p = *q;
*q = temp;
}
</code></pre>
| 4,587 |
<p>Is there a good reference, or summary list, of new features in WCF 2.0/VS2010?</p>
<p>I'm trying to do a justification proposal for a project, to migrate from Jabber to WCF.</p>
| <p><a href="http://www.aspnetpro.com/articles/2009/04/asp200904mb_f/asp200904mb_f.asp" rel="nofollow noreferrer">http://www.aspnetpro.com/articles/2009/04/asp200904mb_f/asp200904mb_f.asp</a></p>
| <p>Not answering your question in particular, but WCF 2.0's not going to come out for quite some time, so I'd base my evaluation against the current WCF version.</p>
| 39,631 |
<p>What is the best comment in source code you have ever encountered?</p>
| <p>I am particularly guilty of this, embedding non-constructive comments, code poetry and little jokes into most of my projects (although I usually have enough sense to remove anything directly offensive before releasing the code). Here's one I'm particulary fond of, placed far, far down a poorly-designed 'God Object':... | <pre><code>(A bunch of code that's really weird looking) //Kludge.
</code></pre>
| 22,323 |
<p>What's the best way (if any) to make an image appear "grayed out" with CSS (i.e., without loading a separate, grayed out version of the image)?</p>
<p>My context is that I have rows in a table that all have buttons in the right most cell and some rows need to look lighter than others. So I can make the font lighter... | <p>Does it have to be gray? You could just set the opacity of the image lower (to dull it). Alternatively, you could create a <code><div></code> overlay and set that to be gray (change the alpha to get the effect).</p>
<ul>
<li><p>html:</p>
<pre><code><div id="wrapper">
<img id="myImage" src="somet... | <p>Considering filter:expression is a Microsoft extension to CSS, so it will only work in Internet Explorer. If you want to grey it out, I would recommend that you set it's opacity to 50% using a bit of javascript. </p>
<p><a href="http://lyxus.net/mv" rel="nofollow noreferrer">http://lyxus.net/mv</a> would be a good... | 36,378 |
<p>I need to use C# programatically to append several preexisting <code>docx</code> files into a single, long <code>docx</code> file - including special markups like bullets and images. Header and footer information will be stripped out, so those won't be around to cause any problems.</p>
<p>I can find plenty of info... | <p>In spite of all good suggestions and solutions submitted, I developed an alternative. In my opinion you should avoid using Word in server applications entirely. So I worked with OpenXML, but it did not work with AltChunk. I added text to original body, I receive a List of byte[] instead a List of file names but you ... | <p>Its quit complex so the code is outside the scope of a forum post, I'd be writing your App for you, but to sum up.</p>
<ul>
<li>Open both documents as Packages </li>
<li>Loop through the second docuemnt's parts looking for images and embbed stuff</li>
<li>Add these parts to the first package remembering the new rel... | 30,764 |
<p>How do I view the grants (access rights) for a given user in MySQL?</p>
| <pre><code>mysql> show grants for 'user'@'host'
</code></pre>
| <p>If you're already running a web server with PHP then <a href="http://www.phpmyadmin.net/" rel="nofollow noreferrer">phpMyAdmin</a> is a fairly friendly administrative tool.</p>
| 15,538 |
<p>How can I prevent the pocket PC device from shutting down from my application when the power button pressed? I am using C#.</p>
| <p>You could use the Microsoft.WindowsCE.Form.MessageWindows class to intercept the Power Button event. This solution will not be portable, as the hardware key will be different in different machines.</p>
<p>I recommend however that you don't disable power down completely. Have a look at my answer in another question ... | <p>You can try changing the power requirements for the device "BLK1:", which is the blacklight device. Be aware that the behavior may not be the same on all devices and version of the OS or Vendor specific Extensions.</p>
<p>To do this, you can write something like :</p>
<pre><code> [DllImport("coredll")]
priv... | 39,889 |
<p>Is there an easy way in C# to create <a href="http://en.wikipedia.org/wiki/Ordinal_numbers_%28linguistics%29" rel="noreferrer">Ordinals</a> for a number? For example:</p>
<ul>
<li>1 returns 1st</li>
<li>2 returns 2nd</li>
<li>3 returns 3rd</li>
<li>...etc</li>
</ul>
<p>Can this be done through <code>String.Format(... | <p>This page gives you a complete listing of all custom numerical formatting rules:</p>
<p><a href="https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings" rel="noreferrer">Custom numeric format strings</a></p>
<p>As you can see, there is nothing in there about ordinals, so it can't ... | <p>Another alternative that I used based on all the other suggestions, but requires no special casing:</p>
<pre><code>public static string DateSuffix(int day)
{
if (day == 11 | day == 12 | day == 13) return "th";
Math.DivRem(day, 10, out day);
switch (day)
{
case 1:
return ... | 4,050 |
<p>I've got a number of batch processes that run behind the scenes for a Linux/PHP website. They are starting to grow in number and complexity, so I want to bring a small amount of process to bear on them.</p>
<p>My source tree has a bunch of cpp files and scripts, organized with development but not deployment in mind... | <p>There are a several categories of tool here. Some people use a combination of tools from these categories. I sometimes use, for example, both Puppet and Capistrano. See <a href="http://www.agileweboperations.com/puppet-or-capistrano-use-the-right-tool-for-the-job/" rel="nofollow noreferrer">Puppet or Capistrano -... | <p>I have to roll out PHP scripts and Apache configurations to several customers on a frequent basis. Since they all run Debian Linux, I've set up a Debian package repository on my server and the all the customer has to do is type <strong>apt-get upgrade</strong> and they get the latest version.</p>
| 24,294 |
<p>So a column will hold some text that beforehand I won't know how long the length of this string can be. Realistically 95% of the time, it will probably be between 100-500 chars, but there can be that one case where it will 10000 chars long. I have no control over the size of this string and never does the user. Besi... | <p>Varchar(max) in sqlserver 2005 is what I use.</p>
<p>SqlServer handles large string fields weirdly, in that if you specify "text" or a large varchar, but not max, it stores part of the bits in the record and the rest outside.</p>
<p>To my knowledge with varchar(max) it goes ahead and stores the entire contents out... | <p>Have you considered using the BLOB type?</p>
<p>Also, out of curiosity, is you don't control the size of the string, and neither does the user, who does?</p>
| 16,456 |
<p>Recently I was talking to a co-worker about C++ and lamented that there was no way to take a string with the name of a class field and extract the field with that name; in other words, it lacks reflection. He gave me a baffled look and asked when anyone would ever need to do such a thing.</p>
<p>Off the top of my ... | <p>I can list following usage for reflection:</p>
<ul>
<li>Late binding</li>
<li>Security (introspect code for security reasons)</li>
<li>Code analysis</li>
<li>Dynamic typing (duck typing is not possible without reflection)</li>
<li>Metaprogramming</li>
</ul>
<p>Some real-world usages of reflection from my personal ... | <p>Writing dispatchers. Twisted uses python's reflective capabilities to dispatch XML-RPC and SOAP calls. RMI uses Java's reflection api for dispatch.</p>
<p>Command line parsing. Building up a config object based on the command line parameters that are passed in.</p>
<p>When writing unit tests, it can be helpful to ... | 7,235 |
<p>With SMO objects using Server.JobServer.jobs to get a list of jobs, I can find the status of each job. For those that are currently executing I would like to find the SPID it is executing on. I can also get a list of the server's processes using Server.EnumProcesses(). This gives me a list of currently active SPID... | <p>You can nest the StackPanel in a ScrollViewer:</p>
<pre><code> <Grid>
<Expander Header="Expander1" Margin="0,0,0,2" Name="Expander1" VerticalAlignment="Top" Background="Coral">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Name="StackScroll" Margin="0,0,0,2... | <p>Set <strong>ScrollViewer.VerticalScrollBarVisibility="Auto"</strong> in your StackPanel declaration.</p>
| 46,469 |
<p>I've caught the bug to learn functional programming for real. So my
next self-study project is to work through the <a href="http://mitpress.mit.edu/sicp/" rel="noreferrer">Structure and
Interpretation of Computer Programs</a>. Unfortunately, I've never
learned Lisp, as I was not a CS major in college. </p>
<p>While... | <p>Use Scheme. It is one of the simplest and easiest languages in existence, and you will spend very little time learning enough of it to understand SICP. Once you understand SICP, you will see how the concepts apply in any language.</p>
| <blockquote>
<p>but learning a language that helps my resume is still a benefit.</p>
</blockquote>
<p>You should try using VB6 or COBOL, then, as there is a <strong>lot</strong> of billing work out there for it.</p>
| 29,572 |
<p>I want to get whois information of a domain name from my c#/java programs. Is there a simple way to do this? </p>
| <p>I found a perfect C# example on dotnet-snippets.com (<em>which doesn't exist anymore</em>). </p>
<p>It's 11 lines of code to copy and paste straight into your own application.</p>
<pre><code>/// <summary>
/// Gets the whois information.
/// </summary>
/// <param name="whoisServer">The whois serve... | <p>Here's the Java solution, which just opens up a shell and runs <code>whois</code>:</p>
<pre><code>import java.io.*;
import java.util.*;
public class ExecTest2 {
public static void main(String[] args) throws IOException {
Process result = Runtime.getRuntime().exec("whois stackoverflow.com");
Bu... | 7,714 |
<p>I'm currently optimizing the performance on my company's site; when it was taking 6-10 seconds to download 2MB+ of our homepage and assets (the site is mostly Flash with a lot of media, so it's not 2MB of HTML and viewstate). There are a lot of things that will need to be done to get this download size down; but one... | <p><a href="http://www.dotnetspider.com/resources/17562-Edit-Delete-Create-Encrypt-sections.aspx" rel="noreferrer">This fellow</a> shows sample code if you still want to do it after all the caveats:</p>
<pre><code>protected void EditConfigButton(object sender, EventArgs e)
{
Configuration objConfig = System.Web.Con... | <p>Yes I agree with Josh. I have tried this before and I've had two negative effects:</p>
<ol>
<li>Slow loading if the current page after postback because ASP.NET is loading the web.config and all related resources</li>
<li>If you change the web.config early enough in the load cycle (e.g. global.asax events) the site... | 33,964 |
<p>I need a function count_permutations() that returns the number of permutations of a given range. <em>Assuming that the range is allowed to be modified, and starts at the first permutation,</em> I could naively implement this as repeated calls to next_permutation() as below:</p>
<pre><code>template<class Ret, cla... | <p>The number of permutations for a range where all the elements are unique is n! where n is the length of the range.</p>
<p>If there are duplicate elements, you can use n!/(n_0!)...(n_m!) where n_0...n_m are the lengths of duplicate ranges.</p>
<p>So for example [1,2,3] has 3! = 6 permutations while [1,2,2] has 3!/2... | <p>In math the function factorial !n represents the number of permutations of n elements. </p>
<p>As Can Berg and Greg suggested, if there are repeated elements in a set, to take them into account, we must divide the factorial by the number of permutations of each indistinguishable group (groups composed of identical ... | 34,805 |
<p>I'm basically trying to figure out the simplest way to perform your basic insert operation in C#.NET using the SqlClient namespace. </p>
<p>I'm using <code>SqlConnection</code> for my db link, I've already had success executing some reads, and I want to know the simplest way to insert data. I'm finding what seem to... | <pre><code>using (var conn = new SqlConnection(yourConnectionString))
{
var cmd = new SqlCommand("insert into Foo values (@bar)", conn);
cmd.Parameters.AddWithValue("@bar", 17);
conn.Open();
cmd.ExecuteNonQuery();
}
</code></pre>
| <pre><code>using (SqlConnection myConnection new SqlConnection("Your connection string"))
{
SqlCommand myCommand = new SqlCommand("INSERT INTO ... VALUES ...", myConnection);
myConnection.Open();
myCommand.ExecuteNonQuery();
}
</code></pre>
| 5,192 |
<p>I have several similar methods, say eg. CalculatePoint(...) and CalculateListOfPoints(...). Occasionally, they may not succeed, and need to indicate this to the caller. For CalculateListOfPoints, which returns a generic List, I could return an empty list and require the caller to check this; however Point is a value... | <p>Personally, I think I'd use the same idea as TryParse() : using an out parameter to output the real value, and returning a boolean indicating whether the call was successful or not</p>
<p><code>public bool CalculatePoint(... out Point result);</code></p>
<p>I am not a fan of using exception for "normal" behaviors ... | <p>I would say best practice is a return value means success, and an <a href="http://www.c-sharpcorner.com/UploadFile/rajeshvs/ExceptionHandlinginCSharp11282005051444AM/ExceptionHandlinginCSharp.aspx" rel="nofollow noreferrer">exception</a> means failure. </p>
<p>I see no reason in the examples you provided that you s... | 19,568 |
<p>I ended up writing a quick little script for this in Python, but I was wondering if there was a utility you could feed text into which would prepend each line with some text -- in my specific case, a timestamp. Ideally, the use would be something like:</p>
<pre><code>cat somefile.txt | prepend-timestamp
</code></p... | <p>Could try using <code>awk</code>:</p>
<pre><code><command> | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'
</code></pre>
<p>You may need to make sure that <code><command></code> produces line buffered output, i.e. it flushes its output stream after each line; the timestamp <code>awk</cod... | <p>If the value you are prepending is the same on every line, fire up emacs with the file, then:</p>
<p><kbd>Ctrl</kbd> + <kbd><space></kbd></p>
<p>at the beginning of the of the file (to mark that spot), then scroll down to the beginning of the last line (Alt + > will go to the end of file... which probably... | 4,170 |
<p>If I have a series of points as longitude and latitude, how would I calculate the center of all of those points?</p>
| <p><a href="http://www.geomidpoint.com/calculation.html" rel="noreferrer">Geomidpoint</a> covers 3 different methods for calculating this.</p>
| <p>See Moe's answer, although if your points are distributed across the globe, you'll have to be satisfied that your center tends towards the Prime Meridian and not the International Date Line.</p>
| 15,614 |
<p>I am trying to test a class that manages data access in the database (you know, CRUD, essentially). The DB library we're using happens to have an API wherein you first get the table object by a static call:</p>
<pre><code>function getFoo($id) {
$MyTableRepresentation = DB_DataObject::factory("mytable");
$MyTabl... | <p>I agree with both of you that it would be better not to use a static call. However, I guess I forgot to mention that DB_DataObject is a third party library, and the static call is <em>their</em> best practice for their code usage, not ours. There are other ways to use their objects that involve constructing the retu... | <p>What's missing (or not?) from your DB_DataObject class is a setter to pass a prepared db object before calling the factory method. That way you can pass a mock or a custom db object (with the same interface) should the need arise.</p>
<p>In your test setup:</p>
<pre><code> public function setUp() {
$mockDb =... | 44,783 |
<p>We have a 12-year-old Ms Access app that we use for our core inventory warehousing and invoicing system. It IS already running on an SQL Server backend, but all the "logic", forms and reports are in Access. After experiencing the massive amounts of maintenance sludge it took to turn inventory transactions from non-t... | <p>As you already have asp.net with some business logic you could open this up to access as a web service (asmx files). Google for the Microsoft Office Web Services Toolkit for your version of access (xp/2003 etc.) and this will write vba proxy classes for you to call the web service. You can bind web service data to... | <p>I have a similar problem, and addressed it by creating a versioned deployment system in the Access front end (grab and extract a CAB file), figuring out the required AppDomain manipulation to be able to load the correct CLR version into the Access process, load a .config file, and post data <strong>both ways</strong... | 13,067 |
<p>Could someone provide a good description of what a Lambda is? We have a tag for them and they're on the secrets of C# question, but I have yet to find a good definition and explanation of what they are in the first place.</p>
| <p>Closures, lambdas, and anonymous functions are not necessarily the same thing.</p>
<p>An anonymous function is any function that doesn't have (or, at least, need) its own name.</p>
<p>A closure is a function that can access variables that were in its lexical scope when it was declared, even after they have fallen ... | <p>Clipped from wikipedia: <a href="http://en.wikipedia.org/wiki/Lambda#Lambda.2C_the_word" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Lambda#Lambda.2C_the_word</a></p>
<p>In programming languages such as Lisp and Python, lambda is an operator used to denote anonymous functions or closures, following lambd... | 18,090 |
<p>We're printing on a WASP 3MT pellet extruder with PLA. To save time, we're leaving the hotend at 160 °C between prints but realized that the print quality varies, from one print to the another, when using the same G-code file. </p>
<p>Could it be that leaving the temperature at 160 °C constantly creates m... | <p>PLA starts to change its properties at above its glass transition temperature of 60-65 °C, if stored there too long. Keeping it at 160°C, close to the melting temperature (173-178 °C) can degrade the material relatively rapidly. During an extrusion, this is usually mitigated by filling fresh material into ... | <p>I leave the extruder working at 190°C between printings up to for 20 minutes while I made the change; this only provoques that the nozzle gets empty; nothing gets burned or clogged. Once to start againg just feed a little more of filament manualy or waits to the skirt do the cleaning and refilling the nozzle. </p>
... | 1,123 |
<p>When I create a graph after using range.copy and range.paste it leaves the paste range selected, and then when I create a graph a few lines later, it uses the selection as the first series in the plot. I can delete the series, but is there a more elegant way to do this? I tried </p>
<pre><code>Set selection = not... | <pre><code>Cells(1,1).Select
</code></pre>
<p>It will take you to cell A1, thereby canceling your existing selection.</p>
| <p>You could set the <code>Application.ScreenUpdating = False</code> and select a cell out of view and then set the <code>.ScreenUpdating</code> to true. This would at least not show any selected cells in the current view.</p>
| 37,357 |
<p>I've been doing "plain old java objects" programming for 10 years now, with Swing and JDBC, and I consider myself pretty good at it. But I start a new job in two weeks where they use JBoss, and I'd like to get a heads up and start learning all this stuff before I start. What are good resources? On-line tutorials,... | <p>For quick getting up to speed, you really need to master EJBs and JSP/Servlets. Those are the fundamentals of Java EE technology. The Head First series on EJBs and JSP/Servlets is a good start for what has usually been a mind-numbingly complex framework. Beware that recent Head First editions have switched to teachi... | <p>Learn Enterprise Java Beans</p>
| 26,291 |
<p>I would like to override the use of the standard app.config by passing a command line parameter. How do I change the default application configuration file so that when I access ConfigurationManager.AppSettings I am accessing the config file specified on the command line?</p>
<p>Edit:</p>
<p>It turns out that the... | <p>So here is the code that actually allows me to actually access the appSettings section in a config file other than the default one.</p>
<pre><code>ExeConfigurationFileMap configFile = new ExeConfigurationFileMap();
configFile.ExeConfigFilename = Path.Combine(Environment.CurrentDirectory, "Alternate.config");
Config... | <p>This is not exactly what you are wanting... to redirect the actual <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx" rel="nofollow noreferrer"><code>ConfigurationManager</code></a> static object to point at a different path. But I think it is the right solution to your... | 19,804 |
<p>How can you obtain the Type (the name as a string is sufficient) of an Object in VB6 at runtime?</p>
<p>i.e. something like:</p>
<pre><code>If Typeof(foobar) = "CommandButton" Then ...
</code></pre>
<p><strong>/EDIT:</strong> to clarify, I need to check on Dynamically Typed objects. An example:</p>
<pre><code>Di... | <p>I think what you are looking for is TypeName rather than TypeOf.</p>
<pre><code>If TypeName(foobar) = "CommandButton" Then
DoSomething
End If
</code></pre>
<p>Edit: What do you mean Dynamic Objects? Do you mean objects created with
CreateObject(""), cause that should still work.</p>
<p>Edit: </p>
<pre><code>... | <p>This should prove difficult, since in VB6 all objects are COM (<code>IDispatch</code>) things. Thus they are only an interface.</p>
<p><code>TypeOf(object) is class</code> probably only does a COM get_interface call (I forgot the exact method name, sorry).</p>
| 7,540 |
<p>Is there any good way to use a windows application written in C# to display/control a powerpoint slideshow? Ultimately I would like to show thumbnails in a form and clicking these thumbnails would advance the slides shown on a second monitor (similar to using Powerpoint itself to show a slideshow on a second monitor... | <p>This kb lays out the basics for working with the powerpoint presentation viewer object model. I'd suggest you include the viewer when you distribute your application.</p>
<p><a href="http://support.microsoft.com/kb/265385" rel="nofollow noreferrer">http://support.microsoft.com/kb/265385</a></p>
<p>Once you get a r... | <p>I have used the Word toolkit from Aspose -- they have a Powerpoint toolkit too that I think would be worth looking at.</p>
<p><a href="http://www.aspose.com/categories/file-format-components/aspose.slides-for-.net-and-java/default.aspx" rel="nofollow noreferrer">http://www.aspose.com/categories/file-format-componen... | 26,785 |
<p>svn:externals can be great for sucking in central libraries or IP into a project, so that they can be kept in one location accessible for all.</p>
<p>But if I'm asking people to external tags of common IP (so it doesn't change on them) it opens the possibility of them inadvertently committing changes to the tag. <... | <p>Using svn repository hooks to avoid commting into special dirs e.g. tags</p>
<p>If you´re using the ttb (trunk, tags, branches) naming convention and the code for read-only svn:external access resides in tags-directories, you can use the pre-commit hook to avoid commiting into those directories.</p>
<p>Here´re a... | <p>Actually, TortoiseSVN detects you are trying to commit to a tag through the commit hook, and warns the user of this, which basically satisfies my requirement for a speed bump. So we're already good.</p>
| 30,409 |
<p>I know I can loop over the string or build a regex or invert the set (ASCII isn't that big after all) and search for the first instance of that, but Yuck.</p>
<p>What I'm looking for is a nice one liner.</p>
<p>fewer features is better, LINQ is out (for me, don't ask, it's a <em>long</em> story)</p>
<hr>
<p>The ... | <p>This works:</p>
<pre><code>public static char FindFirstNotAny(this string value, params char[] charset)
{
return value.TrimStart(charset)[0];
}
</code></pre>
| <p>Not all that efficient, but:</p>
<pre><code>char f(string str, IEnumerable<char> list)
{
return str.ToCharArray().First(c => !list.Contains(c))
}
</code></pre>
| 38,550 |
<p>I want to otherwise block code execution on the main thread while still allowing UI changes to be displayed.</p>
<p>I tried to come up with a simplified example version of what I'm trying to do; and this is the best I could come up with. Obviously it doesn't demonstrate the behavior I'm wanting or I wouldn't be pos... | <p>You want to use the "<a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">BackgroundWorker</a>" class, which will take most of this pain out of this for you.. but as mentioned before, you'll also want to structure it so that the main thread is updati... | <p>You should probably restructure your code as others have suggested, but depending on the behavior you're looking for, you might also want to have a look at using a Thread.Join on your background worker thread. Join actually allows the calling thread to process COM and SendMessage events while it waits for the other... | 47,084 |
<p>At work, we have multiple branches that we may be working on at any time.
Our solution so far as been to create multiple web-sites but you can only run one web-site at a time. This makes switching between branches more of a pain that in should be. </p>
<p>I just want to go to the URL, mapped in my hosts file, for ... | <p>Yes, it is a restriction and this one website can have only 10 simultanious connections.</p>
<p>Buy a Windows 2003 or 2008 Small Business Edition, it is quite cost-effective in this scenario.</p>
| <p>One way you could solve this without reinstalling your computer is to create each branch in a virtual subdirectory under you current web-root. Then at the top-level website, create a default.asp(x) the reads <code>Request.ServerVariables["SERVER-NAME"]</code> (should be underscore) and redirects the browser to whate... | 5,450 |
<p>I have a new application written in WPF that needs to support an old API that allows it to receive a message that has been posted to a hidden window. Typically another application uses FindWindow to identify the hidden window using the name of its custom window class.</p>
<p><strong>1) I assume to implement a cust... | <p>For the record I finally got this to work.
Turned out the difficulties I had were down to string marshalling problems.
I had to be more precise in my importing of win32 functions.</p>
<p>Below is the code that will create a custom window class in c# - useful for supporting old APIs you might have that rely on custo... | <p>WNDCLASS wind_class;
put the definition in the class, not the function, and the crash will be fixed.</p>
| 15,643 |
<p>When printing objects higher than approximately 8-10 cm, sometimes nozzle hits the printed model and knocks over it. After 7-8 hours of printing that's really annoying. I'm using Creality Ender 3 Pro with Ultimaker Cura. How can I avoid this problem?</p>
<p>As a note; it happens with thick, wide models without... | <p>It seems the problem was because of Z-axis leveling (level of the X-axis), I found out that the right side was more than 3-4 mm below the left side when the Z-axis height exceeds around 8-10 cm. Below 8-10 cm, the two sides were even. I calibrated the X-axis by turning the eccentric nuts of the wheels... | <p>There are options in Cura to avoid that the extruder hovers over printed parts when traveling. There is also an option to lift Z axis while traveling. Those options are hidden by default. You can only enable them in advanced settings mode.</p>
| 1,360 |
<p>Is there a idiomatic way of removing elements from PATH-like shell variables?</p>
<p>That is I want to take</p>
<pre><code>PATH=/home/joe/bin:/usr/local/bin:/usr/bin:/bin:/path/to/app/bin:.
</code></pre>
<p>and <strong>remove</strong> or <strong>replace</strong> the <code>/path/to/app/bin</code> without clobberin... | <p>Addressing the proposed solution from dmckee:</p>
<ol>
<li>While some versions of Bash may allow hyphens in function names, others (MacOS X) do not.</li>
<li>I don't see a need to use return immediately before the end of the function.</li>
<li>I don't see the need for all the semi-colons.</li>
<li>I don't see why y... | <p>The first thing to pop into my head to change just part of a string is a sed substitution.</p>
<p>example:
if echo $PATH => "/usr/pkg/bin:/usr/bin:/bin:/usr/pkg/games:/usr/pkg/X11R6/bin"
then to change "/usr/bin" to "/usr/local/bin" could be done like this:</p>
<p>## produces standard output file</p>
<p>## the "=... | 34,509 |
<p>I think this mostly applies to web applications, since you often see things like language and database vendor in regards to web applications, but not so much on desktop applications.</p>
<p>If a web application is created using language X, would that have any noticeable impact on who deploys the application? For ex... | <p>I assume that you are talking about companies purchasing and deploying web applications within their organizations. If you are talking about just using external applications, I don't think they notice or care.</p>
<p>I think this is very subjective, but from my past experience, companies tend to go with the technol... | <p>No, unless the choice of language has a clear impact on the functionality. Ideally it won't.</p>
<p>Two examples: jEdit is an amazing program, but its Java roots really hold it back. It defaults to the look-and-feel of Java GUI (swing?). It is also very slow (though Java programs need not be slow, this one is).... | 36,506 |
<p>We were using stringstream to prepare select queries in C++. But we were strongly advised to use QUERY PARAMETERS to submit db2 sql queries to avoid using of stringstream. Can anyone share what exactly meant by query parameter in C++? Also, share some practical sample code snippets.</p>
<p>Appreciate the help in ad... | <p>I suspect this refers to parameterized queries in general, rather than constructing the query in a string, they supply sql variables (or parameters) and then pass those variables separately. These are much better for handling SQL Injection Attacks. To illustrate with an example:</p>
<pre><code>"SELECT * FROM Cust... | <p>Sql query in parameterized query form is safe than string format to avoid sql injection attack.
Example of parameterized query </p>
<pre><code>StringBuilder sqlstr = new StringBuilder();
cmd.Parameters.AddWithValue("@companyid", CompanyID);
sqlstr.Append("SELECT evtconfigurationId, companyid,
configname, co... | 38,595 |
<p>I've posted this <a href="https://stackoverflow.com/questions/155739/detecting-unsaved-changes-using-javascript#317246">here</a>, but thought it might deserve a question on its own.</p>
<p>What I'm trying to do is show a dialog box that asks the user if he/she wants to leave the page if there are unsaved changes. T... | <p>In reaction to annakata: Yes, but you want the result of the dialog box to be used by the browser. So you might think using 'return bFlag' would do the trick (or event.returnValue = bFlag), but that gives you a second dialog box.
I've found a way around, thanks to <a href="http://www.codeproject.com/KB/aspnet/EWSWeb... | <p>IE supports an event on the document object called onstop. This event fires after the onbeforeunload event, but before the onunload event. This isn't exactly pertinent to your two dialogs question, but its still relevant to other people that might stumble on this thread ( as I did ).</p>
<p>The problem I was having... | 41,002 |
<p>Is there any Database Abstraction Layer (DAL) or Object Relational Mapper (ORM) that works on Google App Engine (GAE), and on normal relational databases (RDBS), other than <a href="http://www.web2py.com" rel="nofollow noreferrer">web2py</a>'s?</p>
<p>If not, is anybody working on porting one of the existing DAL/O... | <p>There is an ORM for Google App Engine. There are some differences between it and SQLAlchemy, but looks like it works. Check this page: <a href="http://code.google.com/appengine/docs/python/datastore/entitiesandmodels.html" rel="nofollow noreferrer">http://code.google.com/appengine/docs/python/datastore/entitiesandmo... | <p>Currently, it looks like SQLAlchemy is working on it, but it's incomplete / unfinished. Good luck!</p>
| 40,064 |
<p>I want to set the width of a TextBlock based on the width of its container, minus the margins set on the TextBlock.</p>
<p>Here is my code:</p>
<pre><code><TextBlock x:Name="txtStatusMessages"
Width="{Binding ElementName=LayoutRoot,Path=ActualWidth }"
TextWrapping="WrapWithOverflo... | <p>you're supposed to use the other control as the source, not the parameter.
The parameter has to be a constant and in your case can be -5.</p>
<p>I'm not near VS at the moment so the syntax maybe inaccurate, however, it is something like:</p>
<pre><code>Width="{Binding ElementName=LayoutRoot, Path=ActualWidth,
Conv... | <p>If your textbox is a direct child of LayoutRoot, just set the the following property in your textbox</p>
<pre><code>HorizontalAlignment="Stretch"
</code></pre>
| 40,215 |
<p>Could anyone show me a sample about how to use these two commands in Windbg please? I read the document in debugger.chm, but confused. I did search in Google and MSDN, but not find an easy to learn sample.</p>
| <p>Think in terms of function levels as per the following pseudo-code:</p>
<pre><code> 1 x = 0
2 y = 0
3 call 8
4 x = 5
5 y = 7
6 call 8
7 halt
8 print x
9 print y
10 call 12
11 return
12 print x + y
13 print x * y
14 return
</code></pre>
<p>The commands are basically "run until an event occur... | <p>There is something wrong from Windbg output -- "Can't continue completed step". Here is the related output from Windbg and source code, any ideas?</p>
<p>(I set a breakpoint in main, then step next using p command twice and then use gc command -- then error happens.)</p>
<p>(204.18c0): Break instruction exception ... | 17,564 |
<p>What is the least amount of code you can write to create, sort (ascending), and print a list of 100 random positive integers? By least amount of code I mean characters contained in the entire source file, so get to minifying.</p>
<p>I'm interested in seeing the answers using any and all programming languages. Let'... | <p>10 characters in J:</p>
<pre><code>/:~100?9e9
</code></pre>
<p>explanation:</p>
<p><code>/:~</code> sorts an array (technically, applies a lists sorted permutation vector to itself)</p>
<p><code>x ? limit</code> returns x random numbers less than limit</p>
<p><code>9e9</code> (9000000000) is a reasonable uppe... | <p>prints random 100 random numbers in the range [0,100] sorted in C++</p>
<pre><code>srand((unsigned int)time(NULL)); list<int> r;
for (int i=0;i<100;i++) r.push_back((int)((100)*rand()/(float)RAND_MAX));
r.sort();
for (list<int>::iterator j=r.begin();j!=r.end();j++) cout << *j << endl;
</c... | 45,676 |
<p>I'm using the jQuery validation plugin to validate a form, and I'd like to remove the validation and submit the form if a certain link is clicked.</p>
<p>I am submitting form with javascript like <code>jQuery('form#listing').submit()</code>, so I must remove the validation rules/function with javascript.</p>
<p>Th... | <p>Trigger the DOM submit method to skip the validation:</p>
<pre><code>$("#listing")[0].submit();
</code></pre>
| <p>in 2022</p>
<p>the answers above do not work now for me,</p>
<p>So I've written this js method, this would remove the jquery validation correctly</p>
<pre><code>function RemoveJQVRule(rulename, inputname) {
$(`[name="${inputname}"]`).rules('remove', rulename);
$(`[name="${inputname}"]`).rem... | 47,431 |
<p>I have an ActiveX plugin that we need (if possible) to run in Firefox. Is there a plugin (or other way) for Firefox that will allow this?</p>
| <p>I seem to have found a solution:</p>
<p><a href="http://code.google.com/p/ff-activex-host/" rel="nofollow noreferrer">http://code.google.com/p/ff-activex-host/</a></p>
<p>"This Firefox plugin makes it possible to use ActiveX controls in Firefox. It is based on the Gecko NPAPI and provides full access to the hosted... | <p>I found an other ActiveX plug-in that works.
It is called neptune.
See for more info <a href="http://www.meadroid.com/neptune/index.htm" rel="nofollow noreferrer">http://www.meadroid.com/neptune/index.htm</a></p>
| 42,251 |
<p>How do you calculate the length of the string that would be returned by Array::pack? Is there something like Python's calcsize?</p>
| <p>array.pack("").count I would say. Not really the fastest method, but it works.</p>
| <p>By making an interpreter complying to the specifications found in <a href="http://www.ruby-doc.org/core/classes/Array.html#M002245" rel="nofollow noreferrer">Array::pack</a>.</p>
<p>Or, reusing the existing implementation to count the number of characters instead of appending them to a string.</p>
| 17,784 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.