instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>If I have a method with a parameter that's an interface, whats the fasts way to see if the interface's reference is of a specific generic type?</p>
<p>More specifically, if I have:</p>
<pre><code>interface IVehicle{}
class Car<T> : IVehicle {}
CheckType(IVehicle param)
{
// How do I check that param is... | <p>To check if param is a <code>Car<int></code> you can use "is" and "as" as normal:</p>
<pre><code>CheckType(IVehicle param)
{
Car<int> car = param as Car<int>;
if (car != null)
{
...
}
}
</code></pre>
| <p>I often find that if my code requires me to write checks for specific types, I'm probably doing something wrong. You didn't give us enough context for us to give advice on this, though.</p>
<p>Does this meet your needs?</p>
<pre><code>Car<int> carOfInt = param as Car<int>;
if (carOfInt != null)
{
... | 34,275 |
<p>Could somebody please name a few. I could given time, but this is for somebody else, and I'd also like some community input.</p>
| <p>Personally I would say one of the biggest advantages I have found is the product responds quicker i.e. opens faster, compiles and runs projects faster. In my mind why wouldn't you upgrade for this benefit alone.</p>
<p>Because of the environment that I work in I am restricted to .NET 2.0 so have not been able to t... | <p>Depends on your programming language.</p>
<ul>
<li>On .net, the built-in support for .net 3.5 is obvious, although this is mainly project templates. However, SP1 adds .net Client Framework support, which is not possible within VS2005 to my knowledge.</li>
<li>This also means support for WPF with a XAML Designer, al... | 11,625 |
<p>Say I create an object thus:</p>
<pre><code>var myObject =
{"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"};
</code></pre>
<p>What is the best way to retrieve a list of the property names? i.e. I would like to end up with some variable 'keys' such that:</p>
<pre><code>keys == ["ircEvent"... | <p>In modern browsers (IE9+, FF4+, Chrome5+, Opera12+, Safari5+) you can use the built in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys" rel="noreferrer">Object.keys</a> method:</p>
<pre><code>var keys = Object.keys(myObject);
</code></pre>
<p>The above has a full... | <p>The solution work on my cases and cross-browser:</p>
<pre><code>var getKeys = function(obj) {
var type = typeof obj;
var isObjectType = type === 'function' || type === 'object' || !!obj;
// 1
if(isObjectType) {
return Object.keys(obj);
}
// 2
var keys = [];
for(var i in ob... | 25,507 |
<p>I've had a new found interest in building a small, efficient web server in C and have had some trouble parsing POST methods from the HTTP Header. Would anyone have any advice as to how to handle retrieving the name/value pairs from the "posted" data?</p>
<pre><code>POST /test HTTP/1.1
Host: test-domain.com:7017
Use... | <p>You can retrieve the name/value pairs by searching for newline newline or more specifically \r\n\r\n (after this, the body of the message will start).</p>
<p>Then you can simply split the list by the &, and then split each of those returned strings between the = for name/value pairs.</p>
<p>See the <a href="htt... | <p>IETF RFC notwithstanding, here is a more to the point answer. Assuming that you realize that there is always an extra <code>/r/n</code> after the <code>Content-Length</code> line in the header, you should be able to do the work to isolate it into a <code>char*</code> variable named <code>data</code>. This is where ... | 10,519 |
<p>To illustrate, assume that I have two tables as follows:</p>
<pre><code>VehicleID Name
1 Chuck
2 Larry
LocationID VehicleID City
1 1 New York
2 1 Seattle
3 1 Vancouver
4 2 Los Angeles
5 2 Houston
</code></pre>
<p>... | <p>If you're using SQL Server 2005, you could use the FOR XML PATH command.</p>
<pre><code>SELECT [VehicleID]
, [Name]
, (STUFF((SELECT CAST(', ' + [City] AS VARCHAR(MAX))
FROM [Location]
WHERE (VehicleID = Vehicle.VehicleID)
FOR XML PATH ('')), 1, 2, '')) AS Locations
FROM [Vehi... | <p>If you're running SQL Server 2005, you can write a <a href="https://learn.microsoft.com/en-us/sql/relational-databases/clr-integration-database-objects-user-defined-functions/clr-user-defined-aggregates" rel="nofollow noreferrer">custom CLR aggregate function</a> to handle this.</p>
<p>C# version:</p>
<pre><code>u... | 2,858 |
<p>I'm having a weird problem, where tagging <strong>works fine on my development machine</strong>, but when I deploy to the production server, I get this error in the log:</p>
<pre><code>ActionView::TemplateError (undefined method `tags' for #<Person:0x98bb9d4>) on line...
</code></pre>
<p>There is an entry ... | <p><a href="http://msdn.microsoft.com/en-us/library/ms179877.aspx" rel="nofollow noreferrer"><code>sp_attach_db</code></a> (or CREATE DATABASE FOR ATTACH) - don't forget to bring the LDF (log) files, too.</p>
| <p>This will help you</p>
<p><a href="http://support.microsoft.com/kb/224071" rel="nofollow noreferrer">http://support.microsoft.com/kb/224071</a></p>
| 38,881 |
<p>How do I output colored text to the terminal in Python?</p>
| <p>This somewhat depends on what platform you are on. The most common way to do this is by printing ANSI escape sequences. For a simple example, here's some Python code from the <a href="https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/scons/tools/bcolors.py" rel="noreferrer">Blender build scripts</... | <p>I wrote a library which is available on PyPI, with a simple API that follows the standard print function.</p>
<p>You can install it with <code>pip install coloring</code>.</p>
<pre class="lang-py prettyprint-override"><code>import coloring
# Directly use print-like functions
coloring.print_red('Hello', 12)
coloring... | 36,631 |
<p>Although I do understand the serious implications of playing with this function (or at least that's what I think), I fail to see why it's becoming one of these things that respectable programmers wouldn't ever use, even those who don't even know what it is for.</p>
<p>Let's say I'm developing an application where m... | <p><a href="https://learn.microsoft.com/en-us/archive/blogs/ricom/when-to-call-gc-collect" rel="nofollow noreferrer">From Rico's Blog...</a></p>
<blockquote>
<p><strong>Rule #1</strong></p>
<p>Don't.</p>
<p>This is really the most important
rule. It's fair to say that most
usages of GC.Collect() are a bad idea
and I w... | <p>Bottom line, you can profile the application and see how these additional collections affect things. I'd suggest staying away from it though unless you are going to profile. The GC is designed to take care of itself and as the runtime evolves, they may increase efficiency. You don't want a bunch of code hanging arou... | 14,443 |
<p>What is the best way to make a delphi application (delphi 2007 for win32 here) go completely full screen, removing the application border and covering windows task bar ?</p>
<p>I am looking for something similar to what IE does when you hit F11.</p>
<p>I wish this to be a run time option for the user not a design ... | <p>Well, this has always worked for me. Seems a bit simpler...</p>
<pre><code>procedure TForm52.Button1Click(Sender: TObject);
begin
BorderStyle := bsNone;
WindowState := wsMaximized;
end;
</code></pre>
| <p>You need to make sure Form position is poDefaultPosOnly.</p>
<pre><code>Form1.Position := poDefaultPosOnly;
Form1.FormStyle := fsStayOnTop;
Form1.BorderStyle := bsNone;
Form1.Left := 0;
Form1.Top := 0;
Form1.Width := Screen.Width;
Form1.Height := Screen.Height;
</code></pre>
<p>Tested and works on Win7 x64.</p>
| 3,527 |
<p>When I try to send an HTTP GET request through XMLHttpRequest it works on non-secure HTTP.</p>
<p>But when sent over HTTPS, different browsers gave different results:</p>
<p>On Firefox 3.0.2:
- The GET request doesn't reach the web server.</p>
<p>On IE 7:
- The GET request reached the web server.</p>
<p>Does thi... | <p>Try placing your closure after the open:</p>
<pre><code>// send HTTP GET request
try
{
xmlHttp.open("GET", "/[relative path to request]", true);
}
catch (e)
{
alert('Error sending HTTP GET request!');
return false;
}
// we won't be handling any HTTP response
xmlHttp.onreadystatechange=function()
{
/... | <p>By any chance, are you requesting a non-HTTPS URL in an HTTPS page? Do any messages appear in the error log/console?</p>
| 16,690 |
<p>I have the same problem as <a href="http://forums.oreilly.com/content/C-3-0-in-a-Nutshell/775/Linq-To-Sql-Classes-With-Multiple-Relationships-To-A-Table/" rel="nofollow noreferrer">this guy</a>: </p>
<p>I have a table that has references my tblstaff table twice for two different people. Now that I have added this ... | <p>I had to create a function to getStaffbyID and manually call it when I wanted the name instead of the id.</p>
<pre><code> Dim id As String = 1
Session("BusinessPlanID") = id
Dim oLinq As New Linq
Dim bp As BusinessPlan = oLinq.getBusinessPlanById(id)
Dim assignedStaff As Staff = oLinq.getStaffB... | <p>By adding two references you are saying select all rows where the PK = this and the PK = that. Since the Pk is unique that condition will always be false.</p>
<p>I don't know linq really well but in SQL you would reference the table twice and alias it as in</p>
<p>....
FROM
tblstaff staff1, tblstaff staff2</p>... | 45,740 |
<p>Essentially I have a PHP page that calls out some other HTML to be rendered through an object's method. It looks like this:</p>
<p>MY PHP PAGE:</p>
<pre><code>// some content...
<?php
$GLOBALS["topOfThePage"] = true;
$this->renderSomeHTML();
?>
// some content...
<?php
$GLOBALS["topOfThe... | <p>Obviously, you cannot. The whole point of caching is that the 'thing' you cache is not going to change. So you either:</p>
<ul>
<li>provide a parameter</li>
<li>aviod caching</li>
<li>invalidate the cache when you set a different parameter</li>
</ul>
<p>Or, you rewrite the cache mechanism yourself - to support som... | <p>Your question seems unclear, but caching pretty much means 'stored so we don't have to calculate it again'. If you want the content to differ, you need to cache more results and pick the correct cached object one to send back.</p>
<p>Need more info to give a better answer. What is caching the document, Smarty? And ... | 11,306 |
<p>My project is building a Java web application on top of the AllegroGraph RDF store. I would like to find a good solution to map between the triples that come out of the store and our domain objects. I have looked into <a href="http://www.topazproject.org/trac/" rel="nofollow noreferrer">Topaz</a>, an Object/Triple... | <p>For the OO-RDF mapping in general, you might want to have a look at:</p>
<ul>
<li>OpenRDF Elmo <a href="http://www.openrdf.org/" rel="nofollow noreferrer">http://www.openrdf.org/</a> (works only with sesame but designed to be extensible and extending sesame to work on top of allegrograph(look at the sail (Storage a... | <p>I like the <a href="http://librdf.org/" rel="nofollow noreferrer">redland RDF libraries</a>. RDF parsing, storage, SPARQL/RDQL queries, fairly complete, but modular enough to use only what you want. They have Java bindings, but I have only used the C API (and also wrote a (partial) Lua binding)</p>
| 21,548 |
<p>Do we want to add a BLOG to this site?
Blogs are another way of communicating things that don't fit the Q&A model.</p>
<p>Here is a good description of <a href="https://stackoverflow.blog/2011/06/23/blog-overflow/">what a Blog is and how you can start one</a>.</p>
<p>This post on the SuperUser Blog asking for ... | <p>The description of blogs you've cited is 6 years old. Unfortunately, <a href="https://meta.stackexchange.com/questions/291741/we-will-no-longer-be-hosting-blog-overflow">blogs have since been discontinued</a>.</p>
<p>It is no longer possible to start a new blog.</p>
| <p>+1 - As it seems a good idea. Not sure what would go in it though - do you have any concrete examples of blog ideas? </p>
<p>I already have a (messy) <a href="https://gr33nonline.wordpress.com/" rel="nofollow noreferrer">blog</a>, and I am not sure if I could also write a blog on here too. I wonder what the score i... | 43 |
<p>I've been working on a toy OS and have been using grub as my boot loader. Recently when trying to use VGA I found that I couldn't use hardware interrupts. This I found was because I had been slung into protected mode by grub.</p>
<p>Does anybody know how to get back into real mode without having to get rid of gru... | <p>It sounds like you need to do a complete uninstall/reinstall. Alas.</p>
<p>Be sure to check <a href="http://docs.codegear.com" rel="nofollow noreferrer">http://docs.codegear.com</a> for the latest in Delphi help. On that site you can also download the Delphi 2007 help in various forms, including PDF and CHM. </p>... | <p>You probably got a corrupted file from the download. I would try download again and reinstall the help.</p>
| 12,341 |
<p>I'm not sure how to describe this problem, so I think an example is the best way to ask my question:</p>
<p>I have two tables with a manyToMany relationship:</p>
<p>DriversLicence <-> LicenceClass</p>
<p>LicenceClass is things like "Car", "Motorbike", and "Medium Rigid".</p>
<p>Using Hibernate Criteria, how c... | <p>Here's how I finally achieved it using HQL:</p>
<pre><code>public List<DriversLicence> findDriversLicencesWith(List<LicenceClass> licenceClasses) {
String hqlString = "select dl from DriversLicenceImpl dl where 1=1 ";
for (int i = 0; i < licenceClasses.size(); i++) {
hqlString += " an... | <p>'I don't think this going to work. I want to find all licences that have <strong>both</strong> "Car" and "Motorbike" '</p>
<p>User Expression.and(....) instead of Expression.or(....) in the snippet provided by Nick</p>
| 33,107 |
<p>I've recently started upgrading some applications to use Spring Webflow 2, and I want to make use of the new Ajax functionality that comes with Webflow 2. Can somebody please direct me to a tutorial for integrating Tiles 2 with Spring Webflow (since that's apparently what they recommend). I've found the documentat... | <p>This is what I did to get it working with webflow 2 and tiles 2.0</p>
<pre><code><bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-defs/templates.xml</value... | <p>This isn't exactly referring to the ajax features, but it helped me get apache tiles 2 set up for regular flows:</p>
<p><a href="http://jee-bpel-soa.blogspot.com/2008/12/spring-web-flows-2-and-tiles.html" rel="nofollow noreferrer">http://jee-bpel-soa.blogspot.com/2008/12/spring-web-flows-2-and-tiles.html</a></p>
<... | 43,367 |
<p>Given 2 file revisions I want to know how many lines were added/modified/deleted.
I want to have this information for the entire repository of thousand of files.
Please point me to a script or tool as I am a total svn newbie</p>
<p>I am working on windows</p>
<p>Sample output</p>
<p>File~NewRevision~OldRevision~A... | <p>Subversion has a very nice diff tool integrated within it. I would use a command such as:</p>
<pre><code>svn diff -rOldRevision:NewRevision URL
</code></pre>
<p>where URL is the URL of your repository (for instance, <a href="http://www.mycode.org/svn/trunk" rel="noreferrer">http://www.mycode.org/svn/trunk</a>). ... | <p>I also tried to solve task such as "how many lines were removed, added or just changed in selected period of time". So I wrote simple shell script (for Linux only).
It gathers some sipmle statistics about code modifications.
More details and shared script you may find here:</p>
<p><a href="http://cyber-fall.blogspo... | 37,553 |
<p>Is it possible to save an integer array using NSUserDefaults on the iPhone? I have an array declared in my .h file as: <code>int playfield[9][11]</code> that gets filled with integers from a file and determines the layout of a game playfield. I want to be able to have several save slots where users can save their ... | <p>You can save and retrieve the array with a NSData wrapper</p>
<p>ie (w/o error handling)</p>
<p>Save</p>
<pre><code>NSData *data = [NSData dataWithBytes:&playfield length:sizeof(playfield)];
[prefs setObject:data forKey:@"slot1Save"];
</code></pre>
<p>Load</p>
<pre><code>NSData *data = [prefs objectForKey:... | <p>Just use NSArray instead of normal C array then it will solve your problem easily.</p>
| 45,669 |
<p>Has anybody found a good solution for lazily-evaluated lists in Perl? I've tried a number of ways to turn something like </p>
<pre><code>for my $item ( map { ... } @list ) {
}
</code></pre>
<p>into a lazy evaluation--by tie-ing @list, for example. I'm trying to avoid breaking down and writing a source filter to ... | <p>As mentioned previously, for(each) is an eager loop, so it wants to evaluate the entire list before starting.</p>
<p>For simplicity, I would recommend using an iterator object or closure rather than trying to have a lazily evaluated array. While you <em>can</em> use a tie to have a lazily evaluated infinite list, ... | <p>If I remember correctly, for/foreach do get the whole list first anyways, so a lazily evaluated list would be read completely and then it would start to iterate through the elements. Therefore, I think there's no other way than using a while loop. But I may be wrong.</p>
<p>The advantage of a while loop is that you... | 13,514 |
<p>Is there any way to install Setuptools for Python 2.6 in Windows without having an exe installer? </p>
<p>There isn't one built at the moment, and the maintainer of Setuptools has stated that it will probably be a while before he'll get to it. </p>
<p>Does anyone know of a way to install it anyway?</p>
| <p>First Option - Online Installation (i.e. remaining connected to the Internet during the entire installation process):</p>
<ol>
<li>Download <a href="https://pypi.org/project/setuptools/0.6c9/" rel="nofollow noreferrer">setuptools-0.6c9.tar.gz</a></li>
<li>Use <a href="http://www.7-zip.org/" rel="nofollow noreferrer... | <p><a href="http://activestate.com/activepython" rel="nofollow noreferrer">ActivePython</a> already includes setuptools (<a href="http://python-distribute.org/" rel="nofollow noreferrer">Distribute</a> actually), along with pip and virtualenv. </p>
| 39,861 |
<p>I'm trying to work out if I have an open relay on my server. How do I do that?</p>
<p>I've tried <a href="http://www.abuse.net/relay.html" rel="nofollow noreferrer">http://www.abuse.net/relay.html</a></p>
<p>and it reports:</p>
<p>Hmmn, at first glance, host appeared to accept a message for relay.
THIS MAY OR MAY... | <p>Eh? As your link tells you, register for the site and it will give you an address @abuse.net, valid for 24 hours. Enter that address into the testing form. If your abuse.net account receives the test email, you have an open relay.</p>
| <p>This depends on your MTA and how you've configured it. Ultimately there is only one thing you must do to prevent relaying. Restrict relaying to authenticated users and/or restrict relaying to specific IPs. I prefer to restrict all IPs except localhost on my mail server and require authentication from everyone else.<... | 8,557 |
<p>Our policy when delivering a new version is to create a branch in our VCS and handle it to our QA team. When the latter gives the green light, we tag and release our product. The branch is kept to receive (only) bug fixes so that we can create technical releases. Those bug fixes are subsequently merged on the trun... | <p>This is a real practical problem. It gets worse if you have several versions you need to support and have branched for each. Even worse still if you have a genuine R&D branch too.</p>
<p>My preference was to allow the main trunk to proceed at its normal rate and not to hold on because in an environment where ... | <p>Where I work, we keep with the refactoring in the main branch. If the merges get tricky, they just have to be dealt with on an ad-hoc basis, they're all do-able, but occasionally take a bit of time.</p>
| 24,502 |
<p>I'm trying to find out how to read/write to the extended file properties in C#
e.g. Comment, Bit Rate, Date Accessed, Category etc that you can see in Windows explorer.
Any ideas how to do this?
EDIT: I'll mainly be reading/writing to video files (AVI/DIVX/...)</p>
| <p>For those of not crazy about VB, here it is in c#:</p>
<p>Note, you have to add a reference to <em>Microsoft Shell Controls and Automation</em> from the COM tab of the References dialog.</p>
<pre><code>public static void Main(string[] args)
{
List<string> arrHeaders = new List<string>();
Shell... | <p>I'm not sure what types of files you are trying to write the properties for but <a href="http://github.com/mono/taglib-sharp" rel="nofollow noreferrer">taglib-sharp</a> is an excellent open source tagging library that wraps up all this functionality nicely. It has a lot of built in support for most of the popular m... | 27,093 |
<p>What are all the possible ways in which we can get memory leaks in .NET?</p>
<p>I know of two:</p>
<ol>
<li>Not properly un-registering <a href="http://diditwith.net/PermaLink,guid,fcf59145-3973-468a-ae66-aaa8df9161c7.aspx" rel="nofollow noreferrer">Event Handlers/Delegates</a>.</li>
<li>Not disposing dynamic chil... | <p>There's no way to provide a comprehensive list... this is very much like asking "How can you get wet?"</p>
<p>That said, make sure you're calling Dispose() on everything that implements IDisposable, and make sure you implement IDisposable on any types that consume unmanaged resources of any kind.</p>
<p>Every now ... | <p>A lot of the things that can cause memory leaks in unmanaged languages can still cause memory leaks in managed languages. For example, <a href="http://blogs.msdn.com/oldnewthing/archive/2006/05/02/588350.aspx" rel="nofollow noreferrer">bad caching policies</a> can result in memory leaks.</p>
<p>But as Greg and Dan... | 4,075 |
<p>I wonder, why the hell... did the VS team consider that NOT finding a project reference as a non crucial thing?</p>
<p>The referenced component 'X' could not be found. should be considered an error... and nothing else.</p>
<p><strong>Is there a way (without turning 'Treat all warnings as errors' on) to get this wa... | <p>That warning comes from the project system, not the compiler. The project system doesn't know whether or not the reference will actually be needed when the code is compiled. I've run into several cases (all involving multiple platforms and conditional compilation) where this features allows you to maintain a singl... | <p>This warning does my head in.</p>
<p>I have a project with six configurations - each configuration uses a different version of a particular referenced DLL, and so the references are conditional (by hacking the project file, as I cannot find a way to do it through the VS GUI).</p>
<p>The five references that are no... | 20,148 |
<p>The organization I currently work for an organization that is moving into the whole CMMI world of documenting everything. I was assigned (along with one other individual) the title of Configuration Manager. Congratulations to me right. </p>
<p>Part of the duties is to perform on a regular basis (they are still defi... | <p>You could compute a SHA1 hash of the source files on the production server, and compare that hash value to the versions stored in source control. If you can find the same hash in source control, then you know what version is in production. If you <em>can't</em> find the same hash in source control, then there are un... | <p>can't you use your source control for this? if you deploy a version and tag your sourcecontrol with that deployment, you can then verify against the source control system</p>
| 30,394 |
<p>I have two identical tables and need to copy rows from table to another. What is the best way to do that? (I need to programmatically copy just a few rows, I don't need to use the bulk copy utility).</p>
| <p>As long as there are no identity columns you can just </p>
<pre><code>INSERT INTO TableNew
SELECT * FROM TableOld
WHERE [Conditions]
</code></pre>
| <p>To select only few rows..This will work like charm..</p>
<pre><code>SELECT TOP 10 *
INTO db2.dbo.new_table
FROM db1.dbo.old_table;
</code></pre>
<p>Note : Just create a new table in the required db..We need not define its structure.</p>
| 8,137 |
<p>I recently backed a 3D printer on Kickstarter, and I would like to 3D print parts for high-temperature applications. So I have two questions; </p>
<ol>
<li><p>What's the highest temperature polycarbonate can be safely heated to without warping or releasing toxins?</p></li>
<li><p>If there's a filament with better t... | <ul>
<li><p>Polycarbonate is <a href="https://rigid.ink/blogs/news/why-3d-print-with-polycarbonate-how-to-get-best-results" rel="noreferrer">heat-resistant up to ~120C</a>. Above this temperature it will gradually become flexible and may irreversibly bend. It will not generate any toxic fumes all the way up to ignition... | <p>All plastics have two temperatures to consider for operation and evaluation: </p>
<ol>
<li><p>Melting point = the temperature that plastics starts to get soft; this can be considered for maximum temperature operation.</p></li>
<li><p>Flow temperature = normally used for molding process and this have a wide range of... | 749 |
<p>Our company is sending out a lot of emails per day and planning to send even more in future. (thousands) Also there are mass mailouts as well in the ten thousands every now and then.</p>
<p>Anybody has experience with hotmail, yahoo (web.de, gmx.net) and similar webmail companies blocking your emails because "too m... | <p>You want to look at the following:</p>
<ul>
<li>add a bulk-header to your outgoing email (<code>Precedence: bulk</code>)</li>
<li>look into <a href="http://en.wikipedia.org/wiki/Sender_Policy_Framework" rel="noreferrer">SPF</a></li>
<li>look into <a href="http://en.wikipedia.org/wiki/SenderID" rel="noreferrer">Send... | <p>Here is some good advice about the headers for bulk emails, the likes of companies like constant contact use.</p>
<p><a href="http://old.openspf.org/esps.html" rel="nofollow noreferrer">http://old.openspf.org/esps.html</a></p>
<p>To add to the list of good practices least likely to get you blacklisted,</p>
<p>If ... | 19,611 |
<p>I'm creating an email message using CDO object (and VB6, but that doesn't really matter).</p>
<pre class="lang-vb prettyprint-override"><code>With New CDO.Message
.To = "<address>"
.Subject = "Manifest test 8"
.Organization = "<company>"
.From = "<address>"
.Sender = .From
With .Confi... | <p>Ok, that was weird.</p>
<p>We used our gmail accounts to test that thing, more specifically, gmail web interface. We clicked attachments links to save reveived files. And the files were corrupted.</p>
<p>As soon as we instead tried some thick clients, it turned out to be fine. All files get download properly witho... | <p>I have not used CDO in a long time, but i remember having this issue in the past. By trying different things, we figured that if there was any content in the body of the message the attachments were sent properly.</p>
<p>Weird, i know.</p>
<p>try it and let us know.</p>
| 46,889 |
<p>I have a datagridview where the users can select which subset of columns to view.
The problem I am having is that when I change the columns being displayed, the column widths are only being determined by the width of the Header Cells, not the data in it.
I do have each column set to AutoSizeMode = AllCells.</p>
<p... | <p>Hmm... can't say I've seen that myself, but (as a workaround) you could try toggling the resize mode after you change the columns:</p>
<pre><code>dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
</code></pre>
<p>Worth a try...</p>
| <p>The easier option was rather then removing and adding the columns was to add all of the columns and then just selectively hide/show the desired set of columns. Although the other method did work.</p>
| 37,903 |
<p>I'm looking for some suggestions on how to go about this. Any input is appreciated!</p>
<p>Currently, I have an ASP.NET MVC application. On the client, I have a link with an ID of an XPS document. When the user clicks the link, they are taken to a page with details about the document. In addition to this inform... | <p>I think the simplest way would be to provide the document as a link (target="_blank") from the details page. This has several advantages:</p>
<ul>
<li>You don't need to retrieve and stream the entire doc unless the user asks for it. </li>
<li>On my system at least IE is already registered as the default XPS viewer... | <p>There is a Silverlight control capable of displaying XPS documents. See <a href="http://firstfloorsoftware.com/blog/announcement-document-toolkit-for-silverlight/" rel="nofollow noreferrer">http://firstfloorsoftware.com/blog/announcement-document-toolkit-for-silverlight/</a> for more</p>
| 18,651 |
<p>I'm trying to put together a selector in SASS that will operate on the visted, hovered state of a link, but I can't quite seem to get the markup right, can someone enlighten me?
I was writing it like this:</p>
<pre><code> &:visited:hover
attribute: foo
</code></pre>
| <pre><code>a
&:visited:hover
attribute: foo
</code></pre>
<p>Nowadays, this is the only valid form. Indention has to be consistent (2 spaces are recommended) and the colon follows the attribute.</p>
| <p>Perfect for Hover and Before / After:</p>
<pre><code>&:hover {
color:#FFFFFF;
&::before {
color:#FFFFFF;
}
}
</code></pre>
| 14,626 |
<pre><code>>rails -v
Rails 1.2.6
>ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
</code></pre>
<p>When I run a test fixture (that tests a rails model class) like this, it takes 20-30 secs to start executing these tests (show the "Loaded suite..."). What gives?</p>
<pre><code>>ruby test\unit\cat... | <p>When starting any tests, Rails first loads any fixtures you have (in test/fixtures) and recreates the database with them.</p>
<p>20-30 seconds sounds <em>very</em> slow though. Do you have a lot of fixtures that need to be loaded before your tests run, or is your database running slow?</p>
| <p>It seems like Test::Unit is the simplest, but also one of the slowest ways to do unit testing with Ruby. One of alternatives is <a href="http://rubyforge.org/projects/zentest/" rel="nofollow noreferrer">ZenTest</a>.</p>
| 41,854 |
<p>A site I am working on that is built using PHP is sometimes showing a completely blank page.
There are no error messages on the client or on the server.
The same page may display sometimes but not others.
All pages are working fine in IE7, Firefox 3, Safari and Opera.
All pages are XHTML with this meta element:</p>
... | <p>This is a content-type problem from IE.
It does not know how to handle application/xhtml+xml.</p>
<p>Although you write xhtml+xml, IE only knows text+html.
It will be the future before all agents know xhtml+xml</p>
<p>change your meta tag with content type to content="text/html;</p>
| <p>Not sure if this exactly matches your experience. It depends on which specific version of IE (including service packs) is being used.</p>
<p>A known rendering issue with IE6 SP2 & IE7 (both use the same rendering engine) is the existence of orphaned tags in your HTML. This may be an orphaned div or script tag.<... | 33,703 |
<p>OK, deploying ASP.NET MVC seems to be painful. I want to deploy my ASP.NET MVC application on Windows XP (IIS 5.1), but can't seem to find how to do it. When I type the application name into the web browser address bar I get a "website not available" message. </p>
<p>There are workarounds for <a href="https://stack... | <p>Here's what I found out and what worked for <em>me</em>:
<a href="http://itscommonsensestupid.blogspot.com/2008/11/deploy-aspnet-mvc-app-on-windows-xp-iis.html" rel="noreferrer">Deploy ASP.NET MVC App on Windows XP (IIS 5.1)</a></p>
<p><b>Edit:</b></p>
<p>For the latest release of ASP.NET MVC, replace .mvc with a ... | <p>The <em>same</em> process (using Ionic rewriter) which works for 6.0 works for us on 5.x. What do you see in the Windows App Event log? And the IIS server log? Have you tried a rewriter? </p>
| 38,653 |
<p>I'm trying to work through Project Euler and I'm hitting a barrier on problem 03. I have an algorithm that works for smaller numbers, but problem 3 uses a very, very large number.</p>
<p><strong>Problem 03:</strong>
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 60085... | <p>For starters, instead of beginning your search at n / 2, start it at the square root of n. You'll get half of the factors, the other half being their complement.</p>
<p>eg:</p>
<pre><code>n = 27
start at floor(sqrt(27)) = 5
is 5 a factor? no
is 4 a factor? no
is 3 a factor? yes. 27 / 3 = 9. 9 is also a factor.
is ... | <p>Try using the <a href="http://en.wikipedia.org/wiki/Miller-Rabin_primality_test" rel="nofollow noreferrer">Miller-Rabin Primality Test</a> to test for a number being prime. That should speed things up considerably.</p>
| 24,586 |
<p>I haven't ran into the issue yet, but I am sort of expecting it to here soon towards the end of my print. Actually, I am not even sure if it should be something that I should be worried about or not.</p>
<p>Basically I have some overhang on a helmet piece (it's a vent piece) and I see that there is a 90 % degree ove... | <p>That depends on various parameters if an overhang will work or not, material, hotend temperature, speed, cooling, size of the overhang, etc.</p>
| <p>Many parameters will influence success. That overhang, as flat as it is and unsupported, will need to have support-structures enabled to become printable.</p>
| 1,809 |
<p>What is the best way to localise a date format descriptor?</p>
<p>As anyone from a culture which does not use the mm/dd/yyyy format knows, it is annoying to have to enter dates in this format. The .NET framework provides some very good localisation support, so it's trivial to parse dates according to the users cult... | <p>Here is my current method. Any suggestions?</p>
<pre><code>Regex singleMToDoubleRegex = new Regex("(?<!m)m(?!m)");
Regex singleDToDoubleRegex = new Regex("(?<!d)d(?!d)");
CultureInfo currentCulture = CultureInfo.CurrentUICulture;
// If the culture is netural there is no date pattern to use, so use the defaul... | <p><strong>Best option</strong>: I would instead recommend to use a standard date picker.</p>
<p><strong>Alternative</strong>: every time the content of the edit control changes, parse it and display (in a separate control?) the long format of the date (ie: input "03/04/09" display "Your input: March 4, 2009")</p>
| 2,318 |
<p>I'm trying to design a homepage for an MVC site that has two different views, based on if the user is logged in or not.</p>
<p>So image the default (not logged in) view is showing general, nonspecific info. If i'm logged in, the view is showing mostly personal stuff instead.</p>
<p>What's the best practice to hand... | <p>This should be a simple case of returning the appropriate view from your controller.</p>
<pre><code>public ActionResult Index()
If (User.IsLoggedOn)
{
// Do user-specific controller stuff here...
return View("LoggedOnIndex");
}
else
{
// Do anon controller stuff here...... | <p>I'm not sure if you could do </p>
<p><code>User.IsloggedOn</code></p>
<p>in the past, but now I have to say </p>
<p><code>User.Identity.IsAuthenticated</code></p>
<p>if you are using the Built In Web Forms Authentication.</p>
| 35,786 |
<p>I would like to generate a list of differences between 2 instances of the the same object. Object in question:</p>
<pre><code>public class Step
{
[DataMember]
public StepInstanceInfo InstanceInfo { get; set; }
[DataMember]
public Collection<string> AdHocRules { get; set; }
[DataMember]
... | <p>You'll need a separate object, like StepDiff with collections for removed and added items. The easiest way to do something like this is to copy the collections from each of the old and new objects, so that StepDiff has collectionOldStepDocs and collectionNewStepDocs. </p>
<p>Grab the shorter collection and iterate ... | <p>Implementing the IComparable interface in your object may provide you with the functionality you need. This will provide you a custom way to determine differences between objects without resorting to checksums which really won't help you track what the differences are in usable terms. Otherwise, there's no way to ... | 8,075 |
<p>I am printing this piece using a 0.4 mm nozzle. It happens that the piece on the chin does not print properly.</p>
<p>I have already tried the tree mode supports, touching the plate and in all the places but the same thing happens.</p>
<p>I include photos of my configuration in Cura.</p>
<p><a href="https://i.stack.... | <p>I see that you have a minimum support angle of 60 degrees -- that may mean Cura Slicer isn't generating supports for that chin. Try changing this minimum to a lower figure -- 51 degrees or lower. From what I've read, most filaments and settings will allow 60 degrees with PLA, but this is the easy first thing to tr... | <p>You need to zoom in on the layers where the support is being generated and check if there is actually support being generated under that area.</p>
<p>Additionally, I noticed your support generation setting is "Touching build plate only". You should change this setting to 'everywhere' because it could be t... | 1,957 |
<p>I have a client who wants a solution to allow delivery people to text (SMS messaging) in that they have completed a pick up at a particular location. What I'm looking for is Code to read an imbound SMS message or a SMS component if appropiate. This would allow me to create a windows service to read the message and ... | <p>Probably not quite what you're looking for but one approach is to use a gateway like <a href="http://www.itagg.com" rel="nofollow noreferrer">iTagg</a> which provides a number of interfaces for developers to send and receive SMS/MMS etc. Depending on your location, iTagg may be no use but I'm sure there'll be an equ... | <p>Thanks Luke, I am thinking more of a GSM modem which would be connected to the server. I think this would give more control rather than go through a third party, but I take your point and will investigate further.</p>
| 14,064 |
<p>I've hit upon a problem with WSADuplicateSocket, which I'm using to duplicate a socket for use by a different process. It works find when both processes are running under the same Windows user, but fails with error code 10022 (WSAEINVAL) when they are running under different users.</p>
<p>Specifically, the process ... | <ol>
<li>When a key is pressed:
<ol>
<li>Check if there's an existing timer - stop it if there is one</li>
<li>start a timer. </li>
</ol></li>
<li>When the timer expires, call the server method.</li>
</ol>
<pre><code>var searchTimeout;
document.getElementById('searchBox').onkeypress = function () {
if (searchTime... | <p>I don't know much about JavaScript, but you could use a timer (lets say set to 5 seconds) that gets reset on every change event from your input box. If the user stops typing for more than 5 seconds, the timer expires and triggers the submit.</p>
<p>The problem with that approach is that the submit is triggered on e... | 46,959 |
<p>Do you actively manage <a href="http://forums.construx.com/blogs/stevemcc/archive/2007/11/01/technical-debt-2.aspx" rel="noreferrer">technical debt</a> debt on your software development projects and if so, how do you do it?</p>
| <p>One aspect of managing technical debt is in convincing non-technical managers that you need time allocated for refactoring and bug fixing.</p>
<p><a href="https://blog.asmartbear.com/software-quality-mortgage.html" rel="nofollow noreferrer">Here's an article with specific suggestions</a> on how to do that.</p>
| <p>It depends a lot on the product. When I worked in a field where our code had to be outside-audited it was a planned part of our sprint. PM just asked development what area needed refactoring and it was put in the plan. That's not to say you wouldn't fix the code in the area you were working on, but you wouldn't d... | 7,918 |
<p>See the pictures below. I have a severe under extrusion when the printer starts the outer wall, which is resolved by the time it finishes the outer wall. It starts the layer in the same place every time, so it results in this vertical line, on one side of which is fine (where it finishes the layer) and the other sid... | <p>Based on other comments, answers, and question edits so far, in addition to your original question, I believe there are possibly two things going on here: incorrect retraction settings, including a misunderstanding of which settings are relevant and what they do, and issues related to slow acceleration. Both relate ... | <p>try retract before outer wall off.</p>
| 1,425 |
<p>In my C# application I am using the Microsoft Jet OLEDB data provider to read a CSV file. The connection string looks like this:</p>
<pre><code>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Data;Extended Properties="text;HDR=Yes;FMT=Delimited
</code></pre>
<p>I open an ADO.NET OleDbConnection using that connecti... | <p>There's a schema file you can create that would tell ADO.NET how to interpret the CSV - in effect giving it a structure.</p>
<p>Try this: <a href="https://web.archive.org/web/20081009034412/http://www.aspdotnetcodes.com/Importing_CSV_Database_Schema.ini.aspx" rel="nofollow noreferrer">http://www.aspdotnetcodes.com/... | <p>You need to tell the driver to scan all rows to determine the schema. Otherwise if the first few rows are numeric and the rest are alphanumeric, the alphanumeric cells will be blank.</p>
<p>Like <a href="https://stackoverflow.com/a/116111/2350083">Rory</a>, I found that I needed to create a schema.ini file dynamica... | 14,096 |
<p>I'm having some trouble with a generic method I'm writing. It has the following signature;</p>
<pre><code>public static ThingCollection<T> GetThings<T>(...) where T : Thing
</code></pre>
<p>There are several classes; ThingA, ThingB and ThingC that inherit from Thing; and I want to be able to have code... | <p>I don't get what you are trying to do with that code.</p>
<p>If you want to create a Collection of Things where you could add any type of class derived from Thing, ThingCollection should not have a Typename: it's supposed to be a collection for concrete types.</p>
<p>E.g, implementing A ThingCollection this way:<... | <p>If they use a common interface (IThing) you should be able to cast to that.</p>
| 36,440 |
<p>Aloha</p>
<p>I have a VS2008 solution to which I want to add a webservice reference. I enter an url like '<a href="http://192.168.100.87:7001/wsdl/IMySOAPWebService" rel="nofollow noreferrer">http://192.168.100.87:7001/wsdl/IMySOAPWebService</a>'. The Add Web Reference dialog starts looking then throws me this erro... | <p>First of all, you should very seldom use <code>$*</code> and you should almost always use <code>"$@"</code> instead. There are a number of questions here on SO which explain the ins and outs of why.</p>
<p>Second - the <code>env</code> command has two main uses. One is to print the current environment; the other ... | <p>You should carefully read the wikipedia article about <a href="http://en.wikipedia.org/wiki/Shebang_(Unix)" rel="nofollow noreferrer">shebang</a>.</p>
<p>When your system sees the magic number corresponding to the shebang, it does an <code>execve</code> on the given path after the shebang and gives the script itsel... | 45,905 |
<p>I have the following code</p>
<pre><code><html>
<head>
<title>Test</title>
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
}
#Pictures {
position:absolute;
width:591px;
height:214px;
z-index:1;
... | <p>I think a <code>display: block;</code> on your <code>links2</code> class should put the links under the images correctly.</p>
<p>Also, to get the images to line up horizontally, use <code><span></code>s instead of <code><div></code>s inside the 'Pictures' div, and float them left.</p>
<pre><code>#Pictu... | <p>I think a <code>display: block;</code> on your <code>links2</code> class should put the links under the images correctly.</p>
<p>Also, to get the images to line up horizontally, use <code><span></code>s instead of <code><div></code>s inside the 'Pictures' div, and float them left.</p>
<pre><code>#Pictu... | 38,177 |
<p>I would like to use JavaScript to manipulate hidden input fields in a JSF/Facelets page. When the page loads, I need to set a hidden field to the color depth of the client.</p>
<p>From my Facelet:</p>
<pre><code><body onload="setColorDepth(document.getElementById(?????);">
<h:form>
<h:inputHidden... | <p>You'll want to set the ID of the form so you'll know what it is. Then you'll be able to construct the actual element ID.</p>
<pre><code><body onload="setColorDepth(document.getElementById('myForm:colorDepth');">
<h:form id="myForm">
<h:inputHidden value="#{login.colorDepth}" id="colorDepth" />
... | <p>View the generated html source and look at what the jsf named the id attribute of the tag.</p>
<p>You will soon see how the naming convention works. Its usually like FORMNAME:FIELDNAME</p>
| 28,645 |
<p>I have an asp.net mvc application with a route similar to:</p>
<pre><code>routes.MapRoute("Blog",
"{controller}/{action}/{year}/{month}/{day}/{friendlyName}",
new { controller = "Blog", action = "Index", id = "", friendlyName="" },
new { controller = @"[^\.]*",
yea... | <p>I would suggest formatting the Year, Month, and Day as Strings instead.
Think about this: Will you be doing any math on these "integers"? Probably not, so there really is no point for making them integers.
Once you have them as Strings you can force the leading zero format. </p>
| <p>The fact that your parameters are integers has nothing to do with your problem. The route definition you want to be used isn't actually being used, which is why the generated URL is using query string parameters instead of building the structure you want.</p>
<p>Routes are evaluated top-down, so you likely have a m... | 17,627 |
<p>I run windows in a VMWare partition. At times, TSVNCache.exe process starts doing some weird things (Seems like its doing an endless loop of I/O operations). Suddenly my whole VMWare session starts slowing down. My mac heats up badly. In the sense its freaking hot.</p>
<p>My question is what is this TSVNCache proce... | <p>It's what produces the overlaid icons in Explorer that tell you whether files/directories are modified, conflicted etc or not.</p>
<p>There have been several fixes to it recently, make sure you have the latest version of TortoiseSVN. Performance will also improve if you minimize the set of things SVN has to check -... | <p>It's the tortoise SVN icon overlay process, disable icon overlay in tortoise settings for it to go away. If you want to see the icon overlays, (the icons indicating if a file is updated, modified, conflicted, etc in windows explorer) you will have to kill the process when it hangs, and press f5 or restart windows ex... | 18,489 |
<p>in javascript, when I receive a focus event, how can I work out which element has lost focus? I'm trying to avoid having to put an onblur event handler on all elements within my web page. </p>
| <p>@pbrodka: the target/srcElement property would refer to the element with focus for onfocus events</p>
<p>offhand I can't see a way to get this short of onblur, or if the set of objects you care about all have focus methods you could store a reference to that object instead. It's also possible event bubbling could g... | <p>The most simple solution is to write a function that walks all forms and then all elements within the form and installs an onblur handler for each (which will probably call some global function). This handler will get an event and this event will contain the info you seek.</p>
<p>This way, you just have to call thi... | 38,206 |
<p>I have a web service that I created in C# and a test harness that was provided by my client. Unfortunately my web service doesn't seem to be parsing the objects created by the test harness. I believe the problem lies with serializing the soap packet. </p>
<p>Using TCPTrace I was able to get the soap packet passed t... | <p>A somewhat manual process would be to use the <a href="http://code.google.com/p/poster-extension/" rel="nofollow noreferrer">Poster</a> add-in for Firefox. There is also a java utility called <a href="http://sourceforge.net/project/showfiles.php?group_id=136013&package_id=163662&release_id=500134" rel="nofo... | <p>Same as palehorse, use soapUI or directly the specific component for that feature: <a href="http://ws.apache.org/commons/tcpmon/" rel="nofollow noreferrer">TCPMon</a>.</p>
| 4,827 |
<p>I'm processing a huge file with (GNU) <code>awk</code>, (other available tools are: Linux shell tools, some old (>5.0) version of Perl, but can't install modules).</p>
<p>My problem: if some field1, field2, field3 contain X, Y, Z I must search for a file in another directory which contains field4, and field5 on one... | <p>Let me start out by saying that your problem description isn't really that helpful. Next time, please just be more specific: You might be missing out on much better solutions.</p>
<p>So from your description, I understand you have two files which contain whitespace-separated data. In the first file, you want to mat... | <p>This seems to work for some test files I set up matching your examples. Involving perl in this manner (interposed with grep) is probably going to hurt the performance a great deal, though...</p>
<pre><code>## perl code to do some dirty work
for my $line (`grep 'X Y Z' myhugefile`) {
chomp $line;
my ($a, $... | 17,408 |
<p>What is the best way to access a running mono application via the command line (Linux/Unix)? </p>
<p>Example: a mono server application is running and I want to send commands to it using the command line in the lightest/fastest way possible, causing the server to send back a response (e.g. to stdout).</p>
| <p>I would say make a small, simple controller program that takes in your required command line arguments and uses remoting to send the messages to the running daemon.</p>
<p>This would be similar to the tray icon controller program talking to the background service that is prevalent in most Windows service patterns.<... | <p>@Rich B: This is definately a suitable solution, which I already had implemented - however on the server I have to use, the remoting approach takes around 350ms for a single request.</p>
<p>I've measured the time on the server side of the request handling - the request is handled in less than 10ms, so it has to be ... | 14,772 |
<p>I have the following class</p>
<pre>
public class Car
{
public Name {get; set;}
}
</pre>
<p>and I want to bind this programmatically to a text box.</p>
<p>How do I do that?</p>
<p>Shooting in the dark:</p>
<pre>
...
Car car = new Car();
TextEdit editBox = new TextEdit();
editBox.DataBinding.Add("Name", car, ... | <p>You want</p>
<pre><code>editBox.DataBindings.Add("Text", car, "Name");
</code></pre>
<p>The first parameter is the name of the property on the control that you want to be databound, the second is the data source, the third parameter is the property on the data source that you want to bind to.</p>
| <p>The following is generic class that can be used as a property and implements INotifyPropertyChanged used by bound controls to capture changes in the property value. </p>
<pre><code>public class NotifyValue<datatype> : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged = del... | 14,063 |
<p>I am working with a log of events where there are about 60 different "types" of events. Each event shares about 10 properties, and then there are subcategories of events that share various extra properties.</p>
<p>How I work with these events does depend on their type or what categorical interfaces they implement.<... | <p>I would go with the object per event type solution, but I would instead group commonly used combinations of interfaces under (probably abstract) classes providing their <strong>skeletal implementations</strong>. This greatly reduces the code bloat generated by having many interfaces, but, on the other hand, increase... | <p>Merely having a large number of .java files isn't necessarily bad. If you can meaningfully extract a small number (2-4 or so) of Interfaces that represent the contracts of the classes, and then package all of the implementations up, the API you present can be very clean, even with 60 implementations.</p>
<p>I migh... | 17,690 |
<p>I'm looking for a good 3D Mesh library</p>
<ul>
<li>Should be able to read popular formats (OFF, OBJ...)</li>
<li>Should support both half-edge structure and a triangle soup</li>
<li>Should be tolerant to faults and illegal meshes.</li>
<li>Basic geometric operations - intersections, normal calculation, etc'</li>
<... | <p>May I ask why the last point is a requirement?</p>
<p>Libraries written for public consumption are designed to be as generic as possible so that it is usable by the widest possible audience. In C++, this is often best done using templates. It would suck tremendously if found a good library, only to discover it wa... | <p>I don't know if it can be useful for you. There is also another library, which is called the Mangrove TDS Library, freely available at <a href="http://mangrovetds.sourceforge.net" rel="nofollow">http://mangrovetds.sourceforge.net</a> It supports any type of shapes (2d, 3d, any dimension), with any domains (manifold,... | 10,408 |
<p>I was reading a question about the Python <em>global</em> statement ( <a href="https://stackoverflow.com/questions/146359/python-scope">"Python scope"</a> ) and I was remembering about how often I used this statement when I was a Python beginner (I used <em>global</em> a lot) and how, nowadays, years later, I don't ... | <p>I use 'global' in a context such as this:</p>
<pre><code>_cached_result = None
def myComputationallyExpensiveFunction():
global _cached_result
if _cached_result:
return _cached_result
# ... figure out result
_cached_result = result
return result
</code></pre>
<p>I use 'global' because ... | <p>If I can avoid it, no. And, to my knowledge, there is always a way to avoid it. But I'm not stating that it's totally useless either</p>
| 17,647 |
<p>I always have found the open source space interesting but have never actually participated in any projects. I recently had what I thought was a great a idea that was different from other projects I had seen in the area (in case it matters it was a .NET DI framework). </p>
<p>My question is if I have a funky idea sh... | <p>Competition is as important as collaboration in open source. Assuming the licenses are compatible, features and ideas can be cross-pollenating. Everybody wins.</p>
| <p>You may want to consider writing it your own way and turning that process into an article that you could submit to CodeProject. Then if there seems to be interest in the article, add it to SourceForge. I've seen a lot of tools and widgets get a quick audience and coding help that way. One that I use often is XPTa... | 27,716 |
<p>It seems pretty silly to me. What don't I get?</p>
| <p>I've run into cases like this where my app calls a business layer to select a list of values. The business layer then calls through to the Dal to do the data access. In a lot fo these cases, there is no apparent reason for the business layer method that does the pass through, but it does leave room to add business l... | <p>Business logic should be in your BLL. If you end up with "2 liner functions" in your BLL, did you accidentally put that business logic in your DAL or UI?</p>
| 34,384 |
<p>I use NHibernate for my dataacess, and for awhile not I've been using SQLite for local integration tests. I've been using a file, but I thought I would out the :memory: option. When I fire up any of the integration tests, the database seems to be created (NHibernate spits out the table creation sql) but interfacti... | <p>A SQLite memory database only exists as long as the connection to it remains open. To use it in unit tests with NHibernate:<br>
1. Open an ISession at the beginning of your test (maybe in a [SetUp] method).<br>
2. Use the connection from that session in your SchemaExport call.<br>
3. Use that same session in your t... | <p>Just a wild guess, but is the sql output by NHibernate using a command unsupported by sqlite?</p>
<p>Also, What happens if you use a file instead of memory? (System.IO.Path.GetTempFileName() would work i think...)</p>
| 22,950 |
<p>Is there a way to be <strong>sure</strong> that a page is coming from cache on a production server and on the development server as well?</p>
<p>The solution <strong>shouldn't</strong> involve caching middleware because not every project uses them. Though the solution itself might <strong>be</strong> a middleware.<... | <p>We do a lot of component caching and not all of them are updated at the same time. So we set host and timestamp values in a universally included context processor. At the top of each template fragment we stick in:</p>
<pre><code><!-- component_name {{host}} {{timestamp}} -->
</code></pre>
<p>The component_na... | <p>The reason you use caches is to improve performance. Test the performance by running a load test against your server. If the server's performance matches your needs, then you are all set!</p>
| 45,261 |
<p>Ok, this is very weird. I'm trying to do a database migration, and all of a sudden, I'm getting these errors:</p>
<pre>
[C:\source\fe]: rake db:migrate --trace
(in C:/source/fe)
** Invoke db:migrate (first_time)
** Invoke setup (first_time)
** Invoke gems:install (first_time)
** Invoke gems:set_gem_status (first_ti... | <p>Interestingly, the solution here was that i needed to downgrade my rake version. The local version (in my C:\ruby dir) was overriding the one in the source directory, and couldn't be loaded. I had done gem update and updated all my local gems. </p>
<p>The commands were:</p>
<pre><code>gem uninstall rake
gem instal... | <pre><code>rake aborted!
can`'t activate rake
</code></pre>
<p>It is mid-Autumn - perhaps too many leaves have fallen and the rake can't be used. Try using the leaf-blower instead.</p>
<p>Next time, keep up with the raking to prevent this.</p>
| 30,430 |
<p>My goal is to 3D print a 5 liter miniature barrel with a side stand, similar to <a href="http://rads.stackoverflow.com/amzn/click/B009K5DSJG" rel="noreferrer">this wooden one on Amazon</a>. I want it to have a removable top so that a boxed wine bladder may be put inside, and there should be a hole on the top as well... | <p>Your question begins in an inappropriate format for StackExchange, but you've ended it with one more appropriate by asking if Blender would work.</p>
<p>If you are willing to take the time to learn Blender, you are certain to discover that it will do as you require, and much much more. Your referenced model could be... | <p>To the people saying 123design. I can only say I have been a blender user way before 3D printing was a thing and just cant get around learning 123design. It just feels so limited as it only have a few tools. Yes blender might have a hard learning curve but it does pay off in the future as you wont be limited to 3D p... | 366 |
<p>How can i, in a bash script, execute a command when the user stops the script (with ctrl - c)?</p>
<p>Currently, i have this:</p>
<pre><code>afplay file.mp3
while true:
do osascript -e "set volume 10"
end
</code></pre>
<p>But i would like it to execute <code>killall afplay</code> when the user is finished with i... | <p><code>trap 'killall afplay' EXIT</code></p>
| <p>Use <code>trap</code>.</p>
<pre><code>trap "kill $pid" INT TERM EXIT
</code></pre>
<p>Also avoid <code>killall</code> or <code>pkill</code>, since it could kill unrelated processes (for instance, from another instance of your script, or even a different script). Instead, put the player's PID in a variable and kill... | 31,052 |
<p>I have a query that I use for charting in reporting services that looks something like:</p>
<pre>
(SELECT Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta, Iota, Kappa, Lambda, Mu,Nu, Xi from tbl
WHERE
Alpha in (@Alphas) and
Beta in (@Betas) and
Gamma in (@Gammas) and
Delta in (@Deltas) and
Epsilon in (@... | <p>I'm not sure what you really want, but if I understood correctly, you can try something like:</p>
<pre><code>(SELECT a,b,c,d FROM k
WHERE a in (@a) and b in (@b) and c in (@c))
UNION
(SELECT NULL,NULL,NULL,sum(e) FROM k
WHERE a in (@a) and b in (@b) and c in (@c) GROUP BY e)
</code></pre>
<p>NULLs just for being a... | <p>Why don't you just select all the greeks, Xi and Omicron in one select statement and calculate the sum in the host language? That's one potentially costly query instead of two.</p>
| 26,761 |
<p>i.e. I just want them to be permanently accepted all the time.</p>
| <p>No, you cannot. Other people answering this question, please read it more closely. He wasn't asking how to add an exception, or fix a broken certificate. He wanted to TURN OFF THE CHECK COMPLETELY.</p>
<p>The Mozilla people erred on the side of caution by making this impossible. On the one hand it's annoying, b... | <p>I think you need to get the certificate issued by a "root certificate authority" that the browser will know in advance, e.g. Verisign.</p>
<p><a href="http://www.verisign.co.uk/ssl/ssl-information-center/" rel="nofollow noreferrer">http://www.verisign.co.uk/ssl/ssl-information-center/</a></p>
<p>There's other supp... | 34,690 |
<p>I'm wanting to add a class to the body tag without waiting for the DOM to load, but I'm wanting to know if the following approach would be valid. I'm more concerned with validity than whether the browsers support it for now.</p>
<pre><code><body>
$("body").addClass("active");
...
</body>
</code></pr... | <p>The <a href="http://plugins.jquery.com/project/elementReady" rel="nofollow noreferrer">.elementReady() plugin</a> seems to be pretty close to what you're looking for.</p>
<p>It operates by using a <code>setInterval</code> loop, that exits as soon as <code>document.getElementById()</code> returns an element for a gi... | <p>That was VERY helpful.</p>
<p>To put a little real world to the question.</p>
<p>I build with the assumption that JavaScript isn't supported and then override with the JavaScript. The problem is, that when I have to wait for the DOM to load before my overrides kick in the site goes through the flicker stage as it'... | 29,881 |
<p>W3c validator didn't ding me on this, but I was curious if anyone else had an opinion on placing html comments outside of the html tags?</p>
<pre>
...
</body>
</html>
<!-- byee -->
</pre>
<p>I have an application and am outputting some data and want it to be the absolute last thing that is done, ... | <p>I can't see this being a problem - allowable comments are not specified in a DTD (as they're effectively for humans, not computers). Also, the DOM API (<a href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html" rel="noreferrer">http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html</a>) explicitly allows m... | <p>Yes by all means. Any rendering engine (IE, Firefix, Opera, Safari, etc) will ignore any HTML comment tag completely regardless which position.</p>
| 47,755 |
<p>If you are using HAML and SASS in your Rails application, then any templates you define in public/stylesheet/*.sass will be compiled into *.css stylesheets. From your code, you use stylesheet_link_tag to pull in the asset by name without having to worry about the extension. </p>
<p>Many people dislike storing gener... | <p>I always version all stylesheets in "public/stylesheets/sass/*.sass" and set up an exclude filter for compiled ones:</p>
<pre><code>/public/stylesheets/*.css
</code></pre>
| <p>If I can manage it, I like to store all of my styles in SASS templates when I choose HAML/SASS for a project, and I'll remove application.css and scaffold.css. Then I will put SASS in public/stylesheets/sass, and add /public/stylesheets/*.css to .gitignore. </p>
<p>If I have to work with a combination of SASS and C... | 11,151 |
<p>Are there any good recommendations anyone can provide for a good Javascript editor on Windows? </p>
<p>I currently use combinations of FireBug and TextPad but would hate to miss out on the party if there are better options out there. </p>
<p>Thanks.</p>
| <p>I know <a href="https://stackoverflow.com/questions/26897/recommendations-for-javascript-editor-on-windows#26905">jsight</a> already mentioned this, but <a href="http://aptana.com/" rel="nofollow noreferrer"><strong>Aptana Studio</strong></a> really is a great, free editor for JavaScript if you find yourself doing a... | <p><a href="http://editra.org/index.php" rel="nofollow noreferrer">Editra</a> may be worth a look, the code colouring isn't bad, and I believe it has plugins to enable script execution.. Although I have <strong>not</strong> used this myself.</p>
| 4,656 |
<p>If there is a cookie set for a subdomain, metric.foo.com, is there a way for me to delete the metric.foo.com cookie on a request to www.foo.com? The browser (at least Firefox) seems to ignore a Set-Cookie with a domain of metric.foo.com.</p>
| <p>Cookies are only readable by the domain that created them, so if the cookie was created at metric.foo.com, it will have to be deleted under the same domain as it was created. This includes sub-domains.</p>
<p>If you are required to delete a cookie from metric.foo.com, but are currently running a page at www.foo.co... | <p>I had the same problem with subdomains. For some reason getting the cookie first from the request didn't work. Instead I ended up just creating a new cookie with the same cookie name, and expiry date in the past. That worked perfectly:</p>
<pre>
void DeleteSubdomainCookie(HttpResponse response, string name)
{
H... | 14,277 |
<p>Any idea on how to unit test the views in ASP.NET MVC?</p>
<p>I am sick of encountering the yellow screen of death when I launch my MVC project just because I forget to update the views when one of the <code>Action</code> methods of my controller changes name.</p>
| <p>You could write integration tests using <a href="http://watin.sourceforge.net/" rel="nofollow noreferrer">Watin</a>, but if you just need a quick check to see if you've any errors in your views, you could also try the solution mentioned in this post: <a href="https://stackoverflow.com/questions/108405/how-can-i-comp... | <p>S. Walther has something that addresses this, but it looks a little cumbersome...
<a href="http://weblogs.asp.net/stephenwalther/archive/2008/07/26/asp-net-mvc-tip-25-unit-test-your-views-without-a-web-server.aspx" rel="nofollow noreferrer">http://stephenwalther.com/archive/2008/07/26/asp-net-mvc-tip-25-unit-test-yo... | 18,297 |
<p>Given a class:</p>
<pre><code>from django.db import models
class Person(models.Model):
name = models.CharField(max_length=20)
</code></pre>
<p>Is it possible, and if so how, to have a QuerySet that filters based on dynamic arguments? For example:</p>
<pre><code> # Instead of:
Person.objects.filter(name__st... | <p>Python's argument expansion may be used to solve this problem:</p>
<pre><code>kwargs = {
'{0}__{1}'.format('name', 'startswith'): 'A',
'{0}__{1}'.format('name', 'endswith'): 'Z'
}
Person.objects.filter(**kwargs)
</code></pre>
<p>This is a very common and useful Python idiom.</p>
| <p>A really complex search forms usually indicates that a simpler model is trying to dig it's way out.</p>
<p>How, exactly, do you expect to get the values for the column name and operation?
Where do you get the values of <code>'name'</code> an <code>'startswith'</code>?</p>
<pre><code> filter_by = '%s__%s' % ('name'... | 40,043 |
<p>In Object Oriented Paradigm, I would create an object/conceptual model before I start implementing it using OO language.</p>
<p>Is there anything parallel to object model in functional programming. Is it called functional model? or we create the same conceptual model in both the paradigm before implementing it in o... | <p>In fact there is. There is a form of specification for functional languages based on Abstract Data Types called algebraic specification. Their behavior is very similar to that of objects in some ways, however the constructs are logical and mathematical, and are immutable like functional constructs.</p>
<p>A particu... | <p>A flowchart and/or process model/diagram can be used as a functional model for non OO programs. But it still doesn't give the sense of boundaries similar to that of the OO model.</p>
<p><a href="http://en.wikipedia.org/wiki/Functional_model" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Functional_model</a... | 36,650 |
<p>I wanted to write a GUI-wrapper for an application which uses XML-RPC and wondered if there are any XML-RPC frameworks available for Cocoa and if so what's the best?</p>
<p>Thanks in advance</p>
| <p>Thank you very much for your answers.</p>
<p>Yesterday I did an extensive Google session on this topic and came up with some dedicated XML-RPC frameworks for Cocoa.</p>
<ol>
<li>"The Cocoa XML-RPC Framework" from Eric Czarny which can be found at <a href="http://github.com/eczarny/xmlrpc/tree/master" rel="norefer... | <p>I believe there is a web services framework present since very early versions of MacOS X. I heard about it on <A HREF="http://www.mac-developer-network.com/podcasts/latenightcocoa/episode3/index.html" rel="nofollow noreferrer">Late Night Cocoa podcast #3</A>, which is about SOAP, XML-RPC, and REST for Cocoa. I have ... | 26,889 |
<p>I have always used the agile <a href="http://en.wikipedia.org/wiki/Feature_Driven_Development" rel="nofollow noreferrer">Feature Driven Development</a> process for developing software. What does everyone else use, and why do you prefer it? I prefer FDD because that's what I started with fresh out of college. In c... | <p>At work we use the ICONIX process.
It is a subset of AGILE techniques and it is behavioural requirements driven. The ICONIX process aims to be as low-celebration as possible having as little documentation as possible - in order to allow you to easily keep it up-to-date (this is a big difference from other AGILE pro... | <p>Test Driven Design TDD</p>
<p>The confidence you get from knowing that a code change has not broken something subtle is great</p>
| 14,819 |
<p>I am using a textbox in a .NET 2 winforms app that is setup with a custom AutoCompleteSource. Is there anyway through code that I can increase the width of the list that appears containing the auto complete suggestions? </p>
<p>Ideally I would like to do this without increasing the width of the textbox as I am sh... | <p>Not that I know of, but you can auto-size the Textbox so that it is only wide when it needs to be, rather than always as wide as the longest text.</p>
<p>Example from <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3311429&SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowP... | <p>Hmmm, there's no direct way really. You'd probably have to resort to subclassing (in the Windows API sense) the TextBox to do that, and even then there'd be a lot of guessing to do.</p>
| 19,601 |
<p>I would like to make my application somewhat REST compliant. I am using Rails on the backend and <a href="https://developers.google.com/web-toolkit/" rel="noreferrer">GWT</a> on the frontend. I would like to do updates and deletes. I realize I can do something like mydomain.com/:id/delete (GET) and accomplish the... | <p>Rails does this with hidden attributes. The easiest way to figure this out would be to create a new rails application, generate a scaffold and have a look at the HTML in a browser.</p>
<p>Try this:</p>
<pre><code>rails jp
cd jp
./script/generate scaffold RequestBuilder name:string
rake db:migrate
./script/server
... | <p>Like @skrat said, the <code>_method=PUT</code> workaround doesn't work for any kind of body where <code>Content-Type</code> is not <code>x-www-form-urlencoded</code>, e.g. XML or JSON. Luckily, there is a header workaround as well:</p>
<p><a href="https://zcox.wordpress.com/2009/06/17/override-the-http-request-meth... | 36,385 |
<p>I've been slowly working my way through the list of Project Euler problems, and I've come to one that I know how to solve, but it seems like I can't (given the way my solution was written).</p>
<p>I am using Common Lisp to do this with and my script has been running for over 24 hours (well over their one minute goa... | <p>Here's a solution, keeping in mind the spirit of [Project] Euler. [Warning: <strong>spoiler</strong>. I've tried to keep the hints slow, so that you can read only part of the answer and think on your own if you want. :)]</p>
<p>When you are confronted with a problem having to do with numbers, one good strategy (as ... | <p>I think you can attack this problem with something like a prime sieve. That's only my first impression though. </p>
| 43,587 |
<p>I am trying to call php-cgi.exe from a .NET program. I use RedirectStandardOutput to get the output back as a stream but the whole thing is very slow.</p>
<p>Do you have any idea on how I can make that faster? Any other technique?</p>
<pre><code> Dim oCGI As ProcessStartInfo = New ProcessStartInfo()
oCGI.Wo... | <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.outputdatareceived.aspx" rel="noreferrer">OutputDataReceived event</a> to receive data as it's pumped to StdOut.</p>
| <p>The problem is due a bad php.ini config. I had the same problem and i downloaded the Windows installer from: <a href="http://windows.php.net/download/" rel="nofollow">http://windows.php.net/download/</a>.</p>
<p>After that and commenting out not needed extensions, the conversion process is alà Speedy Gonzales, conv... | 19,911 |
<p>Given that Chrome and Safari use webkit has anyone yet found anything that renders differently on Chrome than Safari? Is there any reason at the moment to test sites on both, or would testing Safari be sufficient for right now?</p>
| <p>Part of this is knowing what is dependent on the rendering engine and what isn't. Javascript, for example, is handled differently in both browsers (google has their own custom javascript renderer), so if your page uses javascript substantially I'd test it in both. </p>
<p>This is probably a good place to note that ... | <p>They still have different JavaScript engines, which might behave differently (propably only in some rare conditions, however).</p>
| 21,651 |
<p>I haven't worked much with Visual Studio before. I've started a personal project in my spare time and I would like to use test-driven development since it has been a huge benefit to me in my Java development. I started this project quite a while ago, and I used CppUnit. I know there are probably other frameworks tha... | <p>Sadly IE6 doesn't so you have to use an expression for IE6, then set the max-height for all other browsers:</p>
<pre><code> div{
_height: expression( this.scrollHeight > 332 ? "333px" : "auto" ); /* sets max-height for IE6 */
max-height: 333px; /* sets max-height value for all standards-compliant b... | <p>I found this from <a href="http://www.tutorialspoint.com/css/css_scrollbars.htm" rel="nofollow">http://www.tutorialspoint.com/css/css_scrollbars.htm</a> and modified a bit. It seems working for both IE9 and FF19</p>
<pre><code><style type="text/css">
.scroll{
display:block;
border: 1px solid red;
... | 38,099 |
<p>I need to set up an instance of SQL Server 2005 with SQL_Latin1_General_CP850_Bin as the server collation (the vendor did not take into accounting looking at DB collation for a bunch of things so stored procedures and temp tables default to the server level and the default collation will not work). During the instal... | <p>I think you're looking at instructions for SQL Server 2008.</p>
<p>See the article <a href="http://msdn.microsoft.com/en-us/library/ms179254(SQL.90).aspx" rel="nofollow noreferrer">here</a> for instructions for 2005.</p>
| <p>If possible, I would uninstall and reinstall rather than trying to change it. Changing it without re-installing is not a simple process. To change from the default during install, just uncheck the "Hide advanced configuration options" check box on the Registration Information screen; doing that will give you a Colla... | 20,449 |
<p>Assuming I have three tables :
TableA (key, value)
TableB (key, value)
TableC (key, value)</p>
<p>and I want to return a value for all keys. If the key exists in TableC return that value else if the key exists in B return that value else return the value from table A</p>
<p>The best I have come up with so far is</... | <p>OK, using your concrete example as a basis, I came up with a solution different from the others posted (although I think I like your solution better). This was tested on MS SQL Server 2005 - changes may be needed for your SQL dialect.</p>
<p>First, some DDL to set the stage:</p>
<pre><code>CREATE TABLE [dbo].[Stan... | <p>If you have a number of tables that you want data from, then you are going to have to select from them, there is no other way around it.</p>
<p>From your SQL, it seems that you could get restuls from tableC that contains keys in tableA and tableB, as you are UNION-ing the restuls of a simple select on tableC (of wh... | 22,435 |
<p>Lately I had to change some code on older systems where not all of the code has unit tests.<br>
Before making the changes I want to write tests, but each class created a lot of dependencies and other anti-patterns which made testing quite hard.<br>
Obviously, I wanted to refactor the code to make it easier to test, ... | <p>First of all, <a href="http://devver.net/blog/2008/07/tips-for-unit-testing/" rel="noreferrer">here's a great article with tips on unit testing</a>. Secondly, I found a great way to avoid making tons of changes in old code is to just refactor it a little until you can test it. One easy way to do this is to make pr... | <p>I am not sure why would you say that unit tests are going be removed once refactoring is completed. Actually your unit-test suite should run after main build (you can create a separate "tests" build, that just runs the unit tests after the main product is built). Then you will immediately see if changes in one piece... | 2,894 |
<p>I had a problem with my nozzle on my homemade printer. The problem was that the nozzle with a 0.4 mm diameter wasn't putting out any plastic. I replaced the nozzle with a 0.2 mm one and now the bottom of my model is looking like this: <a href="https://i.stack.imgur.com/UFSHV.jpg" rel="nofollow noreferrer"><img src="... | <p>Without more detail is difficult to say with certainty what the <em>root</em> cause of the problem is, but it looks like <strong>too much material is being deposited on the bed</strong>.</p>
<p>A few things to try/check:</p>
<ul>
<li><strong>Make sure the nozzle is not leaking</strong>. If it is, you should see f... | <p>Without more detail is difficult to say with certainty what the <em>root</em> cause of the problem is, but it looks like <strong>too much material is being deposited on the bed</strong>.</p>
<p>A few things to try/check:</p>
<ul>
<li><strong>Make sure the nozzle is not leaking</strong>. If it is, you should see f... | 820 |
<p>I was browsing Scott Hanselman's <a href="http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx" rel="noreferrer">Developer Interview question list</a>, and ran across this question:</p>
<blockquote>
<p>What is wrong with
DateTime.Parse(myString)?</p>
</blockquote>
<p>Wh... | <p>In addition the locale problem, <code>DateTime.Parse()</code> could also throw an exception which you would then have to catch. Use <code>DateTime.TryParse()</code> or <code>DateTime.TryParseExact()</code> instead.</p>
| <p>this blog post <a href="http://it.toolbox.com/blogs/parthas/more-net-questions-iii-4433" rel="nofollow noreferrer">explains it</a>, but the general thing is that there's no cultureinfo associated with the parse.</p>
| 19,637 |
<p>I'm making my way into web development and have seen the word <strong><em>postback</em></strong> thrown around. Coming from a non-web based background, <strong>what does a new web developer have to know about postbacks? (i.e. what are they and when do they arise?)</strong> </p>
<p>Any more information you'd like to... | <p>The following is aimed at beginners to ASP.Net... </p>
<h3>When does it happen?</h3>
<p>A postback originates from the client browser. Usually one of the controls on the page will be manipulated by the user (a button clicked or dropdown changed, etc), and this control will initiate a postback. The state of this co... | <p>A post back is anything that cause the page from the client's web browser to be pushed back to the server.</p>
<p>There's alot of info out there, search google for postbacks.</p>
<p>Most of the time, any ASP control will cause a post back (button/link click) but some don't unless you tell them to (checkbox/combobo... | 22,155 |
<p>What's the best .NET PDF editing library available, and why?</p>
<p>It needs to be used on an IIS web-server.
Specifically, I need to edit a PDF which was generated by reporting services.</p>
<p>Factors I'm interested in:</p>
<ol>
<li>Speed</li>
<li>Memory Consumption</li>
<li>Price</li>
<li>Quality of documentat... | <p>Have a look at <a href="http://itextsharp.sourceforge.net/" rel="noreferrer">iTextSharp</a>. iTextSharp is a port of the <a href="http://www.lowagie.com/iText/" rel="noreferrer">iText</a> , a free Java-Pdf library.</p>
<p>To quote iText:</p>
<p>You can use iText to:</p>
<ul>
<li>Serve PDF to a browser</li>
<li>Ge... | <p>Check out <a href="http://www.aspose.com/categories/file-format-components/aspose.pdf-for-.net-and-java/default.aspx" rel="nofollow noreferrer">Aspose.Pdf for .NET</a>. It has a nice API, is well documented and has a light footprint. </p>
| 25,093 |
<p>There are a number of great Javascript libraries\frameworks out there (jQuery, Prototype, MooTools, etc.), but they all seem to focus on DOM interaction and AJAX functionality. I haven't found any that focus on extending the built-in data types (String, Date, Number, etc.). And by "Extending" I mean methods to solve... | <p>For handling dates I find very useful <a href="http://www.datejs.com/" rel="nofollow noreferrer">DateJS</a>.</p>
| <p>For handling dates I find very useful <a href="http://www.datejs.com/" rel="nofollow noreferrer">DateJS</a>.</p>
| 38,133 |
<p>Ok, I have the following structure. Basically a plugin architecture</p>
<pre><code>// assembly 1 - Base Class which contains the contract
public class BaseEntity {
public string MyName() {
// figure out the name of the deriving class
// perhaps via reflection
}
}
// assembly 2 - contains plugins based... | <p>I think you can do it through GetType:</p>
<pre><code>public class BaseEntity {
public string MyName() {
return this.GetType().Name
}
}
</code></pre>
| <p>Try this pattern</p>
<pre><code>class BaseEntity {
private readonly m_name as string;
public Name { get { return m_name; } }
protected BaseEntity(name as string) {
m_name = name;
}
}
class BlueEntity : BaseEntity {
public BlueEntity() : base(typeof(BlueEntity).Name) {}
}
</code></pre>
| 43,910 |
<p>First of all, using gnome is not an option (but it is possible to install its libraries).</p>
<p>I need to know what is necessary to display a Java Swing desktop application using the current installed KDE look and feel of KDE. Ideally, the solution should allow me to apply a look and feel that looks like the under... | <p>You can set the look and feel from the command line:</p>
<p>java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel MyApp</p>
<p>Also, <a href="http://java.sun.com/products/jfc/jws/SwingSet2.jnlp" rel="nofollow noreferrer">SwingSet2.jnlp</a> provides a sample demo of all the different things that can be... | <p>The GTK Laf is, IMHO, broken period. It does <strong>not</strong> honor some random settings. I believe it is not supposed to honor <em>any</em> setBackground(), setForeground(), or setFont() on most components.</p>
<p>If you are using java >1.4.2 I suggest using MetalLookAndFeel [should be UIManager.getCrossPlatfo... | 25,737 |
<p>I am using the ruby daemons gem to create a custom daemon for my rails project. The only problem is that when I try to start the daemons <code>ruby lib/daemons/test_ctl start</code> that it fails and will not start. The log file has this output.</p>
<pre><code># Logfile created on Wed Oct 22 16:14:23 +0000 2008 by... | <p>OK, I actually found the answer to this problem. I require two custom files in the <code>config/environment.rb</code>. I used relative path names and because the daemons are executed in the rails main directory it could not find these two files. after making them absolute path it fixed the problem.</p>
| <p>I just spent 30 minutes trying to solve a similar error when trying to get daemons plugin working: </p>
<pre><code>LoadError: no such file to load -- active_support
</code></pre>
<p>For some reason, it wasn't finding <code>active_support</code> lib, even though it was installed. (Perhaps due to me having frozen ra... | 27,794 |
<p>I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id.</p>
<p>On the Panel:</p>
<pre><code> MyPanel.DefaultButton = SearchBut... | <p>Ends up this resolved my issue:</p>
<pre><code> SearchButton.UseSubmitBehavior = False
</code></pre>
| <p>I might be wrong and this might not make a difference but have you tried:</p>
<pre><code>Me.Page.Form.DefaultButton = SearchButton.ID
</code></pre>
<p>instead of</p>
<pre><code>Me.Page.Form.DefaultButton = SearchButton.UniqueID
</code></pre>
| 2,788 |
<p>The TIBCO EMS user's guide (pg 292) says:</p>
<blockquote>
<p>The backup server <strong>will work indefinitely</strong> to either A) become the
primary server or B) reconnect to the primary server. It also says
<strong>clients may receive fail-over notification</strong> when the switch is successful (see also... | <p>I can at least answer #1 above.</p>
<p>If you have enabled Tibems.SetExceptionOnFTSwitch(true); and have set up an exception handler to capture the messages the server sends to the client, you will see the following:</p>
<p>For single-server, non-fault tolerant connection failures:
"Connection has been terminated"... | <p>We use TEMS (Tibco EMS - a Tibco Product for WCF) So it becomes a custom binding. We tried to break it by doing things like bounce the server to force switch overs and it works really well. make sure you are using version 1.2 not 1.1 because you cannot do anything other then client acknowledgement.</p>
| 29,059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.