instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>In <code>SQL Server</code>, I can do something like this:</p>
<pre><code>UPDATE tbl1
SET col2 = tbl2.col2
FROM table1 tbl1
INNER JOIN table2 tbl2
ON tbl1.col1 = tbl2.col1
</code></pre>
<p>I haven't bothered to look whether this is part of any SQL standard or not, and I'm sure there are other ways to do... | <p>This works for sqlite:</p>
<pre><code>UPDATE tbl1 SET col2 = (SELECT col2 FROM tbl2 WHERE tbl2.col1 = tbl1.col1)
</code></pre>
| <p>I've discovered this can be done with <code>INSERT OR REPLACE INTO</code>. A little more verbose than T-SQL's equivalent, but just as handy.</p>
| 42,660 |
<p>This code works (C# 3)</p>
<pre><code>double d;
if(d == (double)(int)d) ...;
</code></pre>
<ol>
<li>Is there a better way to do this?</li>
<li>For extraneous reasons I want to avoid the double cast so; what nice ways exist other than this? (even if they aren't as good)</li>
</ol>
<p><em>Note:</em> Several people ... | <pre><code>d == Math.Floor(d)
</code></pre>
<p>does the same thing in other words.</p>
<p>NB: Hopefully you're aware that you have to be very careful when doing this kind of thing; floats/doubles will very easily accumulate miniscule errors that make exact comparisons (like this one) fail for no obvious reason.</p>
| <p>Something like this</p>
<pre><code>double d = 4.0;
int i = 4;
bool equal = d.CompareTo(i) == 0; // true
</code></pre>
| 17,197 |
<p>What is the best FREE Datepicker that can be dropped into an ASPX application?</p>
| <p>There's an excellent, free package that will AJAX enable the calendar control for use as a date picker.</p>
<p>Here's the video tutorial: <a href="http://www.asp.net/LEARN/ajax-videos/video-124.aspx" rel="nofollow noreferrer">http://www.asp.net/LEARN/ajax-videos/video-124.aspx</a></p>
| <p>Visual studio has one built-in.</p>
| 12,033 |
<p>When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly difficult; you need to cut and paste properties about, or delete them and ... | <p>Using Linq-to-Sql, you can have columns in the DataGridView appear different than in the original table by:</p>
<ol>
<li>In your Linq query, extract the columns that you want, in the order than you want, and store them in a var. Then the autogenerate columns should show them in that order in the DataGridView</li>
<... | <p>If you are in the scenario where you have reordered the columns in the database, and you now want to have this new order be reflected in the designer, I think that you have to delete the table from the designer and then put it in again. Or if you use <a href="http://msdn.microsoft.com/en-us/library/bb386987.aspx" re... | 5,872 |
<p>We have a fairly complicated GUI in windows forms using C# and .Net 2.0. My problem is that whenever I drag any window over the GUI, it leaves artifacts over the form. I can't for the life of me figure out how to eliminate it. I've tried enabling double buffering, but it only helps, doesn't eliminate the problem. Ot... | <p>You might be doing too much work on the GUI thread. Off-loading some work to background threads will free the GUI up to process Windows messages more responsively.</p>
| <p>Related to Jon B's answer, if your application is doing a lot of drawing using the Graphics object in .NET, those methods are fairly slow relative to Windows API calls.</p>
<p>Another possibility is that your GUI might not be updating itself in the OnPaint event. Sometimes custom graphics code updates a drawing su... | 32,432 |
<p>We need a web content accelerator for static images to sit in front of our Apache web front end servers</p>
<p>Our previous hosting partner used Tux with great success and I like the fact it's part of Red Hat Linux which we're using, but its last update was in 2006 and there seems little chance of future developmen... | <p>In my experience varnish is much faster than squid, but equally importantly it's much less of a black box than squid is. Varnish gives you access to very detailed logs that are useful when debugging problems. It's configuration language is also much simpler and much more powerful that squid's.</p>
| <p>We are about to roll out a varnish 2.01 server in front of an IIS 6 installation. The only caveats we've had was with our SSL (as varnish can't handle SSL). So we've also installed Nginx to handle those requests.</p>
<p>In all our testing we've shown a 66% percent increase in the amount of traffic the site can hand... | 36,965 |
<p>I have a search program that will be looking at a database from a database. If the date range is more than 3 weeks I want to alert them that it might take a while with all the data in the database. I have a confirm message box in a JavaScript function. I want to check the date range in the aspx.cs page. how do I... | <p>A Confirmation Box to go ahead, pops up when the button is clicked</p>
<pre><code>SearchButton.Attributes.Add("onclick", "javascript:return " + "confirm('" +
"The date range you have selected will return a substantial amount of data and will take some time to process.\n\nAre you sure you want to continue?')");
</c... | <p>Why check the date range on the server side? If you have the date range on the client side, its considerably less work.</p>
<p>Otherwise, you will need to postpack (or partially post), and then check the date range, then render the warning javascript back out to the page...</p>
<p>Time to rethink your method.</p>
| 43,471 |
<p>How do I truncate output in BASH? </p>
<p>For example, if I "du file.name" how do I just get the numeric value and nothing more?</p>
<p>later addition:<br>
all solutions work perfectly. I chose to accept the most enlightning "cut" answer because I prefer the simplest approach in bash files others are supposed to b... | <p>If you know what the delimiters are then cut is your friend</p>
<pre><code>du | cut -f1
</code></pre>
<p>Cut defaults to tab delimiters so in this case you are selecting the first field. </p>
<p>You can change delimiters: cut -d ' ' would use a space as a delimiter. (from <a href="https://stackoverflow.com/users/... | <p>If you just want the number of bytes of a single file, use the <code>-s</code> operator.</p>
<pre><code>SIZE=-s file.name
</code></pre>
<p>That gives you a different number than <code>du</code>, but I'm not sure how exactly you're using this.</p>
<p>This has the advantage of not having to run <code>du</code>, and... | 29,638 |
<p>I am working through a book which gives examples of Ranges being converted to equivalent arrays using their "to_a" methods</p>
<p>When i run the code in irb I get the following warning</p>
<pre><code> warning: default `to_a' will be obsolete
</code></pre>
<p>What is the the correct alternative to using to_a?</p>
... | <p>You can create an array with a range using splat,</p>
<pre><code>>> a=*(1..10)
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
</code></pre>
<p>using <code>Kernel</code> <code>Array</code> method,</p>
<pre><code>Array (1..10)
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
</code></pre>
<p>or using to_a</p>
<pre><code>(1..10... | <p>I just tried to use ranges from bigger to smaller amount and got the result I didn't expect:</p>
<pre><code>irb(main):007:0> Array(1..5)
=> [1, 2, 3, 4, 5]
irb(main):008:0> Array(5..1)
=> []
</code></pre>
<p>That's because of ranges implementations.<br />
So I had to use the following option:</p>
<pre... | 23,231 |
<p>My company has a 3rd party application that runs on a <a href="http://www.progress.com/" rel="nofollow noreferrer">Progress</a> database. I've been building an application on top of their database using an ODBC connection.</p>
<p>One of the "quirks" of Progress is that it doesn't honor SQL column widths, so it wil... | <p>The link from @tom-bascom no longer works because Progress moved their KB.
the comment from @stefan-moser on @mdb's question is appropriate. </p>
<p>According to <a href="http://media.datadirect.com/download/docs/odbc/allodbc/reference/workarounds.html" rel="nofollow">Chapter 11 WorkAround Options</a> of the <a hre... | <p>The <a href="http://media.datadirect.com/download/docs/odbc/readme/unixread.htm" rel="nofollow noreferrer">README file for DataDirect Connect for ODBC</a> (a Unix-based ODBC driver) contains a list of workarounds in the "Driver WorkAround Options" section of the document.</p>
| 21,765 |
<p>My client wants me to enable a "Remember Me" checkbox when the user logs in. I am encrypting and storing both the username and password in a cookie.</p>
<p>However, you cannot write to a textbox when it's in password mode.</p>
<p>I've seen this done numerous times, so how are they doing it?</p>
<p>thanks in adva... | <p>How about instead of inserting the text into the login form, you just bypass the form completely and check the contents of the cookie right at the login page? Less work for the user, and it'll make it a little more seamless.</p>
| <p>You can set the expiration of the cookie in 2 weeks to keep the user logged in. That's how ASP.NET authentication works with persistent authentication. Remember to update the expiration on every request.</p>
| 18,103 |
<p>In C#, if I have an inherited class with a default constructor, do I have to explicitly call the base class' constructor or will it be implicitly called?</p>
<pre><code>class BaseClass
{
public BaseClass()
{
// ... some code
}
}
class MyClass : BaseClass
{
public MyClass() // Do I need to pu... | <p>You do not need to explicitly call the base constructor, it will be implicitly called.</p>
<p>Extend your example a little and create a Console Application and you can verify this behaviour for yourself:</p>
<pre><code>using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(... | <p>You don’t need call the base constructor explicitly it will be implicitly called, but sometimes you need pass parameters to the constructor in that case you can do something like:</p>
<pre><code>using System;
namespace StackOverflow.Examples
{
class Program
{
static void Main(string[] args)
... | 3,872 |
<p>I have limited experience with .net. My app throws an error this.dateTimeFormat is undefined which I tracked down to a known ajax bug. The workaround posted said to:</p>
<p>"Register the following as a startup script:"</p>
<pre><code>Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value)
{
if (!this._upp... | <p>You would use <a href="http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx" rel="noreferrer">ClientScriptManager.RegisterStartupScript()</a></p>
<pre><code>string str = @"Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value) {
if (!this._upperAbbrMonths) {
this._upperAbbrMonths = this._toUp... | <p>Put it in the header portion of the page</p>
| 15,147 |
<p>Is it possible to prevent stack allocation of an object and only allow it to be instiated with 'new' on the heap?</p>
| <p>One way you could do this would be to make the constructors private and only allow construction through a static method that returns a pointer. For example:</p>
<pre><code>class Foo
{
public:
~Foo();
static Foo* createFoo()
{
return new Foo();
}
private:
Foo();
Foo(const Foo&);
... | <p>You could create a header file that provides an abstract interface for the object, and factory functions that return pointers to objects created on the heap.</p>
<pre><code>// Header file
class IAbstract
{
virtual void AbstractMethod() = 0;
public:
virtual ~IAbstract();
};
IAbstract* CreateSubClassA();
I... | 15,184 |
<p>I am working on an application that will be used as an extensible framework for other applications.</p>
<p>One of the fundamental classes is called Node, and Nodes have Content. The SQL tables look like this:</p>
<p>TABLE Node ( NodeId int, .... etc )</p>
<p>TABLE NodeContentRelationship ( NodeId int, ContentType... | <p>Beware the <a href="http://thedailywtf.com/Articles/The_Inner-Platform_Effect.aspx" rel="noreferrer">Inner Platform Effect</a>.</p>
<p>If you're trying to build an 'extensible framework' which allows developers to store data of different 'content types' and relate them to each other in a generic fashion, you may fi... | <p>You're in for a world of hurt down the road if you ever want to actually report on this data. You just made it much much harder to write joins and such. The lack of constraints is bad, but the extra work needed on queries is (IMHO) worse.</p>
<p>However, if you want other developers to be able to extend the syste... | 37,668 |
<p>I need to change the credentials of an already existing Windows service using C#. I am aware of two different ways of doing this.</p>
<ol>
<li>ChangeServiceConfig, see <a href="http://www.pinvoke.net/default.aspx/advapi32.ChangeServiceConfig" rel="nofollow noreferrer">ChangeServiceConfig on pinvoke.net</a></li>
<li... | <p>Here is one quick and dirty method using the System.Management classes.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
namespace ServiceTest
{
class Program
{
static void Main(string[] args)
{
string theServiceName = "My Windows Service"... | <p>ChangeServiceConfig is the way that I've done it in the past. WMI can be a bit flaky and I only ever want to use it when I have no other option, especially when going to a remote computer.</p>
| 15,307 |
<p>When running get svn fetch to pull the latest new branches from the upstream svn repository I got this error:</p>
<pre><code>$ git svn fetch
fatal: failed to unpack tree object 5ecb324e8b8fcb918acb253f33edc6ce49e49e0d
read-tree 5ecb324e8b8fcb918acb253f33edc6ce49e49e0d: command returned error: 128
</code></pre>
<p>... | <p>I had the same problem. It is due to a particular SVN revision that git-svn can't read or deal with somehow. Here is what i tried in order:</p>
<ol>
<li>Rewind to a revision known to work: <code>git svn reset -r 42</code></li>
<li>Retry the fetch: <code>git svn fetch</code> — Fetches each revision starting from 42 ... | <p>The most likely cause for this is a file or commit (that the tree references) is corrupted or missing. Or the tree itself could be corrupted. Check with:</p>
<pre><code>git fsck --unreachable HEAD $(cat .git/refs/heads/*)
</code></pre>
<p>This will show a bunch of "dangling" files, which you don't care about; cor... | 43,889 |
<p>Is there some reasonably cross platform way to create a thumbnail image given a URL? I know there are thumbnail web services that will do this, but I want a piece of software or library that will do this locally. I guess in Linux I could always spawn a browser window using a headless X server, but what about Windows... | <p>You can use Firefox or XULRunner with some fairly simple XUL to create thumbnails as PNG dataURLs (that you could then write to file if needed). Robert O'Callahan has some excellent information on it here:</p>
<p><a href="http://weblogs.mozillazine.org/roc/archives/2005/05/rendering_web_p.html" rel="nofollow norefe... | <p>There are a number of commercial packages that will do what you want. I'm not sure from reading your question if free is a requirement. But here are some applications I've found that are reasonably priced and which do exactly what you want. I have not used them myself, but they have free trial downloads so you ca... | 9,082 |
<p>How can I remove duplicate values from a multi-dimensional array in PHP?</p>
<p>Example array:</p>
<pre><code>Array
(
[0] => Array
(
[0] => abc
[1] => def
)
[1] => Array
(
[0] => ghi
[1] => jkl
)
[2] => Array
(
[0] =>... | <p>Here is another way. No intermediate variables are saved. </p>
<p>We used this to de-duplicate results from a variety of overlapping queries.</p>
<pre><code>$input = array_map("unserialize", array_unique(array_map("serialize", $input)));
</code></pre>
| <p>Based on the Answer marked as correct, adding my answer. Small code added just to reset the indices-</p>
<pre><code>$input = array_values(array_map("unserialize", array_unique(array_map("serialize", $inputArray))));
</code></pre>
| 39,604 |
<p>Can you suggest how to create a test environment to simulate various types of bandwidths and traffic in a web app?</p>
<p>Or maybe an open source program which does this against localhost?</p>
<p>I think this is a very important subject when programming web apps but it is not a usual topic, the only way i can imagin... | <p>if you're using apache you may want to take a look at <a href="http://httpd.apache.org/docs/2.0/programs/ab.html" rel="noreferrer">apache ab</a></p>
| <p>We use Loadrunner to do bandwidth and traffic simulation in our App. Loadrunner is can start agents on various machines and you can simulate one machine as running on dialup modem v/s another on DSL v/s another on Cable internet.
We also use Loadrunner to simulate various kinds of traffic conditions from 10 user run... | 18,784 |
<p>Imagine you don't have the problem of feature creep, you have a motivated and stable team, clear defined problems to solve, AND you know the domain/language/tools related to your project.</p>
<p>How do you <em>stick to a schedule</em> and accomplish that 1.0 milestone?<br>
What is your approach to an <em>iterative ... | <ol>
<li>Focus on features not implementation tasks.</li>
<li>Work in iterations (like weekly or biweekly).</li>
<li>Release working features to your staging environment in order of priority.</li>
<li>Unit test your code as you go, so you're not slowed down by a buglist that increases geometrically as you approach the ... | <p>Stage <strong><em>periodic</em></strong> (monthly? weekly?) product walkthroughs using the current accepted build, for the benefit of the Product Team. Begin these as early as possible. Demo every feature, regardless of their current usability; don't skip over the ones which are lagging behind.</p>
<p>The point is ... | 20,863 |
<p>At the risk of becoming the village idiot, can someone explain to me why generics are called generics? I understand their usage and benefits, but if the <a href="http://dictionary.reference.com/browse/generic" rel="noreferrer">definition of generic</a> is "general" and generic collections are type safe, then why is... | <p>"Generic" is talking about the implementation. You write a single "Generic" list implementation that works with any type, instead of having to write specific implementations for each type you want to use.</p>
| <p>I am not a "native" English Speaker, so I could be wrong but the point of the "Generics" is that the Define Generics types, isn't it?</p>
| 39,841 |
<p>I tried searching around, but I couldn't find anything that would help me out.</p>
<p>I'm trying to do this in SQL:</p>
<pre><code>declare @locationType varchar(50);
declare @locationID int;
SELECT column1, column2
FROM viewWhatever
WHERE
CASE @locationType
WHEN 'location' THEN account_location = @locationID
... | <pre><code>declare @locationType varchar(50);
declare @locationID int;
SELECT column1, column2
FROM viewWhatever
WHERE
@locationID =
CASE @locationType
WHEN 'location' THEN account_location
WHEN 'area' THEN xxx_location_area
WHEN 'division' THEN xxx_location_division
END
</code></pre>
| <p>Try this query. Its very easy to understand:</p>
<pre><code>CREATE TABLE PersonsDetail(FirstName nvarchar(20), LastName nvarchar(20), GenderID int);
GO
INSERT INTO PersonsDetail VALUES(N'Gourav', N'Bhatia', 2),
(N'Ramesh', N'Kumar', 1),
(N'Ram', N'Lal', 2),
(N'Sunil', N'Ku... | 25,296 |
<p>You must have heard the archetypical story of a failing/failed project:</p>
<ol>
<li>A team of inexperienced programmers work 24x7</li>
<li>Bugs are fixed only to introduce new bugs</li>
<li>Customer is screaming that he could not even do the basic stuff (Saving/Querying) etc.</li>
<li>Programmers used to having th... | <p>Vyas, I feel like I could have written this question. My previous job involved resurrecting a KVM project that had failed after a year's development. Specs were in the form of a user manual and developers' experience with similar products. I ended up teaching C to 3 assembly programmers and re-architecting from s... | <p>If you were involved in the project from the beginning, I hate to say it, but the company should replace you (and the entire team). </p>
<p>It should be reanalyzed with a competent team with real project management processes and lead by a project manager with experience in this situation.</p>
<p>None of the origin... | 29,042 |
<p>I'm not looking for the usual answer like Web-services. I'm looking for a light solution to be run in the same machine.</p>
<p>Edit: I'm looking for way in Java to call .NET methods</p>
| <p>I believe Java can talk to COM and .NET can expose COM interfaces. So that may be a very light weight solution that doesn't require any 3rd party. There is also the option of using sockets to communicate between the programs which wouldn't require a heavy instance of IIS to be installed on the machine.</p>
| <p>We tried IKVM in our production environment but it kept crashing. We use JNBridge which is a commercial product but is very stable and performs well in our ASP.NET environment.</p>
| 35,974 |
<p>I have two arrays in PHP. The first array ($author_array) is comprised of user_ids in a particular order, like so: (8, 1, 6)</p>
<p>The second array ($user_results) is comprised of an array of objects like so:</p>
<pre><code>Array
(
[0] => stdClass Object
(
[ID] => 1
[user... | <p>Use <a href="http://php.net/uksort" rel="noreferrer">usort</a> and provide a custom comparison function which uses the position of the key in your "ordering" array to determine the sort order, e.g. something like:</p>
<pre><code>function cmp($a, $b)
{
global $author_array;
$pos1=array_search ($a->ID, $au... | <pre><code>public static function reorganizeBykey ($objects, array $keys){
$results = array();
foreach($keys as $key){
$i=0;
foreach($objects as $object){
if($object->sourceName==$key){
$results[$i] = $object;
}
$i++;
}
}
$ot... | 46,344 |
<p>Is there a way, when I parse an XML document using lxml, to validate that document against its DTD using an external catalog file? I need to be able to work the fixed attributes defined in a document’s DTD.</p>
| <p>You can add the catalog to the <code>XML_CATALOG_FILES</code> environment variable:</p>
<pre><code>os.environ['XML_CATALOG_FILES'] = 'file:///to/my/catalog.xml'
</code></pre>
<p>See <a href="http://thread.gmane.org/gmane.comp.python.lxml.devel/5907" rel="noreferrer">this thread</a>. Note that entries in <code>XML_... | <p>It seems that lxml does not expose this libxml2 feature, grepping the source only turns up some #defines for the error handling:</p>
<pre><code>C:\Dev>grep -ir --include=*.px[id] catalog lxml-2.1.1/src | sed -r "s/\s+/ /g"
lxml-2.1.1/src/lxml/dtd.pxi: catalog.
lxml-2.1.1/src/lxml/xmlerror.pxd: XML_FROM_CATALOG =... | 3,362 |
<p>In c++ what is object slicing and when does it occur?</p>
| <p>"Slicing" is where you assign an object of a derived class to an instance of a base class, thereby losing part of the information - some of it is "sliced" away.</p>
<p>For example, </p>
<pre><code>class A {
int foo;
};
class B : public A {
int bar;
};
</code></pre>
<p>So an object of type <code>B</code> ha... | <p>when a derived class object is assigned to a base class object, additional attributes of a derived class object are sliced off (discard) form the base class object.</p>
<pre><code>class Base {
int x;
};
class Derived : public Base {
int z;
};
int main()
{
Derived d;
Base b = d; // Object Slicing, z of d... | 34,598 |
<p>This is a question you can read everywhere on the web with various answers:</p>
<pre><code>$ext = end(explode('.', $filename));
$ext = substr(strrchr($filename, '.'), 1);
$ext = substr($filename, strrpos($filename, '.') + 1);
$ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filename);
$exts = split("[/\\.]", $filena... | <p>People from other scripting languages always think theirs is better because they have a built-in function to do that and not PHP (I am looking at Pythonistas right now :-)).</p>
<p>In fact, it does exist, but few people know it. Meet <a href="http://php.net/manual/en/function.pathinfo.php" rel="noreferrer"><code>pa... | <p>Use </p>
<pre><code>str_replace('.', '', strrchr($file_name, '.'))
</code></pre>
<p>for a quick extension retrieval (if you know for sure your file name has one).</p>
| 20,953 |
<p>I have a Delphi DLL with a function defined as:</p>
<p>function SubmitJobStringList(joblist: tStringList; var jobno: Integer): Integer;</p>
<p>I am calling this from C#. How do I declare the first parameter as a tStringList does not exist in C#. I currently have the declaration as:</p>
<pre><code>[DllImport("opt7... | <p>You'll most likely not have any luck with this. The TStringList is more than just an array, it's a full-blown class, and the exact implementation details may differ from what is possible with .NET. Take a look at the Delphi VCL source code (that is, if you have it) and try to find out if you can rebuild the class in... | <p>I am not exactly clear your way of using delphi and C#. It seems you have created a Win32 DLL which you want to call from C#. Offcourse you must be using PInvoke for this.</p>
<p>I would suggest that you create a .NET DLL using your source code since complete porting of VCL is available. I can further elaborate if ... | 18,368 |
<p>I need a code documentation tool similar to javadoc or c# xml doc for delphi code. What is the best tool? I prefer a technology, which is in the future compatible to the Microsoft sandcastle project.</p>
| <p>Take a look at <a href="http://synopse.info/fossil/wiki?name=SynProject" rel="nofollow noreferrer">SynProject</a>, an Open Source tool written in Delphi.</p>
<p>It was designed to handle a full documentation workflow, from specifications to release notes, including tests, architecture and design; and of course ther... | <p>Sandcastle needs to get access to the assemblies in order to generate it's documentation, which means that it is only applicable for .net languages (although I'm not sure able Delphi.Net). However, Delphi 2007 and 2009 has an inline XML documentation very similar to C#. When you switch on the 'generate XML documenta... | 29,210 |
<p>This is in reference to the <a href="https://stackoverflow.com/questions/282944/jquery-one-slider-controls-another">question</a> previously asked</p>
<p>The problem here is, each <code>slider</code> controls the other. It results in feedback. </p>
<p>How do I possibly stop it?</p>
<pre><code>$(function() {
$(... | <p>This is sort of a hack, but works:</p>
<pre><code>$(function () {
var slider = $("#slider");
var slider1 = $("#slider1");
var sliderHandle = $("#slider").find('.ui-slider-handle');
var slider1Handle = $("#slider1").find('.ui-slider-handle');
slider.slider({ slide: moveSlider1 });
slider1.sl... | <p>You could just give an optional parameter to your <code>moveSlider1</code> and <code>moveSlider2</code> functions that, when set to a true value, suppresses the recursion.</p>
| 37,492 |
<p>Is there any way to create a virtual drive in "(My) Computer" and manipulate it, somewhat like JungleDisk does it?</p>
<p>It probably does something like:</p>
<pre><code>override OnRead(object sender, Event e) {
ShowFilesFromAmazon();
}
</code></pre>
<p>Are there any API:s for this? Maybe to write to an XML-f... | <p>You can use the <a href="https://dokan-dev.github.io/" rel="nofollow noreferrer">Dokan library</a> to create a virtual drive. There is a .Net wrapper for interfacing with C#.</p>
| <p>Yes, use the classes in <a href="http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.aspx" rel="nofollow noreferrer">System.IO.IsolatedStorage</a></p>
| 8,104 |
<p>So I have a large 2d array that i serialize, but when I attempt to unserialize the array it just throws the same error to the point of nearly crashing Firefox.</p>
<p>The error is:</p>
<pre><code>Warning: unserialize() [function.unserialize]: Node no longer exists in /var/www/dev/wc_paul/inc/analyzerTester.php on ... | <p>Usually, when you get an error message, you can figure out a great deal by simply searching the web for that very message. For example, when you put <a href="http://www.google.co.uk/search?q=Node+no+longer+exists" rel="nofollow noreferrer">Node no longer exists</a> into Google, you end up with <a href="http://www.r... | <p>to answer your second question about how else you could save the data</p>
<p>why not output the xml responce directly to a file and save it locally, then read from the local file when required.</p>
| 14,860 |
<p>I am trying to join together several audio files into one mp4/m4a file containing chapter metadata.</p>
<p>I am currently using QTKit to do this but unfortunately when QTKit exports to m4a format the metadata is all stripped out (this has been confirmed as a bug by Apple) see <a href="http://files.shinydevelopment.... | <p><a href="http://audiobookmaker.sourceforge.net/" rel="nofollow noreferrer">Audiobook Maker</a> does something like this, and I believe it uses ffmpeg under the hood. It's open source, so maybe its worth a look?</p>
| <p>Depending on where the bug is, you could try going straight to the QuickTime C APIs to write the movie file. You might also try adding the chapters track using the C APIs. </p>
<p>Any word on when Apple will fix the bug? I am planning to create enhanced podcasts with QTKit, and need this to work. </p>
| 7,724 |
<p>I've been working on this for a few days now, and I've found several solutions but none of them incredibly simple or lightweight. The problem is basically this: We have a cluster of 10 machines, each of which is running the same software on a multithreaded ESB platform. I can deal with concurrency issues between t... | <p>you might want to consider using <a href="http://www.hazelcast.com" rel="noreferrer">Hazelcast</a> distributed locks. Super lite and easy.</p>
<pre><code>java.util.concurrent.locks.Lock lock = Hazelcast.getLock ("mymonitor");
lock.lock ();
try {
// do your stuff
}finally {
lock.unlock();
}
</code></pre>
<p>Haze... | <p>Back in the day, we'd use a specific "lock server" on the network to handle this. Bleh.</p>
<p>Your database server might have resources specifically for doing this kind of thing. MS-SQL Server has application locks usable through the <em>sp_getapplock</em>/<em>sp_releaseapplock</em> procedures.</p>
| 11,786 |
<p>This seems like it should be simple but after a couple hours of googling I have not figured it out. I know I can add iCal links using ICS files, but this does not work on the iPhone.</p>
<p>BTW, when I say iPhone I would like it to work on the touch also. Anyone have any luck with this?</p>
| <p>You can get iPhone to download the .ics file (using Safari on a mobile web page) by using the webcal protocol:</p>
<p>webcal://website.mobi/mymeeting.ics</p>
| <p>Of course it is possible but only if your JavaScript application is installed on the device. Look at <a href="http://tetontech.wordpress.com" rel="nofollow noreferrer">http://tetontech.wordpress.com</a> to see how to make calls from JavaScript to Objective-C. You can then use this and the Calendar Store Programmin... | 20,338 |
<p>In my <a href="http://www.codeplex.com/MEF" rel="nofollow noreferrer">MEF</a> usage, I have a bunch of imports that I want to make available in many other parts of my code. Something like:</p>
<pre><code>[Export (typeof (IBarProvider))]
class MyBarFactory : IBarPovider
{
[Import]
public IFoo1Service IFoo1Se... | <p>I'm not entirely sure this answers your question but have you considered using the constructor injection yet?</p>
<pre><code>class BarImplementation : IBar
{
[ImportingConstructor]
public BarImplementation(IFoo1Service foo1, IFoo2Service foo2, ...) { }
}
</code></pre>
<p>By marking your constructor with th... | <p>I thought about making an interface to provide these services:</p>
<pre><code>partial class BarImplementation
{
public IRequiredServices
{
public IFoo1Service IFoo1Service { get; set; }
public IFoo2Service IFoo2Service { get; set; }
public IFoo3Service IFoo3Service { get; set; } ... | 24,215 |
<p>How do I export all of the names and email addresses from a distribution list in Outlook using code? I have access to an Outlook 2000 or Outlook 2007 client. Ideally I would like the code to be in C#.</p>
| <p>I realize you asked about c#, but the following script from <a href="http://www.microsoft.com/technet/scriptcenter/resources/officetips/may05/tips0524.mspx" rel="nofollow noreferrer">http://www.microsoft.com/technet/scriptcenter/resources/officetips/may05/tips0524.mspx</a> may be of some use.</p>
<pre><code>Const ... | <p>use outlook component model
<a href="http://www.dotnetjunkies.ddj.com/Tutorial/2E1EEEAF-C78A-4A38-A830-AC204B12DF83.dcik" rel="nofollow noreferrer">http://www.dotnetjunkies.ddj.com/Tutorial/2E1EEEAF-C78A-4A38-A830-AC204B12DF83.dcik</a></p>
| 38,276 |
<p>I need to create a code editor for my own simple language:</p>
<p>className.MethodName(parameterName = 2, ... )</p>
<p>I've created the appropriate grammar and autogenerate parser using ANTLR tool. Now I would like to have an autocomplete for class, method, variables and parameter names. This list should be contex... | <p>You need to parse at least some parts of the code to know what to display.</p>
<p>You either need a parser that allows parsing until it finds an error and continues from there later (or even just ignore it and tries to fix it itself to be able to continue parsing — but it gets very difficult here, so you can access... | <p>how about TextMate on the Mac or its clones on other platforms? I've just started with it, but it seems to have a very open plugin toolset.</p>
| 40,527 |
<p>I am using slideDown animation to show some divs in a newly added table row:</p>
<pre><code>$("div", newRow).slideDown(10000, UpdateHours(response.d.Hours));
</code></pre>
<p>however the UpdateHours() function is called long before the divs are finished animating. This is causing me a problem because the Updated H... | <p>I think it's trying to pass the result of the call UpdateHours(response.d.Hours) as the callback function, which would explain why it is being called so soon. One solution would be to create an anonymous function that calls UpdateHours.</p>
<pre><code>$("div", newRow).slideDown(10000, function () { UpdateHours(res... | <p>I think you want this:</p>
<p><code>$("div", newRow).slideDown(10000, function() { UpdateHours(response.d.Hours); });</code></p>
<p>This creates an anonymous function that will be called as a callback - what you're doing is setting the callback to be the return value of <code>UpdateHours</code></p>
| 43,442 |
<p>I bet I've got elementary question, but I couldn't solve it for two nights.
I've got 1 "ul" element and I just want it to move any amount of pixels every e.g. 2 sec to the left. I want him to move like this step by step and then come back to the original position and start moving again.
I've been stucked, my script... | <p>Do you mean something like this?</p>
<pre><code>window.onload = function moveUl()
{
var eUl = document.getElementById('change');
var eLi = eUl.getElementsByTagName('li');
var delta = 0;
function move()
{
for(i=0;i< eLi.length;i++)
eUl.style.marginLeft = (-300*i+delta)+'px... | <p>Is the problem you can't go back from where you started?</p>
<p>Why not just add a new for loop in move</p>
<pre><code> for(i=eLi.length; i>0 ;i--){
eUl.style.marginLeft = i*x+'px';
}
</code></pre>
<p>Do you also want it to loop for ever ie start -> left -> start -> left and again?</p>
| 48,797 |
<p>One I am aware of is <a href="http://search.cpan.org/dist/Perl-Critic/" rel="nofollow noreferrer">Perl::Critic</a></p>
<p>And my googling has resulted in no results on multiple attempts so far. :-(</p>
<p>Does anyone have any recommendations here?</p>
<p>Any resources to configure Perl::Critic as per our coding s... | <p>In terms of setting up a profile, have you tried <code>perlcritic --profile-proto</code>? This will emit to stdout all of your installed policies with all their options with descriptions of both, including their default values, in perlcriticrc format. Save and edit to match what you want. Whenever you upgrade Perl... | <p>In addition to the cosmetic best practices, I always find it useful to run Devel::Prof on my unit test suite to check test coverage.</p>
| 7,456 |
<p>Hi I want to create form on my site, which is run using Micrsoft Sharepoint. </p>
| <p>there are multiple ways to create/use forms in SharePoint. You can do this by </p>
<ul>
<li>implementing a web part</li>
<li>designing/implementing an aspx page</li>
<li>using InfoPath </li>
</ul>
<p>To decide which option is the right one for you depends on the problem you want so solve or the goal you want do ar... | <p>there are multiple ways to create/use forms in SharePoint. You can do this by </p>
<ul>
<li>implementing a web part</li>
<li>designing/implementing an aspx page</li>
<li>using InfoPath </li>
</ul>
<p>To decide which option is the right one for you depends on the problem you want so solve or the goal you want do ar... | 35,471 |
<p>I am trying to validate the WPF form against an object. The validation fires when I type something in the textbox lose focus come back to the textbox and then erase whatever I have written. But if I just load the WPF application and tab off the textbox without writing and erasing anything from the textbox, then it i... | <p>If you're not adverse to putting a bit of logic in your code behind, you can handle the actual <em>LostFocus</em> event with something like this:</p>
<p><strong>.xaml</strong></p>
<pre><code><TextBox LostFocus="TextBox_LostFocus" ....
</code></pre>
<hr>
<p><strong>.xaml.cs</strong></p>
<pre><code>private voi... | <p>I've gone through the same problem and found an ultra simple way to resolve this : in the Loaded event of your window, simply put txtLastName.Text = String.Empty. That's it!! Since the property of your object has changed (been set to an empty string), the validation's firing !</p>
| 12,921 |
<p>UDP doesnot sends any ack back, but will it send any response?</p>
<p>I have set up client server UDP program. If I give client to send data to non existent server then will client receive any response?</p>
<p>My assumption is as;</p>
<p>Client -->Broadcast server address (ARP)
Server --> Reply to client with its... | <p>You can never receive an error, or notice for a UDP packet that did not reach destination.</p>
| <p>If you need reliable UDP as in ordering or verification such that TCP/IP will give you take a look at RUDP or Reliable UDP. Sometimes you do need verification but a mixture of UDP and TCP can be held up on the TCP reliability causing a bottleneck.</p>
<p>For most large scale MMO's for isntance UDP and Reliablity U... | 43,247 |
<p>Recently I used a class that inherits from a collection instead of having the collection instantiated within the class, is this acceptable or does it create unseen problems further down the road? Examples below for the sake of clarity:</p>
<pre><code>public class Cars : List<aCar>
</code></pre>
<p>instead of... | <p>The problem with this is that your Cars class will still have the interface it inherits from List, which may allow operations you don't want.</p>
| <p>Is the "Cars" class really required?
Has some added functionality than "List" ? If not, you should use "List" ( or better "IList" ).</p>
<p>If class "Cars" has any added functionality, there is two main scenarios:</p>
<ul>
<li>This class is "final" class, there is no big possibility, the someone others need extend... | 45,535 |
<p>I've got a C# program with values in a config file. What I want is to store ampersands for an url value like...</p>
<pre><code><appSettings>
<add key="myurl" value="http://www.myurl.com?&cid=&sid="/>
</appSettings>
</code></pre>
<p>But I get errors building my site. The ampersand is n... | <p>Use "<code>&amp;</code>" instead of "&".</p>
| <p>I think you should be able to use the HTML escape character (&). They can be found at <a href="http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php" rel="nofollow noreferrer">http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php</a></p>
| 49,228 |
<p>My WCF Service uses wsHttpBinding and works fine from the client when the service is gerenated by the client using the default options as follows:</p>
<pre><code>RServiceClient R = new RServiceClient();
</code></pre>
<p>However, at some point I'll need to be able to specify the location of the service, presumably ... | <p>By default, wsHttpBinding uses Windows authentication. I'm not sure how hosting in IIS affects that scenario. </p>
<p>If you don't want security turned on, you can add an element for security and set the mode element to "None" to the config on both ends to turn off the default setting.</p>
<p>I think this may do... | <p>Are you using MessageSecurity with certificates? this could be a certificate issue (wrong hostname, self-signed certificate not installed, etc..)</p>
| 30,615 |
<p>I'm getting this worthless error in my code. it's very consistant and restarting the compiler hasn't done anything. Has anyone else ever solved this? </p>
<pre><code>while( int CharPos = _Message.Pos(_What) )
{
_Message.Insert( _With, CharPos);
_Message.Delete(CharPos + 1, 1);
}
</code></pre>
| <p>Well... apparently the compiler breaks when you try to declare an int in the while loop's condition.</p>
| <p>This is expected to be addressed in the soon to be released Update 3 for RAD Studio 2009.</p>
| 43,902 |
<p>Here's a quicky question. Which method name makes the most sense for an Objective-C Cocoa application?</p>
<pre><code>-(void) doSomethingWithAnimation:(BOOL)animated
</code></pre>
<p>or:</p>
<pre><code>-(void) doSomething:(BOOL)animated
</code></pre>
<p>or even:</p>
<pre><code>-(void) doSomethingAnimated:(BOOL)... | <p>I think the Cocoa convention would give your examples the following semmantics (ignoring the BOOL type for the argument, obviously):</p>
<pre><code>-(void) doSomethingWithAnimation:(BOOL)animated
</code></pre>
<p>would actually expect an Animation as the parameter (i.e. something that represents the animation.</p>... | <p>Here's another option to consider: make two methods, <code>-doSomething</code> and <code>-doSomethingWithAnimation</code>.</p>
<p>Then, if you want, you can have them both tail-call a third, private method, and give that method any name you want. :)</p>
| 29,077 |
<p>I have an xPC target application that talks to a device over RS-232. I am using the xPC serial block for this.<br>
To talk to this device I first have to start at a default speed, say, 9600 bps, request a change of speed to, say 57600 bps, then change the speed on my side to match it.<br>
The problem with the xPC bl... | <p>Here is my take so far. I don't think it can be done using existing Simulink blocks. I think I am going to have to take the xpcserial C code that comes with Matlab, take the code that sets the RS-232 speed, and wrap it in my own S-function.</p>
| <p>Ian,</p>
<p>What I've done before on this stuff is just modify the registers behind XPC target's back. It's ugly, but xPCTarget is ugly in the first place. </p>
<p>Try modify Line Control Register and set the divisors directly -- all you need is the serial port IO address, and you know that.</p>
<p>It's worth a... | 6,480 |
<p>I have a c# asp.net web app. Breakpoints in the database layer are no longer stopping execution but the breakpoints in the UI layer are still working okay. Can anyone hazard a guess why this might be happening?</p>
<p>I've checked all the usual suspects (Debug build is on for all projects) and recompiled all projec... | <p>I would ensure that the UI layer is referencing the appropriate 'debug' .dll's. I'd also consider pressing <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>U</kbd> (<code>Modules View</code>) when you're debugging to see if symbols are loaded for your BLL and DAL <code>.dlls</code>. If not then Visual Studio is unable to find <c... | <p>Have you tried deleting your bin directories before recompiling?</p>
| 8,489 |
<p>I have the feeling that is easy to find samples, tutorials and simple examples on Flex.<br>
It seems harder to find tips and good practices based on real-life projects.<br>
Any tips on how to :</p>
<ul>
<li>How to write maintainable actionscript code</li>
<li>How to ensure a clean separation of concern. Has anybody... | <p>I work often with Flex in my job, and I will be happy to help.. but your questions deserve an article for each one :) I'll try some short answer.</p>
<p>Maintenable code: I think that the same rules of any other OO languages apply. Some flex-specific rules I'm use to follow: use strong typed variables, always consi... | <p>I have found the MVC framework RIAWave <a href="http://ria.richtechmedia.com/go.php?http://ria.richtechmedia.com/flexsample/sample.rar" rel="nofollow noreferrer">link</a> to be absolutely incredible. It is super lightweight and easy to use. I found Cairngorm and PureMVC to have a pretty steep learning curve and th... | 12,159 |
<p>I previously asked how to do this in Groovy. However, now I'm rewriting my app in Perl because of all the CPAN libraries.</p>
<p>If the page contained these links:</p>
<pre>
<a href="http://www.google.com">Google</a>
<a href="http://www.apple.com">Apple</a>
</pre>
<p>The output would be:... | <p>Please look at using the <a href="http://search.cpan.org/dist/WWW-Mechanize/" rel="noreferrer">WWW::Mechanize</a> module for this. It will fetch your web pages for you, and then give you easy-to-work with lists of URLs.</p>
<pre><code>my $mech = WWW::Mechanize->new();
$mech->get( $some_url );
my @links = $me... | <p>We can use regular expression to extract the link with its link text. This is also the one way.</p>
<pre><code>local $/ = '';
my $a = <DATA>;
while( $a =~ m/<a[^>]*?href=\"([^>]*?)\"[^>]*?>\s*([\w\W]*?)\s*<\/a>/igs )
{
print "Link:$1 \t Text: $2\n";
}
__DATA__
<a href="http:... | 31,725 |
<p>I infrequently (monthly/quarterly) generate hundreds of Crystal Reports reports using Microsoft SQL Server 2005 database views. Are those views wasting CPU cycles and RAM during all the time that I am not reading from them? Should I instead use stored procedures, temporary tables, or short-lived normal tables sinc... | <p>For the most part, it doesn't matter. Yes, SQL Server will have more choices when it parses SELECT * FROM table (it'll have to look in the system catalogs for 'table') but it's highly optimized for that, and provided you have sufficient RAM (most servers nowadays do), you won't notice a difference between 0 and 1,00... | <p>The views are only going to take up cpu/memory resources when they are called.</p>
<p>Anyhow, best practice would be to consolidate what can be consolidated, remove what can be removed, and if it's literally only used by your reports, choose a consistent naming standard for the views so they can easily be grouped t... | 6,140 |
<p>I've had a hard time finding good ways of taking a time format and easily determining if it's valid then producing a resulting element that has some formatting using XSLT 1.0.</p>
<p>Given the following xml:</p>
<pre><code><root>
<srcTime>2300</srcTime>
</root>
</code></pre>
<p>It woul... | <p>There aren't any regular expressions in XSLT 1.0, so I'm afraid that pattern matching isn't going to be possible.</p>
<p>I'm not clear if <code><srcTime>23:00</srcTime></code> is supposed to be legal or not? If it is, try:</p>
<pre><code><dstTime>
<xsl:if test="string-length(srcTime) = 4 or
... | <p>Have a look at:
<a href="http://www.exslt.org/" rel="nofollow noreferrer">http://www.exslt.org/</a> specifically the "dates and times" section.
I haven't dug deep into it but it looks like it may be what your looking for.</p>
| 17,210 |
<p>Anyone knows a way to define refactoring in a more formal way?</p>
<p>UPDATE.</p>
<blockquote>
<p>A refactoring is a pair R = (pre; T) where pre is the precondition that
the program must satisfy, and T is the program transformation.</p>
</blockquote>
| <p>It's an interesting question and one I hadn't considered. I did a little googling and came up with this <a href="http://wwwiti.cs.uni-magdeburg.de/iti_db/forschung/ramses/publications/ADI2006.pdf" rel="nofollow noreferrer">paper</a> (PDF) on refactoring in AOP that attempts to apply some mathematical modeling to as... | <p>Well not directly, but in terms of money - I can say Yes. I can't come up with an equation on that :)</p>
<p>Code well-written, free of complexity (that could be due to refactoring) can save time/effort and hence money.</p>
| 38,607 |
<p>Singletons are a hotly debated design pattern, so I am interested in what the Stack Overflow community thought about them.</p>
<p>Please provide reasons for your opinions, not just "Singletons are for lazy programmers!"</p>
<p>Here is a fairly good article on the issue, although it is against the use of Singletons... | <p>In defense of singletons:</p>
<ul>
<li><strong>They are not as bad as globals</strong> because globals have no standard-enforced initialization order, and you could easily see nondeterministic bugs due to naive or unexpected dependency orders. Singletons (assuming they're allocated on the heap) are created after a... | <p>I really disagree on the <em>bunch of global variables in a fancy dress</em> idea. Singletons are really useful when used to solve the right problem. Let me give you a real example.</p>
<p>I once developed a small piece of software to a place I worked, and some forms had to use some info about the company, its em... | 3,295 |
<p>I have a custom application with a simple app.config specifying SQL Server name and Database, I want to prompt the user on application install for application configuration items and then update the app.config file.</p>
<p>I admit I'm totally new to setup projects and am looking for some guidance.
Thank You
Mark Ko... | <p>I had problems with the code Gulzar linked to on a 64 bit machine. I found the link below to be a simple solution to getting values from the config ui into the app.config.</p>
<p><a href="http://raquila.com/software/configure-app-config-application-settings-during-msi-install/" rel="noreferrer">http://raquila.com/s... | <p>Create custom dialogs for use in your Visual Studio Setup projects:
<a href="http://www.codeproject.com/Articles/18834/Create-custom-dialogs-for-use-in-your-Visual-Studi" rel="nofollow">http://www.codeproject.com/Articles/18834/Create-custom-dialogs-for-use-in-your-Visual-Studi</a></p>
| 30,969 |
<p>We need to remotely create an Exchange 2007 distribution list from Asp.Net.</p>
<p>Near as I can tell, the only way to create a distribution list in the GAL is via the exchange management tools. Without installing this on our web server, is there any way to create a distribution list remotely? There are some thir... | <p>SelectMany - i.e.</p>
<pre><code> IEnumerable<List<string>> someList = ...;
IEnumerable<string> all = someList.SelectMany(x => x);
</code></pre>
<p>For each item in someList, this then uses the lambda "x => x" to get an IEnumerable<T> for the inner items. In this case, eac... | <p>Make a simple method. No need for LINQ:</p>
<pre><code>IEnumerable<string> GetStrings(IEnumerable<List<string>> lists)
{
foreach (List<string> list in lists)
foreach (string item in list)
{
yield return item;
}
}
</code></pre>
| 18,114 |
<p>I understand how Map is easily parallelizable - each computer/CPU can just operate on a small portion of the array.</p>
<p>Is Reduce/foldl parallelizable? It seems like each computation depends on the previous one. Is it just parallelizable for certain types of functions?</p>
| <p>If your reduction underlying operation is associative*, you can play with the order of operations and locality. Therefore you often have a tree-like structure in the 'gather' phase, so you can do it in several passes in logarithmic time:</p>
<pre><code>a + b + c + d
\ / \ /
(a+b) (c+d)
... | <p>It depends on your Reduce step. In a Hadoop-style implementation of MapReduce, your Reducer is getting called once <em>per key,</em> with all the rows relevant to that key.</p>
<p>So, for example, your Mapper might be taking in a lot of unordered web server logs, adding some metadata (e.g., geocoding), and emittin... | 42,683 |
<p>I would like to keep a list of a certain class of objects in my application. But I still want the object to be garbage collected. Can you create <strong>weak references</strong> in .NET?</p>
<p>For reference:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/346762">Garbage Collecting objects which keep tr... | <p>Yes, there's a generic weak reference class.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/xt0a1s34.aspx" rel="noreferrer">MSDN > Weak Reference</a></p>
| <p>Here is the full (non thread safe) implementation sample of <code>WeakReference</code></p>
<pre><code>ClassA objA = new ClassA();
WeakReference wr = new WeakReference(objA);
// do stuff
GC.Collect();
ClassA objA2;
if (wr.IsAlive)
objA2 = wr.Target as ClassA;
else
objA2 = new ClassA(); // create it directl... | 45,135 |
<p>I found this guide for using the flash parameters, thought it might be useful to post here, since Flash CS3 lacks a usage example for reading these parameters.</p>
<p>See answers for the link</p>
| <p>Not sure why <a href="http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html" rel="nofollow noreferrer">his example</a> calls LoaderInfo. The <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObject.html" rel="nofollow noreferrer">DisplayObject</a> class has ... | <pre><code>var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
</code></pre>
<p>The entire article is at:</p>
<p><a href="http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html" rel="nofollow noreferrer">http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html</a><... | 13,433 |
<p>Are there any good examples (websites or books) around of how to build a full text search engine in F#? </p>
| <pre><code> HttpConnectionManagerParams cmparams = new HttpConnectionManagerParams();
cmparams.setSoTimeout(10000);
cmparams.setTcpNoDelay(true);
HttpConnectionManager manager = new SimpleHttpConnectionManager();
manager.setParams(cmparams);
params = new HttpClientParams();
params.setSoTimeou... | <blockquote>
<p>cmparams.setSoTimeout(10000);</p>
</blockquote>
<p>This one is for all HttpClient by default.</p>
<blockquote>
<p>params.setSoTimeout(5000);</p>
</blockquote>
<p>And this one is for a particular httpclient.</p>
| 16,046 |
<p>I'm trying to determine if any changes were made to a particular entity object. Essentially, I want to know if SubmitChanges() will actually change anything. I would prefer to be able to determine this after SubmitChanges() has been called, but it doesn't really matter.</p>
<p>Anyone know how I would do this?</p>
| <p>Take a look at the <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.getchangeset.aspx" rel="noreferrer">GetChangeset</a> function on your DataContext.</p>
| <p>This is what I came up with:</p>
<pre><code>Public Function HasChanges(ByVal obj As Object) As Boolean
Dim cs = GetChangeSet()
If cs.Updates.Contains(obj) Or cs.Inserts.Contains(obj) Or cs.Deletes.Contains(obj) Then Return True
Return False
End Function
</code></pre>
| 46,951 |
<p>I have a ASP.Net 2.0 website that is currently using a custom MembershipProvider and the standard login control. I would like to replace the login control with the one from DotNetOpenId.</p>
<p>I override the ValidateUser which checks the username and password, but I shouldn't need to implement this when using Ope... | <p>There is no inbuilt provider available. But you can always implement your own provider.</p>
<p>Or you can check out <a href="http://www.codeplex.com/OpenIDMembership" rel="nofollow noreferrer">this one</a> available in codePlex. </p>
| <p>This is the premier .NET OpenID library, by Andrew Arnott, MSFT employee: <a href="http://code.google.com/p/dotnetopenid/" rel="nofollow noreferrer">http://code.google.com/p/dotnetopenid/</a></p>
<p>Not sure about integration with Membership.</p>
| 17,179 |
<p>I am wondering if anyone is already using Entity Framework with an Oracle database in a production environment? There seems to be no support for EF in ODP.Net and only 3rd party data providers (OraDirect) seem to be available to connect with Oracle. Someone mentioned asample data provider available on Codeplex but i... | <p>Personally, I wouldn't attempt this yet. The message on the sample data provider is warning enough. The level of validation you would need to go through to be comfortable using EF in this configuration wouldn't be worth the effort, IMO.</p>
| <p>I've installed this from Oracle</p>
<p><a href="http://www.oracle.com/technetwork/topics/dotnet/downloads/oracleefbeta-302521.html" rel="nofollow">http://www.oracle.com/technetwork/topics/dotnet/downloads/oracleefbeta-302521.html</a></p>
<p>The only problem i have accoured is when i have a table with a SEQ+Trigger... | 14,158 |
<p>I am currently in the process of replacing the IBM WebService framework with Axis2. When generating the code from the WSDL file, I use the Maven plugin WSDL2Code. However, the code created is always wrong. Or rather, the packagenames are always wrong, which in turn makes every method called uncallable (creating even... | <p>Version 1.4.1 has a few more configuration options that are not really documented (have a look at the the source of org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo)...</p>
<p>Just use <flattenFiles>true</flattenFiles> - that should solve your problem :-)</p>
| <p>Maybe 'src' is part of ${basedir} ?</p>
| 43,275 |
<p>I'm working in a small company and weeks away from deploying a web-app that will be used a lot. Everyone at one location will have to learn to use it, and although I think it's pretty easy and intuitive I may be biased.<br>
I've written a help guide with plenty of screenshots that's available on every page, but I'l... | <p><strong>First try to avoid the training:</strong></p>
<p>Perform <a href="http://en.wikipedia.org/wiki/Usability_testing" rel="noreferrer">usability testing</a> to ensure your web app is intuitive. Usability testing is a very important aspect of testing and it is often ignored. How you see your system will probabl... | <p>Try a few users first, one or two in a small company. Mostly watch, help as little as possible. This tells you what needs to be fixed, and it creates an experienced user base - so you are not the "training bottleneck" anymore. </p>
<p>Turn core requirements/use cases/storycards into HowTo / walkthroughs for your d... | 29,262 |
<p>I currently use the following command, but it's a little unwieldy to type. What's a shorter alternative?</p>
<pre><code>find . -name '*.txt' -exec grep 'sometext' '{}' \; -print
</code></pre>
<p>Here are my requirements:</p>
<ul>
<li>limit to a file extension (I use SVN and don't want to be searching through all... | <p>grep has -r (recursive) and --include (to search only in files and directories matching a pattern).</p>
| <p>I usualy avoid the "man find" by using <code>grep $(find . -name "*,txt")</code></p>
| 27,500 |
<p>I've read on Wikipedia and other sites about <a href="https://en.wikipedia.org/wiki/OSGi" rel="noreferrer">OSGi</a>, but I don't really see the big picture. It says that it's a component-based platform, and that you can reload modules at runtime. Also the "practical example" given everywhere is the Eclipse Plugin Fr... | <p>I've found the following benefits from OSGi:</p>
<ul>
<li>Each plugin is a versioned artifact that has its own classloader.</li>
<li>Each plugin depends on both specific jars that it contains and also other specific versioned plug-ins.</li>
<li>Because of the versioning and isolated classloaders, different versions... | <p>It is also being used to bring additional portability of middleware and applications on the mobile side. Mobile side is available for WinMo, Symbian, Android for example. As soon as integration with device features occurs, can get fragmented.</p>
| 13,169 |
<p>I have some code that gives a user id to a utility that then send email to that user.</p>
<pre><code>emailUtil.sendEmail(userId, "foo");
public void sendEmail(String userId, String message) throws MailException {
/* ... logic that could throw a MailException */
}
</code></pre>
<p><code>MailException</code> co... | <p>I usually start with a general exception and subclass it as needed. I always can catch the general exception (and with it all subclassed exceptions) if needed, but also the specific.</p>
<p>An example from the Java-API is IOException, that has subclasses like FileNotFoundException or EOFException (and much more).</... | <p>I would just go by</p>
<pre><code>throw new exception("WhatCausedIt")
</code></pre>
<p>if you want to handle your exceptions, you could pass a code instead of "WhatCausedIt" an then react to the different answers with a switch statement. </p>
| 4,179 |
<p>It seems redundant to have zlib compress a web page during every request. It is also the bottleneck of my files' response times. Is there a way to cache the zlib'd file so that it is compressed only once at each modification? Or should I just keep wishing?</p>
| <p>If you want a quick and lazy solution, just make gzipped copies of your most used files and turn <a href="http://httpd.apache.org/docs/2.2/content-negotiation.html" rel="nofollow noreferrer">MultiViews</a> on for them. This still has CPU overhead to calculate the right file to send but it's less than a gzip every ti... | <p>Hm, I think mod_cache will do the job. <a href="http://httpd.apache.org/docs/2.0/mod/mod_cache.html" rel="nofollow noreferrer">http://httpd.apache.org/docs/2.0/mod/mod_cache.html</a></p>
| 22,476 |
<p>I am trying to be a "good" programmer and have unit tests for my ColdFusion application but haven't been able to find a code coverage tool that can tie into the test that I'm using. For those of you who do unit tests on your ColdFusion code, how have you approached this problem?</p>
| <p><a href="http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53046" rel="nofollow noreferrer">Many</a> <a href="http://www.pbell.com/index.cfm/2006/10/20/What-is-Code-Coverage-Analysis--and-why-should-you-care" rel="nofollow noreferrer">have</a> <a href="http://coolskool.blog-city.com/what_coldfusion_too... | <p><a href="http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:53046" rel="nofollow noreferrer">Many</a> <a href="http://www.pbell.com/index.cfm/2006/10/20/What-is-Code-Coverage-Analysis--and-why-should-you-care" rel="nofollow noreferrer">have</a> <a href="http://coolskool.blog-city.com/what_coldfusion_too... | 5,049 |
<p>When I debug in Visual Studio, Firefox opens and that is annoying because of the hookups that Internet Explorer and Visual Studio have, such as when you close the Internet Explorer browser that starting debug opened, Visual Studio stops debugging. How can I get Visual Studio to open Internet Explorer instead withou... | <p>Scott Guthrie has made a post on <a href="http://weblogs.asp.net/scottgu/archive/2005/11/18/430943.aspx" rel="noreferrer">how to change Visual Studio's default browser</a>:</p>
<blockquote>
<p>1) Right click on a .aspx page in your
solution explorer</p>
<p>2) Select the "browse with" context
menu option<... | <p>Another way is to do the following in Visual Studio:</p>
<ol>
<li>Select Debug</li>
<li>Options and Settings</li>
<li>Expand Environment</li>
<li>Select Web Browser</li>
<li>Click the '<strong>Internet Explorer Options</strong>' button</li>
<li>Select the '<strong>Programs</strong>' tab</li>
<li>Select '<strong>Mak... | 10,540 |
<p>Another poster asked about <a href="https://stackoverflow.com/questions/224138/infinite-loops-top-or-bottom">preferred syntax for infinite loops</a>.</p>
<p>A follow-up question: <i>Why</i> do you use infinite loops in your code? I typically see a construct like this:</p>
<pre><code>for (;;) {
int scoped_variabl... | <p>A loop like:</p>
<pre><code>while (true)
{
// do something
if (something else) break;
// do more
}
</code></pre>
<p>lets you break out of the loop in the middle, rather than at the start (while/for) or end (do-while).</p>
<p>If you've got a complex condition, you might also want to use this style to m... | <p>I used to use them when waiting for multiple threads to complete in c#, but now I use the ThreadPool class.</p>
| 27,696 |
<p>I'm looking at the following code snippet:</p>
<pre><code>my @ret = <someMethod>
return (undef) if( $DB_ERROR );
return (undef) unless ($#ret >= 0);
</code></pre>
<p>Does <code>$#</code> just give you a count of elements in a array?</p>
| <p><code>$#arrayname</code> gives you the index of the last element, so if array <code>@ret</code> has 2 elements then <code>$#ret</code> is 1. </p>
<p>And, as noted by Barry Brown, an empty array gives -1.</p>
<p>To get the length you can use the array in scalar context:</p>
<pre><code>print scalar @ret;
</code></... | <p>To summarize everyone else, that code is much more legible if written like this:</p>
<pre><code>my @ret = someMethod();
return if $DB_ERROR;
return unless @ret;
</code></pre>
| 29,878 |
<p>Here's my table: </p>
<pre><code>CREATE TABLE `alums_alumphoto` (
`id` int(11) NOT NULL auto_increment,
`alum_id` int(11) NOT NULL,
`photo_id` int(11) default NULL,
`media_id` int(11) default NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `alums_alumphoto_alum_id` (`alum_id... | <p>Precisely, try this : </p>
<p>First drop the Foreign Key or Constraint :</p>
<pre><code>ALTER TABLE `alums_alumphoto` DROP FOREIGN KEY `photo_id_refs_id_63282119`;
</code></pre>
<p>The previous command removes the Foreign Key Constraint on the column. Now you can drop the column <code>photo_id</code> (the index i... | <p>Try combining the DROP KEY and DROP FOREIGN KEY statements.</p>
<pre><code>ALTER TABLE `alums_alumphoto`
DROP KEY KEY `alums_alumphoto_photo_id`,
DROP FOREIGN KEY `photo_id_refs_id_63282119`;
ALTER TABLE `alums_alumphoto`
DROP COLUMN `photo_id`;
</code></pre>
| 44,013 |
<p>Up till now I have been developing my personal and school
projects at home without using any form of revision control
software to handle my changes and whatnot.</p>
<p>My question is, <strong>how feasible is it to use a Version
Control application</strong> (such as <a href="http://en.wikipedia.org/wiki/TortoiseSVN"... | <p>Completely.</p>
<p>Credits also to <a href="http://blogs.embarcadero.com/nickhodges/2010/04/23/39416" rel="noreferrer">http://blogs.embarcadero.com/nickhodges/2010/04/23/39416</a>:</p>
<ul>
<li><strong>Sometimes we do stupid mistakes.</strong> Having a source control safety net is a must.</li>
<li><strong>Tag impo... | <p>I find that it is extremely helpful to have a SVN server setup because I find myself going back through revisions and other 'throw away' projects because I remembered some function or way of doing something that I could use now. Having the SVN server, I know that the code is stored at home and I can pull it up late... | 47,098 |
<p>What are good reasons to prohibit inheritance in Java, for example by using final classes or classes using a single, private parameterless constructor? What are good reasons of making a method final?</p>
| <p>Your best reference here is Item 19 of Joshua Bloch's excellent book "Effective Java", called "Design and document for inheritance or else prohibit it". (It's item 17 in the second edition and item 15 in the first edition.) You should really read it, but I'll summarize.</p>
<p>The interaction of... | <p>You want to make a method final so that overriding classes does not change its behavior. When you want to be able to change the behavior make the method public. When you override a public method it can be changed. </p>
| 26,916 |
<p>Alright, so I just finished my last compiler error (so I thought) and these errors came up:</p>
<pre><code>1>GameEngine.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA)
1>Component.obj : error LNK2001: unresolved external symbol "public: static double ... | <p>Most often, when the linker is failing to detect a static member it is because you to forgot to really define it somewhere, as it was pointed before:</p>
<pre><code>// header
class X {
static const int y;
};
// cpp
const int X::y = 1;
</code></pre>
<p>But in your case, as you are not only missing static variab... | <p>Declaring a variable in one place and assigning it a value in another place shouldn't cause any errors. Make sure you include WeaponsDB.h at the top of all files that reference objects defined there. </p>
<p>Ex: at the top of Driver.cpp, make sure "#include WeaponsDB.h" appears.</p>
<p>Hope this helps!</p>
| 49,818 |
<p>I'm new to Ruby, and I'm trying the following: </p>
<pre><code>mySet = numOfCuts.times.map{ rand(seqLength) }
</code></pre>
<p>but I get the 'yield called out of block' error. I'm not sure what his means. BTW, this question is part of a more general question I asked <a href="https://stackoverflow.com/questions/11... | <p>The problem is that the times method expects to get a block that it will yield control to. However you haven't passed a block to it. There are two ways to solve this. The first is to not use times:</p>
<pre><code>mySet = (1..numOfCuts).map{ rand(seqLength) }
</code></pre>
<p>or else pass a block to it:</p>
<pr... | <p>Integer.times expects a block. The error message means the <code>yield</code> statement inside the <code>times</code> method can not be called because you did not give it a block.</p>
<p>As for your code, I think what you are looking for is a range: </p>
<pre><code>(1..5).map{ do something }
</code></pre>
<p>Here... | 14,502 |
<p>I'm a php guy, but I have to do some small project in JSP.
I'm wondering if there's an equivalent to htmlentities function (of php) in JSP.</p>
| <pre><code>public static String stringToHTMLString(String string) {
StringBuffer sb = new StringBuffer(string.length());
// true if last char was blank
boolean lastWasBlankChar = false;
int len = string.length();
char c;
for (int i = 0; i < len; i++)
{
c = string.charAt(i);
... | <p>I suggest using escapeXml set to true attribute of JSTL's directly in JSP</p>
<pre><code><c:out value="${string}" escapeXml="true" />
</code></pre>
| 42,549 |
<p>As a developer, how do you use gdb to track down bugs within your code? What techniques tricks do you use to make your life easier?</p>
| <p>In general you find something that isn't how it should be, and work backwards until you understand why.</p>
<p>The most obvious is the most useful: Setting a breakpoint on a function or line number and walking through the code line by line.</p>
<p>Another handy tip is to have show functions for all your structure... | <p>Use ddd, a visual front-end for gdb. It lets you do things easily with a few mouse clicks and visualise how the code works, plus in the debugger console you have an intercative gdb.</p>
| 16,966 |
<p>What do you do if members of your team are not cooperative during scrum meetings?
They either provide a very high level definition of what they are currently working on, ("working on feature x"), or go into extremely irrelevant details, <strong>in spite of being well educated in SCRUM methodology</strong>.
This caus... | <p>First of all... make sure folks are standing up... and not even leaning on the wall or a desk.</p>
<p>At a high level, I would say that, whenever you face issues on the team, the best response is to <em>ask the team</em> for solutions. However, here are some of the techniques I've used for the issues you're facing.... | <p>Ask for the specific details you need. People won't be aware of stuff you are interested in.</p>
<p>Also try to put forth some guidelines for better and effective presentation before the meeting.</p>
| 9,647 |
<p>How to arrange a Makefile to compile a kernel module with multiple .c files?</p>
<p>Here is my current Makefile. It was auto generated by <a href="http://www.kdevelop.org/" rel="noreferrer">KDevelop</a></p>
<pre><code>TARGET = nlb-driver
OBJS = nlb-driver.o
MDIR = drivers/misc
EXTRA_CFLAGS = -DEXPORT_SYMTAB
CURRE... | <p>In my case the project consists of 6 files: </p>
<ul>
<li><code>monter_main.c</code>, <code>monter_main.h</code></li>
<li><code>monter_cdev.c</code>, <code>monter_cdev.h</code></li>
<li><code>monter_pci.c</code>, <code>monter_pci.h</code></li>
</ul>
<p><code>monter_main.c</code> is the main file of my module. </p>... | <p>I would assume that just listing more object files in the second line would do the trick.</p>
| 45,513 |
<p>What are all <a href="http://en.wikipedia.org/wiki/Hayes_command_set" rel="nofollow noreferrer">AT</a> commands required for <a href="http://en.wikipedia.org/wiki/General_Packet_Radio_Service" rel="nofollow noreferrer">GPRS</a> communication?</p>
| <p>A more specific answer, if you're using a MultiTech Multimodem GPRS (or similar) and Tmobile's internet service (one of the higher tiers usually used with laptops). The uppercase names starting with "M" were the names of the states in the modem control state machine I was using. The data I was collecting was simpl... | <p>Most of the mobile phone specific AT commands are standardised and specified in <a href="http://www.3gpp.org/ftp/Specs/html-info/27007.htm" rel="nofollow noreferrer">27.007</a> (SMS related commands are in <a href="http://www.3gpp.org/ftp/Specs/html-info/27005.htm" rel="nofollow noreferrer">27.005</a>). For Sony Eri... | 32,644 |
<p>Wondering if anyone has gotten the infamous "database is locked" error from Trac and how you solved it. It is starting to occur more and more often for us. Will we really have to bite the bullet and migrate to a different DB backend, or is there another way?</p>
<p>See these two Trac bug entries for more info:</p>
... | <p>That's a problem with the current SQLite adapter. There are scripts to migrate to postgres and I can really recommend that, postgres is a lot speeder for trac.</p>
| <p>I don't think this is 100% fixed just yet. We experience this error a couple dozen times a day. In our case, we have 30+ people updating Trac <em>constantly</em> as we use it for tracking pretty much everything, and not just bugs. From ticket #3446:</p>
<blockquote>
<p>Quite obviously, this is [...] due to
our ... | 15,283 |
<p>I would like to have alternate behavior during a print stylesheet on a web page. Something along the lines of:</p>
<blockquote>
<p>If this page is being printed, don't
bother calling SWFObject to summon an
.swf into existence. Just leave the
HTML that the Flash will replace.</p>
</blockquote>
<p>I've tri... | <p>It sounds like you're confused that print style-sheets are used when you view a printer-friendly page, but that is not the case. A print style sheet isn't applied until the user actually sends the page to the printer. At this point, any javascript that is going to run has already finished.</p>
<p>What you want to... | <p>You could use JavaScript to access the stylesheets in the document and then check if the 'Print' stylesheet is active. Once you determined which CSS is active then you could manage your content.</p>
<p>The <code>getActiveStyleSheet</code> function would looks something like this:</p>
<pre><code>function getActiveS... | 44,882 |
<p>How does one do this?</p>
<p>If I want to analyze how something is getting compiled, how would I get the emitted assembly code?</p>
| <p>Use the <a href="https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#index-S" rel="noreferrer">-S</a> option to <code>gcc</code> (or <code>g++</code>), optionally with <a href="https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fverbose-asm" rel="noreferrer">-fverbose-asm</a> which works well at the ... | <p>Use "-S" as an option. It displays the assembly output in the terminal.</p>
| 16,578 |
<p>What is the shortest chunk of C++ you can come up with to safely clean up a <code>std::vector</code> or <code>std::list</code> of pointers? (assuming you have to call delete on the pointers?)</p>
<pre><code>list<Foo*> foo_list;
</code></pre>
<p>I'd rather not use Boost or wrap my pointers with smart pointers.... | <p>Since we are throwing down the gauntlet here... "Shortest chunk of C++"</p>
<pre><code>static bool deleteAll( Foo * theElement ) { delete theElement; return true; }
foo_list . remove_if ( deleteAll );
</code></pre>
<p>I think we can trust the folks who came up with STL to have efficient algorithms. Why reinvent t... | <pre><code>for (list<Foo*>::const_iterator i = foo_list.begin(), e = foo_list.end(); i != e; ++i)
delete *i;
foo_list.clear();
</code></pre>
| 39,516 |
<p>Are there any more generic tools that can "compile" or basically merge multiple PHP files into a single file based on includes and autoloading classes? I'm thinking of something similar to Doctrine's compiling functionality or the compiling that many of the major JS frameworks do for "production" sites to lighten th... | <p>Out of curiosity, why do you want to do this? If it's for performance, don't bother. Just use regular includes instead of auto-loading, and it will have much of the same effect. For performance you're better off looking at one of the run-time caching solutions.</p>
| <p>I have run across the <a href="http://www.codeplex.com/YUICompressor" rel="nofollow noreferrer">YUI Compressor for .NET</a> that is hosted on codeplex.</p>
<p>It will compress both JavaScript and CSS files in your project.</p>
<p>I haven't tried it yet, but I am very interested in it.</p>
<p>You can easily integr... | 20,270 |
<p>The mouse hovers over an element and a tip appears. The tip overflows the page, triggering a scrollbar, which changes the layout just enough so that the underlying element that triggered the tip is no longer under the mouse pointer, so the tip goes away.</p>
<p>The tip goes away, so the scrollbar goes away, and n... | <p><strong>edit</strong>: in response to the comments, it sounds like you're trying to have the tooltip appear, without affecting the positioning of existing elements (and thus causing the scrollbar on the main window).</p>
<p>if that's the case, you want to define your tooltip's position as absolute, as this will rem... | <p>Seems to me that what you need is cursor position within the client browser window. Then you can do your calculations to place the tooltip so it doesn't cross the border.</p>
<p>What I found on the web is a short article discussing this in diffrent browsers: <a href="http://javascript.about.com/library/blmousepos.h... | 25,924 |
<p>I have a .net project (MySolution.Common) that uses the app.config. I am using the project MySolution.Common in an InteropUserControl project called MySolution.InteropCtrl. MySolution.InteropCtrl is embedded into a VB6 project. When the MySolution.InteropCtrl is in the VB6 project, It cannot find the app.config file... | <p>I'm not 100% sure on this. But I'll throw out some possibilities. First of all, app.config is not the correct name for the file. While it is app.config in your project, it gets auto-renamed to <em>binary</em>.exe.config or <em>binary</em>.dll.config (depending on project type) where <em>binary</em> is the name of... | <p>Two options:</p>
<p>1) Find your vb.exe path and put your config in there, as VB6.exe.config.</p>
<p>2) If you don't need to use the IDE just make your MyApp.exe an put it in your project's folder as MyApp.exe.config, then run the exe and it will find it.</p>
| 21,200 |
<p>I need to decrement a Javascript date by 1 day, so that it rolls back across months/years correctly. That is, if I have a date of 'Today', I want to get the date for 'Yesterday'.</p>
<p>It always seems to take more code than necessary when I do this, so I'm wondering if there's any simpler way. </p>
<p>What's th... | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var d = new Date();
d.setDate(d.getDate() - 1);
console.log(d);</code></pre>
</div>
</div>
</p>
| <p><code>setDate(dayValue)</code></p>
<p><code>dayValue</code> is an integer from 1 to 31, representing the day of the month.</p>
<p>from <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Date/setDate" rel="nofollow noreferrer">https://developer.mozilla.org/en/Core_JavaScript_1.5_... | 5,190 |
<p>Any recommendations for a javascript form validation library. I could try and roll my own (but I'm not very good at javascript). Needs to support checking for required fields, and preferably regexp validation of fields.</p>
| <p>I am about to start implementing javascript validation in my forms using <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="noreferrer">jQuery Validation</a>.
I think that StackOverflow users this jQuery plugin as well. It seems to be a very mature validation library, however it does build... | <p>I've used <a href="http://tetlaw.id.au/view/javascript/really-easy-field-validation" rel="nofollow noreferrer">this library</a> for a couple of personal projects. It's pretty good, though I have had to make my own modifications to it a couple of times - nothing major, though, and it's easy enough to do so.</p>
<p>I... | 3,841 |
<p>I'm having a bit of trouble with the UTL_MAIL package in Oracle 10g, and was wondering if anyone had any solutions?</p>
<p>I connect to my DB as SYSMAN and load the following two scripts;</p>
<p><strong>@C:\oracle\product\10.2.0\db_1\rdbms\admin\utlmail.sql</strong></p>
<p><strong>@C:\oracle\product\10.2.0\db_1\r... | <p>I'm pretty sure that public synonyms will be the only difference.</p>
<pre><code>SELECT * FROM ALL_SYNONYMS WHERE OWNER = 'PUBLIC' and table_name LIKE 'UTL%'
</code></pre>
<p>will confirm or deny</p>
| <p>logon as sys and run the scripts</p>
| 23,963 |
<p>I'm writing some JavaScript code to parse user-entered functions (for spreadsheet-like functionality). Having parsed the formula I <em>could</em> convert it into JavaScript and run <code>eval()</code> on it to yield the result.</p>
<p>However, I've always shied away from using <code>eval()</code> if I can avoid it ... | <p>I'd like to take a moment to address the premise of your question - that eval() is "<em>evil</em>". The word "<em>evil</em>", as used by programming language people, usually means "dangerous", or more precisely "able to cause lots of harm with a simple-looking command". So, when is it OK to use something dangerous? ... | <p>Only during testing, if possible. Also note that eval() is much slower than other specialized JSON etc. evaluators.</p>
| 24,070 |
<p>Is there any way to change the autonumber field to a number datatype, when the field is used a primary key and linked to other tables?</p>
| <p>You will have to delete the relationship(s) between the table and any foreign key columns on other tables first. Change the data type and then recreate the relationship(s).</p>
| <p>As far as I'm aware there's no way to change this. In Access 2007 it can be changed from Long Integer to Replication ID. In previous versions I don't recall any way of doing this - if I recall correctly it was automatically set to Long Integer but there's no way to control what Access does with the AutoNumber.</p>... | 45,353 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.