instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Before few days I was at some IT conference here in Belgrade. On Agenda was a topic about MySql, and clustering in MySql, and the guys from MySql said that they have the best solution for cluster split brain problem, does anyone know something about this, is this true or just a marketing trick?</p>
| <p>MySQL Cluster requires at least 3 systems which allows it have one of the nodes be an arbitrator for dealing with split brain scenarios. Two of the systems can run data nodes/mysqld nodes and the third needs to run the management node (which is normally the arbitrator by default, however SQL nodes can also operate ... | <p>It is subjective whether or not this is true or not, although I've heard that mysql's cluster support is good. However this concept is definitely supported and in use for other db's such as Slony-I for postgres.</p>
<p>You may get more useful responses if you clarify what aspect of best you mean (i.e. performance, ... | 31,956 |
<p>How can I get a history of uptimes for my debian box? After a reboot, I dont see an option for the uptime command to print a history of uptimes. If it matters, I would like to use these uptimes for graphing a page in php to show my webservers uptime lengths between boots.</p>
<p>Update:
Not sure if it is based on ... | <p>You could create a simple script which runs uptime and dumps it to a file.</p>
<pre><code>uptime >> uptime.log
</code></pre>
<p>Then set up a cron job for it.</p>
| <p>Nagios can make even very beautiful diagrams about this.</p>
| 10,488 |
<p>Previously our SharePoint server was 32-bit and we used the web capture web part to display a bugzilla search results page. Since we've migrated to a 64-bit server the webpart no longer works. We're running the same versions of everything, the only change was moving from a Windows Server 2003 32-bit box to a Windows... | <p>I finally found the answer to my problem. It's origin are within the application code (like 99% of a programmer's 3rd party tools 'bugs'). I decided to post it anyway in case someone is in a similar scenario.</p>
<p>This code was part of WebServiceRequester class. The web service requester class was instanciated wh... | <p>Not strictly an answer to your question, but have you tried it using a sql server based session store? (Search on MSDN for the permanent script rather than the temp script that's provided with asp.net)</p>
<p>I've heard "bad things" about the executable session service, and consequently have not used it. Never had ... | 41,720 |
<p>I have some low level serialization code that is templated, and I need to know the system's endianness at compiletime obviously (because the templates specializes based on the system's endianness). </p>
<p>Right now I have a header with some platform defines, but I'd rather have someway to make assertions about en... | <p>If you're using autoconf, you can use the <code>AC_C_BIGENDIAN</code> macro, which is fairly guaranteed to work (setting the <code>WORDS_BIGENDIAN</code> define by default)</p>
<p>alternately, you could try something like the following (taken from autoconf) to get a test that will probably be optimized away (GCC, a... | <p>This answer is based on the following specs (this is for clarity):</p>
<blockquote>
<p>Language: C++ v17, 64-Bit<br>
Compilers: g++ v8 (The GNU Compiler Collection <a href="https://www.gnu.org/software/gcc/" rel="nofollow noreferrer">https://www.gnu.org/software/gcc/</a>) & MingW 8.1.0 toolchain (<a href=... | 35,416 |
<p>Sharepoint isn't the speediest of server applications, and I've read about a few tips to speed it up. What steps do you think are necessary to increase performance so it can be used to host a high traffic site?</p>
| <p>At the end of the day SharePoint is just a complicated web site with all the standard components. </p>
<p>In order to optimize performance you need to analyze each component and determine which one is a problem, and then adjust it accordingly.</p>
<p>We're in the process of implementing a 1000 concurrent user shar... | <p>In addition to caching and hardware, try to make sure that your masterpages and page layouts are not ghosted in the database (requiring a database call to retrieve).</p>
<p>Do this by ensuring the files get released to the 12 hive in your solution.</p>
| 26,439 |
<p>To test printing in a Visual Basic Project I need to simulate a SLOW printer,
how can I do that?</p>
| <p>Fax modems are pretty slow, and you should be able to find a print-to-fax driver somewhere. But since Windows spools print jobs, your application won't notice that the printer device is slow.</p>
| <p>There's no better simulation than the real thing. I can suggest several models I have personal experience with that would help with your simulation. </p>
| 32,648 |
<p>I keep getting compiler errors when I try to access flashVars in an AS3 class.</p>
<p>Here's a stripped version of the code:</p>
<pre><code>package myPackage {
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
public class myClass {
public function CTrafficHandler(... | <p>I found what the problem was. The class in question wasn't the main class used in the project, but rather a secondary class.</p>
<p>I've moved the code to the main class to get the parameters and after I got them, I sent them to the class constructor function.</p>
| <p>I think you should extend from Sprite, but be sure to initialize it first and maybe put to the stage. Try to enable debugging and see what exactly is null as exception report says.</p>
| 13,478 |
<p>I have some ksh scripts which I'd like to convert to run with bash instead.</p>
<p>Are there any useful on-line resources for this?</p>
<p>I'm really looking for a list of differences between the two shells and any gotchas I might encounter, although all information is welcome :-)</p>
| <p>Have you tried looking at <a href="http://www.faqs.org/faqs/unix-faq/shell/shell-differences/" rel="nofollow noreferrer">this</a> page? It has a useful matrix of features and links to elsewhere.</p>
<p>Also <a href="http://www.faqs.org/faqs/unix-faq/shell/bash/" rel="nofollow noreferrer">this</a> link, search for:<... | <p>Here's a comparison from HP on the differences between shells:</p>
<ul>
<li><a href="https://web.archive.org/web/20100829200456/http://docs.hp.com/en/B2355-90046/ch15s03.html" rel="nofollow noreferrer">https://web.archive.org/web/20100829200456/http://docs.hp.com/en/B2355-90046/ch15s03.html</a></li>
</ul>
<p>Here's ... | 8,089 |
<p>When you create an instance of a class with the <code>new</code> operator, memory gets allocated on the heap. When you create an instance of a struct with the <code>new</code> operator where does the memory get allocated, on the heap or on the stack ?</p>
| <p>Okay, let's see if I can make this any clearer.</p>
<p>Firstly, Ash is right: the question is <em>not</em> about where value type <em>variables</em> are allocated. That's a different question - and one to which the answer isn't just "on the stack". It's more complicated than that (and made even more complicated by ... | <p>Structs get allocated to the stack. Here is a helpful explanation:</p>
<p><a href="http://www.developerfusion.com/article/4341/the-quick-dirty-net-guide-to-cvb-oop/7/" rel="nofollow noreferrer">Structs</a></p>
<blockquote>
<p>Additionally, classes when instantiated within .NET allocate memory on
the heap or .N... | 24,920 |
<p>I am working on a tool where I need to convert string values to their proper object types. E.g. convert a string like <code>"2008-11-20T16:33:21Z"</code> to a <code>DateTime</code> value. Numeric values like <code>"42"</code> and <code>"42.42"</code> must be converted to an <code>Int32</code> value and a <code>Doubl... | <p>In terms of efficiency, yes, TryParse is generally the preferred route.</p>
<p>If you can know (for example, by reflection) the target type in advance - but don't want to have to use a big <code>switch</code> block, you might be interested in using <code>TypeConverter</code> - for example:</p>
<pre><code> D... | <p>Keeping the idea of a converter to skip a switch block, you could use the concept of Duck Typing. Basically, you want to turn a string to X, so you make a method that will call X.TryParse(string, out X x) if X has TryParse on it, otherwise you just don't bother (Or I suppose you could throw an error). How would yo... | 39,327 |
<p>I found the following code to create a tinyurl.com url:</p>
<pre><code>http://tinyurl.com/api-create.php?url=http://myurl.com
</code></pre>
<p>This will automatically create a tinyurl url. Is there a way to do this using code, specifically C# in ASP.NET?</p>
| <p>You should probably add some error checking, etc, but this is probably the easiest way to do it:</p>
<pre><code>System.Uri address = new System.Uri("http://tinyurl.com/api-create.php?url=" + YOUR ADDRESS GOES HERE);
System.Net.WebClient client = new System.Net.WebClient();
string tinyUrl = client.DownloadString(add... | <p>Here my version of the implementation:</p>
<pre><code>static void Main()
{
var tinyUrl = MakeTinyUrl("https://stackoverflow.com/questions/366115/using-tinyurl-com-in-a-net-application-possible");
Console.WriteLine(tinyUrl);
Console.ReadLine();
}
public static string MakeTinyUrl(string url)
{
stri... | 47,790 |
<p>Is there a way to define a column (primary key) as a <a href="https://en.wikipedia.org/wiki/Universally_unique_identifier" rel="noreferrer">UUID</a> in <a href="http://www.sqlalchemy.org/" rel="noreferrer">SQLAlchemy</a> if using <a href="http://www.postgresql.org/" rel="noreferrer">PostgreSQL</a> (Postgres)?</p>
| <p>The sqlalchemy postgres dialect supports UUID columns. This is easy (and the question is specifically postgres) -- I don't understand why the other answers are all so complicated.</p>
<p>Here is an example:</p>
<pre><code>from sqlalchemy.dialects.postgresql import UUID
from flask_sqlalchemy import SQLAlchemy
import... | <p>You could try writing a <a href="http://www.sqlalchemy.org/docs/05/types.html#types_custom" rel="nofollow noreferrer">custom type</a>, for instance:</p>
<pre><code>import sqlalchemy.types as types
class UUID(types.TypeEngine):
def get_col_spec(self):
return "uuid"
def bind_processor(self, dialect)... | 22,125 |
<p>I know there are quite a few line count tools around. Is there something simple that's not a part some other big package that you use ?</p>
| <p><a href="http://www.slickedit.com/index.php?option=com_content&view=article&id=78&Itemid=90" rel="nofollow noreferrer">Slick Edit Gadgets</a> has a nice report breaking it down by lines of code, whitespace and comments. The plug-in is free and relatively small.</p>
| <p>not sure if this works in VS08 ... <a href="http://www.codeproject.com/KB/macros/LineCounterAddin.aspx" rel="nofollow noreferrer">code project</a></p>
| 8,325 |
<p>Just wondering if anyone has any favourite SQL references they to use when creating new queries. Possibly something that shows syntax, or available functions?</p>
| <p>If you're looking for one with just very basic functions you can try this to see if it fits your need.</p>
<p><a href="http://www.sql.su/" rel="noreferrer">http://www.sql.su/</a></p>
<p>You might have to paste the parts that you want into a better printing format as the top of the page has google ads =(</p>
| <p>Also O'Reilly SQL pocket guide for a quick glance. Covers Oracle, DB2, SQL Server and MySQL. For more detailed questions, Date/Darwen: A Guide to the SQL Standard, MySQL Reference Manual ( <a href="http://dev.mysql.com/doc/refman/5.0/en/" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/</a> ). or ju... | 35,289 |
<p>Some rows in the dataset visualizer have an exclamation mark for each column, other rows have the data as expected. I have been unable to track down a description for the exclamation mark or indeed any symbol within the dataset visualizer.</p>
<p>What does the VisualStudio Dataset visualizer exclaimation mark mean?... | <p>If you save the configuration via the IIS Manager (right-click All Tasks -> Save Configuration to a file) this will export all the host header information along with everything else about the website. Then on the new server you can import this configuration to recreate the website.</p>
| <p>You can try the Web Deployment Tool, which can sync settings between IIS servers:
<a href="http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1602" rel="nofollow noreferrer">http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1602</a></p>
<p>You should also be able to export the settings ... | 29,742 |
<p>Is there a definitive list for all of the functions available for a Sharepoint Calculated Field?</p>
| <p>Here you go: </p>
<p><a href="http://office.microsoft.com/en-us/sharepointtechnology/CH011711171033.aspx" rel="noreferrer">http://office.microsoft.com/en-us/sharepointtechnology/CH011711171033.aspx</a></p>
| <p>The closest I've found is: </p>
<p>Math and comparison:
<a href="http://office.microsoft.com/en-us/sharepointtechnology/HA011608661033.aspx?pid=CH011711541033" rel="nofollow noreferrer">http://office.microsoft.com/en-us/sharepointtechnology/HA011608661033.aspx?pid=CH011711541033</a></p>
<p>and </p>
<p>Formulas:
... | 43,503 |
<p>I have a script that checks responses from HTTP servers using the PEAR HTTP classes. However, I've recently found that the script fails on FTP servers (and probably anything that's not HTTP or HTTPS). I tried Google, but didn't see any scripts or code that returned the server status code from servers other than HTTP... | <p>HTTP works slightly differently than FTP though unfortunately. Although both may look the same in your browser, HTTP works off the basis of URI (i.e. to access resource A, you have an identifier which tells you how to access that).</p>
<p>FTP is very old school server driven. Even anonymous FTP is a bit of a hack, ... | <p>Wouldn't it be simpler to use the built-in PHP FTP* functionality than trying to roll your own? If the URI is coming from a source outside your control, you would need to check the protocal definition (http:// or ftp://, etc) in order to determine which functionality to use, but that is fairly trivial. If there is... | 3,021 |
<p>I'm writing a component and would like to insert images from the template folder.</p>
<p>How do you get the correct path to the template folder?</p>
| <p>IIRC, the $mainframe global object is eventually going away. Here is a way to do it through the framework:</p>
<pre><code>$app = JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();
</code></pre>
| <p>I've figured out one method. Use the global $mainframe object.</p>
<pre><code>$templateDir = $mainframe->getBasePath() . "templates/" . $mainframe->getTemplate();
</code></pre>
<p>Is there another (better) way?</p>
| 49,783 |
<p>I'm starting to try and test my Doctrine objects with PHPUnit, and would like to reload the DB from my model objects afresh each time.</p>
<p>My first attempt looks something like this:</p>
<pre><code>class Tests_User extends PHPUnit_Framework_TestCase
{
public function setUp()
{
Doctrine_Manager... | <p>Try setting the DispId attribute of the property to be 0, as described here in the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dispidattribute(VS.71).aspx" rel="nofollow noreferrer">MSDN documentation</a>.</p>
| <p>Thanks to Rob Walker's tip, I got it working by adding the following method and attribute to MyCollection:</p>
<pre><code>[DispId(0)]
public string Item(string key) {
return this[key];
}
</code></pre>
<p>Edit: See <a href="https://stackoverflow.com/a/311946/3195477">this better solution</a> which uses an index... | 38,330 |
<p>I was wondering if there is a clean way to represent an is-a relationship as illustrated by this example:</p>
<p>This DB stores recording times for three types of programs: movies, game shows, drama. In an object oriented sense each of these is-a program. Each of these subclasses have different properties. Here are... | <p>Yes, that should be one table like</p>
<pre><code>Programs:
id,
name,
type_id,
length,
etc...
</code></pre>
<p>with a reference table for the type of program if there are
other bits of data associated with the type:</p>
<pre><code>ProgramType
type_id,
type_name,
etc...
</code></pre>
<p>L... | <p>My first idea was also to use one Program table for movies, shows & drama's. Then add a ProgramType table and use a foreign key to it just like the parent post. </p>
<p>Other columns can be added such as fkDirector, fkMovie. Then add a constraint that when the ProgramType is a movie, fkDirector can not be null ... | 15,810 |
<p>I'm looking for a library/method to parse an html file with more html specific features than generic xml parsing libraries.</p>
| <p><a href="https://html-agility-pack.net" rel="nofollow noreferrer">Html Agility Pack</a></p>
<blockquote>
<p>This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allow... | <p>You could use a HTML DTD, and the generic XML parsing libraries.</p>
| 8,000 |
<p>I know with python and a couple other languages there is a way to safely make install a newer generational version of a language onto a machine, but after digging through PHP5's configure & makefile the only thing I've seen is the prefix dir option and the ini scan path.</p>
<p>Ideally I'd like php5 to have its... | <p>Here's a pretty detailed explanation on how to do this on Gentoo with some tips to watch out for.</p>
<p><a href="http://www.gentoo.org/proj/en/php/php4-php5-configuration.xml" rel="nofollow noreferrer">link text</a></p>
<p>And here's another one for good measure</p>
<p><a href="http://www.howtoforge.com/apache2_... | <p>The cli version should be easy</p>
<pre><code>configure --prefix=/usr/local/php5
make install-cli
</code></pre>
<p>It's not possible to run PHP4 and PHP5 as <strong>module</strong> together in one Apache server.
But is possible to run php version X as module and version Y as cgi.
Its also possible to run both as... | 48,210 |
<p>While I know IronRuby isn't quite ready for the world to use it, I was wondering if anyone here tried it and tested how well it faired against the other Rubies out there in terms of raw performance?</p>
<p>If so, what are the results, and how did you go about measuring the performance (which benchmarks etc)?</p>
<... | <p>According to this article <a href="http://www.iunknown.com/2008/05/ironruby-and-rails.html" rel="nofollow noreferrer">http://www.iunknown.com/2008/05/ironruby-and-rails.html</a>. In may performance was nowhere near where they expected it to be. I heard in <a href="http://altnetpodcast.com/episodes/9-state-of-ironrub... | <p>I have used it and it has worked great for what I have done. However my measuring of performance isn't really scientific, because it was all visual. However I did notice that IronRuby seemed a little more snappier when I compared the two program on equal tasks. I really think this had to do more with the strong a... | 5,913 |
<p>I want to show HTML content inside Flash. Is there some way to do this?
I am talking about full blown HTML (with JavaScript if possible).</p>
| <p><a href="http://www.wdvl.com/Reviews/Graphics/Flash5/external.html" rel="nofollow noreferrer">Here is a decent article</a> on how to accomplish that.</p>
<p><a href="https://stackoverflow.com/questions/22909/is-there-some-way-to-show-html-content-inside-flash#24396">@Flubba</a>: I didn't say "<em>great</em>" articl... | <p>If it is complex HTML and Javascript, one possible way is <a href="http://drumbeatinsight.com/htmlcomponent" rel="nofollow noreferrer">HTMLComponent</a>, a method that uses an iframe over your flash to make it appear like the HTML is in your app. There are a few downsides to this method however - most of them descri... | 4,294 |
<p>What is the sqlalchemy equivalent column type for 'money' and 'OID' column types in Postgres?</p>
| <p>we've never had an "OID" type specifically, though we've supported the concept of an implicit "OID" column on every table through the 0.4 series, primarily for the benefit of postgres. However since user-table defined OID columns are deprecated in Postgres, and we in fact never really used the OID feature that was ... | <p>we've never had an "OID" type specifically, though we've supported the concept of an implicit "OID" column on every table through the 0.4 series, primarily for the benefit of postgres. However since user-table defined OID columns are deprecated in Postgres, and we in fact never really used the OID feature that was ... | 46,881 |
<p>I am using jProfiler to find memory leaks in a Java swing application. I have identified instances of a JFrame which keeps growing in count.</p>
<p>This frame is opened, and then closed.</p>
<p>Using jProfiler, and viewing the Paths to GC Root there is only one reference, 'JNI Global reference'.</p>
<p>What does ... | <p>Wikipedia has a good overview of <a href="http://en.wikipedia.org/wiki/Java_Native_Interface" rel="noreferrer">Java Native Interface</a>, essentially it allows communication between Java and native operating system libraries writen in other languages.</p>
<p>JNI global references are prone to memory leaks, as they ... | <p>I had this exact problem when fixing memory leaks in a JavaFX application. In the end the problem turned out to be that i was running the application in <strong>debug mode</strong> and had several breakpoints in the code. This seems to have caused objects to be 'JNI Global reference' and being kept in memory without... | 13,765 |
<p>I want to use a template engine in a struts application and would like to know if using TILES can be recommended instead of FREEMARKER or VELOCITY.</p>
| <p>I've used tiles before on a project. It was good for templating, however it can't really be compared to velocity or freemarker: with Tiles you use normal JSPs and are limited to the JSP tags youv'e got.</p>
<p>Velocity (and probably Freemarker although I haven't used it before) provide their own tags or expression ... | <p>Or you could use Stripes. MUCH easier than Tiles!</p>
| 21,981 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/358874/how-can-i-use-a-carriage-return-in-a-html-tooltip">How can I use a carriage return in a HTML tooltip?</a> </p>
</blockquote>
<p>I'd like to know if it's possible to force a newline to show in the tooltip... | <p>This should now work with Internet Explorer, Firefox v12+ and Chrome 28+</p>
<pre><code><img src="'../images/foo.gif'"
alt="line 1&#013;line 2" title="line 1&#013;line 2">
</code></pre>
<p>Try a JavaScript tooltip library for a better result, something like <a href="https://github.com/overlib/over... | <p>The jquery <a href="http://tutorialzine.com/2010/07/colortips-jquery-tooltip-plugin/" rel="nofollow">colortip</a> plugin also supports <code><br></code>
tags in the title attribute, you might want to look into that one.</p>
| 30,585 |
<p>I've been working with the Joomla framework and I have noticed that they use a convention to designate private or protected methods (they put an underscore "<code>_</code>" in front of the method name), but they do not explicitly declare any methods <code>public</code>, <code>private</code>, or <code>protected</code... | <p>public, private and protected are PHP5 keywords. unfortunately, PHP4 still has a very high install base (especially amongst shared hosting services).</p>
<p>here's a <a href="http://www.nexen.net/images/stories/phpversion/200807/evolution.milieu.png" rel="noreferrer">pretty pic</a> showing july usage rates (text in... | <p>PHP5 introduced some hefty changes in the object model. Among supporting visibility, there are various other changes. Be sure to check out:</p>
<p><a href="http://www.php.net/manual/en/language.oop.php" rel="nofollow noreferrer">PHP 4 classes and objects</a></p>
<p><a href="http://www.php.net/manual/en/language.... | 23,905 |
<p>I have been thinking about design by contract lately and I was wondering what people think is the best way to assert pre-condition and post-condition of values in .NET?
i.e. validating argument values to a method.</p>
<p>Some people recommend Debug.Assert while others talk about using an if statement plus throwing ... | <p>We'll eventually use Code Contracts when .NET 4.0 ships. However, in our production code right now we have had great success with a "Guard" class along with common way to generate exceptions.</p>
<p>For more details, see <a href="http://www.moserware.com/2008/01/borrowing-ideas-from-3-interesting.html" rel="nofollo... | <p>Spec# is the way to do it, which is a superset of C#. Now you have "<a href="http://research.microsoft.com/en-us/projects/contracts/" rel="nofollow noreferrer">Code Contracts</a>", which is the language-agnostic version of Spec#, so now you can have code contracts in VB.NET, for example. </p>
| 18,795 |
<p>We are trying to populate a domain object from an oracle 10g database. The field in question is defined as a string in the domain object with the following constraints.</p>
<p>zdata(blank:false,maxSize:3000000)</p>
<p>The size of the data is approximately 70K of XML.</p>
<p>The table definition looks like this:<... | <p>This is a known limitation of the oracle jdbc driver as listed in the release notes for version 10.2.0.1.0. </p>
<p>This known limitation has been fixed according to the release notes of Oracle JDBC Driver release 11.1.0.7.0</p>
| <p>Why do you use a long field in Oracle? Long is very obsolete, you should use a clob. </p>
| 44,282 |
<p>Is it possible to see the return value of a method after the line has been run and before the instruction pointer returns to the calling function?</p>
<p>I am debugging code I can't modify <em>(read: don't want to re-compile a third party library)</em>, and sometimes it jumps to code I don't have source to or the r... | <p>This feature was added to Eclipse version 4.7 M2 under <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=40912" rel="noreferrer">Eclipse bug 40912</a>.</p>
<p>To use it:</p>
<ul>
<li>step over the <code>return</code> statement (using "Step Over" or "Step Return")</li>
<li>now the first line in the variable vi... | <p>Tough one. My experience, outside of Eclipse, is that if you might need to see the return value, it is best to assign it to a local variable in the function so that the return statement is a simple <code>return varname;</code> and not <code>return(some * expression || other);</code>. However, that's not dreadfully... | 26,687 |
<p>I'm writing a simple templating layer in PHP but I've got myself a little stuck. Here's how it works at the moment:</p>
<p>Firstly I use <code>fetch_template</code> to load the template contents from the database - this works (and I collect all the templates at startup if you're interested).</p>
<p>I use PHP varia... | <p>Rather than run through your loop you can use <code>include($template_name)</code>.</p>
<p>Or, if you want the content of the output from the template, you can do something like this:</p>
<pre><code>$template_name = 'template.php';
// import the contents into this template
ob_start();
include($template_name);
$co... | <p><strong>Create file</strong></p>
<ol>
<li>config.php</li>
<li>index.php</li>
</ol>
<p><strong>Create folder</strong></p>
<ol>
<li>inc</li>
<li>template/default/controller/ main files here home.php, login.php, register.php, contact.php, product.php ...</li>
</ol>
<hr>
<ol>
<li>headet.tpl and footer.tpl include h... | 37,310 |
<p>What do the brackets do in a sql statement?</p>
<p>For example, in the statement: </p>
<pre>insert into table1 ([columnname1], columnname2) values (val1, val2)</pre>
<p>Also, what does it do if the table name is in brackets?</p>
| <p>The [] marks the delimitation of a identifier, so if you have a column whose name contains spaces like Order Qty you need to enclose it with [] like:</p>
<pre><code>select [Order qty] from [Client sales]
</code></pre>
<p>They are also to escape reserved keywords used as identifiers</p>
| <p>They are simply delimiters that allow you to put special characters (like spaces) in the column or table name
e.g. </p>
<pre><code>insert into [Table One] ([Column Name 1], columnname2) values (val1, val2)
</code></pre>
| 18,583 |
<p>I'm planning on doing my next project in c# rather than c++ (using SlimDX).</p>
<p>All of directX uses floats, however System.Math uses doubles. This means constantly converting between floats and doubles.</p>
<p>So ideally I'd like to write all the code using floats, since I'm not getting any added precision conv... | <p>XNA provides several math constants (including 3D specialists, like PI/2 etc.) and some advanced math functions with float precision (though not the trigonometric functions). While that is most likely not an option for you, since XNA is not as slim as SlimDX, it certainly means that System.Math is either actually mi... | <p>Yes, you'll make very significant performance gains by working end-to-end in floats if that is all the precision that is required.</p>
<p>Check out the <a href="http://centerspace.net" rel="nofollow noreferrer">NMath</a> libraries from CenterSpace software. Float, double, and complex types are consistently support... | 24,172 |
<p>SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not "borrow" the session cookie from the parent window.</p>
<p>DETAILS:</p>
<p>I'm working on an ASP.NET website (.NET 2.0). I use FormsAuthentication. It is a requirement to use cookies to handle the session.</p>
<p>On a page I ha... | <p>Correct!</p>
<p>Additionally,you can expose two methods:
BeginEdit - In this method, your mark your IsDirty Flag to True. Meaning you are doing modification. Call this method when you are about to make modifications</p>
<p>CancelEdit - In this method, reset the IsDirty Flag to False. Meaning you have arborted the ... | <p>If you have a set of objects which are being edited then you'll probably need something more than a boolean flag for isDirty(). This problem is not dissimilar to reference counting, i.e. increment a dirty count on edit and decrement on undo. If you are supporting undo I suspect you are going to wind up with some p... | 24,521 |
<p>How do you create an application shortcut (.lnk file) in C# or using the .NET framework?</p>
<p>The result would be a .lnk file to the specified application or URL.</p>
| <p>It's not as simple as I'd have liked, but there is a great class call <a href="http://www.vbaccelerator.com/home/NET/Code/Libraries/Shell_Projects/Creating_and_Modifying_Shortcuts/ShellLink_Code.html" rel="nofollow noreferrer">ShellLink.cs</a> at
<a href="http://www.vbaccelerator.com/home/index.html" rel="nofollow ... | <p>Similar to <a href="https://stackoverflow.com/a/19914018/590790">IllidanS4's answer</a>, using the <a href="https://msdn.microsoft.com/en-us/library/ec0wcxh3(v=vs.84).aspx" rel="nofollow noreferrer">Windows Script Host</a> proved the be the easiest solution for me (tested on Windows 8 64 bit).</p>
<p>However, rathe... | 28,989 |
<p>Is there a clean way of cloning a record in SQL that has an index(auto increment). I want to clone all the fields except the index. I currently have to enumerate every field, and use that in an insert select, and I would rather not explicitly list all of the fields, as they may change over time.</p>
| <p>Not unless you want to get into dynamic SQL. Since you wrote "clean", I'll assume not.</p>
<p><strong>Edit:</strong> Since he asked for a dynamic SQL example, I'll take a stab at it. I'm not connected to any databases at the moment, so this is off the top of my head and will almost certainly need revision. But h... | <p>You could create an insert trigger to do this, however, you would lose the ability to do an insert with an explicit ID. It would, instead, always use the value from the sequence.</p>
| 18,032 |
<p>I'd like to change this:</p>
<pre><code><a href='foo'>
<div> Moo </div>
</a>
</code></pre>
<p>to be standards compliant (you're not supposed to have block elements in inline elements). Wiring javascript to the divs just for navigation seems like a hack and degrades accessibility.. In t... | <p>Why not use a <strong><span></strong> rather than a <strong><div></strong> and set <strong>display:block</strong> on both elements?</p>
<p>Additionally, to answer your latter question: I don't believe adding <strong>display:block;</strong> to your anchor will make it pass validation. The validator check... | <p>If I understand correctly your intentions, you should place, as already mentioned, the div outside the anchor, and, to get the same presentation, make the anchor <code>width:100%;height:100%</code>. Cross Browser milage may vary.
Also, you could dump the div altogether and give the anchor <code>display:block;</code>... | 35,136 |
<p>I'm now in search for a Java Text to Speech (TTS) framework. During my investigations I've found several JSAPI1.0-(partially)-compatible frameworks listed on <a href="http://java.sun.com/products/java-media/speech/reference/codesamples/index.html" rel="noreferrer">JSAPI Implementations page</a>, as well as a pair of... | <p>I've actually had pretty good luck with <a href="http://freetts.sourceforge.net/" rel="noreferrer">FreeTTS</a></p>
| <p>I found little comfortable with <a href="http://mary.dfki.de/" rel="nofollow noreferrer">MarryTTS</a> It has multilanguage and clear voice to understand.</p>
<p>T convert speech to text, the better optiion is <a href="https://cmusphinx.github.io/wiki/download/" rel="nofollow noreferrer">sphinx4-5prealpha</a>.
I gi... | 17,315 |
<p>I'm setting up a new development server and want to install the latest version of SQL Server 2008 Express.</p>
<p>Will our existing sql2005 databases work with 2008 without modification?
If so is there any reason to install both versions on the same server?</p>
| <p>I haven't actually tried migrating a 2005 database to 2008, but generally SQL handles this cleanly and without difficulty. The simplest way to do it would be to make a backup of your database from SQL 2005 and then restore that backup with SQL 2008.</p>
<p>If you want to keep the SQL 2005 copy around and online unt... | <p>The databases should (<em>should!</em>) work unmodified. However, for development it is preferable that you have sql2005 to test your scripts unless you assume all your clients would upgrade to 2008 as well, since 2008 has features that do not exist in SQL Server 2005.</p>
| 17,667 |
<p>In a typical enterprise scenario with in-house development, you might have dev, staging, and production environments. You might use SVN to contain ongoing development work in a trunk, with patches being stored in branches, and your released code going into appropriately named tags. Migrating binaries from one envi... | <p>I assume when you talk about database content you are referring to the actual contents contained in a site a or a list.</p>
<p>Probably the best way to do this is to use the stsadm import and export commands to export and import content from one environment to another. (Don't use backup/restore when going from one... | <p>The best resource I can point you to is Eric's paper:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb428899.aspx" rel="nofollow noreferrer"><a href="http://msdn.microsoft.com/en-us/library/bb428899.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb428899.aspx</a></a></p>
<p>I was... | 14,170 |
<p>An application currently in development has the requirements for using MS Word to perform spell check on certain textareas within the application.</p>
<p>I currently have Office 2007 (which is the Office 12 com objects).</p>
<p>My question is, if I add in the Office 12 objects what will happen on boxes which have ... | <p>We gave up on trying to use a dependency on Word, as both have differing versions installed or no Office installation at all! Instead opting for <a href="http://www.codeproject.com/KB/string/netspell.aspx" rel="nofollow noreferrer">NetSpell</a>.</p>
| <p>I am guessing here, but if it is as you can't use the 2007 PIA (Primary Interop Assembly) with a 2003 installation, you could try accessing the PIA via reflection as I would guess the calls you want won't change between the two, and then it won't matter - you'll use whichever is installed. If you are installing the... | 19,324 |
<p>We have a whole bunch of queries that "search" for clients, customers, etc. You can search by first name, email, etc. We're using LIKE statements in the following manner: </p>
<pre><code>SELECT *
FROM customer
WHERE fname LIKE '%someName%'
</code></pre>
<p>Does full-text indexing help in the scenario? We're usi... | <p>It will depend upon your DBMS. I believe that most systems will not take advantage of the full-text index unless you use the full-text functions. (e.g. <a href="http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html" rel="nofollow noreferrer">MATCH/AGAINST</a> in mySQL or FREETEXT/CONTAINS in MS SQL... | <p>To answer the question specifically for MSSQL, full-text indexing will <strong>NOT</strong> help in your scenario.</p>
<p>In order to improve that query you could do one of the following:</p>
<ol>
<li>Configure a full-text catalog on the column and use the CONTAINS() function.</li>
<li><p>If you were primarily sea... | 8,236 |
<p>I got this error when trying to update an image.
It was a cross-thread update, but I used .Invoke(), so that shouldn't be the problem, should it.</p>
| <p><em>(Answering my own question, for others, and for future reference)</em></p>
<p>I <em>think</em> (not yet entirely sure) that this is because InvokeRequired will always return false if the control has not yet been loaded/shown. I have done a workaround which seems to work for the moment, which is to simple refere... | <p>If the handle doesn't yet exist, you can force it by subclassing the control and calling <code>CreateHandle</code>; however, the bigger question is: why are you doing things with a form that hasn't been loaded? Personally I'd only start such an operation after Load.</p>
| 30,531 |
<p>It seems like every time I try to create a pure CSS layout it takes me much longer than if I'd use a table or two. Getting three columns to be equal lengths with different amounts of data seems to require particular fancy hacks, especially when dealing with cross-browser issues.</p>
<p>My Question:</p>
<p>Who are ... | <p>Since this is stack<strong>overflow</strong>, I'll give you my <em>programmer's answer</em></p>
semantics 101
<p>First take a look at this code and think about what's wrong here...</p>
<pre><code>class car {
int wheels = 4;
string engine;
}
car mybike = new car();
mybike.wheels = 2;
mybike.engine = null;
</... | <p>:: nods at palmsey and Jon Galloway ::</p>
<p>I agree with the maintainability factor. It does take me a bit longer to get my initial layouts done (since I'm still a jedi apprentice in the CSS arts) but doing a complete revamp of a 15 page web site just by updating 1 file is heaven.</p>
| 2,727 |
<p>What is the purpose of annotations in Java? I have this fuzzy idea of them as somewhere in between a comment and actual code. Do they affect the program at run time?</p>
<p>What are their typical usages?</p>
<p>Are they unique to Java? Is there a C++ equivalent?</p>
| <p>Annotations are primarily used by code that is inspecting other code. They are often used for modifying (i.e. decorating or wrapping) existing classes at run-time to change their behavior. Frameworks such as <a href="http://www.junit.org/" rel="noreferrer">JUnit</a> and <a href="http://www.hibernate.org/" rel="noref... | <p><a href="https://stackoverflow.com/questions/94361/when-do-you-use-javas-override-annotation-and-why">When do you use Java's @Override annotation and why?</a>
The link refers to a question on when one should use the override annotation(@override)..
This might help understand the concept of annotation better.Chec... | 4,396 |
<p>I'm trying to construct a query that will include a column indicating whether or not a user has downloaded a document. I have a table called HasDownloaded with the following columns: id, documentID, memberID. Finding out whether a user has downloaded a <em>specific</em> document is easy; but I need to generate a que... | <p>Move the condition in the WHERE clause to the join condition.</p>
<pre><code>SELECT Documents.name, HasDownloaded.id FROM Documents
LEFT JOIN HasDownloaded ON HasDownloaded.documentID = Documents.id
AND HasDownloaded.memberID = @memberID
</code></pre>
<p>This is necessary whenever you want to refer to a left j... | <pre><code>WHERE HasDownloaded.memberId IS NULL OR HasDownloaded.memberId = @memberId
</code></pre>
<p>would be the normal way to do that. Some would shorten it to:</p>
<pre><code>WHERE COALESCE(HasDownloaded.memberId, @memberId) = @memberId
</code></pre>
<p>You can, as Matt B. shows, do it in your JOIN condition - ... | 26,957 |
<p>I'm using version 3.3.2, I know that regular Eclipse for Java does variable highlighting.
Notepad++ does it regardless of what language you're using (if you select any text, it highlights similar text)</p>
<p>I know it's not critically important, and a back/forward incremental search is an adequate workaround, but ... | <p>You can download new PDT 2.0 All-in-one together with Eclipse 3.4 - this feature as "mark occurences" is here an there is some new features. I use it now and found it stable.</p>
<p><a href="http://www.eclipse.org/pdt/downloads/" rel="nofollow noreferrer">http://www.eclipse.org/pdt/downloads/</a></p>
| <p>I think your question in poorly worded. Syntax highlighting, and highlighting all similar strings are very different. </p>
| 41,788 |
<p>I'm trying to get the label of some network resources mapped as drives. When I use DriveInfo.GetDrives(), local volumes have the VolumeLabel filled parameter as expected, but in network drives it is an empty string. How can I get those labels?</p>
| <p>It is. You're looking for a semi-fluid layout. The quest was was originally the <a href="http://www.alistapart.com/articles/holygrail" rel="noreferrer">holy grail of CSS implementation</a>... But as you can see from that link (they're doing 3 columns, 2 fixed but it's easy to alter), it's a problem long solved =)</p... | <p>I did a quick experiment as well after looking at a number of potential solutions all over the place. What I was trying to do was to have a mix of fluid and fixed rows and columns.</p>
<p>This is what I ended up with:</p>
<p><a href="http://jsbin.com/hapelawake" rel="nofollow">http://jsbin.com/hapelawake</a></p>
| 44,648 |
<p>I've got a "little" problem with Zend Framework Zend_Pdf class. Multibyte characters are stripped from generated pdf files. E.g. when I write aąbcčdeę it becomes abcd with lithuanian letters stripped.</p>
<p>I'm not sure if it's particularly Zend_Pdf problem or php in general. </p>
<p>Source text is encoded in utf... | <p><code>Zend_Pdf</code> supports UTF-8 in version 1.5 of Zend Framework. However, the standard PDF fonts support only the Latin1 character set. This means you can't use <code>Zend_Pdf_Font::FONT_TIMES_BOLD</code> or any other "built-in" font. To use special characters you must load another TTF font that includes ch... | <p>ZF v. 1.6, TIMES_BOLD (as I understand thats the only way to make text bold?)</p>
| 20,907 |
<p>I've had my printer for almost a year now.</p>
<p>Is there something I should be doing to maintain the motors?</p>
| <p>The stepper motor itself does not. You may want to inspect the motors for debris or dust.</p>
<p>Depending on your configuration you may want to check on parts of your printer that connect to your stepper motor such as shaft couplings, pulleys, lead screws/threaded rods and belts. The stepper motor wires should o... | <p>No, stepper motors do not require maintenance. They are a brushless kind of motor, so they do not have brushes that need to be replaced.</p>
| 113 |
<p>I have noticed that my particular instance of Trac is not running quickly and has big lags. This is at the very onset of a project, so not much is in Trac (except for plugins and code loaded into SVN).</p>
<p><strong>Setup Info:</strong> This is via a SELinux system hosted by WebFaction. It is behind Apache, and ... | <p>It's hard to say without knowing more about your setup, but one easy win is to make sure that Trac is running in something like <code>mod_python</code>, which keeps the Python runtime in memory. Otherwise, every HTTP request will cause Python to run, import all the modules, and then finally handle the request. Using... | <p>Serving the chrome files statically with and expires-header could help too. See the end of <a href="http://bannister.us/weblog/2007/07/23/example-of-configuring-trac-and-subversion-on-ubuntu/" rel="nofollow noreferrer">this page</a>.</p>
| 26,285 |
<p>Given the following code,</p>
<pre><code>Choices choices = new Choices();
choices.Add(new GrammarBuilder(new SemanticResultValue("product", "<product/>")));
GrammarBuilder builder = new GrammarBuilder();
builder.Append(new SemanticResultKey("options", choices.ToGrammarBuilder()));
Grammar grammar = new Gram... | <p>efotinis found a good way using <strong>from_stream</strong> . </p>
<hr>
<p>I've looked into the manual of <code>date_time</code> and found it supports facets:</p>
<pre><code>#include <boost/date_time/gregorian/gregorian.hpp>
#include <iostream>
#include <sstream>
#include <locale>
int ma... | <p>You can use the <strong>from_stream</strong> parser function:</p>
<pre><code>using boost::gregorian::date;
using boost::gregorian::from_stream;
std::wstring ws( L"2008/01/01" );
date d1(from_stream(ws.begin(), ws.end()));
std::cout << d1; // prints "2008-Jan-01"
</code></pre>
| 42,472 |
<p>I'm trying to figure out the best way to determine whether I'm in the last iteration of a loop over a map in order to do something like the following:</p>
<pre><code>for (iter = someMap.begin(); iter != someMap.end(); ++iter) {
bool last_iteration;
// do something for all iterations
if (!last_iteration)... | <p>Canonical? I can't claim that, but I'd suggest </p>
<pre><code>final_iter = someMap.end();
--final_iter;
if (iter != final_iter) ...
</code></pre>
<p><strong>Edited</strong> to correct as suggested by <strong><a href="https://stackoverflow.com/questions/151046/c-last-loop-iteration-stl-map-iterator#151104">KTC</a... | <p>You can just pull an element out of the map prior to iteration, then perform your "last iteration" work out of the loop and then put the element back <em>into</em> the map. This is horribly bad for asynchronous code, but considering how bad the rest of C++ is for concurrency, I don't think it'll be an issue. :-)</... | 18,212 |
<p>What is the best way to maniupulate richtext / *.rtf data in SQL server 2005 / 2008
I have looked at ocx solutions. Maybe creating some CLR stored procs??</p>
<p>The problem is that I have several notes written in richtext that need to be combined for ease of reporting.
Like
SELECT @Notes = @Notes + RTFColumn FROM ... | <p>I think you are probably better off creating a simple application to read the two files, merge the data and save if that is where you are heading. Its sounds like you are expecting the database to do something outside of its store/retrieve job functions...</p>
| <p>I think you are probably better off creating a simple application to read the two files, merge the data and save if that is where you are heading. Its sounds like you are expecting the database to do something outside of its store/retrieve job functions...</p>
| 10,056 |
<p>I'm trying to do some research on flash objects in browsers. For example memory usage etc.
With Adobe Flex Builder 3 im trying to do some profiling on swf files but the problem is that I can only do this on debug swfs. Almost all adds/games/video are release version. Is there a way to some testing on those?</p>
| <p>The best way to use this is with DBMS_SQL.</p>
<p>You create a string that represents your SQL statement. You still use bind variables. It's painful.</p>
<p>It goes something like this (I haven't compiled this, but it should be close) :-</p>
<pre><code>CREATE OR REPLACE FUNCTION find_country( v_name t1.country... | <p>One way would be to build up your query as a string then use <a href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/executeimmediate_statement.htm" rel="nofollow noreferrer">execute immediate</a></p>
| 49,429 |
<p>I'm using <code>IIS 5.1</code> in Windows XP on my development computer. I'm going to set up HTTPS on my company's web server, but I want to try doing it locally before doing it on a production system.</p>
<p>But when I go into the Directory Security tab of my web site's configuration section, the "Secure communica... | <p>I'm having a similar issue. You might be able to do something like this:</p>
<pre><code>SET arithabort arith_overflow off
SET @the_date = CAST(@date_string AS DATETIME)
IF @the_date is NULL
set @the_date = getdate()
SET arithabort arith_overflow on
</code></pre>
<p>However, this doesn't work well in a select.... | <p>Found <a href="http://blog.sqlauthority.com/2007/07/12/sql-server-validate-field-for-date-datatype-using-function-isdate/" rel="nofollow noreferrer">this in the second result</a> in Google when searching for "validate date string sql".</p>
<pre><code>----Invalid date
SELECT ISDATE('30/2/2007')
RETURNS : 0 (Zero)
--... | 3,051 |
<p>Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT?</p>
<p>Bonus question: If given the date/time as a string, how would you first parse it into the (y,m,d,h,m,s) array?</p>
| <p>This is the simplest way to get unix time:</p>
<pre><code>use Time::Local;
timelocal($second,$minute,$hour,$day,$month-1,$year);
</code></pre>
<p>Note the reverse order of the arguments and that January is month 0.
For many more options, see the <a href="https://metacpan.org/pod/DateTime" rel="noreferrer">DateTime... | <p>If you're just looking for a command-line utility (i.e., not something that will get called from other functions), try out this script. It assumes the existence of GNU date (present on pretty much any Linux system):</p>
<pre><code>#! /usr/bin/perl -w
use strict;
$_ = (join ' ', @ARGV);
$_ ||= <STDIN>;
chom... | 12,105 |
<p>so I have a huge collection of PDF files that I need to extract text from.
The files are encrypted, but I know the password for them. I'm looking for a way to automate the process of extracting the text.<br><br>
I can manually open the file in Acrobat professional, remove security by typing in the password, and then... | <p>pdftotext should be able to do that. It comes with the poppler library, and can also be found with xpdf (poppler came from xpdf).</p>
| <p>If you can't find any decent pure programmatic way to do it, an alternative is <a href="http://www.autoitscript.com/autoit3/" rel="nofollow noreferrer">AutoIt</a>.</p>
<p>It is "a freeware BASIC-like scripting language designed for automating the Windows GUI", which can do all that pointing and clicking for you whi... | 28,836 |
<p>I get this error:</p>
<p><code>Can't locate Foo.pm in @INC</code></p>
<p>Is there an easier way to install it than downloading, untarring, making, etc?</p>
| <p><strong>On Unix</strong>:</p>
<p>usually you start <em>cpan</em> in your shell:</p>
<p><code>$ cpan</code></p>
<p>and type</p>
<p><code>install Chocolate::Belgian</code></p>
<p>or in short form:</p>
<p><code>cpan Chocolate::Belgian</code></p>
<p><strong>On Windows</strong>:</p>
<blockquote>
<p>If you're using Active... | <p>On Windows with the ActiveState distribution of Perl, use the <a href="http://docs.activestate.com/activeperl/5.10/faq/ActivePerl-faq2.html#pkg_operations" rel="nofollow noreferrer">ppm</a> command.</p>
| 9,152 |
<p>I'm planning to start using FxCop in one of our ongoing project. But, when i tried it with selecting all available rules, it looks like I have to make lots of changes in my code. Being a "team member" I can't right away start making these changes, like naming convention change etc. anyway i would like to start using... | <p>On our most important code:</p>
<ul>
<li>Treat warnings as errors (level 4)</li>
<li>FxCop must pass 100% (no ignores generally allowed)</li>
<li><a href="http://www.mono-project.com/Gendarme" rel="noreferrer">Gendarme</a> used as a guideline (sometimes it conflicts with FxCop)</li>
</ul>
<p>Believe it or not, FxC... | <p>The design and security rules are a good place to start.</p>
| 17,303 |
<p>I am working on a C++ app which internally has some controller objects that are created and destroyed regularly (using new). It is necessary that these controllers register themselves with another object (let's call it controllerSupervisor), and unregister themselves when they are destructed.</p>
<p>The problem I a... | <p>The order of destruction of automatic variables (that include "normal" local variables that you use in functions) is in the reverse order of their creation. So place the controllerSupervisor at the top.</p>
<p>Order of destruction of globals is also in the reverse of their creation, which in turn depends on the ord... | <p>You could do any of the following according to the circumstances.</p>
<ol>
<li>Use the Observer pattern as suggested by gurin. Basically the supervisor informs the controllers that it is going down...</li>
<li>Have the Supervisor "own" the Controllers and be responsible for their destruction when it goes down.</li>... | 36,683 |
<p>Are there plugins for trac that enable cookie based authentication instead of http authentication, and allow keeping the site private for unknown users?</p>
<p>We want to allow customers outside the office to log in, add and look at the tickets on their projects, but not the projects for our other clients. Non tech... | <p>Taken from its home page:</p>
<p>The <a href="http://trac-hacks.org/wiki/AccountManagerPlugin" rel="noreferrer">Account Manager plugin</a> offers several features for managing user accounts: </p>
<ul>
<li>allow users to register new accounts </li>
<li>login via an HTML form instead of using HTTP authentication </l... | <p>I second antispam on the Account Manager plugin. Also, if your trac needs to be web facing, you may be interested in the auth required plugin. Just be aware that it hasn't been upgraded for 0.11 and I suspect that there are some minor compatibility problems. It does do the job though.</p>
| 29,553 |
<p>We need to validate an user on Microsoft's Active Directory using Delphi 7, what is the best way to do that?</p>
<p>We can have two scenarios: the user inputs its network username and password, where the username may include the domain, and we check on active directory if it is a valid, active user. Or we get the c... | <p>Here's a unit we wrote and use. Simple and gets the job done.</p>
<pre><code>unit ADSI;
interface
uses
SysUtils, Classes, ActiveX, Windows, ComCtrls, ExtCtrls, ActiveDs_TLB,
adshlp, oleserver, Variants;
type
TPassword = record
Expired: boolean;
NeverExpires: boolean;
CannotChange: boolean;
end;... | <p>Google for using ADSI with Delphi, you can find some articles talking about that</p>
<p><a href="http://www.agnisoft.com/white_papers/active_directory.asp" rel="nofollow noreferrer">Active Directory Service Interfaces</a></p>
<p><a href="http://adsi.mvps.org/adsi/Delphi/index.html" rel="nofollow noreferrer">Using ... | 43,764 |
<p>If you started a new Java EE project today which is to be finished in about a year, which application server would you choose and why?</p>
<p>Part of your answer should include your arguments for your decision. And also how much experience you have with the Java EE server you choose and with the other available ser... | <p>I have used WebLogic, WebSphere, JBoss, GlassFish, Resin, Jetty, Tomcat, and a few others over the last 10+ years. So, if I were considering a new project, I would ask myself a few questions first. One thing that I would not question anymore is that I would flat refuse to use JSPs unless I was tortured until I cri... | <p>An alternative: use no appserver at all.</p>
<p>Check out <a href="http://www.atomikos.com/Publications/J2eeWithoutApplicationServer" rel="nofollow noreferrer"><a href="http://www.atomikos.com/Publications/J2eeWithoutApplicationServer" rel="nofollow noreferrer">http://www.atomikos.com/Publications/J2eeWithoutApplic... | 35,024 |
<p>I can't find a pre-built set of MSVC++ libs for Boost 1.37.0, only the source. I don't understand how their weird build system works... are there any places I can find a download of a visual studio project or something?</p>
| <p>The <a href="http://www.boostpro.com/" rel="nofollow noreferrer">BoostPro Computing</a> folks maintain the Boost installer for Windows but it usually take a few weeks for them to put new versions online. It's not yet up for 1.37.</p>
<p>There's no Visual Studio solution (remember, Boost targets <em>many</em> platf... | <p>Building it isn't difficult.
They have a fairly good expanaltion of the default process here:
<a href="http://www.boost.org/doc/libs/1_37_0/more/getting_started/windows.html#or-build-binaries-from-source" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_37_0/more/getting_started/windows.html#or-build-binari... | 36,937 |
<p>So the question is how to distribute/offload the media files from Wordpress posts across multiple domains. </p>
<p>The reasoning being to overcome this limitation:
"Most browser will only make 2 simultaneous requests to a server, so if you page requires 16 files they will be requested 2 at a time."</p>
<p>In relat... | <p>You just need to edit the URL's to the various media files throughout your WordPress theme.</p>
<p>For example, edit you "header.php" to change the css file to an alternate domain.</p>
<p>Change This:</p>
<pre><code>print("<link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('styleshee... | <p>The question is a bit ambiguous, I'm not sure but maybe if the domains are on the same server you could replace wp-content/uploads by a symlink.</p>
| 23,479 |
<p><a href="https://stackoverflow.com/questions/160930">Another question</a> asked about determining odd/evenness in C, and the idiomatic (x & 1) approach was correctly flagged as broken for <a href="http://en.wikipedia.org/wiki/Signed_number_representations#Ones.27_complement" rel="noreferrer">one's complement-bas... | <p>This all comes down to knowing your roots.<br>
Yes, this is technically an old technique and I would probably do what other people suggested in that question and use the modulo (%) operator to determine odd or even.
But understanding what a 1s complement (or 2s complement) is always a good thing to know. Whether or... | <blockquote>
<p>Is one's complement a real-world issue, or just a historical one?</p>
</blockquote>
<p>Yes, it still used. Its even used in modern Intel processors. From <a href="https://www-ssl.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html" rel="nofollow">Intel® 64 and IA-32 A... | 19,565 |
<p>I'm using a 200x200 mm PCB Mk2B which connects to the MOSFET of the D8 pin on a RAMPS 1.4 shield. I used 12 V power source for heat bed so I connected positive to pin 1 and negative to both pin 2 & 3 of the bed. Heat bed worked properly. But the wires that connects power source to power supply pin on R... | <p>This can be achieved with start G-code adaptations, this requires no software changes. Cura, and most slicers, have the ability to use placeholders (basically variables or maybe better: constants). These placeholders are substituted with the correct value upon slicing.</p>
<p>To sequentially heat the bed and hotend ... | <p>It is a little annoying, what <code>Cura</code> is doing for me is forcing to wait. On start G-code I have:</p>
<pre><code>; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
;*** Start Dual Nozzle/Bed Preheating ***
M140 S60 ; start preheating the bed
M104 S200 T0 ; start preheating hotend
G28 ; home
M190 S60 ; h... | 1,611 |
<p>I am trying to convert this test code to C# and having a problem with the Trim command. Has anyone done anything similiar like this in C# going to use this with a text box for searching the aspx page. </p>
<pre><code>Dim q = From b In db.Blogs _
Where b.BlogContents.Contains(txtSearch.Text.Trim()) ... | <p>What is the issue you are having? And what LINQ provider is this? An in-memory set (LINQ-to-Objects)? Or LINQ-to-SQL? Or LINQ-to-Entities?</p>
<p>I <em>suspect</em> you are getting something about the db LINQ provider not knowing about Trim() - in which case, try doing the trim first:</p>
<pre><code>string s = txt... | <p>not sure what you are asking but the Trim function in c# is the same.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/t97s7bs3.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/t97s7bs3.aspx</a></p>
| 44,941 |
<p>I'm leading a project where we'll be recording metrics data. I'd like to retain the data for years. However, I'd also like to keep the primary table from becoming bloated with data that, while necessary for long term trending, isn't required for short term reporting.</p>
<p>What is the best strategy for handling th... | <p>We use both methods at my work, but slightly different, we keep all sales data in the primary table for 30 days, then at night (part of the nightly jobs) the days sales are rolled up into summaries (n qty of x product sold today ect) in a separate table for reporting reasons, and sales over 30 days are archived into... | <p>Either of those options are excellent, but it really depends on the problem domain. For things like cash balances or statistical data, I think that rolling up records and consolidating them is the best way, you can then move the rolled up records into a parallel archive table, keying them in such a way that you can ... | 4,011 |
<p>We are trying to make a project template, but the documentation on this is spotty or non-existent.</p>
<p>Doing some reverse-engineering on some template files, we have come up with the following. However, it doen't actually work!</p>
<p>First of all, we have figured out that project templates should be installed... | <p>You likely want to use a "FilesToRename" section. The following is from the PyObjC Cocoa Document Based Application template. It works fine.</p>
<pre><code> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">... | <p>Why are you missing those "<<" like symbols? Thats the reason why <code>xcode</code> is not recognizing and replacing template tags..</p>
| 21,247 |
<p>Looking for a way to display a PDF in Flex. I'm sure there are several ways. Looking for the easiest to maintain / integrate / most user friendly. I'm guessing it's possible to display a browser window in the app and render it, but if it goes off of IE / FireFox it's not acceptable for this project.</p>
<p>Thanks..... | <p>This looks like a nice PDF viewer for flex <a href="http://www.devaldi.com/?p=212" rel="nofollow noreferrer">http://www.devaldi.com/?p=212</a></p>
| <p>Oh sweet, this is an air app. I'll go with the HTML view. I can't convert them to SWF because the client will be uploading the files.</p>
| 5,096 |
<p>What is the maximum number of <strong>publishers</strong> one can create on one Database on that same database server itself?</p>
<p>Also, Vice - versa ,</p>
<p>What is the maximum number of <strong>subscribers</strong> one can create on one Database on that same database server itself?</p>
| <p>Why would you have the subscribers on the same database server? Why do you need multiple publishers on one database? Perhaps you should explain the problem you are trying to solve.</p>
<p>You only need one publisher per database. One distribution agent can distribute to many subscribers. The distribution agent is u... | <p>I have not heard of a "logical" limit to publications/subscriptions. Your limitation will either be linked to licensing (some SQL versions have limited rights for publications) or hardware issues, as noted by <a href="https://stackoverflow.com/questions/298704/transactional-replication#298737">@Mitch</a></p>
| 38,246 |
<p>Flat files and relational databases give us a mechanism to serialize structured data. XML is superb for serializing un-structured tree-like data.</p>
<p>But many problems are best represented by graphs. A thermal simulation program will, for instance, work with temperature nodes connected to each others through res... | <p>How do you represent your graph in memory?<br>
Basically you have two (good) options:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Adjacency_list" rel="noreferrer">an adjacency list representation</a></li>
<li><a href="http://en.wikipedia.org/wiki/Adjacency_matrix" rel="noreferrer">an adjacency matrix represe... | <p>On a less academic, more practical note, in <a href="http://cubictest.openqa.org" rel="nofollow noreferrer">CubicTest</a> we use <a href="http://xstream.codehaus.org/" rel="nofollow noreferrer">Xstream</a> (Java) to serialize tests to and from xml. Xstream handles graph-structured object relations, so you might lear... | 7,499 |
<p>After using them a while I can't help but feel that the hoops you're forced to jump through when using anonymous classes are not worth it.</p>
<p>You end up with <code>final</code> all over the place and no matter what the code is more difficult to read than if you'd used a well named inner class.</p>
<p>So what a... | <p>The advantage is that it's an implementation of closures. It's clunky, but it's the best we've got in Java at the moment. In other words, you don't have to create a new class just for the sake of preserving some state which you've already got as a local variable somewhere.</p>
<p>I have <a href="http://csharpindept... | <p>I generally limit anonymous classes to just a few lines. Anything longer than, say 5, make a named class. </p>
| 33,824 |
<p>I'm using CSS Filters to modify images on the fly within the browser. These work perfectly in Internet Explorer, but aren't supported in Firefox.</p>
<p>Does anyone know what the CSS Filter equivalent for these is for Firefox? An answer that would work cross browser (Safari, WebKit, Firefox, etc.) would be preferre... | <p>Please check the <a href="http://www.nihilogic.dk/labs/imagefx/" rel="noreferrer">Nihilogic Javascript Image Effect Library</a>:</p>
<ul>
<li>supports IE and Fx pretty well</li>
<li>has a lot of effects</li>
</ul>
<p>You can find many other effects in the <a href="http://www.netzgesta.de/cvi/" rel="noreferrer">CVI... | <p>Not really, and hopefully there never will be. It's not a web standard CSS feature for the reason that you're using CSS to format the webpage, not the browser itself. The day that other web designers and developers think they should style my browser how they wish and are then do so is the day I stop visiting their... | 18,888 |
<p>I need to know the default port settings for the following services</p>
<ol>
<li>SQL Server</li>
<li>SQL Browser</li>
<li>SQL Reporting services</li>
<li>SQL Analysis services</li>
</ol>
<p>I need to know the port settings for these services for different versions of SQL Server (2000,2005,2008)</p>
<p>Also let me k... | <ol>
<li><p>The default SQL Server port is 1433 but only if it's a default install. Named instances get a random port number.</p></li>
<li><p>The browser service runs on port UDP 1434.</p></li>
<li><p>Reporting services is a web service - so it's port 80, or 443 if it's SSL enabled.</p></li>
<li><p>Analysis services i... | <p>You can use SQL Configuration Manager to set individual IP addresses to use dynamic ports or not (value of 0 = yes, use dynamic port), and to set the TCP port used for each IP.</p>
<p>But be careful: I recommend first mapping out your instances, IPs, and ports, and planning such that no instances or IPs step on eac... | 18,439 |
<p>Is it possible to not have the:</p>
<p>/****Script Date: 10/27/2008 09:05:41 ******/</p>
<p>in the output?</p>
<p>I want to use Diff's so I can see what's changed, having a timestamp makes it difficult!</p>
| <p>Tools|Options|Scripting|Include Descriptive Headers -> false</p>
| <p>The options "Script Descriptive Headers" - set it to false, should do it.</p>
| 29,830 |
<p>How do I use Windows Vista's FOLDERID API in order to retrieve filepaths for "known folders" such as System or Windows? I've seen some APIs but I don't know how to import them properly. And yes, I know this is a very newbie question, but I spent a half hour googling and couldn't find the answer; I'd also appreciate ... | <p>Take a look at <a href="http://pinvoke.net/default.aspx/shell32/SHGetKnownFolderPath.html" rel="noreferrer">PInvoke SHGetKnownFolderPath</a></p>
<p>There's also a managed API:
<a href="http://msdn.microsoft.com/en-us/library/system.environment.getfolderpath.aspx" rel="noreferrer">Environment.GetFolderPath</a>
but i... | <p>This morning I read about Vista Bridge. It may help.</p>
<p>"Many of you don’t know about the Vista Bridge sample library, what can it do or even where you can find it. Let’s start with the basics; i.e. definitions. Vista Bridge is a sample library that contains managed wrappers for a number of Windows Vista APIs ... | 23,554 |
<p>In Oracle, the number of rows returned in an arbitrary query can be limited by filtering on the "virtual" <code>rownum</code> column. Consider the following example, which will return, at most, 10 rows.</p>
<pre>SELECT * FROM all_tables WHERE rownum <= 10</pre>
<p>Is there a simple, generic way to do something ... | <p>Blatantly changing my answer. "Limit 10" works for MySql and others, Ingres uses</p>
<pre><code>Select First 10 * from myTable
</code></pre>
<p><a href="http://docs.ingres.com/sqlref/Selectinteractive" rel="noreferrer">Ref</a></p>
| <p>Hey Craig. I'm sorry, I made a Ninja Edit.
No, Limit 10 does not work, I was mistaken in thinking it was standard SQL supported by everyone. Ingres uses (according to doc) "First" to solve the issue.</p>
| 7,224 |
<p>I have to work on some code that's using generic lists to store a collection of custom objects.</p>
<p>Then it does something like the following to check if a given object's in the collection and do something if so:</p>
<pre><code>List<CustomObject> customObjects;
//fill up the list
List<CustomObject> ... | <p>Well, you seem to have answered it yourself? If you need fast query against a set of data, then a dictionary may be better than a flat list (for largish data sizes, which yours is).</p>
<p>You could, for example, use the object as its own key - </p>
<pre><code>Dictionary<CustomObject,CustomObject> ...
</code... | <p>If you <em>must</em> maintain two separate lists, one of the Set types might be faster (using a Join operation). Some of the available libraries are</p>
<ol>
<li><a href="http://www.codeproject.com/KB/recipes/GenericISet.aspx" rel="nofollow noreferrer">IESI Collections</a></li>
<li><a href="http://www.codeplex.com/... | 48,102 |
<p>We all know that alerts are bad. If you didn't know it read <a href="http://www.codinghorror.com/blog/archives/000114.html" rel="nofollow noreferrer">this</a></p>
<p>Alerts are used to communicate with the user. So if we don't use them what is a good alternative? </p>
<p>I'd like to get a nice list of good alterna... | <p>Here’s the hierarchy for dealing with user errors or warnings, applied to validating user input to a field.</p>
<ol>
<li><p>Remove the element that may result in an error. Do you really need the user’s birth date? Can you get by just as well with something else that won’t require validation, such as option buttons ... | <p>I quite like ASP.NET's validator controls end result (although they are a bitch to actually use). Work in a similar way to what you describe, placing a star next to the input with an optional message or summary of messages displayed on the page rather than the in your face alert way.</p>
<p>I'd always go for keepin... | 31,099 |
<p>Given a controller method like: </p>
<pre><code>def show
@model = Model.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => model }
end
end
</code></pre>
<p>What's the best way to write an integration test that asserts that the return has the expected... | <p>A combination of using the format and assert_select in an integration test works great:</p>
<pre><code>class ProductsTest < ActionController::IntegrationTest
def test_contents_of_xml
get '/index/1.xml'
assert_select 'product name', /widget/
end
end
</code></pre>
<p>For more details check out <a href... | <p>Set the request objects accept header:</p>
<pre><code>@request.accept = 'text/xml' # or 'application/xml' I forget which
</code></pre>
<p>Then you can assert the response body is equal to what you were expecting</p>
<pre><code>assert_equal '<some>xml</some>', @response.body
</code></pre>
| 8,431 |
<p>I want to create a simple http proxy server that does some very basic processing on the http headers (i.e. if header x == y, do z). The server may need to support hundreds of users. I can write the server in C# (pretty easy) or c++ (much harder). However, would a C# version have as good of performance as a C++ ve... | <p>You can use <strong>unsafe</strong> C# code and <strong>pointers</strong> in critical bottleneck points to make it run faster. Those behave much like C++ code and I believe it executes <em>as fast</em>.</p>
<p>But most of the time, C# is JIT-ted to uber-fast already, I don't believe there will be much differences a... | <p>The proxy server you describe would deal mostly with string data and I think its reasonable to implement in C#. In your example,</p>
<pre><code>if header x == y, do z
</code></pre>
<p>the slowest part might actually be doing whatever 'z' is and you'll have to do that work regardless of the language.</p>
| 5,059 |
<p>I have a section on my ASP.net web.config for the Enterprise library logging block. Is it possible to separate the logging configuration into another configuration file? How do I do that?</p>
| <p>set up your tasks as an event stream, and have the event-processing 'engine' report progress. Each event instance can have its own name, progress-reporting blurb/template, etc. if you want to go that far</p>
<p>if this is a pattern that occurs often, it is worth the effort for the infrastructure. When you're done, ... | <p>You could call ReportProgress from inside the doTask methods, that might make it look a little cleaner, instead you would just have:</p>
<pre><code>doTask1();
doTask2();
</code></pre>
<p>The reporting would be handled inside those methods. </p>
<p>You could use AOP, but my brain screams KISS!!(Keep It Simple Stu... | 38,007 |
<p>Scientific or market research questionnaires mainly consist of questions in the following form:</p>
<p><em>INTRO:</em> Indicate how much you agree with the following statements...</p>
<p><em>OPTIONS:</em> very much - rather - so-so - rather not - not at all</p>
<p><em>ITEM</em> 1: I love Coca-Cola</p>
<p>...</p>... | <p>The best way would be to build that simple back-end for non-technical third parties.</p>
<p>Non-technical users would probably have trouble editing an XML file, and how would you check that the file was properly formatted after they edit it? Your software would have to check the input and spit out meaningful error ... | <p>It would be simpler to do it via a backend (is that the right term?) than parsing a config file (essentially what your xml file is) everytime something changed.</p>
| 40,153 |
<p>I have TortoiseSVN set up to use KDiff3 as the conflict resolution tool (I find it shows more information useful to the merge than the built-in TortoiseMerge does).</p>
<p>When I open a file with Tortoise's "Edit Conflicts" command it shows me the three files and I have to select "Merge->Merge Current File" manuall... | <p>Mine is a bit longer:</p>
<pre><code>"C:\Program Files\KDiff3\kdiff3.exe" %base %mine %theirs -o %merged --L1 Base --L2 Mine --L3 Theirs
</code></pre>
| <p>I had the same problem, but could solve it without any command line:
when I clicked "Edit Conflicts" kdiff3 opend up.
After solving the conflict I simply clicked "save" and closed the kdiff3 window.
After the window was closed I switched back to the SVN "resolve confict"- window and clicked resolved.
Then the next... | 23,386 |
<p>Does anyone use Accurev for Source Control Management? We are switching (eventually) from StarTeam to Accurev.</p>
<p>My initial impression is that the GUI tool is severely lacking, however the underlying engine, and the branches as streams concept is incredible.</p>
<p>The biggest difficulty we are facing is asse... | <p>Honestly, I feel like I need to double check to see if I'm using the same tool as these folks that seem to like Accurev. I used Subversion in my previous job and liked it a lot. We never had any issues with it to speak of, and of course the price is right. My biggest problem with Accurev is that it seems they fel... | <p>I've just come across this discussion and thought I would share our experiences with AccuRev.</p>
<p>We have been using the Dimensions SCM from Serena for around 8 years. Two years ago we had a major problem integrating our India based Development team with our UK Dev team. It was clear that we were not going to me... | 3,968 |
<p>I have an L6 phone from motorola, a usb cable to connect it to my computer, and the Tools for Phones software so I can do things like upload my own custom ringtones or download pictures from the phone's camera.</p>
<p>I have some ideas for programs I'd like to run on the phone, and it supports java, but I don't see... | <p>I've never used Morotolla's SDK but from my limited work in JME the real hook in the 3rd party tools are the emulators. Setting up a JME dev environment quickly is something that Sun got surprisingly right. Just get NetBeans with the JME pack and there is a regular emulator right in the IDE, and then you can hook in... | <p>Yeah, the act of asking the question pointed me in the direction of an answer, and I found this:<br>
<a href="https://developer.motorola.com/docstools/motodevstudio/" rel="nofollow noreferrer">https://developer.motorola.com/docstools/motodevstudio/</a><br>
I could still use some pointers from someone of what to expe... | 7,595 |
<p>I have a History Table in SQL Server that basically tracks an item through a process. The item has some fixed fields that don't change throughout the process, but has a few other fields including status and Id which increment as the steps of the process increase.</p>
<p>Basically I want to retrieve the last step fo... | <p>It's kind of hard to make sense of your table design - I think SO ate your delimiters.</p>
<p>The basic way of handling this is to GROUP BY your fixed fields, and select a MAX (or MIN) for some unqiue value (a datetime usually works well). In your case, I <em>think</em> that the GROUP BY would be BatchRef and ItemC... | <p>It's a bit hard to decypher your data the way WMD has formatted it, but you can pull of the sort of trick you need with common table expressions on SQL 2005:</p>
<pre><code>with LastBatches as (
select Batch, max(Id)
from HistoryTable
group by Batch
)
select *
from HistoryTable h
join LastBatches b ... | 4,967 |
<p>What is the best way to write a Safari extension? I've written a couple XUL extensions for Firefox, and now I'd like to write versions of them for Safari. Is there a way that would allow you to add buttons or forms to the browser UI, since this is not possible with an Input manager or Service menu?</p>
| <p>Safari plugin development is non-trivial. The interface is written in Objective-C, and most of it is not even part of WebKit (so you can't see the source), but there's machinery to inspect and patch the object hierarchy of a running application. It requires understanding of Cocoa and Objective-C, but no lower.</p>
... | <p>Also, to note - Apple has stated that InputManagers are being severely limited as of Leopard and will not run in 64-bit applications per Apple <a href="http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSInputManager" rel="nofollow noreferrer">Leopard Release Notes</a>. This is especially interesting consid... | 8,512 |
<p>INotifyPropertyChanged is fairly self explanatory and I think I'm clear on when to raise that one (i.e. when I've finished updating the values).<br>
If I implement INotifyPropertyChanging I'm tending to raise the event as soon as I enter the setter or other method that changes the objects state and then continue wit... | <p>If your object is given a value that is invalid for the property and you throw an exception then you shouldn't raise the <code>PropertyChanging</code> event. You should only raise the event when you've decided that the value <em>will</em> change. The typical usage scenario is for changing a simple field:</p>
<pre><... | <p>If you would like to avoid implementing INotifyPropertyChanged altogether, consider using <a href="http://codeplex.com/updatecontrols" rel="nofollow noreferrer">Update Controls .NET</a> instead. This eliminates almost all of the bookkeeping code.</p>
| 20,498 |
<p>In SQLSERVER 2005, I'm using table-valued function as a convenient way to perform arbitrary aggregation on subset data from large table (passing date range or such parameters).</p>
<p>I'm using theses inside larger queries as joined computations and I'm wondering if the query plan optimizer work well with them in e... | <p>In this case, it's an "inline table valued function"
The optimiser simply expands (unnests) it if it's useful (or view).</p>
<p>If the function is treated as "black box" by the outer query, the quickest way is to compare IO shown in SSMS vs IO in profiler.
Profler captures "black box" IO that SSMS does not.</p>
<... | <p>1) Yes, using your syntax, it does. If you happened to use a UDF that returned a table which had conditional logic in it, it would not, though. </p>
<p>3) The optimizer won't point out what part of your query it's optimizing, because it may see fit to combine chunks of the plan with your function, or to optimize ... | 40,076 |
<p>I am having trouble using the attribute XPath Selector in ElementTree, which I should be able to do according to the <a href="http://effbot.org/zone/element-xpath.htm" rel="noreferrer">Documentation</a></p>
<p>Here's some sample code</p>
<p><strong>XML</strong></p>
<pre><code><root>
<target name="1">... | <p>The syntax you're trying to use is new in <strong><a href="http://effbot.org/zone/element-xpath.htm" rel="noreferrer">ElementTree 1.3</a></strong>.</p>
<p>Such version is shipped with <strong>Python 2.7</strong> or higher.
If you have Python 2.6 or less you still have ElementTree 1.2.6 or less.</p>
| <p>There are several problems in this code.</p>
<ol>
<li><p>Python's buildin ElementTree (ET for short) has no real XPATH support; only a limited subset By example, it doesn't support <em>find-from-root</em> expressions like <code>//target</code>. </p>
<p>Notice: the <a href="http://docs.python.org/2/library/xml.etr... | 27,431 |
<p>I have ordered a dual hotend Chimera and it came with 2x 12 V heater elements (in my rush I forgot to order the one with 2x 24V).</p>
<p><a href="https://i.stack.imgur.com/xhQNem.png" rel="nofollow noreferrer" title="Chimera dual filament hotend"><img src="https://i.stack.imgur.com/xhQNem.png" alt="Chimera dua... | <p>This answer is intended to be a generic answer for Z-offset determination. The question is not clear on how the Z-offset has been determined. It appears as if this distance is measured, while in reality this cannot be measured.</p>
<p>A touch (or a inductive or capacitive) probe uses a trigger point to determine th... | <p>You should be able to offset this with a <code>G54 Z-1.3</code> - <strong>if your setup accepts these gcodes</strong>. </p>
<p>If you do this, always add a <code>G53</code> to the very start and just before the <code>M30</code> to clear all offsets after job finish (or in the event of a cancel, at the start of the ... | 1,467 |
<p>Yesterday, I found myself writing code like this:</p>
<pre><code>SomeStruct getSomeStruct()
{
SomeStruct input;
cin >> input.x;
cin >> input.y;
}
</code></pre>
<p>Of course forgetting to actually return the struct I just created. Oddly enough, the values in the struct that <em>was</em> re... | <p>Falling off the end of a function that is declared to return a value (without explicitly returning a value) leads to undefined consequences. For gcc, you should start with the <code>-Wall</code> command line switch that turns on most useful warnings. The specific gcc warning that controls the warning you want is <co... | <p>You didn't get any warning because you didn't have <code>-Wall -Werror</code> turned on. (As stated in other answers)</p>
<p>However I think you probably got a zero-filled struct as the result because the stack object was default constructed in the caller function, possibly with explicit zero arguments, or else due... | 37,460 |
<p>I'm a beginner. I've a Printrbot Play with a heated bed add-on. I'm using it exclusively with PLA.</p>
<p>It worked great initially, but then I took the nozzle out and put it back in, and the Z calibration was lost (and I didn't know the calibration was a thing). As a result, I started having issues with the piece ... | <p><strong>Options to check</strong> (in order of probability of occurenece and success):</p>
<ol>
<li>Z-calibration</li>
</ol>
<p>Maybe you should perform calibration again. It's possible that nozzle is now too close which causes the filament is spread on the heatbed, which causes that the bottom surface is "too fla... | <p>When I started, I got a lot of failed prints due to loss of adhesion. It still happens but much rarer. Dialling in settings improved that, but downside is that parts stay stuck to my glass bed really well even when completely cooled off.</p>
<p>I now use a 30mm paint scraper to peel the brim up as far around the m... | 373 |
<p>I'm a little lost (still working with Ron Jeffries's book). Here's a simple class:</p>
<pre><code>public class Model{
private String[] lines;
public void myMethod(){
String[] newLines = new String[lines.length + 2];
for (i = 0, i <= lines.length, i++) {
newLines[i] = lines[i]... | <p>I think your example is probably not the same as your actual code based on your description. I think the problem is that arrays are zero-based and thus an array initialized as:</p>
<p>string[] lines = new string[0];</p>
<p>has no elements.</p>
<p>You need to change your loop so that you check that the index is s... | <p>Take a look at my answer <a href="https://stackoverflow.com/questions/242079/is-there-an-expandable-list-of-object-references-in-java#242093">here</a> - I think this will get you the background you are looking for on the differences between array initialization in Java and C/C++.</p>
| 41,283 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.