instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I am building a Web service using WCF as a way to provide access to data within my VB.Net application.</p>
<p>When building web services hosted on IIS, there is a helpful test page as part of the service that allows the webservice to be invoked with parameters there and then. It's very helpful for testing.</p>
<p>... | <p>I am afraid you have to build web pages form e.g. aspx to call the service and display the result, WCF service no more generates the UI for you anymore.</p>
| <p>I am afraid you have to build web pages form e.g. aspx to call the service and display the result, WCF service no more generates the UI for you anymore.</p>
| 40,891 |
<p>What I am trying to do is change the background colour of a table cell <td> and then when a user goes to print the page, the changes are now showing.</p>
<p>I am currently using an unobtrusive script to run the following command on a range of cells:</p>
<pre><code>element.style.backgroundColor = "#f00"
</cod... | <p>Is it not recommended to do this with stylesheets? You can change the media type in the LINK statement in your HTML, so when the page is printed, it will revert to the different style?</p>
| <p>Have you tried hard-coding the values just to see if background-colors are showing on the print-preview at all? I think it is a setting in the Browser.</p>
| 4,973 |
<p>I have a Flex application with multiple modules.</p>
<p>When I redeploy the application I was finding that modules (which are deployed as separate swf files) were being cached in the browser and the new versions weren't being loaded. </p>
<p>So i tried the age old trick of adding <code>?version=xxx</code> to all t... | <p>I had a similar problem, and ended up putting the SWF files in a sub-directory named as the build number. This meant that the URL to the SWF files pointed to a different location each time.</p>
<p>Ideally this should be catered for by the platform, but no joy there. But this works perfectly for us, and integrates v... | <p>The caching is not done by Flash Player but by the browser, so it's out of Adobe's control. I think you have found a workable solution. If I want to avoid caching I usually append a random number on the URL.</p>
| 38,567 |
<p>What is the most proper way to sending email of minimal 1000 or more in PHP? Any reliable email queuing technique that is capable to handle that?
</p>
| <p>You could just insert your emails into a Mail Queue database table, and have a separate process check the queue and batch send a certain number at once.</p>
| <p>I've generally relied on a hack.
I have a database list of email addresses and then use a meta-redirect to self with an increasing 'offset' parameter that specifies which row in the database I am up to. Server redirects cause problems because browsers assume that the time taken indicates an infinite loop.</p>
| 3,820 |
<p>I am facing a problem with .NET generics. The thing I want to do is saving an array of generics types (GraphicsItem):</p>
<pre><code>public class GraphicsItem<T>
{
private T _item;
public void Load(T item)
{
_item = item;
}
}
</code></pre>
<p>How can I save such open generic type in ... | <p>Implement a non-generic interface and use that:</p>
<pre><code>public class GraphicsItem<T> : IGraphicsItem
{
private T _item;
public void Load(T item)
{
_item = item;
}
public void SomethingWhichIsNotGeneric(int i)
{
// Code goes here...
}
}
public interface IGr... | <p>If you want to store heterogeneous GrpahicsItem's i.e. GraphicsItem< X> and GrpahicsItem< Y> you need to derive them from common base class, or implement common interface. Another option is to store them in List< object></p>
| 8,274 |
<p>What files can we modify so that our solution is still supported by Microsoft?</p>
<p>Is it allowed to customize error pages?
Can we modify the web.config files to use custom HTTPHandlers?</p>
| <p>You can certainly edit the web.config file for your sites. The one thing that you should be aware of, however, is that when you start editing files manually on the file system, you will have to remember to manually make those changes across all servers in the farm (assuming a farm exists). In addition to this, whe... | <p>do not modify any pre-installed files in the 12 hive (Program Files\Common Files\Microsoft Shared\Web Server Extensions\12)... a service pack may update and overwrite any changes.</p>
<p>Anything in the Content Database (Masterpage, Stylesheets list in ~Catalogs) is available to modify (I would add, instead of upda... | 10,848 |
<p>I'm doing a project where we play multiple videos back to back, and if we load them the normal way by providing a stream url, there is a load delay each time we start the next video.</p>
<p>I've looked through Adobe's docs for both Flash and Flex, and I can't find a way to pre-load the videos. Embedding them is no... | <p>The MonthControl seems to already do what you're looking for. Setting the minDate property removes the invalid days/years from the calendar so they can't be selected. Works in .NET 2.0 and 3.5.</p>
<p>Keep in mind, I'm using Windows Server 2008, so the visual styles for .NET controls may be different than on your ... | <p>Without creating your own control or custom drawing, it can't be done.</p>
| 49,583 |
<p>I was recently asked to come up with a script that will allow the end user to upload a PSD (Photoshop) file, and split it up and create images from each of the layers.</p>
<p>I would love to stay with PHP for this, but I am open to Python or Perl as well.</p>
<p>Any ideas would be greatly appreciated.</p>
| <p>Oops, it's</p>
<pre><code>$('#mySelect').attr('size', value)
</code></pre>
| <pre><code>$("#mySelect").bind("click", function(){
$("#myOtherSelect").children().remove();
var myArray = [ "value1", "value2", "value3" ];
for (var i = 0; i < myArray.length; i++) {
$("#myOtherSelect").append( '<option value="' + myArray[i] + '">' + myArray[i] + '</option>' );
}... | 9,100 |
<p>I am trying to use Lucene Java 2.3.2 to implement search on a catalog of products. Apart from the regular fields for a product, there is field called 'Category'. A product can fall in multiple categories. Currently, I use FilteredQuery to search for the same search term with every Category to get the number of resul... | <p>I don't have enough reputation to comment (!) but in Matt Quail's answer I'm pretty sure you could replace this:</p>
<pre><code>int numDocs = 0;
td.seek(terms);
while (td.next()) {
numDocs++;
}
</code></pre>
<p>with this:</p>
<pre><code>int numDocs = terms.docFreq()
</code></pre>
<p>and then get rid of the t... | <p>So let me see if I understand the question correctly: Given a query from the user, you want to show how many matches there are for the query in each category. Correct?</p>
<p>Think of it like this: your query is actually <code>originalQuery AND (category1 OR category2 or ...)</code> except as well an overall scor... | 18,349 |
<p>Imagine a DOS style .cmd file which is used to launch interdependent windowed applications in the right order.</p>
<p>Example:<br>
1) Launch a server application by calling an exe with parameters.<br>
2) Wait for the server to become initialized (or a fixed amount of time).<br>
3) Launch client application by calli... | <p>Remember that PowerShell can access .Net objects. The Start-Sleep as suggested by <a href="https://stackoverflow.com/questions/49402/creating-batch-jobs-in-powershell#49520">Blair Conrad</a> can be replaced by a call to <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.waitforinputidle.aspx... | <p>To wait 10 seconds between launching the applications, try</p>
<pre><code>launch-server-application serverparam1 serverparam2 ...
Start-Sleep -s 10
launch-client-application clientparam1 clientparam2 clientparam3 ...
</code></pre>
<p>If you want to create a script and have the arguments passed in, create a file ca... | 7,193 |
<p>I am selecting from a table that has an XML column using T-SQL. I would like to select a certain type of node and have a row created for each one.</p>
<p>For instance, suppose I am selecting from a <em>people</em> table. This table has an XML column for <em>addresses</em>. The XML is formated similar to the followi... | <p>Here is your solution: </p>
<pre><code>/* TEST TABLE */
DECLARE @PEOPLE AS TABLE ([Name] VARCHAR(20), [Address] XML )
INSERT INTO @PEOPLE SELECT
'Joel',
'<address>
<street>Street 1</street>
<city>City 1</city>
<state>State 1</state>
<zi... | <p>If you can use it, the linq api is convenient for XML:</p>
<pre><code>var addresses = dataContext.People.Addresses
.Elements("address")
.Select(address => new {
street = address.Element("street").Value,
city = address.Element("city").Value,
state = address... | 23,382 |
<p>I have topics(id*) and tags(id*,name) and a linking table topic_tags(topicFk*,tagFk*).</p>
<p>Now I want to select every single topic, that has all of the good tags (a,b,c) but none of the bad tags (d,e,f).</p>
<p>How do I do that?</p>
| <p>Assuming your Topic_Tags table is unique, this answers your <em>exact</em> question - but may not be generalizable to your actual problem:</p>
<pre><code>SELECT
TopicId
FROM Topic_Tags
JOIN Tags ON
Topic_Tags.TagId = Tags.TagId
WHERE
Tags.Name IN ('A', 'B', 'C', 'D', 'E', 'F')
GROUP BY
TopicId
HAVING
COUN... | <p>Not completely sure I understand, and I hope there's a better way to do the good tags part, but:</p>
<pre><code>select id from topic
inner join topic_tags tta on topic.id=tta.topicFk and tta.tagFk=a
inner join topic_tags ttb on topic.id=ttb.topicFk and ttb.tagFk=b
inner join topic_tags ttc on topic.id=t... | 22,320 |
<p>Is there drop-in replacement for ActiveRecord that uses some sort of Object Store?</p>
<p>I am thinking something like Erlang's MNesia would be ideal. </p>
<p><strong>Update</strong></p>
<p>I've been investigating CouchDB and I think this is the option I am going to go with. It's a toss-up between using CouchRest... | <p><a href="http://code.google.com/p/activecouch/" rel="nofollow noreferrer">AciveCouch</a> purports to be just such a library for <a href="http://incubator.apache.org/couchdb/" rel="nofollow noreferrer">CouchDB</a>, which is, in fact, written in Erlang. I wouldn't say it's as mature as ActiveRecord though.</p>
<p>Th... | <p>Apart from Madeleine, you can also see:</p>
<p><a href="http://purple.rubyforge.org/" rel="nofollow noreferrer"><a href="http://purple.rubyforge.org/" rel="nofollow noreferrer">http://purple.rubyforge.org/</a></a></p>
<p>But it depends on scale too. Mnesia is known to support large amount of data, and is clustered... | 21,329 |
<p>I am having problems converting a string in the format "yyyy-MM-ddZ" using VB.net.</p>
<p>For example I have the string "2007-10-21Z".</p>
<p>Using CDate or TryParse it comes out to 10/20/2007 instead of 10/21/2007.</p>
<p>I'm not understanding how the Z affects the date string so that when it is parsed it result... | <p>Try </p>
<p>DateTime.ParseExact("2007-10-21Z", "yyyy-MM-ddZ", CultureInfo.InvariantCulture);</p>
| <p>Wow, that's interesting. I try in C# DateTime.Parse("2008-10-31").ToString(); and the result is "10/30/2008 5:00:00 PM".</p>
<p>I can't wait for an answer!</p>
| 31,853 |
<p>Given an EmployeeId, how can I construct a Linq to Sql query to find all of the ancestors of the employee? Each EmployeeId has an associated SupervisorId (see below).</p>
<p>For example, a query of the ancestors for EmployeeId 6 (Frank Black) should return Jane Doe, Bob Smith, Joe Bloggs, and Head Honcho.</p>
<p>... | <p>First off, it's important to recognize that what you're comparing in your code is the <em>references</em> of the datatables, not the <em>contents</em> of the datatables. In order to determine if both datatables have the same contents, you're going to have to loop through all of the rows and columns and see if they'... | <p>You have to cast objects t1.Rows[i][dc.ColumnName] and t1.Rows[i][dc.ColumnName] otherwise the statement t1.Rows[i][dc.ColumnName] != t2.Rows[i][dc.ColumnName] is always true. I modified the code the following way:</p>
<pre><code>for(int i = 0; i < t1.Rows.Count; i++)
{
if((string)t1... | 29,276 |
<p>I have an Ender 3 that I have been pretty happy with so far, however it recently started an odd behavior and I can't figure out what's causing it. </p>
<p>What happens is that the first ~3 mm of the print comes out "sloppy". After that, everything clears up and it prints fine for the rest of the print. (Althou... | <p>After much trial and error, I think I finally figured out the solution. </p>
<p>Even though I could get better prints by tweaking with the temperatures, I could never totally eliminate the problem. The better I made it look by cooling down the bed, the more likely it would break free and the print would fail comple... | <p>I had similar problem with my Tevo Tarantula. Tried all the options mentioned above as well. It seemed to be Z-axis height related. Changed my Z-axis flexible coupling to a solid coupling which solved it for me.</p>
| 1,190 |
<p>A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementation of <code>Function.prototype.curry</code>, which was the basis of our discussion:</p>
<... | <p>Technically you're creating a brand new function that calls the original function. So if my understanding of partially applied functions is correct, this is not a partially applied function. A partially applied function would be closer to this (note that this isn't a general solution):</p>
<pre><code>vindaloo.curry... | <p>You should check out <a href="http://www.svendtofte.com/code/curried_javascript/" rel="nofollow noreferrer">Curried JavaScript Functions</a>. I haven't completely wrapped my head around his curry function, but it might have your answer.</p>
<p>Edit: I would agree with your assessment, however.</p>
| 11,847 |
<p>In the following HTML, I'd like the frame around the image to be snug -- not to stretch out and take up all the available width in the parent container. I know there are a couple of ways to do this (including horrible things like manually setting its width to a particular number of pixels), but what is the <em>right... | <p>The <em>right</em> way is to use:</p>
<pre><code>.pictureframe {
display: inline-block;
}
</code></pre>
<p><strong>Edit:</strong> Floating the element also produces the same effect, this is because floating elements use the same <a href="http://www.w3.org/TR/CSS21/visudet.html#shrink-to-fit-float" rel="norefer... | <p>The only way I've been able to do picture frames reliably across browsers is to set the width dynamically. Here is an example using jQuery:</p>
<pre><code>$(window).load(function(){
$('img').wrap('<div class="pictureFrame"></div>');
$('div.pictureFrame').each(function(i) {
$(this).width($('*:fi... | 15,759 |
<p>I'm trying to use the CoreCon API in Visual Studio 2008 to programmatically launch device emulators. When I call <code>device.Connect()</code>, I inexplicably get a DirectoryNotFoundException. I get it if I try it in PowerShell or in C# Console Application. Here's the code I'm using:</p>
<pre><code>static void Main... | <p>It can be found at <code><systemdrive>:\Program files\Common Files\Microsoft Shared\CoreCon\1.0\Bin</code>.</p>
<p>This is the path where you can get this dll, so add this dll to your project.</p>
| <p>I tried this and it works ok. Can you paste in the whole exception and stack trace?</p>
<p><strong>Updated:</strong> Strangely I can't find that interop assy on my machine either other than under the c:\windows\assembly\GAC_MSIL folders.</p>
<p>Why not fire up SysInternals FileMon or Process Monitor, it'd save som... | 2,859 |
<p>I have been trying to learn multi-threaded programming in C# and I am confused about when it is best to use a thread pool vs. create my own threads. One book recommends using a thread pool for small tasks only (whatever that means), but I can't seem to find any real guidelines.</p>
<p>What are some pros and cons of ... | <p>If you have lots of logical tasks that require constant processing and you want that to be done in parallel use the pool+scheduler.</p>
<p>If you need to make your IO related tasks concurrently such as downloading stuff from remote servers or disk access, but need to do this say once every few minutes, then make yo... | <p>I usually use the Threadpool whenever I need to just do something on another thread and don't really care when it runs or ends. Something like logging or maybe even background downloading a file (though there are better ways to do that async-style). I use my own thread when I need more control. Also what I've found ... | 17,519 |
<p>As an example these are some of the things I always do when starting a new machine:</p>
<ol>
<li>Install 'Visor' - gives you an always available HUD style terminal window via F1. </li>
<li>Install 'Clix' - run a million system customization command line instructions. </li>
<li>Install 'Default App' - self explanato... | <p>If you come have a Linux background <a href="http://www.macports.org/" rel="nofollow noreferrer">MacPorts</a> (gentoo like) or <a href="http://finkproject.org/" rel="nofollow noreferrer">Fink</a> (apt-get like) are indispensable. You cal install all familiar utilities just like you would on a normal Linux machine.</... | <p>I install PostgreSQL and Eclipse, well I did at my previous work where we used Macs.</p>
<p>Then I removed all the unnecessary icons from the Dock, and put my work ones there, and Terminal.</p>
<p>I also installed Pages, it's a nice document editor for documentation uses.</p>
| 45,621 |
<p>I've always been told that adding an element to an array happens like this:</p>
<blockquote>
<p>An empty copy of the array+1element is
created and then the data from the
original array is copied into it then
the new data for the new element is
then loaded</p>
</blockquote>
<p>If this is true, then using ... | <p>Look at the generic <code>List<T></code> as a replacement for arrays. They support most of the same things arrays do, including allocating an initial storage size if you want. </p>
| <p>The best thing you can do is to allocate as much memory as you need upfront if possible. This will prevent <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="nofollow noreferrer">.NET</a> from having to make additional calls to get memory on the heap. Failing that then it makes sense to allocate in chunks of... | 10,162 |
<p>In a visual studio project I have three layers, Data Layer, Business Layer and Presentation Layer. </p>
<p>In the Data Layer I have a few XSLT's that transform some objects into an email, all works fine but I have discovered that the XSLTs do not get built/copied when building. </p>
<p>I have currently, created a ... | <p>If you are using Visual Studio 2005/2008, the easiest way to do this is by including your XSLT files as project resources.</p>
<ol>
<li>Open the Properties for your project.</li>
<li>Select the Resources tab. You will probably see a link that says "This project does not contain a default resources file. Click her... | <p>Obvious question maybe, but still has to be asked, did you include the folder containing the XSLT's in the project itself? Is this a web or forms app?</p>
| 32,241 |
<p>I am following the <strong><em>learning</em> ASP.NET 3.5</strong> by O'REILLY to write some ASP.NET 3.5 code using Visual Studio 2008 SP1. I have gotten to the point to where I need to Configure a Data Source using the SqlDataSource control. I chose <strong>Microsoft SQL Server (SqlClient)</strong> even though I h... | <p>You may investigate <a href="http://social.msdn.microsoft.com/forums/es-ES/Offtopic/thread/70a5cb26-6b20-43a0-8cef-a0c5716a3e1c/" rel="nofollow noreferrer">this</a> recipe.</p>
| <p>You may need to reinstall your copy of SQL 2005 Express. But sure to install all of the client-side developer packages in the installer.</p>
| 34,382 |
<p>I'm working with some example java code for making md5 hashes. One part converts the results from bytes to a string of hex digits:</p>
<pre><code>byte messageDigest[] = algorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i=0;i<messageDigest.length;i++) {
hexString.append(Integer.to... | <p>A simple approach would be to check how many digits are output by <code>Integer.toHexString()</code> and add a leading zero to each byte if needed. Something like this:</p>
<pre><code>public static String toHexString(byte[] bytes) {
StringBuilder hexString = new StringBuilder();
for (int i = 0; i < byte... | <p>This is also equivalent but more concise using Apache util <a href="http://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/impl/dv/util/HexBin.html#encode%28byte%5b%5d%29" rel="nofollow">HexBin</a> where the code reduces to</p>
<pre><code>HexBin.encode(messageDigest).toLowerCase();
</code></pre>
| 43,019 |
<p>I just added xUnit to our test project (for the Asserts, we're still using MSTest as the framework) and immediately the test runs refused to execute any of the tests. This is the error message:</p>
<blockquote>
<p>Failed to queue test run '{ .... }'
Test run deployment issue: The
location of the file or direc... | <p>It took me a few tries to find the answer in Google, so I'm putting it here in case anyone else runs into the same problem. A detailed description can be found at <a href="http://smartclientfactory.blogspot.com/2008/01/nmock2-was-blocked.html" rel="noreferrer">this blog posting</a>.</p>
<p>Basically, the fix invovl... | <p>I also tried opening the file in notepad++ and renaming it.
Slightly different approach, but it worked for me. The local file system then think it comes from the same machine.</p>
| 24,580 |
<p>Which is generally considered "best practice" when wanting to securely transmit flat files over the wire? Asymmetric encryption seems to be a pain in that you have to manage keysets at endpoints and make sure that the same algorithm is used by all clients, where as SFTP seems to be a pain because of NAT issues with... | <p>I believe you're talking about <a href="http://en.wikipedia.org/wiki/FTPS" rel="nofollow noreferrer">FTP with SSL</a> when you say SFTP, and not the <a href="http://en.wikipedia.org/wiki/SSH_file_transfer_protocol" rel="nofollow noreferrer">SFTP protocol that goes along with SSH</a>. Use SFTP (the SSH version) as it... | <p>Use <a href="http://en.wikipedia.org/wiki/Pretty_Good_Privacy" rel="nofollow noreferrer">PGP</a> / <a href="http://www.gnupg.org/" rel="nofollow noreferrer">GPG</a> and transfer the gpg-ed file directly via ftp or any other method. </p>
| 12,138 |
<p>I seem to be losing a lot of precision with floats.</p>
<p>For example I need to solve a matrix:</p>
<pre><code>4.0x -2.0y 1.0z =11.0
1.0x +5.0y -3.0z =-6.0
2.0x +2.0y +5.0z =7.0
</code></pre>
<p>This is the code I use to import the matrix from a text file:</p>
<pre><code>f = open('gauss.dat')
lines = f.readlin... | <p>I'm not familiar enough with the Decimal class to help you out, but your problem is due to the fact that decimal fractions can often not be accurate represented in binary, so what you're seeing is the closest possible approximation; there's no way to avoid this problem without using a special class (like Decimal, pr... | <p>Also see <a href="https://stackoverflow.com/questions/249467/what-is-a-simple-example-of-floating-pointrounding-error">What is a simple example of floating point error</a>, here on SO, which has some answers. The one I give actually uses python as the example language...</p>
| 36,339 |
<p>I've been put in charge of coming up with a training itinerary for my team at work for a migration from c++ to Visual Studio 2008 with C#. </p>
<p>The actual language switch I'm not too worried about, its the learning curve to Visual Studio. What does everything think would be the best way to set up a training co... | <p>We are a C++ shop, that is moving to C# for UI work (our image processing and 3D graphics code will stay in native C++). I found <a href="http://media.wiley.com/assets/264/22/0764557599_bonus_AppD.pdf" rel="nofollow noreferrer">C# for C++ Developers</a> a very quick and handy introduction to the language. Our team h... | <p>I purchased the on-demand training from pluralsight about 4 months ago and IMHO is the best training out there. </p>
<p><a href="http://www.pluralsight.com/main/olt/Courses.aspx" rel="nofollow noreferrer">link text</a></p>
| 5,615 |
<p>Say we have the following method:</p>
<pre><code>private MyObject foo = new MyObject();
// and later in the class
public void PotentialMemoryLeaker(){
int firedCount = 0;
foo.AnEvent += (o,e) => { firedCount++;Console.Write(firedCount);};
foo.MethodThatFiresAnEvent();
}
</code></pre>
<p>If the class wit... | <p>Yes, save it to a variable and unhook it.</p>
<pre><code>DelegateType evt = (o, e) => { firedCount++; Console.Write(firedCount); };
foo.AnEvent += evt;
foo.MethodThatFiresAnEvent();
foo.AnEvent -= evt;
</code></pre>
<p>And yes, if you don't, you'll <em>leak</em> memory, as you'll hook up a new delegate object e... | <p>Yes in the same way that normal event handlers can cause leaks. Because the lambda is actually changed to:</p>
<pre><code>someobject.SomeEvent += () => ...;
someobject.SomeEvent += delegate () {
...
};
// unhook
Action del = () => ...;
someobject.SomeEvent += del;
someobject.SomeEvent -= del;
</code></p... | 3,720 |
<p>The DBAs here maintain all SQL Server and SQL Reporting servers. I have a custom developed SQL Reporting 2005 project in Visual Studio that runs fine on my local SQL Database and Reporting instances. I need to deploy to a production server, so I had a folder created on a SQL Reporting 2005 server with permissions ... | <p>You will receive the warning if the properties on the data source are such that they do not allow you to overwrite the data source. However, the rest of your project or report should deploy. Check the properties of your report and I think that you will find that it is the current version. This is only a warning a... | <p>Did you check the configuration you are setting the OverwriteDataSource project property setting to False? The default Configuration is Active(DebugLocal) but you may have to set the OverwriteDataSource setting to False for another Configuration such as Production. You can use the All Configurations to force the O... | 11,011 |
<p>i have a problem with windows system cache.
Sample code:</p>
<pre><code>int main(int argc, char* argv[])
{
HANDLE file_ = INVALID_HANDLE_VALUE;
file_ = CreateFile(
"test_file.txt",
GENERIC_WRITE,
FILE_SHARE_READ,
... | <p>The Windows file cache will try to keep as much of a file in RAM as possible. In Windows NT, loading a very big file could trigger a bug. If the file didn't fit into the cache, it would never be released anymore forcing everything else out of RAM into the swapfile until your machine would constantly swap.</p>
<p>Bu... | <p>When my system run out of RAM cache doesnt shrinks, system unload everything into the swap file. When i close the file in the writing process, system cache shrinks. </p>
| 43,698 |
<p>Something really weird is going on with Xcode and an iPhone project I'm working on, when I'm building for the simulator, the project has 2 active executables (MyApp - iPhone Simulator (2.0) and MyApp - iPhone Simulator (2.1)) Almost all of the time, I want to use the the 2.1 active executable, but Xcode will occasi... | <p>Ok, it was a bug. The good news: it's fixed in the fresh new 2.2 SDK.</p>
| <p>So.. why are you actually doing that? It is probably better, given the nature of the iPhone (with multiple frameworks for multiple architectures), to set up different Targets for your various projects. The executable produced will be the result of the build phases for your targets.</p>
| 38,455 |
<p>I am trying to find a better way to integrate IRB with my normal ruby devleopment. Currently I rarely use IRB with my code. I only use it to verify syntax or to try something small. </p>
<p>I know I can load my own code into ruby as a</p>
<pre><code>require 'mycode'
</code></pre>
<p>but this usually doesn't me... | <p>Install the ruby-debug gem. Of course, require it inside your app (only in development/test mode). Now you can write 'debugger' where you want to stop execution.</p>
<p>Once your app stop at your breakpoint, you can type 'help' to know about all commands. One of them is 'irb'. It starts an IRB session in which you ... | <p>I just use rdebug to debug any of my ruby or RoR code. </p>
| 17,373 |
<p>Most mathematicians agree that:</p>
<blockquote>
<p>e<sup>πi</sup> + 1 = 0</p>
</blockquote>
<p>However, most floating point implementations disagree. How well can we settle this dispute?</p>
<p>I'm keen to hear about different languages and implementations, and various methods to make the result as close to ze... | <p>It's not that most floating point implementations disagree, it's just that they cannot get the accuracy necessary to get a 100% answer. And the correct answer is that they can't.</p>
<p>PI is an infinite series of digits that nobody has been able to denote by anything other than a symbolic representation, and e^X ... | <p>@Ryan Fox <blockquote>In fact, how does one represent i (or j for the engineers) in a conventional programming language?</blockquote></p>
<p>Native complex data types are far from unknown. Fortran had it by the mid-sixties, and the OP exhibits a variety of other languages that support them in hist followup. </p>
<... | 2,348 |
<p>I have an existing database with the table Transactions in it. I have added a new table called TransactionSequence where each transaction will ultimately have only one record. We are using the sequence table to count transactions for a given account. I have mapped this as a one-to-one mapping where TransactionSequen... | <p>One to one mapping in nhibernate doesn't work the way you think it does. It's designed so that you have two classes, which when persisted to their corresponding tables have the same primary keys.</p>
<p>However you can make it work, but it's not pretty. I'll show you how then offer up some alternatives:</p>
<p>I... | <p>Turns out that for my situation a <code><join table></code> mapping worked best. I just had to make sure that I made the properties that came from the second table were nullable types, or it would do an insert on save even if nothing had changed. Since I did not need lazy loading for the second table, this wor... | 30,363 |
<p>I am trying to use a stringstream object in VC++ (VStudio 2003) butI am getting an error when I use the overloaded << operator to try and set some manipulators. </p>
<p>I am trying the following: </p>
<pre><code>int SomeInt = 1;
stringstream StrStream;
StrStream << std::setw(2) << SomeInt; ... | <p>Are you sure you included all of the right headers? The following compiles for me in VS2003:</p>
<pre><code>#include <iostream>
#include <sstream>
#include <iomanip>
int main()
{
int SomeInt = 1;
std::stringstream StrStream;
StrStream << std::setw(2) << SomeInt;
return 0;
... | <p>You probably just forgot to include iomanip, but I can't be sure because you didn't include code for a complete program there.</p>
<p>This complete program works fine over here using VS 2003:</p>
<pre><code>#include <sstream>
#include <iomanip>
int main()
{
int SomeInt = 1;
std::stringstream S... | 9,504 |
<p>In VB.NET, what is the difference between <code>And</code> and <code>AndAlso</code>? Which should I use?</p>
| <p>The <code>And</code> operator evaluates both sides, where <code>AndAlso</code> evaluates the right side if and only if the left side is true.</p>
<p><strong>An example:</strong></p>
<pre><code>If mystring IsNot Nothing And mystring.Contains("Foo") Then
' bla bla
End If
</code></pre>
<p><strong>The above throws ... | <h2>To understand with words not cods:<br></h2>
<p>Use Case:<br>With “And” the compiler will check all conditions so if you are checking that an object could be “Nothing” and then you are checking one of it’s properties you will have a run time error.<br>
But with AndAlso with the first “false” in the conditions it wi... | 38,772 |
<p>There are a couple of questions similar to this on stack overflow but not quite the same.</p>
<p>I want to open, or create, a local group on a win xp computer and add members to it, domain, local and well known accounts. I also want to check whether a user is already a member so that I don't add the same account t... | <p>Okay, it's taken a while, messing around with different solutions but the one that fits best with my original question is given below. I can't get the DirectoryEntry object to access the members of a local group using the 'standard' methods, the only way I could get it to enumerate the members was by using the Invo... | <p>You should be able to find this information inside the <a href="http://msdn.microsoft.com/en-us/library/ms677097(VS.85).aspx" rel="nofollow noreferrer"><code>"member"</code> attribute</a> on the <code>DirectoryEntry</code> that represents the group.</p>
| 31,509 |
<p>I'm attempting to model and print a globe. The semi-circular arm that holds the globe has an outer diameter of 98mm and inner diameter of 92mm, so the arm is fairly thin. The arm has a small hole on either end that fits around a protrusion at each pole of the globe to hold it in place. The hole extends into the a... | <p><strong>The flexibility of 3d plastics has a lot to do with the additives manufacturers use</strong>. The same base material with additive X may have very different properties than the one with additive Y.</p>
<p>That said, <strong>generally speaking PLA is known to be more rigid</strong> (and brittle) than ABS, b... | <p>Print thinner layers. Also, you did not mention the other dimension of your arm. If you view the globe with the arm to the left, then you have said the thickness in the X direction (left to right) is 6mm. But what about in the Z axis (away from you)? You could make it thicker in that direction to improve its rigidit... | 793 |
<p>How do I exit a script early, like the <code>die()</code> command in PHP?</p>
| <pre><code>import sys
sys.exit()
</code></pre>
<p>details from the <a href="https://docs.python.org/2/library/sys.html#sys.exit" rel="noreferrer"><code>sys</code> module documentation</a>:</p>
<blockquote>
<p><code>sys.<strong>exit</strong>([<em>arg</em>])</code></p>
<p>Exit from Python. This is implemented by raising ... | <p>Just put at the end of your code <code>quit()</code> and that should close a python script.</p>
| 9,938 |
<p>I need to merge a forked project.
Unfortunately, the CVS $Id lines are different so the merge tools I tried report that all the files are different (and 95% of them have only this line different)</p>
<p>Is there a merge tool that can be configured to ignore line comparison results based on a pattern ?</p>
<p>[edi... | <p>I use meld, which can use regex filters to ignore.
It has some preset ones you can select including CVS keywords.
The regex it uses for that BTW is:</p>
<pre><code>\$\w+(:[^\n$]+)?\$
</code></pre>
<p>You can get meld on any linux distro or
download from here: <a href="http://meld.sourceforge.net/" rel="nofollow no... | <p><a href="http://www.grigsoft.com/wincmp3.htm" rel="nofollow noreferrer">CompareIT</a> allow to use <a href="http://www.grigsoft.com/wincmp3/help/source/html/cmp_usingregularexpressions.htm" rel="nofollow noreferrer">regular expression</a> matching. I used it for automatically generated code comparison and it was ver... | 24,802 |
<p>Any idea how to <strong>return multiple variables</strong> from a function in ActionScript 3? </p>
<p>Anything like VB.NET where you can have the <strong>input argument's variable</strong> modified (ByRef arguments)?</p>
<pre><code>Sub do (ByRef inout As Integer)
inout *= 5;
End Sub
Dim num As Integer = 10
Debug... | <p>Quoting a googled source:</p>
<blockquote>
<blockquote><p>In ActionScript 3.0, all arguments are passed by reference because all values are stored as objects. However, objects that belong to the primitive data types, which includes Boolean, Number, int, uint, and String, have special operators that make them beha... | <p>Note the subtle difference between DarthZorG's example and this one from the Flash docs:</p>
<pre><code>function passByRef(objParam:Object):void
{
objParam.x++;
objParam.y++;
trace(objParam.x, objParam.y);
}
var objVar:Object = {x:10, y:15};
trace(objVar.x, objVar.y); // 10 15
passByRef(objVar);... | 43,540 |
<p>If my email id receives an email from a particular sender, can I ask sendmail to trigger a different program and pass on the newly arrived email to it for further processing? This is similar to filters in gmail. Wait for some email to arrive, see if it matches the criteria and take some action if it does.</p>
| <p>This is what Procmail is for.</p>
<p>Set Sendmail up to use procmail as the mail delivery agent (MDA), or set up your .forward to pipe stuff through procmail. (See the man page.)</p>
<p>Then you can write your .procmailrc to do all sorts of things along these lines.</p>
<p>This filter predates gmail. Still useful... | <p>We handle this by having a cron process running on the mail server which watches the inbox directory and scans any new messages (files) every 10 minutes or so.</p>
<p>When the process finds an email of interest, it fires the information off to another process which then reacts to the new message (and, in our case, ... | 10,732 |
<p>What is the best way to localize a collection (IEnumerable)?
From the BL I retrieve a collection of entities which still need to localized, I figured I write a method which extends the IEnumerable and returns the localized list. </p>
<p>How can i get the code underneath working? Any ideas? Maybe better options? ... | <p>have you tried something where you <a href="http://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx" rel="nofollow noreferrer">yield</a> the item?</p>
<pre><code>public static IEnumerable<string> Localize(this IEnumerable<string> items, CultureInfo culture)
{
foreach (string item in items)
{
... | <p>Simple change to get it to return a new enumerable collection of localized values:</p>
<pre><code>public static IEnumerable<string> Localize(this IEnumerable<string> items, CultureInfo cultureInfo)
{
List<string> newItems = new List<string>();
foreach(string item in items)
{
... | 27,035 |
<p>We help our clients to manage and publish their media online - images, video, audio, whatever. They always ask my boss whether they can stop users from copying their media, and he asks me, and I always tell him the same thing: no. If the users can view the media, then a sufficiently determined user will always be ... | <p>No. If you let them view it, they can always make a copy of what they saw. You can make it harder for this to happen, but in the end, you can't stop a suitably determined attacker.</p>
| <p>I'm inclined to agree that in a practical sense, there may be no foolproof way to prevent copying, but can I prove it? No, and I haven't heard any airtight proof yet.</p>
<p>Copying is inherent in normal computation, and it is irreversible. For example</p>
<pre><code>X = A; // statement 1
X = B; // statement 2
</c... | 13,913 |
<p>I'm working in a windows environment (my laptop!) and I need a couple of scripts that run other programs, pretty much like a windows batch file.</p>
<p>how can I run a command from python such that the program when run, will replace the script? The program is interactive (for instance, unison) and keeps printing li... | <p>You should create a new processess using the <a href="http://www.python.org/doc/2.5.2/lib/module-subprocess.html" rel="noreferrer">subprocess module</a>.</p>
<p>I'm not fluent in windows processes but its Popen function is cross-platform, and should be preffered to OS specific solutions.</p>
<p>EDIT: I maintain th... | <p><code>os.execlp</code> should work. This will search your path for the command. Don't give it any args if they're not necessary:</p>
<pre><code>>>> import os
>>> os.execlp("cmd")
D:\Documents and Settings\Claudiu>Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
... | 40,152 |
<p>I'm writing a Windows Forms Application in C#.NET</p>
<p>On startup, the application displays a splash screen which is running in a separate thread. Whilst the splash screen is showing, the main application is initialising.</p>
<p>Once the main application has finished initialising, the main form of the applicati... | <p>Try calling .Activate() on your main window when your thread closes.</p>
<p>It's never been active, and thus has low Z-Order, so whatever is higher will naturally be above it. I had to fix this exact scenario in our app.</p>
<p>Don't forget! You may need to marshal the call to the correct thread using an Invoke()!... | <p>You can use code like this :</p>
<pre><code>private void button1_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Abort;
this.Hide();
}
</code></pre>
<p>Thanks all! </p>
| 23,373 |
<p>Usually, we install VS.NET on our production server, to solve problems easily with our product, if necessary. </p>
<p>Is this a good or bad idea?</p>
| <p>Debugging and development should be done in a "safe" environment - something that is not mission critical. For example, you should have a development and/or QA server that you use for development and debugging.</p>
<p><strong>EDIT:</strong> Your QA server should mirror your production server, so that you are able... | <p>Depends on how you're using it. Most of the heavy work that it's designed for shouldn't be necessary on a production server. I usually install Notepad++ on the production server for editing xml, config files, etc. I'd say if you want to install VS, go for it.</p>
| 34,658 |
<pre><code>private JButton jBtnDrawCircle = new JButton("Circle");
private JButton jBtnDrawSquare = new JButton("Square");
private JButton jBtnDrawTriangle = new JButton("Triangle");
private JButton jBtnSelection = new JButton("Selection");
</code></pre>
<p>How do I add action listeners to these buttons, so that from ... | <p>Two ways:</p>
<p><b>1.</b> Implement ActionListener in your class, then use <code>jBtnSelection.addActionListener(this);</code> Later, you'll have to define a menthod, <code>public void actionPerformed(ActionEvent e)</code>. However, doing this for multiple buttons can be confusing, because the <code>actionPerform... | <p>To add an action listener, you just call <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/AbstractButton.html#addActionListener(java.awt.event.ActionListener)" rel="nofollow noreferrer">addActionListener</a> from Abstract Button.</p>
| 36,160 |
<p>I want to store a large result set from database in memory. Every record has variable length and access time must be as fast as arrays. What is the best way to implement this? I was thinking of keeping offsets in a separate table and storing all of the records consecutively? Is it odd? (Programming Language: Delphi)... | <p>Not sure I totally follow you, but have a look at TList.</p>
<p>In Delphi 7 at least, it is implemented as an arrary of pointers. You can use the capacity property to pre allocate the list ahead of time if you know how many results are coming back.</p>
<p>The list will automatically grow if it runs out of space. ... | <p>I'd use TList, and store pointers to your record.</p>
<pre><code>type
pMyRecord : ^TMyRecord;
...
...
...
var
p : pMyRecord;
...
...
New(p);
with p^ do
begin
...
...
end;
...
MyList.Add(P);
</code></pre>
| 35,902 |
<p>I would like to extract a reduced collection of "meaningful" tags (10 max) out of an english text of any size. </p>
<p><a href="http://tagcrowd.com/" rel="noreferrer">http://tagcrowd.com/</a> is quite interesting but the algorithm seems very basic (just word counting)</p>
<p>Is there any other existing algorithm t... | <p>There are existing web services for this. <s>Two</s> Three examples:</p>
<ul>
<li><a href="http://developer.yahoo.com/search/content/V1/termExtraction.html" rel="nofollow noreferrer">Yahoo's Term Extraction API</a></li>
<li>Topicalizer</li>
<li><a href="http://www.opencalais.com/" rel="nofollow noreferrer">OpenCala... | <p>Perhaps "Term Frequency - Inverse Document Frequency" <a href="http://en.wikipedia.org/wiki/Tf-idf" rel="nofollow noreferrer">TF-IDF</a> would be useful...</p>
| 9,328 |
<p>I've seen questions for doing the reverse, but I have an 800MB PostgreSQL database that needs to be converted to MySQL. I'm assuming this is possible (all things are possible!), and I'd like to know the most efficient way of going about this and any common mistakes there are to look out for. I have next to no experi... | <p>One advise is to start with a current version of MySQL, otherwise you will not have sub-queries, stored procedures or views. The other obvious difference is auto-increment fields. Check out:</p>
<p><a href="http://www.lightbox.ca/pg2mysql.php" rel="noreferrer">pg2mysql</a></p>
<p>/Allan</p>
| <p>You should not convert to new database engine based solely on the fact that you do not know the old one. These databases are very different - MySQL is speed and simplicity, Postgres is robustness and concurrency. It will be easier for you to learn Postgres, it is not that hard.</p>
| 13,513 |
<h3>Background</h3>
<p>Last year, I did an internship in a physics research group at a university. In this group, we mostly used <a href="http://en.wikipedia.org/wiki/LabVIEW" rel="noreferrer">LabVIEW</a> to write programs for controlling our setups, doing data acquisition and analyzing our data. For the first two pur... | <p>The course <a href="http://www.swc.scipy.org/" rel="noreferrer">Software Carpentry</a> is aimed specifically at people doing scientific computing and aims to teach the basics and lessons of software engineering, and how best to apply them to projects.</p>
<p>It covers topics like version control, debugging, testing... | <p>I'm no expert in this area, but I've always understood that this is what <a href="http://en.wikipedia.org/wiki/MATLAB" rel="nofollow noreferrer">MATLAB</a> was created for. There is <a href="http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11596&objectType=file" rel="nofollow noreferrer"... | 5,915 |
<p>How would I go about implementation the queries required for pagination?</p>
<p>Basically, when page 1 is requested, get the first 5 entries. For page 2, get the next 5 and so on.</p>
<p>I plan to use this via the couchdb-python module, but that shouldn't make any difference to the implementation.</p>
| <p>The <a href="http://guide.couchdb.org/" rel="noreferrer">CouchDB Guide</a> has a good discussion of pagination, including lots of sample code, here: <a href="http://guide.couchdb.org/draft/recipes.html#pagination" rel="noreferrer">http://guide.couchdb.org/draft/recipes.html#pagination</a>
Here's their algorithm:</p>... | <ul>
<li><p>Here below is the recursive way I found :</p>
<p>Take two variables</p></li>
</ul>
<pre><code> var lastOffset = 0; var counter = 0;
function someRecursive(lastOffset,counter) {
queryView(db, whereClause).then(result => {
var rows_per_page = 5;
//formula below
var page = Math.floor((last... | 40,228 |
<p>If I have a datetime field, how do I get just records created later than a certain time, ignoring the date altogether?</p>
<p>It's a logging table, it tells when people are connecting and doing something in our application. I want to find out how often people are on later than 5pm. </p>
<p>(Sorry - it is SQL Ser... | <p>For SQL Server:</p>
<pre><code>select * from myTable where datepart(hh, myDateField) > 17
</code></pre>
<p>See <a href="http://msdn.microsoft.com/en-us/library/aa258265(SQL.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa258265(SQL.80).aspx</a>.</p>
| <p>Ok, I've got it.</p>
<pre><code>select myfield1,
myfield2,
mydatefield
from mytable
where datename(hour, mydatefield) > 17
</code></pre>
<p>This will get me records with a mydatefield with a time later than 5pm.</p>
| 21,277 |
<p>I am changing a GET to a POST. Currently I have .jsp?id=a,b,c,d. When changing this to a post I am still sitting the id parameter a,b,c,d . This is not working for me. Can I submit a comma separated list to a post parameter?</p>
| <p>Am I wrong or most of the answers are beside the point?</p>
<p>To answer precisely your question, yes, you can submit a comma separated list to a POST parameter. To be honest, I just did a quick try with a PHP script, but I don't see why Java would behave differently. One point with POST requests is precisely that ... | <p>in post request minimum 1 parameter should be there in parameter list. If you are appending parameter to request then it wont work.
for that u need to send parameter as hidden field of form.
Or try using following code</p>
<p>function makePOSTRequest(url, parameters) {</p>
<pre><code> http_request = false;
if (... | 21,427 |
<p>I installed Visual Studio 2008 Standard Edition a month or so ago after a reformat (on Vista64, if that matters). I got it for free from one of those "Heroes Happen Here" launch events.</p>
<p>I then installed SQL Server 2008 Express Edition a week or so ago (we're supposed to be getting that for free in the mail b... | <p>To be honest, I wouldn't tempt it. This is sort of like a knock in the engine, but the car drives fine. Then one day you get stranded on the side of the road (or maybe not.) I would suggest an uninstall and a reinstall to be safe. I've had a similar run in with Visual Studio 2008 and that's exactly what I ended up d... | <p>I'd leave it alone. However, if the engine in my car knocks, I'm getting it rebuilt NOW while the fix is minor, rather than waiting for the catastrophic failure (voice of experience here). :-)</p>
| 22,714 |
<p>Is there a acts as taggable solution out there for merb users already?</p>
| <p><a href="http://dm-tags.rubyforge.org/" rel="nofollow noreferrer">dm-tags</a> for Datamapper.</p>
| <p>Looks like the answer to your question as asked is "No".</p>
<p>I did find <a href="http://www.mbleigh.com/2008/6/11/gemplugins-a-brief-introduction-to-the-future-of-rails-plugins" rel="nofollow noreferrer">this</a> which at least shows some interest, but it's a few months old now with no apparent progress.</p>
<p... | 24,924 |
<p>Without getting a degree in information retrieval, I'd like to know if there exists any algorithms for counting the frequency that words occur in a given body of text. The goal is to get a "general feel" of what people are saying over a set of textual comments. Along the lines of <a href="http://wordle.net/" rel="... | <p>You'll need not one, but several nice algorithms, along the lines of the following.</p>
<ul>
<li>ignoring pronouns is done via a <a href="http://en.wikipedia.org/wiki/Stoplist" rel="noreferrer">stoplist</a>.</li>
<li>preserving proper nouns? You mean, detecting named entities, like <em>Hoover</em> <em>Dam</em> and ... | <p>U can use the worldnet dictionary to the get the basic information of the question keyword like its past of speech, extract synonym, u can also can do the same for your document to create the index for it.
then you can easily match the keyword with index file and rank the document. then summerize it. </p>
| 11,594 |
<p>The question I want to ask is thus:</p>
<p>Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available?</p>
<p>Now, the example of why I think it can be used for good.</p>
<p... | <p>I think I would make the this[int] and this[string] accessors virtual and override them in BList/BDictionary. Classes where the accessors does not make sense should cast a NotSupportedException() (perhaps by having a default implementation in BItem).</p>
<p>That makes your code work in the same way and gives you a ... | <p>Did you concider parsing a simple "path" so you could write it this way:</p>
<p><p><code>
BDictionary torrent = BItem.DecodeFile("my.torrent");<br />
int filelength = (int)torrent.Fetch("info.files.0.length");
</code></p><p>
Perhaps not the best way, but the readability increases(a little)</p></p>
| 10,768 |
<p>I was trying to remove all the lines of a file except the last line but the following command did not work, although file.txt is not empty.</p>
<pre><code>$cat file.txt |tail -1 > file.txt
$cat file.txt
</code></pre>
<p>Why is it so?</p>
| <p>Redirecting from a file through a pipeline back to the same file is unsafe; if <code>file.txt</code> is overwritten by the shell when setting up the last stage of the pipeline before <code>tail</code> starts reading off the first stage, you end up with empty output.</p>
<p>Do the following instead:</p>
<pre><code>... | <p>It seems to not like the fact you're writing it back to the same filename. If you do the following it works:</p>
<pre><code>$cat file.txt | tail -1 > anotherfile.txt
</code></pre>
| 14,996 |
<p>Being really new to wx, I'm wondering if there is an IDE (especially for Linux) which would help me lay out a frame or dialog or whatever just to help me see what I'm doing. That means also creating the code for those changes.</p>
<p>I remember way back when using resource compilers for OS/2 and Windows that produ... | <p>I use <a href="http://www.wxformbuilder.org" rel="nofollow noreferrer">wxFormBuilder</a>. It is written in wxWidgets, so it works on Linux quite well. It can generate C++ code or XRC files. Make sure you understand its philosophy, and use it like this:</p>
<ul>
<li>generate C++ code for the GUI</li>
<li>don't edit ... | <p>For windows you've got "wx-devcpp" which is Blodsheed Dev C++ with some addons providing what you looking for </p>
<p>Here is project page
<a href="http://wxdsgn.sourceforge.net/" rel="nofollow noreferrer">http://wxdsgn.sourceforge.net/</a></p>
| 27,746 |
<p>I want to be able to take still images with a web cam, via .NET 2.0 (or 3.5 if necessary). I know I can use DirectShow but that seems like a very large learning curve.</p>
<p>Is there a simple to use OCX, or library that can work with most standard webcams?</p>
| <p>This may look ugly but it's a way to do it in trampoline-style (no system stack overflow), and without using gotos.</p>
<pre><code>push x,1 on homemade stack
while stack length > 1
n = pop
if (n==1)
x = pop
if (type(x)==NIL || type(x)==TEXT)
push x // this is the "return value"
els... | <p>The best I can come up with is something like this:</p>
<pre><code>(define (doaction vars action)
(cond ((symbol=? action 'frob)
(cond ((foo? (first vars))
(first vars))
((bar? (first vars))
(doaction (list (f (first vars)) (doaction (g x) 'frob)) 'macerate)... | 40,730 |
<p>Exception is:
'Country' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value</p>
<pre><code>UserService.DsUserAttributes dsCountry = us_service.GetUserAttributeDropDown(systemId, "Country");
Country.DataSource = dsCountry.tblDropDownValues;
Country.DataTextFiel... | <p>Every time I got this error it was because the keys I was matching on to bind my data didn't match.</p>
<p>The lines you showed may not be the problem. Look into when you are possibly loading a record from another table and binding their values into the dropdown list. </p>
<p>For example, if you have a dropdown li... | <p>This could also be caused by having nulls in the source data you are binding to your drop down list.</p>
| 28,502 |
<p>I have a process that runs on a UNIX (Solaris) server that runs nightly and needs to be able to send out encrypted emails.</p>
<p>I only need the "encryption" portion, NOT the digital signature / self-repudiation part of PKI.</p>
<p>I use MS Outlook in a corporate setting and I am assuming that when a user clicks ... | <p><strong>You're logic is right.</strong></p>
<p>Typical PKI encryption is:</p>
<pre><code>cryptoAlgorithm(plaintext, public key) = ciphertext
cryptoAlgorithm(ciphertext, private key) = plaintext
</code></pre>
<p>For some algorithms, the cryptoAlgorithm is the same procedure, sending and receiving.</p>
<p>So... f... | <p>The caveat not noted previous is that the GAL isn't necessarily on the Exchange Server, and is more frequently found on the Domain server, when not run in a standalone mode. The certificate will be found in the LDAP attribute userCertificate or userSMIMECertificate.</p>
| 38,495 |
<p>If I grant execute permissions to a role via</p>
<pre><code>GRANT EXECUTE ON [DBO].[MYPROC] TO MY_ROLE
</code></pre>
<p>what's the equivalent syntax to remove them?</p>
| <p>REVOKE EXECUTE ON [DBO].[MYPROC] TO MY_ROLE</p>
| <pre><code>DENY EXECUTE ON [DBO].[MYPROC] TO MY_ROLE
</code></pre>
| 31,204 |
<p>I have a table containing the runtimes for generators on different sites, and I want to select the most recent entry for each site. Each generator is run once or twice a week.</p>
<p>I have a query that will do this, but I wonder if it's the best option. I can't help thinking that using WHERE x IN (SELECT ...) is... | <p>Should your query not be correlated? i.e.:</p>
<pre><code>SELECT id, site_id, start, "end", duration
FROM generator_logs g1
WHERE start = (SELECT MAX(g2.start) AS start
FROM generator_logs g2
WHERE g2.site_id = g1.site_id)
ORDER BY start DESC
</code></pre>
<p>Otherwise you will po... | <p>In MYSQL it could be problematic because Last i Checked it was unable to optimise subqueries effectively ( Ie: by query-rewriting ) </p>
<p>Many DBMS's have Genetic Query planners which will do the same thing regardless of your input queries structure. </p>
<p>MYSQL will in some cases for that situation create a t... | 39,734 |
<p>I'd like to enter the mysteries of Emacs - but gently! Excuse the lack of machismo, but is there a Emacs-clone for Windows which supports mouse-and-menu usage to get me started -- so I can delay learning ALT-META_CTRL-C-C for a while.</p>
| <p><a href="http://ftp.gnu.org/gnu/emacs/windows/" rel="nofollow noreferrer">Download</a> the latest version of GNU Emacs for Windows. By default, it comes with a menu, which looks like any other Windows menu. You can first do things using the menu, and since it displays what the shortcuts are, you'll quickly learn.</p... | <p>Theres some options:</p>
<p><a href="http://www.xemacs.org/index.html" rel="nofollow noreferrer">http://www.xemacs.org/index.html</a></p>
<p><a href="http://www.notgnu.org/" rel="nofollow noreferrer">http://www.notgnu.org/</a></p>
<p>Probably even more...</p>
| 44,137 |
<p>I have a loop that looks something like this:</p>
<pre><code>for (int i = 0; i < max; i++) {
String myString = ...;
float myNum = Float.parseFloat(myString);
myFloats[i] = myNum;
}
</code></pre>
<p>This is the main content of a method whose sole purpose is to return the array of floats. I want this ... | <p>PERFORMANCE:</p>
<p>There is absolutely no performance difference in where the try/catch structures are placed. Internally, they are implemented as a code-range table in a structure that is created when the method is called. While the method is executing, the try/catch structures are completely out of the picture u... | <p>If it's inside, then you'll gain the overhead of the try/catch structure N times, as opposed to just the once on the outside.</p>
<hr>
<p>Every time a Try/Catch structure is called it adds overhead to the execution of the method. Just the little bit of memory & processor ticks needed to deal with the structure... | 17,108 |
<p>Please share how you do version control for Lotus Notes/Domino development.</p>
<p>I want to put in our SVN repository all the scripts, views, custom forms, script libraries, etc.</p>
<p>Semi-automated methods are accepted as well (i.e. if I find a way to get all the event scripts for a form in one file, and to be... | <p>The openntf project Design Catalog can be used for version control. It uses dxl technique mentioned by kerr.
www.openntf.org/projects/pmt.nsf/ProjectLookup/DesignCatalog</p>
<p>At lotusphere the lotus911 people mentioned they used the Design Catalog in combination with Trigger Happy.
www.openntf.org/projects/pmt.n... | <p>Teamstudio are the best products on the market. I have used them, and dont have any trouble. They're not cheap, but if you're doing something requiring multiple developers or requires a controlled release process for changes, you need to get CIAO.</p>
<p><a href="http://www.teamstudio.com" rel="nofollow noreferrer"... | 36,245 |
<p>I feel like questions along the lines of, "my printer is crashing for no obvious reason, what should I do?" may be too broad and open-ended for this format. It's better handled by a forum where people can have running discussions to rule out a series of tests. What do you guys think?</p>
| <p>For common problems that get asked a lot, I wouldn't just close these as <em>too broad.</em> A better solution is to create a <strong>canonical post</strong> like this:</p>
<p><a href="https://superuser.com/a/260078/697"><strong>How do I troubleshoot when I have no clue where to start?</strong></a></p>
<p>These at... | <p>In addition to <a href="https://3dprinting.meta.stackexchange.com/a/84/63">Robert Cartaino♦</a>'s suggestion, I think that there is value in this class of question.</p>
<p>Over on <em>Robotics</em> we find that troubleshooting questions can often lead to interesting and often more generalised answers, and can lead ... | 19 |
<p>I have a ASP.NET project, in which I have a method with 10 local variables. This method calls about 10 other methods. 3 of the called methods need all the variables. Is it considered good practice to turn all those variables into global members, and then they don't have to passed as parameters?</p>
| <p>If you want to pass complex state around, package it in an object - i.e.</p>
<pre><code>public class Foo {
public string Key {get;set;}
public decimal Quantity {get;set;}
// etc
}
</code></pre>
<p>And have the methods accept this object as an argument. Then you just create an instance of this and pa... | <p>Just be sure to be conscious about boxing. If you are passing 10 ref types around, it comes down to personal preference. </p>
<p>However, if you are passing 10 value types, if you were to declare them as member variables within a class, they will be boxed, then they will have to be unboxed by the recipient. </p>... | 46,400 |
<p>I have a Selenium test case that enters dates into a date selector made up of three pulldowns (year, month, and day). </p>
<pre><code>select validity_Y label=2008
select validity_M label=08
select validity_D label=08
</code></pre>
<p>This part gets repeated a lot throughout the test case. I'd like to reduce it by ... | <p>Almost every GUI library is designed to only allow calls that change the GUI to be made in a single thread designated for that purpose (called the UI thread). If you are in another thread, you are required to arrange for the call to change the GUI to be made in the UI thread. In .NET, the way to do that is to call I... | <p>Use the <strong>SetWindowPos</strong> API call to ensure that your notify form is the topmost window. This post explains how:</p>
<p><a href="http://www.pinvoke.net/default.aspx/user32/SetWindowPos.html" rel="nofollow noreferrer">http://www.pinvoke.net/default.aspx/user32/SetWindowPos.html</a></p>
| 19,412 |
<p>With Java Version 1.5.0_06 on both Windows and Ubuntu Linux :</p>
<p>Whenever I add minutes to the date "2008/10/05 00:00:00" , it seems that an extra hour is wrongly added.</p>
<p>ie: adding 360 minutes to 2008/10/05 00:00:00 at midnight should arrive at 2008/10/05 06:00:00</p>
<p>But it is arriving at 2008/10/0... | <p>There's a crossover to daylight savings on that day.</p>
<p>Are you in New Zealand? If so, that means your timezone files are out of date. Better go to the Java download site and download new ones; look for "JDK DST Timezone Update Tool".</p>
| <h2>java.time</h2>
<p>I recommend that you use java.time, the modern Java date and time API, for your date and time work (you reported using Java 1.5 back in 2008, before the advent of java.time, but I hope that you aren’t anymore). java.time can be considered the successor of the Joda-Time library that Willi aus Rohr ... | 36,304 |
<p>I have a JavaScript snippet that runs very well on Firefox and Safari, but refuses to run on IE:</p>
<pre><code>var drop= function(id)
{
if(document.getElementById("select1").value == "Ficha de pediatria"){
top.location.href = "print.jsp?id="+id+"&type=2";
}
else if(document.getElementById("select1... | <p>[EDIT] Sorry. I introduced an error with my first post by not carefully looking at how you are constructing your url. I shouldn't have removed the <code>id</code> parameter. I've updated the code and it should work now.</p>
<p>Try this instead:</p>
<pre><code>function drop(ctl,id)
{
var value = ctl.options[... | <p>I see two possible reasons.</p>
<p><strong>1</strong> - The way the function is declared. I've never seen it like that though I guess it works.</p>
<p>Maybe try the following and see if it still does not work:</p>
<pre><code>function drop(id)
{
// same code
}
</code></pre>
<hr>
<p><strong>2</strong> - The r... | 32,077 |
<p>The current system that I am working on makes use of Castle Activerecord to provide ORM (Object Relational Mapping) between the Domain objects and the database. This is all well and good and at most times actually works well!</p>
<p>The problem comes about with Castle Activerecords support for asynchronous executio... | <p>I solved a problem very similar to this where I copied the data out of a lot of older web service contracts into WCF data contracts. I created a number of methods that had signatures like this:</p>
<pre><code>public static T ChangeType<S, T>(this S source) where T : class, new()
</code></pre>
<p>The first t... | <p>My apologies for not really putting the details in here, but a basic OO approach would be to make the DTO a member of the ActiveRecord class and have the ActiveRecord delegate the accessors and mutators to the DTO. You could use code generation or refactoring tools to build the DTO classes pretty quickly from the Ac... | 6,296 |
<p>I have a Flex swf hosted at <a href="http://www.a.com/a.swf" rel="nofollow noreferrer">http://www.a.com/a.swf</a>.
I have a flash code on another doamin that tries loading the SWF:</p>
<pre><code>_loader = new Loader();
var req:URLRequest = new URLRequest("http://services.nuconomy.com/n.swf");
_loader.contentLoader... | <p>This is all described in <a href="http://livedocs.adobe.com/flex/3/progAS_flex3.pdf" rel="nofollow noreferrer">The Adobe Flex 3 Programming ActionScript 3 PDF</a> on page 550 (Chapter 27: Flash Player Security / Cross-scripting):</p>
<blockquote>
<p>If two SWF files written with ActionScript 3.0 are served from d... | <p>Mayhaps <a href="http://livedocs.adobe.com/flex/15/flex_docs_en/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flex_Documentation&file=00001750.htm" rel="nofollow noreferrer" title="Flex Documentation: System.Security.allowDomain">System.Security.allowDomain</a> is what you need?</p>
| 3,511 |
<p>Any good converter for GB, Big5, Unicode?</p>
<p>Convert GB to Unicode, Unicode to GB, Big5 to Unicode, Unicode to Big5, GB to Big5.</p>
| <p>iconv should be able to do the job. It's part of the GNU C Library.</p>
<pre><code>http://en.wikipedia.org/wiki/Iconv
http://www.gnu.org/software/libiconv/
</code></pre>
| <p>If it's a converting tool that you need, you can try:</p>
<pre><code>http://alf-li.pcdiscuss.com/c_convertz.html
</code></pre>
<p>Really useful to me, it does GB/BIG5/UNICODE.</p>
| 41,151 |
<p>I have built an application that uses SQL Express 2005 and I want to deploy it, but the problem is that anyone who has SQL Management Studio(or something like that) installed on his computer, can connect to my database and change it.
Is there anyway to prevent end-users from seeing or editing the content of my data... | <p>I guess you're referring to the fact that by default SQL Server installs allow Windows and SQL Server Authentication. If you remove the Windows Authentication mode then users will have to connect via SQL Server authentication.</p>
<p>This from <a href="http://support.microsoft.com/kb/247931" rel="nofollow noreferre... | <p>I suppose this is not the answer you hoped for but it is unavoidable that anyone with administrative rights will be able to browse and edit information in the database. </p>
<p>You cannot change this.</p>
<p>Perhaps you could consider WHY you want to prevent this kind of access?</p>
<p>I expect you want to preve... | 33,164 |
<p>We take text/csv like data over long periods (~days) from costly experiments and so file corruption is to be avoided at all costs.</p>
<p>Recently, a file was copied from the Explorer in XP whilst the experiment was in progress and the data was partially lost, presumably due to multiple access conflict. </p>
<p>Wh... | <p>Use a database as a secondary data storage mechanism and take advantage of the atomic transaction mechanisms</p>
| <p>Write data to a buffer file in an obscure directory and copy the data to the 'public' data file periodically (every 10 points for instance), thereby reducing writes and also providing a backup</p>
| 37,349 |
<p>Could you tell me, please, if it's possible to preview (or at least retroview, for example, in a kind of a log file) SQL commands which SQL Server Management Studio Express is about to execute (or has just executed)?</p>
<p>In the past I used Embarcadero DBArtisan which shows SQL queries to be executed before actua... | <p>To answer the question of viewing underlying queries executed when using Management Studio, there are two ways to do this.</p>
<p>Most of the Dialog boxes in Management Studio allow you to generate a change script to file or clipboard which can be useful for peaking under the hood, as well as applying changes betwe... | <p>You can use </p>
<pre><code>SET SHOWPLAN_TEXT ON
</code></pre>
<p>At the beginning of your batch to have the plan and text of the query echoed back to you. The query will not affect any rows while <code>SHOWPLAN_TEXT</code> is on.</p>
<p>You can then set <code>SHOWPLAN_TEXT</code> to <code>OFF</code> to run your... | 28,792 |
<p>Specifically, what commands do I run from the terminal?</p>
| <p>Without a home directory</p>
<pre><code>sudo useradd myuser
</code></pre>
<p>With home directory</p>
<pre><code>sudo useradd -m myuser
</code></pre>
<p>Then set the password</p>
<pre><code>sudo passwd myuser
</code></pre>
<p>Then set the shell</p>
<pre><code>sudo usermod -s /bin/bash myuser
</code></pre>
| <p>There's basicly 2 commands to do this...</p>
<ul>
<li>useradd</li>
<li>adduser (which is a frendlier front end to useradd)</li>
</ul>
<p>You have to run them has root.
Just read their manuals to find out how to use them.</p>
| 5,917 |
<p>I have a Maven pom that uses <code><packaging>war</packaging></code>. But actually, I don't want build the war-file, I just want all the dependent jars collected and a full deployment directory created.</p>
<p>So I'm running the <code>war:exploded</code> goal to generate the deploy directory:</p>
<pre... | <p>According <a href="http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Built-in_Lifecycle_Bindings" rel="noreferrer">builtin lifecycle bindings</a> for war packaging in package phase war:war mojo is called.</p>
<p>You can call previous 'prepare-package' phase - all actions will be perform... | <p>As far as I know (I'm still new to maven) this is not possible. The only default lifecycle you can skip is 'test'. In order to get to the deploy you have to package. You can read all about the default lifecycle order of execution here: <a href="http://maven.apache.org/guides/introduction/introduction-to-the-life... | 45,921 |
<p>I am fairly new to using infragistics controls (started yesterday). While they are (very) impressive they do add another layer of complexity, which I am muddeling through. So I am asking what I feel to be a fairly simple issue:</p>
<p>I am trying to get the value from another column besides the one that is displaye... | <p>Looks like you found a working solution to your own problem. I thought I would just add in some more information and things to consider.</p>
<p>You may want to avoid a hard index refrence to your cell, in case the position changes in the future as you add new data to the grid's datasource. Say you insert another co... | <p>found correct combination:</p>
<pre><code>LastName = ucboPatientInfo.Cells(5).Value
</code></pre>
| 49,117 |
<p>I am attempting to mock a call to an indexed property. I.e. I would like to moq the following:</p>
<pre><code>object result = myDictionaryCollection["SomeKeyValue"];
</code></pre>
<p>and also the setter value</p>
<pre><code>myDictionaryCollection["SomeKeyValue"] = myNewValue;
</code></pre>
<p>I am doing this bec... | <p>It's not clear what you're trying to do because you don't show the declaration of the mock. Are you trying to mock a dictionary? </p>
<p><code>MyContainer[(string s)]</code> isn't valid C#.</p>
<p>This compiles:</p>
<pre><code>var mock = new Mock<IDictionary>();
mock.SetupGet( p => p[It.IsAny<string&g... | <p>It appears that what I was attempting to do with MOQ is not possible.</p>
<p>Essentially I was attempting to MOQ a HTTPSession type object, where the key of the item being set to the index could only be determined at runtime. Access to the indexed property needed to return the value which was previously set. This w... | 44,281 |
<p>I listen to the podcast java posse, on this there is often discussion about components (note components are not (clearly) objects). They lament the fact that Java does not have components, and contrast with .NET that does. Components apparently makes developing applications (not just GUI apps) easier.</p>
<p>I c... | <p>Software Engineering Radio has an episode on exactly this topic: <a href="http://se-radio.net/podcast/2008-02/episode-87-software-components" rel="nofollow noreferrer">http://se-radio.net/podcast/2008-02/episode-87-software-components</a></p>
<p>The general idea is that a software component can describe what its ow... | <p>I don't know .NET components particularly, but from the Java POV, I'd say that a component is some functional unit that should have a defined interface/usage principle. While Java does not have components as a language concept, there are IMHO components in Java. Technical components would be e.g.:</p>
<ul>
<li>EJBs... | 23,826 |
<p>Looking for a good approach to keep track of a Breadth-First traversal between two nodes, without knowing anything about the graph. Versus Depth-First (where you can throw away the path if it doesn't pan out) you may have quite a few "open" possibilities during the traversal.</p>
| <p>The naive approach is to build a tree with the source node as the root and all its connections as its children. Depending on the amount of space you have, you might need to eliminate cycles as you go. You can do that with a bitmap where each bit corresponds to a distinct node in the graph. When you reach the target ... | <p>If you are using .NET 3.5 consider using the <a href="http://msdn.microsoft.com/en-us/library/bb359438.aspx" rel="nofollow noreferrer">Hashset</a> to prevent duplicate nodes from being expanded, this happens when there is cycles in your graph. If you have any knowledge about the contents of the graph consider implem... | 8,170 |
<p>I've got a <strong>large</strong> array of primitive types (double).
How do I sort the elements in <strong>descending order</strong>?</p>
<p>Unfortunately the Java API doesn't support sorting of <strong>primitive</strong> types with a Comparator.</p>
<p>The first approach that probably comes to mind is to convert it... | <p><a href="https://github.com/mintern-java/primitive#java-primitive" rel="noreferrer">Java Primitive</a> includes functionality for sorting primitive arrays based on a custom comparator. Using it, and Java 8, your sample could be written as:</p>
<pre><code>double[] array = new double[1048576];
...
Primitive.sort(arra... | <pre><code>double[] array = new double[1048576];
</code></pre>
<p>...</p>
<p>By default order is ascending </p>
<p>To reverse the order </p>
<pre><code>Arrays.sort(array,Collections.reverseOrder());
</code></pre>
| 26,459 |
<p>Say I have a linked list of numbers of length <code>N</code>. <code>N</code> is very large and I don’t know in advance the exact value of <code>N</code>. </p>
<p>How can I most efficiently write a function that will return <code>k</code> completely <em>random numbers</em> from the list?</p>
| <p>There's a very nice and efficient algorithm for this using a method called <strong>reservoir sampling</strong>.</p>
<p>Let me start by giving you its <strong>history</strong>:</p>
<p><strong>Knuth</strong> calls this Algorithm R on p. 144 of his 1997 edition of Seminumerical Algorithms (volume 2 of The Art of Comp... | <p>Well, you do need to know what N is at runtime at least, even if this involves doing an extra pass over the list to count them. The simplest algorithm to do this is to just pick a random number in N and remove that item, repeated k times. Or, if it is permissible to return repeat numbers, don't remove the item.</p>
... | 7,767 |
<p>I have a table in a SQL 2005 database that contains a column defined as a xml datatype. I'm trying to write stored proc that queries the xml and returns a resultset from a select statement. I've seen examples of returning scalar values or xml but not how to return a resultset.</p>
<p>Am I going to have to use ope... | <p>The xml data type has its own set of methods that you can use to deal with the data in the column. In this case you'd probably use something like this:</p>
<pre><code>select xmlColumnName.value('XpathExpression', 'outputSqlType') from dataTable
</code></pre>
<p>For example, </p>
<pre><code>select xmlColumnName.v... | <p>You can use the xml data type or OPENXML. Another poster gave an xml data type example, so here is a OPENXML example.</p>
<p>It really depends on the XML schema though. SQL Server may not like your schema very well. If you have any control over the schema then it helps. You may end up having to use a table variable... | 44,496 |
<p>I have a problem, and was hoping I could rely on some of the experience here for advice and a push in the right direction. I have an MS Access file made by propietary software. I only want to take half the columns from this table, and import into new(not yet setup)mysql database.</p>
<p>I have no idea how to do thi... | <p>This is a bash script <strong><em>linux</em></strong> example using <a href="http://mdbtools.sourceforge.net/" rel="noreferrer">mdbtools</a> for automatic extraction and import from a mdb file to mysql. </p>
<pre><code>#!/bin/bash
MDBFILE="Data.mdb"
OPTIONS="-H -D %y-%m-%d"
mdb-export $OPTIONS $MDBFILE TableName... | <p><a href="http://www.dbtalk.net/mailing-database-mysql-win32/what-quickest-way-convert-access-136837.html" rel="nofollow noreferrer">http://www.dbtalk.net/mailing-database-mysql-win32/what-quickest-way-convert-access-136837.html</a></p>
<p>Search for Kofler (He wrote a german Book, where Part of it was a mdb2sql con... | 30,090 |
<p>So, I am trying to deploy a Web Application feature that updates the web.config using the WebConfigModifications collection. There is lots of information on doing this including all the issues you run into so I am very confident in the code but no matter what I try the config elements are not added to the web config... | <p>How about <a href="http://www.owlnet.rice.edu/~elec301/Projects99/faces/index.html" rel="noreferrer">Eigenfaces</a>? Utilizes simple mathematics to store recognizable eigenvector of the face and reconstruct faces using multiple vectors.</p>
<p>The code is all available in Python as well <a href="http://www.owlnet.r... | <p>I find <a href="http://www.luxand.com/" rel="nofollow">Luxand Facesdk</a> the best for Face recognition and identification.</p>
| 46,002 |
<p>When writing an abstract class, or a class that doesn't get instantiated directly... do you tend to write a dealloc method in the abstract class and release where appropriate, and then allow for children to call [super dealloc] and then worry about only instance variables they add which aren't part of the super clas... | <p>Yes, you take responsibility for yourself, not for super or subclasses. </p>
| <p>Saying the same thing as Stephan, but from a different angle: Avoid putting <code>alloc</code> and <code>release</code> in different places as much as possible (<code>init</code> and <code>dealloc</code> being the main exceptions). That goes double for putting them in different classes, as in your case of a class an... | 49,620 |
<p>I'm looking at using ASP.NET for a new SaaS service, but for the love of me I can't seem to figure out how to do account lookups based on subdomains like most SaaS applications (e.g. 37Signals) do.</p>
<p>For example, if I offer yourname.mysite.com, then how would I use ASP.NET (MVC specifically) to extract the sub... | <p>This works for me:</p>
<pre><code> //--------------------------------------------------------------------------------------------------------------------------
public string GetSubDomain()
{
string SubDomain = "";
if (Request.Url.HostNameType == UriHostNameType.Dns)
SubDomain... | <p>The way I have done it is with HttpContext.Request.ServerVariables["HTTP_HOST"].Split(".").</p>
<p>Let me know if you need more help.</p>
| 46,037 |
<p><b>Duplicate of: <a href="https://stackoverflow.com/questions/255214/when-should-i-use-the-visitor-design-pattern">When Should I Use The Visitor Design Pattern</a></b></p>
<p>Why would someone want to use the visitor pattern? I've read a couple of articles, but I'm not getting something.</p>
<p>If I need a functio... | <p>The issue arises when you have a complex structure, i.e., a hierarchy or something else that's not simply linear. When you can't simply iterate over the structure, a visitor is very handy.</p>
<p>If I have a hierarchy (or tree), each Node has a list of children. When I want to apply a process to every node in the... | <p>In both case, the visitor is separated from the customer class. The advantage would be if you wanted to abstract the visitor from the caller class as well. In the second case the calling class has to know about billing. You could instead have another routine somewhere that would return an IVisitor. The calling code... | 47,190 |
<p>It seems like each body section in an <em>axapta</em> report can only print columns from a single table(consistantly). For instance:
I have a report that has the following tables: SalesLine, InventTable and CustTable. Then I would like to print columns from each of this tables on the same row. It seems like I can... | <p>It should be possible to do this, there are several reports in the base system that work this way. Look at the SalesContractShipment report in 4.0 as an example.</p>
<p>On your report, create a datasource for SalesLine, and under that create datasource each for InventTable and CustTable. On InventTable and CustTabl... | <p>Consider using temporary tables. Fill it with your data first, than use in the report.</p>
| 29,163 |
<p>How do you create a database from an Entity Data Model.</p>
<p>So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server. </p>
| <p>From what I understand you are not just supposed to use EDM as a "pretty" database designer, in fact EDM does not depend on a specific storage layer. It tries to abstract that part for the developer. There are design schemas (CSDL) and storage schemas (SSDL). Anyway, don't mean to lecture you. ;)</p>
<p>There is <a... | <p>The Feature "Generate Database Schema from Model" is scheduled for a future release of Entity Framework. V1 does'nt support schema generatiorn based on EF models.</p>
| 8,607 |
<p><strong>How would you design and implement OpenID components?</strong></p>
<p>(Was "How does OpenId work")</p>
<p>I realize this question is somewhat of a <a href="https://stackoverflow.com/questions/69076/openid-login-workflow">duplicate</a>, and yes, I have read <a href="http://openid.net/specs/openid-authentica... | <p>Check out Security Now podcast, <a href="http://www.grc.com/sn/notes-095.htm" rel="nofollow noreferrer">episode 95</a>. (<a href="http://www.grc.com/securitynow.htm#95" rel="nofollow noreferrer">Actually audio</a>)</p>
| <p>Jeff has a great article on OpenID where he shares his experiences:</p>
<p><a href="http://www.codinghorror.com/blog/archives/001121.html" rel="nofollow noreferrer">OpenID: Does The World Really Need Yet Another Username and Password?</a></p>
<p>There are some links to tutorials on the official OpenID site:</p>
<... | 15,043 |
<p>In Maven, dependencies are usually set up like this:</p>
<pre class="lang-xml prettyprint-override"><code><dependency>
<groupId>wonderful-inc</groupId>
<artifactId>dream-library</artifactId>
<version>1.2.3</version>
</dependency>
</code></pre>
<p>Now, if you ar... | <p><em><strong>NOTE:</strong></em></p>
<p><em>The mentioned <code>LATEST</code> and <code>RELEASE</code> metaversions <a href="https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes#Maven3.xCompatibilityNotes-PluginMetaversionResolution" rel="noreferrer">have been dropped <strong>for plugin dep... | <p>MY solution in maven 3.5.4 ,use nexus, in eclipse:</p>
<pre><code><dependency>
<groupId>yilin.sheng</groupId>
<artifactId>webspherecore</artifactId>
<version>LATEST</version>
</dependency>
</code></pre>
<p>then in eclipse: <code>atl + F5</code>, and choo... | 5,047 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.