instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I often need to run reduce (also called foldl / foldr, depending on your contexts) in java to aggregate elements of an Itterable. </p>
<p>Reduce takes a collection/iterable/etc, a function of two parameters, and an optional start value (depending on the implementation details). The function is successively applie... | <p>you could probably roll your own generic pretty easily, based on your description:</p>
<pre><code>public interface Reducer<A, T>
{
public A foldIn(A accum, T next);
}
</code></pre>
<p>Then using the strategy pattern:</p>
<pre><code>public class Reductor<A, T>
{
private Reducer<A, T> work... | <p>Try the <a href="http://commons.apache.org/sandbox/functor/" rel="nofollow noreferrer">commons functor package</a>. It's been in sandbox forever, but I think it'll do what you want.</p>
| 27,524 |
<p>I just finished setting up an out-of-place build system for our existing C++ code using inherited property sheets, a feature that seems to be specific to the Visual C++ product. Building out-of-place requires that many of the project settings be changed, and the inherited property sheets allowed me to change all the... | <p>I'm not quite sure what an "out-of-place" build system is, but if you just need the ability to copy the compiled files (or other resources) to other directories you can do so by tying into the MSBuild build targets.</p>
<p>In our projects we move the compiled dlls into lib folders and put the files into the proper ... | <blockquote>
<p>Is there a way I can define a macro for a directory and use it in the output path </p>
</blockquote>
<p>Have you looked at the pre-build and post-build events of a project?</p>
| 5,271 |
<p>I have a <code>NSTimer</code> object that I need to invalidate if a user taps on a button or if they exit a view.</p>
<p>So I have:</p>
<pre><code>[myNSTimer invalidate];
</code></pre>
<p>inside my button handler and inside <code>viewWillDisappear</code>. If user taps on a button and then exists a view the app th... | <p>Once you invalidate the timer, simply call <code>release</code> on it (assuming you've retained the reference you're holding on to) and then nil out your reference. That way when you exit the view, trying to invalidate the timer a second time will just call that method on nil instead, which does nothing.</p>
<p>Alt... | <p>Swift: </p>
<pre><code>if timer.valid {
timer.invalidate()
}
</code></pre>
| 48,072 |
<p>I found this open-source library that I want to use in my Java application. The library is written in C and was developed under Unix/Linux, and my application will run on Windows. It's a library of mostly mathematical functions, so as far as I can tell it doesn't use anything that's platform-dependent, it's just ver... | <p>Your best bet is probably to grab a good c book (K&R: The C Progranmming language) a cup of tea and start translating! I would be skeptical about trusting a translation program, more often then not the best translator is yourself! If you do this one, then its done and you don't need to keep re-doing it. There mi... | <p>Have you tried using:</p>
<pre><code>System.loadLibrary("mylibrary.dll");
</code></pre>
<p>Not sure if this will work with a pure C library but it's probably worth a shot. :)</p>
| 10,899 |
<p>I have several templates that match various nodes in an xml document. If I do just an<br>
<xsl:apply-templates/>
it somehow recursively outputs the text of all the nodes beneath. I just want it to recursively match any template I have defined. How do I do that ? </p>
| <blockquote>
<p>This is happening because of the
built-in templates in XSLT. XSLT has a
couple of built in templates, which
say:</p>
<ul>
<li>when you apply templates to an element, process its child elements</li>
<li>when you apply templates to a text node, give its value</li>
</ul>
<p>Together... | <p>you could set a mode to apply only your own templates:</p>
<pre><code><xsl:template match="* | /" >
<xsl:apply-templates mode="myMode" />
</xsl:template>
<xsl:template match="somenode" mode="myMode">
<!-- do something here -->
</xsl:template>
</code></pre>
<p>Another opti... | 45,070 |
<p>I am totally new to XSLT and can't work out where I am going wrong with the following code.</p>
<pre><code><xsl:variable name="var" select="boolean('false')"/>
<xsl:if test="$var'">variable is true</xsl:if>
</code></pre>
<p>It is always returning true when it is meant to be false. Why?</p>
| <p>The value of the $var variable as defined in:</p>
<p> <code><xsl:variable name="var" select="boolean('false')"/></code></p>
<p>is </p>
<p> <strong><code>true()</code></strong></p>
<p>This is because in XPath "<code>false</code>" is an ordinary string, as opposed to <code>f... | <p>A bit late at this stage perhaps but imo dealing with booleans is just not worth the effort. Heres how I dealt with a boolean (Mandatory) coming back from the DB:</p>
<pre><code><xsl:variable name="vTrue" select="true()"/>
<xsl:choose>
<xsl:when test="string(Mandatory) ... | 45,052 |
<p>Ok so ive got a swing app going using the "System" look and feel. Now, I want to change the background colour of the main panels to black. Too easy right?</p>
<pre><code>UIManager.put("Panel.background", Color.BLACK);
</code></pre>
<p>Well yeah, except now the controls in the app look stupid, because their 'shadow... | <p>You might try these:</p>
<ul>
<li>control </li>
<li>controlDkShadow</li>
<li>controlHighlight </li>
<li>controlLtHighlight</li>
<li>controlShadow</li>
</ul>
<p>(I just found them in this list: <a href="http://forums.sun.com/thread.jspa?threadID=183858&forumID=57" rel="nofollow noreferrer">Swing [Archive] - UIM... | <p>You can see what the default settings (and their keys) are by using UIManager.getDefaults();
You can then iterate over the resulting keySet (it is an instance of Map).</p>
<p>So something like this will show all the default keys:</p>
<pre><code>for (Object key: UIManager.getDefaults().keySet())
{
System.out.p... | 24,401 |
<p>I run VPC 2007 on my Vista business laptop with 4 gig RAM. I use VPC to run windows XP and maintain a VS2003 web project. At first everything was great. I assigned the VPC 512MB and did my work as usual. I also run Resharper and Visual SVN. Lately, the act of scrolling in a page causes the CPU to spike above 50... | <p>Try <a href="http://www.virtualbox.org/" rel="nofollow noreferrer">VirtualBox</a>.</p>
<blockquote>
<p>VirtualBox is a family of powerful x86
virtualization products for enterprise
as well as home use. Not only is
VirtualBox an extremely feature rich,
high performance product for
enterprise customers, i... | <p>I'd bet VisualSVN is the problem. I had the same problem on a dual-core system with 6GB of RAM. I eventually just uninstalled it because it kept crashing the IDE.</p>
<p>BTW, I'm running Server2003 64-bit.</p>
| 28,248 |
<p>I realize there's no definitely "right" answer to this question, but when people talk about lines of code, what do they mean? In C++ for example, do you count blank lines? Comments? Lines with just an open or close brace?</p>
<p>I know some people use lines of code as a productivity measure, and I'm wondering if t... | <p>No, there is no standard convention, and every tool that counts them will be slightly different.</p>
<p>This may make you ask, "Why then would I ever use LOC as a productivity measure?" and the answer is, because it doesn't really matter how you count a line of code, as long as you count them consistently you can ... | <ol>
<li><strong>LOCphy:</strong> physically lines</li>
<li><strong>LOCbl:</strong> Blanklines Kommentarblocks werden als Kommentarzeile gezählt</li>
<li><strong>LOCpro:</strong> programming lines (declarations, definitions, directives & code)</li>
<li><strong>LOCcom:</strong> lines of comments </li>
</ol>
<p>Many... | 46,023 |
<p>I'm trying to get the contents from another file with <code>file_get_contents</code> (don't ask why).<br />
I have two files: <em>test1.php</em> and <em>test2.php</em>. <em>test1.php</em> returns a string, bases on the user that is logged in.</p>
<p><em>test2.php</em> tries to get the contents of <em>test1.php</em> ... | <p>First, this is probably just a typo in your question, but the third arguments to file_get_contents() needs to be your streaming context, NOT the array of options. I ran a quick test with something like this, and everything worked as expected</p>
<pre><code>$opts = array('http' => array('header'=> 'Cookie: ' ... | <p>Make sure that file1.php exists on the server. Try opening it in your own browser to make sure!</p>
| 39,440 |
<p>I am using <code>Path.Combine</code>, and one of the strings contain a Unicode characters. I get <code>{System.ArgumentException} exception; illegal characters in path</code>.</p>
<p>According to <a href="http://msdn.microsoft.com/en-us/library/aa365247.aspx" rel="nofollow noreferrer">MSDN</a> filepath/name can have... | <p>I figured out the problem. The second string contains a "tab" character in it causing the exception. (that didn't showed up when I pasted the string here)</p>
<p>Thanks everyone and sorry for the confusion.</p>
| <p>You may have <a href="http://www.mail-archive.com/nant-developers@lists.sourceforge.net/msg05235.html" rel="nofollow noreferrer">double quotes</a> in your set of paths, since <a href="http://msdn.microsoft.com/en-us/library/system.io.path.invalidpathchars.aspx" rel="nofollow noreferrer"><code>Path.InvalidPathChars</... | 48,006 |
<p>I'm relatively new to NHibernate, but have been using it for the last few programs and I'm in love. I've come to a situation where I need to aggregate data from 4-5 databases into a single database. Specifically it is serial number data. Each database will have its own mapping file, but ultimately the entities al... | <p>I don't know if this'll help, but I wouldn't be trying to do that, basically.</p>
<p>Essentially, I think you're possibly suffering from "golder hammer" syndrome: when you have a REALLY REALLY nice hammer (i.e. Hibernate (and I share your opinion on it; it's a MAGNIFICENT tool)), everything looks like a nail.</p>
... | <p>I'm not 100% sure this will do what I need, but I found this googling today about NHibernate and anonymous types:</p>
<p><a href="http://infozerk.com/averyblog/refactoring-using-object-constructors-in-hql-with-nhibernate/" rel="nofollow noreferrer">http://infozerk.com/averyblog/refactoring-using-object-constructors... | 35,579 |
<p>I am looking to implement (or build as a last resort) a type of survey engine that allows for extensibility and integration into an existing workflow engine.</p>
<p>The survey/questionnaire engine should allow for admin users to add new questions and response types (text/bool/multiple/etc), should use SQL Server fo... | <p>Maybe these articles might be useful if you decide to build your own solution:</p>
<p>Web-Based Surveys Made Easy:
<a href="https://web.archive.org/web/20210513212537/http://aspnet.4guysfromrolla.com/articles/061604-1.aspx" rel="noreferrer">https://web.archive.org/web/20210513212537/http://aspnet.4guysfromrolla.com... | <p><a href="http://www.classapps.com/SelectSurveyNETOverview.asp" rel="nofollow noreferrer">SelectSurvey.Net</a> works well and has a lower cost than Feedback Server</p>
| 44,606 |
<p>I have a Delphi 5 executable that calls into a .NET assembly via the free <a href="http://sourceforge.net/projects/delphinet/" rel="nofollow noreferrer">Delphi .NET</a> code, and for the most part, this works great. However, one of the requirements of my application is that our clients be able to use this from a ne... | <p>Update to .NET 3.5 SP 1. That <a href="http://blogs.msdn.com/vancem/archive/2008/08/13/net-framework-3-5-sp1-allows-managed-code-to-be-launched-from-a-network-share.aspx" rel="nofollow noreferrer" title=".NET Framework 3.5 SP1 Allows managed code to be launched from a network share!">removes the distinction</a> betw... | <p>Yes, I have given Full Trust to the share. That's what I meant by full permissions, I'm too used to having to explain it to non-technical people.</p>
| 33,064 |
<p>I seek an algorithm that will let me represent an incoming sequence of bits as letters ('a' .. 'z' ), in a minimal matter such that the stream of bits can be regenerated from the letters, without ever holding the entire sequence in memory.</p>
<p>That is, given an external bit source (each read returns a practicall... | <p>If you assign a different number of bits per letter, you should be able to exactly encode the bits in the twenty-six letters allowed without wasting any bits. (This is a lot like a Huffman code, only with a pre-built balanced tree.)</p>
<p>To encode bits into letters: Accumulate bits until you match exactly one of ... | <p>Any solution you use is going to be space-inefficient because 26 is not a power of 2. As far as an algorithm goes, I'd rather use a lookup table than an on-the-fly calculation for each series of 9 bits. Your lookup table would 512 entries long.</p>
| 15,856 |
<p>I'm working with a project involving 3D printing's terminology, but I'm not such an expert... so I was asking myself if someone can explain the meaning of the "downstream" adjective in this field. </p>
<p>More precisely, I'm dealing with this sentence: "Handle any downstream task", which I really can't understand b... | <p>Without more anymore context "downstream" could be in reference to a print that would be sent to another machine for post-processing. The post-processing machine is "downstream" from the machine used to make the print in the first place.</p>
| <p>Imagine an assembly line and the flow of the material along that line. That flow is analogous to a river, and therefore any machining/processing following on from <em>any point</em> along that line is considered to be downstream of <em>that point</em>.</p>
<p>From <a href="https://en.wikipedia.org/wiki/Downstream_(... | 1,139 |
<p>I have an iPhone app that is running great in the simulator. It responds well to the memory warnings by getting rid of everything that is not absolutely essential. When I run it on the device, it runs well. But after a certain amount of usage it crashes with error code 101 - which, from what I can tell, is the OS... | <p>One quick thing to try is running the <a href="http://clang.llvm.org/StaticAnalysis.html" rel="nofollow noreferrer">Clang static analyzer</a>. This will find some, but not all, issues in your code that you might be missing. It checks the code at compile time, so it's by no means infallible, but will almost certainly... | <p>One thing to look for is circular references.</p>
<p>(I don't want this to sound patronising - just want to make sure I'm being clear:) If object <strong>a</strong> refers to object <strong>b</strong> and object <strong>b</strong> refers to object <strong>a</strong>, there may not be a reported "leak" because all t... | 35,663 |
<p>I am using the webbrowser control in winforms and discovered now that background images which I apply with css are not included in the printouts.</p>
<p>Is there a way to make the webbrowser print the background of the displayed document too?</p>
<p>Edit:
Since I wanted to do this programatically, I opted for this... | <p>If you're going to go and change an important system setting, make sure to first read the current setting and restore it when you are done.</p>
<p>I consider this <em>very bad</em> practice in the first place, but if you must do it then be kind.</p>
<pre><code>Registry.LocalMachine
</code></pre>
<p>Also, try chan... | <p>By default, the browser does not print background images at all. </p>
<p>In Firefox</p>
<pre><code>* File > Page Setup > Check Off "Print Background"
* File > Print Preview
</code></pre>
<p>In IE</p>
<pre><code>* Tools > Internet Options > Advanced > Printing
* Check Off "Print Background Image... | 7,068 |
<p>I have found a software development system which is currently free to use and develop with.</p>
<p>This system is completely codeless and one can develop business oriented applications effortlessly using its GUI and a bit of MDA. The site is : <a href="http://www.codeless.com/" rel="nofollow noreferrer">http://www.... | <p>I have looked at the site but the story is extremely vague.</p>
<p>For majority of non-Dutch speakers, I have translated the following text:</p>
<blockquote>
<p>Klaar voor de toekomst!</p>
<p>Stel dat u over 20 jaar nog steeds
dezelfde software zou kunnen gebruiken
als nu. Toekomstmuziek? Nou, welkom in... | <p>I have tested version 1 current version is 2. but as there is not documentation available in English I am a bit baffled as to how we can go ahead building our apps as per our requirements.</p>
<p>The samples provided looked impressive though.</p>
| 48,882 |
<p>I am the web guy for a large TV station. Our site is cached by Akamai. Pages render perfectly in our testing environment (not cached) and on our "origin" page (again, not cached), but when they are viewed on our live environment (the cached site), they do not render exactly the same as how I coded them. Maybe it's a... | <p>I've been working on sites behind Akamai and can honestly say they don't mess with your code, so that's not the issue. It's more than likely one of the following:</p>
<p><strong>You have a cache latency issue</strong> - You updated your html and css, and one of the two updated while the other is still cached by Ak... | <p>Perhaps Akamaia isn't seeing the updated versions of your CSS files that are <link />'d in your HTML code? It might be a good idea to embed a version number in the URL so that when you release an updated version of the HTML, it's always going to ask Akamai for a new version of the CSS as well (this applies to... | 9,069 |
<p>In traditional embedded programming, we will give a delay function like so:</p>
<pre><code>for(i=0;i<255;i++)
for(j=0;j<255;j++);
</code></pre>
<p>In the microprocessor's view, is this how the sleep() function works?</p>
<p>Is there an alternative for the sleep() function in C?</p>
| <p>The kind of loop you describe is called a "busy wait". In real operating systems, sleeping does not cause a busy wait; it tells the operating system to not schedule the process in until the sleep period is over.</p>
| <p>an attempt... to really solve this issue, i.e. something that works (not like the above attempts of answer) lol</p>
<p>I still have to improve this code to make it out. Few add-ons are welcome.</p>
<pre><code>// Sleep for both Windows and Linux:
// Too bad? No one proposed you a solution that works?
// Since Win... | 33,108 |
<p>We don't exactly comply with the XML-RPC spec, but the concepts are nearly identical. A client comes in over HTTP/HTTPS with an XML payload. We respond with an XML payload answering the request. This is primarily machine to machine, so no human to type a username/password. Our construct runs within apache tomcat... | <p>HTTP BASIC/DIGEST works fine for most machine to machine tasks, and it handled by the server so your API is unaffected.</p>
<p>It doesn't work as well for interactive uses because it's difficult to "log out" the user without closing the browser.</p>
<p>Otherwise you'll most likely need to alter your APIs to includ... | <p>@Will</p>
<p>I second the HTTP Basic suggestion, and can testify that it integrates fairly well with <a href="http://static.springframework.org/spring-security/site/index.html" rel="nofollow noreferrer">Spring Security</a>, which I implemented on top of a legacy application that rolled its own DB-based authenticati... | 19,668 |
<p>What is the command to match brackets in Emacs (the equivalent of the <code>%</code> command in Vim)?</p>
| <p>See <code>show-paren-mode</code> as described in <a href="http://www.gnu.org/software/emacs/manual/html_mono/efaq.html#Matching-parentheses" rel="noreferrer">5.27 How do I show which parenthesis matches the one I'm looking at?</a></p>
| <p><a href="https://github.com/redguardtoo/evil-matchit" rel="nofollow">https://github.com/redguardtoo/evil-matchit</a></p>
<p>I read vim matchit code before developing evil-matchit. evil-matchit is offering much more than original vim matchit now.</p>
<p>Besides, you can easily extend evil-matchit to support any new... | 32,700 |
<p>I'm in dire need to reprint a small chunk of a print that got messed up during print because the support for it broke which I cannot explain whatsoever.</p>
<p>Anyway. I need to edit the STL file and I don't know what tool to use since Blender is definitely not user friendly for just a simple cut and past.</p>
<p>... | <p>Alright so I asked in my facebook group and a friendly fellow game me the tip to use Meshmixer from AutoCAD and then check a video on Plane cut. I only needed 3 simple cuts and the piece I needed was all ready to print. :) 40 Minutes to print and only 3g of PLA to spend :)</p>
| <p>You could import the STL file in a 3D CAD modelling program and edit it there.</p>
<p>To not give an opinionated answer, there are many free or paid alternatives available. Loading the STL generally requires it to be scaled down to one tenth of the imported size and transform the surface model into a solid. Once yo... | 1,146 |
<p>Suppose that I have interface MyInterface and 2 classes A, B which implement MyInterface.<br>
I declared 2 objects: <code>MyInterface a = new A()</code> , and <code>MyInterface b = new B()</code>.<br>
When I try to pass to a function - function <code>doSomething(A a){}</code> I am getting an error.</p>
<p>This is m... | <p>Can you not just have a method on the interface which each class implements? Or do you not have control of the interface? </p>
<p>This would provide both polymorphism and avoid the need to define any external methods. I believe this is the intention of an interface, it allows a client to treat all classes implement... | <p>I usually use an abstract class to get around this problem, like so:
<blockquote>
<p><code>public abstract class Parent {}</code><br>
<code>public class A extends Parent {...}</code><br>
<code>public class B extends Parent {...}</code></p>
</blockquote>
<p>That allows you to pass Parent objects to functions ... | 18,792 |
<p>I want to put a copyright notice in the footer of a web site, but I think it's incredibly tacky for the year to be outdated.</p>
<p>How would I make the year update automatically with <a href="http://en.wikipedia.org/wiki/PHP#History" rel="noreferrer">PHP 4</a> or <a href="http://en.wikipedia.org/wiki/PHP#History" r... | <p>You can use either <a href="http://php.net/manual/en/function.date.php" rel="noreferrer">date</a> or <a href="http://php.net/manual/en/function.strftime.php" rel="noreferrer">strftime</a>. In this case I'd say it doesn't matter as a year is a year, no matter what (unless there's a locale that formats the year differ... | <pre><code><?php
$time_now=mktime(date('h')+5,date('i')+30,date('s'));
$dateTime = date('d_m_Y h:i:s A',$time_now);
echo $dateTime;
?>
</code></pre>
| 8,947 |
<p>I am working on implementing tail for an assignment. I have it working correctly however I seem to be getting an error from free at random times.</p>
<p>I can't see, to track it down to a pattern or anything besides it is consistent.</p>
<p>For example if I call my program as "tail -24 test.in" I would get the the... | <p>Your routine is writing beyond the allocated line buffer.</p>
<p>The size of the line passed as an argument (i.e. "len") probably does not include the NUL terminator. When you call malloc to copy the line (i.e. "s") you need to allocate an extra byte for the string terminator:</p>
<pre><code> *(lines + slot) = (ch... | <p>Do nlines and numlines have the same value?</p>
<p>Does the caller of insert_line allow room for the trailing NUL when passing the length in the second parameter?</p>
| 28,793 |
<p>I have two tables A and B. I would like to delete all the records from table A that are returned in the following query:</p>
<pre><code>SELECT A.*
FROM A , B
WHERE A.id = B.a_id AND
b.date < '2008-10-10'
</code></pre>
<p>I have tried:</p>
<pre><code>DELETE A
WHERE id in (
SELECT a_id
FROM B
... | <p>I think this should work (works on MySQL anyway):</p>
<pre><code>DELETE a.* FROM A a JOIN B b ON b.id = a.id WHERE b.date < '2008-10-10';
</code></pre>
<p>Without aliases:</p>
<pre><code>DELETE A.* FROM A JOIN B ON B.id = A.id WHERE B.date < '2008-10-10';
</code></pre>
| <p>According to your description to your DELETE-statement, you want to delete empty orphants in table A aswell?</p>
<pre>
DELETE A.*
FROM A
LEFT JOIN B ON A.id = B.a_id AND b.date > '2008-10-10'
WHERE b.id IS NULL
</pre>
<p>(please note the inverted way of joining in B)</p>
<p>Should do the trick in that case. I'm ... | 34,241 |
<p>I am having a great deal of trouble getting named queries to work with nHibernate. My latest problem is getting the error message "could not execute query" with no additional information. Are there any complete examples I can download from somewhere because all the tutorials and documentation examples provide code s... | <p>I assume that you have tested before the SQL in your client database, so I think that maybe we should see what is happening inside, so I can recommend you this links;</p>
<ol>
<li><a href="http://forum.hibernate.org/viewtopic.php?t=938710&sid=f457c1ab5873b97794203503d750567e" rel="nofollow noreferrer">Named Que... | <p>Maybe I'm wrong but it seems that could be a conflict between the table "TABLENAME" and the parameter ":TableName", what happens if you try to use another parameter name? </p>
| 31,457 |
<p>In vc++ i am using MScomm for serial communication,
i received data in this format 02120812550006050.0,
i am not gettng how to read this ,in which format it is,
begning starting frame and at the end ending file, remaing i dont know.</p>
<p>EDIT 1:</p>
<p>it contains date time and data how i can seperate this one<... | <p>The funny characters are markers indicating things like record start, record end, field separator and so on. Without knowing the actual protocol, it's a little hard to tell.</p>
<p>The data is a lot easier.</p>
<p>Between the 000f and 0002 markers you have a date/time field, 2nd of December 2008, 12:55:00.</p>
<... | <p>It is unlikely that you will figure it out unless you know what you are communicating with and how it communicates with you. (hint -- you can try telling us)</p>
| 43,624 |
<p>I need to control the data type when reading XML data in SAS. The XML data are written and accessed using the XML libname engine in SAS.</p>
<p>SAS seems to guess the data type based on the contents of a column: If I write "20081002" to my XML data in a character column, it will be read back in as a numerical varia... | <p>Take a look at the SAS XML Mapper.
It allows you to create a map to read (and wrte in 9.2) XML files and specifying column attributes.</p>
<p>If this is your XML file:</p>
This is obviously text
20081002
42
42
You could create a MAP like this:
<p></p>
<pre><code><... | <p>I think you need to define some xml specific options whith your libname XML statement for export go:</p>
<pre><code>libname my_xml_out XML XMLMETA=SCHEMADATA;
</code></pre>
<p>To include the data schema. Also, you might want to save the XML schema to a separate file for later import:</p>
<pre><code>libname my_xml... | 19,569 |
<p>For a project of mine I would love to provide auto completion for a specific textarea. Similar to how intellisense/omnicomplete works. For that however I have to find out the absolute cursor position so that I know where the DIV should appear.</p>
<p>Turns out: that's (nearly I hope) impossible to achieve. Does ... | <p><strong>Version 2 of My Hacky Experiment</strong></p>
<p><em>This new version works with any font, which can be adjusted on demand, and any textarea size.</em></p>
<p>After noticing that some of you are still trying to get this to work, I decided to try a new approach. My results are FAR better this time around -... | <p>How about appending a span element to the cloning div and setting the fake cursor based on this span's offsets? I have updated your fiddle <a href="http://jsfiddle.net/2Rzfb/2/" rel="nofollow noreferrer">here</a>. Also here's the JS bit only</p>
<pre><code>// http://stackoverflow.com/questions/263743/how-to-get-care... | 15,612 |
<p>I'm looking for a way to check within <code>pageLoad()</code> if this method is raised during load event because of a postback/async postback or because of being loaded and access the first time.</p>
<p>This is similar to <code>Page.IsPostback</code> property within code behind page.</p>
<p>TIA,
Ricky</p>
| <p>One way you could do that is to wire up an Application.Load handler in Application.Init, then have that handler unbind itself after running:</p>
<pre><code>Sys.Application.add_init(AppInit);
function AppInit() {
Sys.Application.add_load(RunOnce);
}
function RunOnce() {
// This will only happen once per GET re... | <p>You can still use Page.IsPostback during an async call.</p>
| 6,218 |
<p>A lot of developers say only throw exceptions in truly exceptional circumstances. One of these would be if an external hard drive I want to write to is not switched on (therefore not a connected/registered drive). However, there are some situations which are difficult to work out whether they are truly exceptional o... | <p>Generally, it works like this:</p>
<p>If you can handle the situation without any interruptions, do so. (File doesn't exist, but its input isn't essential to continuing operation [preferences, optional configuration, etc])</p>
<p>If you need user intervention, ask them. (File doesn't exist, but you need it to con... | <p>Exceptions should be used if there is something that can be done about it, but the code that detects it can't known what to do.</p>
| 48,821 |
<p>I'm writing a program that sends an email out at a client's specific local time. I have a .NET method that takes a timezone & time and destination timezone and returns the time in that timezone. So my method is to select every distinct timezone in the database, check if it is the correct time using the method, t... | <h1>Hey! These queries are not equivalent.</h1>
<p>Results will be same only if assuming that one email belongs only to the one time zone. Of course it does however SQL engine doesn't know that and tries to remove duplicities. So the first query should be faster.</p>
<p>Always use UNION ALL, unless you know why you w... | <p>Some DBMS's Query Optimizers modify your query to make it more efficient, so depending on the DBMS your using, you probably shouldn't care.</p>
| 4,481 |
<p>What's the best way to serialize a HashTable (or a data best navigated through a string indexer) with SOAP/XML?</p>
<p>Let's say I have a <code>Foo</code> that has an property <code>Bar[] Bars</code>. A <code>Bar</code> object has a key and a value. By default, this serializes to the following XML:</p>
<pre><code>... | <p>I really don't think that what you want reflects the structure better. To define a schema (think XSD) for this you would have to know all of the potential keys in advance since you indicate that you want each one to be a separate custom type. Conceptually Bars would be an array of objects holding objects of type K... | <p>ISerializable isn't used for xml serialization; its used for binary serialization. You would be better implementing IXmlSerializable.</p>
<p>But I think that the KeyedCollection serializes more like you're thinking. Except you'll never get <key0 ... /> <key1 ... /> since the elements map to classes.</p>
| 11,434 |
<p>Can anyone reccomend a .net control (winforms) that can be used to as a designer to edit xml files / DSL files ??</p>
| <h2>Why might an XSLT fail?</h2>
<p>An XSLT will fail because of obvious things like typos. However, the most likely situation relates to namespace usage. If you declared a default namespace for your XML but don't include that in your XSLT, the XSLT won't match the templates as you might expect.</p>
<p>The following ... | <p>Maybe this, if the data you show is really like what you got to work with</p>
<pre><code><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Businesses">
<Businesses>
<xsl:apply-templates/>
</Businesses>
</xsl:template>
<x... | 34,103 |
<p>I am working with an open-source UNIX tool that is implemented in C++, and I need to change some code to get it to do what I want. I would like to make the smallest possible change in hopes of getting my patch accepted upstream. Solutions that are implementable in standard C++ and do not create more external depende... | <p>I am using #3: the boost string format library - but I have to admit that I've never had any problem with the differences in format specifications.</p>
<p>Works like a charm for me - and the external dependencies could be worse (a very stable library)</p>
<p>Edited: adding an example how to use boost::format inste... | <p>Is this about serialization? Or printing proper?
If the former, consider boost::serialization as well. It's all about "recursive" serialization of objects and sub-object.</p>
| 9,512 |
<p>For example so that it works like this
toString (Var x)= "x"</p>
| <p>Use the <code>show</code> function:</p>
<pre><code>putStrLn (show x)
</code></pre>
<p>will print out the "x" variable. (Naturally, you don't need to use it with <code>putStrLn</code>, either -- <code>show</code> returns a string that can be used anywhere like a string.)</p>
| <p>If I understand you correctly, you're asking how to convert programming constructs into strings. You aren't concerned with what 'x' represents so much as you are that the programmer called it "x" in the source file.</p>
<p>You can convert data constructors into strings using some of the Scrap Your Boilerplate comp... | 42,643 |
<p>I have my own class inside the file "Particles.h" and the class's implementation is inside "Particles.cpp"</p>
<p>I want the file "Load.h" to recognize my classes inside there, so I've added the line</p>
<pre><code>#include "Particles.h"
</code></pre>
<p>and the file doesn't recognize it and in the past everythin... | <p>It sounds like your include path - the list of directories that the compiler scans in order to locate files that you #include - is set incorrectly. Which compiler are you using?</p>
| <p>make sure the file "Particles.cpp" has also included "Particles.h" to start with and the files are in the same folder and they are all part of the same project. it will help if you also share the error message that you are getting from your compiler.</p>
| 9,751 |
<p>How can I add a plaintext into encrypted ciphertext?</p>
<p>For example, I would like to add number 4 into encrypted(5)</p>
| <p>There are schemes that allow you to perform arithmetic on encrypted data without being able to decrypt the data. Such schemes are useful for for example electronic voting (you can tabulate the votes without being able to view the individual votes).</p>
<p>If you want details, lookup <a href="http://en.wikipedia.org... | <p>@Bill the lizard:
Well you can, if you are using ECB or any other block mode where the n+1 block doesn't require much knowledge about block n you can chain on an extra block (or even insert a block as in the case of ecb).</p>
<p>However this leaves you open to mitm-attacks and so on...</p>
| 30,091 |
<p>Is there a way to bind a MemoryStream to asp:image control?</p>
| <p>Best bet is to create an HttpHandler that would return the image. Then bind the ImageUrl property on the asp:Image to the url of the HttpHandler.</p>
<p>Here is some code.</p>
<p>First create the HttpHandler:</p>
<pre><code><%@ WebHandler Language="C#" Class="ImageHandler" %>
using System.Drawing;
using S... | <p>Nope. </p>
<p>But you can create a special page to stream that image out. First, you set the URL of the image to the page that performs the streaming, including some url parameters that let you know where to get the image:</p>
<pre><code><img src="GetImage.aspx?filename=foo" ... />
</code></pre>
<p>in Get... | 6,895 |
<p>I 3d-printed a key.
<a href="https://i.stack.imgur.com/8sfuT.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/8sfuT.jpg" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/XoGY3.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/XoGY3.jpg" alt="enter image description here"></... | <p>I must admit, I've never printed a key...but I think I can help anyway:</p>
<p><strong>Print method:</strong>
Consider printing on side, solid concentric infill. Or, if you can't manipulate your infill pattern, just increase the perimeter so you get the same effect, several continuous perimeter layers around the o... | <p>Which direction are the layers being printed? If the layers are printing top to bottom (in relation to your picture) there isn't a lot of sheer force required to break the key when turning. If you make the layers print from left to right you might have better luck.</p>
| 395 |
<p>I am looking for some general advice about the mp3 format before I start a small project to make sure I am not on a wild-goose chase.</p>
<p>My understanding of the internals of the mp3 format is minimal. Ideally, I am looking for a library that would abstract those details away. I would prefer to use Python (but c... | <p>I got three quality answers, and I thank you all for them. I haven't chosen any as the accepted answer, because each addressed one aspect, so I wanted to write a summary.</p>
<p><strong>Do you need to work in MP3?</strong></p>
<ul>
<li><p>Transcoding to PCM and back to MP3 is unlikely to result in a drop in quality.... | <p>Not a direct answer to your needs, but check the <a href="http://mpesch3.de1.cc/mp3dc.html#dwn" rel="nofollow noreferrer">mp3DirectCut</a> software that does what you want (as a GUI app). I think that the source code is available, so even if you don't find a library, you could build one of your own, or build a pytho... | 40,049 |
<p>I am currently using an MSAccess mdb file for a redistributable app. </p>
<p>A while ago I found out about SQLite, as an alternative to my solution, but the binaries they provide do not offer the possiblilty of using them as an object in VB6. (Or at least I couldn't figure it out how).</p>
<p>Does anyone has a lin... | <p>Here is a link with code examples:</p>
<p><a href="http://www.freevbcode.com/ShowCode.asp?ID=6893" rel="nofollow noreferrer">http://www.freevbcode.com/ShowCode.asp?ID=6893</a></p>
| <p>The <strong>COM Wrappers / Visual Basic DLLs</strong> section at the middle of <a href="http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers" rel="nofollow">this page</a> lists some solution usable with VB6. </p>
<p>And yes, I'm still stuck developing with VB6 :(</p>
| 13,642 |
<p>I'd like to have a <code>TabNavigator</code> component that has a close button for some of the tabs. How do I do that? <br>
It seems that the <code>TabNavigator</code> component does not allow (or I could not find) extensibility of this form.
Help. Thanks</p>
| <p>You should take a look at the SuperTabNavigator component from the <a href="http://code.google.com/p/flexlib/" rel="nofollow noreferrer">FlexLib</a> project:</p>
<ul>
<li><a href="http://flexlib.googlecode.com/svn/trunk/examples/SuperTabNavigator_Sample.swf" rel="nofollow noreferrer">SuperTabNavigator example</a></... | <p>Spark Based Component</p>
<p><a href="http://blog.flexwiz.net/spark-tabs-with-close-button/" rel="nofollow"> <strong>flexwiz</strong> spark-tabs-with-close-button</a></p>
| 9,305 |
<p>I have a class that parses very large file (that can't fit in memory) and I'm currently utilizing the IEnumerable interface to use foreach so I can easily grab the parsed contents of the file line by line. Currently, I'm trying to write this to file using an XMLSerializer. It insists on enumerating the class and i... | <p>I managed to fix this problem without having to change my design. None of my code was relying on the IEnumerable interface, just the implementation of IEnumerable GetEnumerator() (apparently foreach doesn't check to see if IEnumerable is implemented). Just commenting out the interface in the class declaration did ... | <p>It seems to me that your problem could be solved by using tighter encapsulation.</p>
<p>It sounds as if you are using the same class to load your data from file, and to store the in-memory representation of that data. If this is the case, you could (and possibly <em>should</em>) move the functionality into two clas... | 48,901 |
<p>I started using IRC at a young age, and I have always been fascinated with it. As a language exercise, I was thinking about programming a simple IRC client in Ruby with <a href="http://www.shoooes.net/" rel="noreferrer">Shoes</a> as a graphical front-end. My question to you, kind-sirs, what do I need to become fam... | <p>An earlier post mentioned RFC1459. While it is a very good introduction to IRC, it has actually been superseded by RFCs 2810-2813. Here is a more complete list of documentation you need to program anything IRC-related:</p>
<ul>
<li><a href="https://www.rfc-editor.org/rfc/rfc1459" rel="nofollow noreferrer">RFC1459</a... | <p>Not exactly an answer to your question, but it may be helpful. If you are using Ruby, I have found the Autumn Leaves project to be a great way to build an IRC bot using Ruby:</p>
<p><a href="http://github.com/RISCfuture/autumn/tree/master" rel="nofollow noreferrer">http://github.com/RISCfuture/autumn/tree/master</a... | 4,403 |
<p>I want to have a function that will return the reverse of a list that it is given -- using recursion. How can I do that?</p>
| <p>Append the first element of the list to a reversed sublist:</p>
<pre><code>mylist = [1, 2, 3, 4, 5]
backwards = lambda l: (backwards (l[1:]) + l[:1] if l else [])
print backwards (mylist)
</code></pre>
| <p>Why not:</p>
<pre><code>a = [1,2,3,4,5]
a = [a[i] for i in xrange(len(a)-1, -1, -1)] # now a is reversed!
</code></pre>
| 26,570 |
<p>I'm having an issue with a standard ASP.NET page that has a TextBox and a RequiredFieldValidator. The steps to reproduce are quite simple:</p>
<ol>
<li>Place a TextBox on a page</li>
<li>Place a RequiredFieldValidator on the page</li>
<li>Point the RequiredFieldValidator at the TextBox</li>
<li>Run the app</li>
<l... | <p>Is it possible this behavior is by design to suppress the appearance of validation controls until user input?</p>
<p>Generally speaking, Validate() gets called whenever a control is clicked that has CausesValidation set to true, like a submit button. </p>
<p>In any case, a poor mans work around, you <em>could</em... | <p>A form can contain several validation groups. AFAIK validation is only triggered through a post-back, activating the validators of the corresponding validator group. Only after the post-back does the validator add its client-side Javascript validation code.</p>
| 32,635 |
<p>I have created a namespace extension that is rooted under Desktop. The main purpose of the extension is to provide a virtual list of ZIP files that represent a list of configurable directories. When the user clicks one of the those items the contents of the related directory are zipped in place and the resulting ZIP... | <p>What would be wrong with doing something like the following:</p>
<p>Defining a 'Maintainer' interface with the addListener(Listener, Enum) method.</p>
<p>Create a DefaultMaintainer class (as above) which implements Maintainer.</p>
<p>Then, in each Listener class, 'inject' the Maintainer interface (constructor inj... | <blockquote>
<p>You said "... you can't have java.lang.Enum as"
annotation param ..."</p>
</blockquote>
<p>I think you are wrong on that. I have recently used on a project something like this :</p>
<pre><code>public @interface MyAnnotation {
MyEnum value();
}
</code></pre>
| 9,697 |
<p>I am trying to FTP some apple DMG files, if we do it by hand through Safari or IE it ends up at the destination just fine and uncorrupted. However, if I use a freeware FTP client that we had been using with great success for zip's and exe's or if I use a Powershell script I finished off (adapted from another stackov... | <p>Seems like your client treats dmg file as text file.
set Binary transfer mode in your ftp client and it will ftp it as is.</p>
<p>I always thought that ascii transfer mode in ftp is just plain stupid. It causes more trouble then it is worth.</p>
| <p>Seems like your client treats dmg file as text file.
set Binary transfer mode in your ftp client and it will ftp it as is.</p>
<p>I always thought that ascii transfer mode in ftp is just plain stupid. It causes more trouble then it is worth.</p>
| 36,943 |
<p>I've been trying with the idea of taking an existing ASP.NET Webforms application and converting it to a hybrid so that going forward, we can do ASP.NET MVC.</p>
<p>In order to do this, I created an ASP.NET MVC application and started copying some of the folders from the ASP.NET webforms projects that contain webfo... | <p>I think you'd have a lot easier conversion adding the System.Web.Mvc assemblies to your current project and updating the web.config file and global.asax.</p>
<p>You have to make sure your current application is a web application (not site) project. If it isn't convert it and make sure it compiles first.</p>
| <p>I think you'd have a lot easier conversion adding the System.Web.Mvc assemblies to your current project and updating the web.config file and global.asax.</p>
<p>You have to make sure your current application is a web application (not site) project. If it isn't convert it and make sure it compiles first.</p>
| 38,119 |
<p>How do I convert a datetime <em>string in local time</em> to a <em>string in UTC time</em>?</p>
<p>I'm sure I've done this before, but can't find it and SO will hopefully help me (and others) do that in future.</p>
<p><strong>Clarification</strong>: For example, if I have <code>2008-09-17 14:02:00</code> in my lo... | <p>First, parse the string into a naive datetime object. This is an instance of <code>datetime.datetime</code> with no attached timezone information. See its <a href="https://docs.python.org/3/library/datetime.html#available-types" rel="noreferrer">documentation</a>.</p>
<p>Use the <a href="http://pytz.sourceforge.net/... | <p>How about - </p>
<pre><code>time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(seconds))
</code></pre>
<p>if seconds is <code>None</code> then it converts the local time to UTC time else converts the passed in time to UTC.</p>
| 10,521 |
<p>I need to share SSO information between two different domains with a cookie, can this be done in PHP and how?</p>
| <p>On both domains, place an image or other web element that is pulled from the other domain. Use the URL to notify the other domain that user X is on domain A, and let domain B associate that user ID with that user on their system.</p>
<p>It's a little complex to carry out correctly, but if you think it through it'l... | <p>You don't, cookies are bound to a domain. There are restrictions on this and it's referred to as cross site scripting.</p>
<p>Now, for some help to your problem.
What you can do is create a script that helps bridge them.</p>
<p>You can globally rewrite all links to your second site are going to need cookie informa... | 40,677 |
<p>I got this message from my Creality Ender 6 printer.</p>
<p>Now every time I want to print, or when it heats up, the printer gives me this message.</p>
<p>Can anyone please help with this?</p>
<p><a href="https://i.stack.imgur.com/oCLzI.jpg" rel="nofollow noreferrer" title="Heating failed error"><img src="https://i.... | <p>I've seen a version of this error on my Ender 3 when I heated the hot end without the silicone sock (or any other insulating wrap).</p>
<p>If this occurred after changing a nozzle, replacing a heat break (or entire hot end), installing a new cooling duct, or similar, it's likely you just inadvertently left off the i... | <p>Someone with experience using an Ender may give a more specific answer to you question. This is a general answer, not for a specific model.</p>
<p>"Soon enough" is saying the printer timed out before reaching temperature.</p>
<ol>
<li><p>Do you see the temperature increasing on both the hot end and bed? ... | 1,848 |
<p>I have a WPF window for editing database information, which is represented using an Entity Framework object. When the user closes the window, I'd like to notice in the Closing event whether the information has changed and show a message box offering to save the changes to the database.</p>
<p>Unfortunately, change... | <p>In WPF you can change a <code>Binding</code> to update the source on modification, rather than on losing the focus. This is done by setting the <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.binding.updatesourcetrigger.aspx"><code>UpdateSourceTrigger</code></a> property to <a href="http://msdn.... | <p>Also look at the sugestions in <a href="https://stackoverflow.com/questions/57493/wpf-databind-before-saving#58443">this</a> post</p>
| 27,502 |
<p>I often use this recursive 'visitor' in F#</p>
<pre><code>let rec visitor dir filter=
seq { yield! Directory.GetFiles(dir, filter)
for subdir in Directory.GetDirectories(dir) do yield! visitor subdir filter}
</code></pre>
<p>Recently I've started working on implementing some F# functionality in C#,... | <p><code>yield!</code> does a 'flatten' operation, so it integrates the sequence you passed it into the outer sequence, implicitly performing a <code>foreach</code> over each element of the sequence and <code>yield</code> on each one.</p>
| <p>There is no simple way to do this.
You could workaround this by defining a C# type that can store either one value or a sequence of values - using the F# notation it would be:</p>
<pre><code>type EnumerationResult<'a> =
| One of 'a
| Seq of seq<'a>
</code></pre>
<p>(translate this to C# in any way... | 39,740 |
<p>I have read about a technique involving writing to disk a rendered dynamic page and using that when it exists using mod_rewrite. I was thinking about cleaning out the cached version every X minutes using a cron job.</p>
<p>I was wondering if this was a viable option or if there were better alternatives that I am no... | <p>You could use your cron job to run the scripts and redirect the output to a file.</p>
<p>If you had a php file index.php, all you would have to do is run</p>
<p><code>php index.php > (location of static file)</code></p>
<p>You just have to make sure that your script runs the same on command line as it does ser... | <p>Does the page need to be junked every so often because it just has to? Or should it be paralleled with a static version after an update to the page?</p>
<p>If the latter, you could try and write a script that would make a copy of the just edited page and save it to its static filename version. That should lighten t... | 32,807 |
<p>I'm trying to generate my models from a schema.xml file on OSX 10.5 with the latest versions of PHP & Propel 1.3 & Phing. All the model classes actually get created, then it just dies, right at the last step. I have already tried </p>
<blockquote>
<p>chmod -R 777 ./application/config</p>
</blockquote>
<p... | <p>I don't know how this happened, but my runtime-conf.xml file had a bad line in it:</p>
<pre><code><datasource id="models"> <!-- this ID must match <database name=""> in schema.xml -->
</code></pre>
<p>See how it says those things <em>must</em> match? Mine didn't. I must have hit a key when I wasn... | <p>I don't know how this happened, but my runtime-conf.xml file had a bad line in it:</p>
<pre><code><datasource id="models"> <!-- this ID must match <database name=""> in schema.xml -->
</code></pre>
<p>See how it says those things <em>must</em> match? Mine didn't. I must have hit a key when I wasn... | 46,770 |
<p>The eval function is a powerful and easy way to dynamically generate code, so what are the caveats?</p>
| <ol>
<li><p>Improper use of <strong>eval</strong> opens up your
code for injection attacks</p></li>
<li><p><strong>Debugging</strong> can be more challenging
(no line numbers, etc.)</p></li>
<li><p>eval'd code executes slower (no opportunity to compile/cache eval'd code)</p></li>
</ol>
<p>Edit: As @Jeff Walden points ... | <p>I won't attempt to refute anything said heretofore, but i will offer this use of eval() that (as far as I know) can't be done any other way. There's probably other ways to code this, and probably ways to optimize it, but this is done longhand and without any bells and whistles for clarity sake to illustrate a use o... | 11,199 |
<p>I wonder if there's a way to do the following: I have a structure containing a member which is a pointer to a block of memory allocated by the kernel when I pass the structure to an API function (the structure is a WAVEHDR, the member is the <em>reserved</em> field.)</p>
<p>I can set a data breakpoint on the value ... | <p>A macro can evaluate anything that you can in the watch window:</p>
<pre><code> Dim e As EnvDTE.Expression
e = DTE.Debugger.GetExpression("<my expression>", True)
If e.IsValidValue Then
... use e.Value to do something
End If
</code></pre>
<p>The value you get back in e.Value is exact... | <p>I'm not sure if thats possible. I know that there are conditional breakpoints, but that would require knowing the memory address ahead of time...</p>
<p>Something along the lines of *p == 0xADDRESS in the conditional break dialog.</p>
| 22,248 |
<p>I'd like to calculate the power lost through the filament being extruded (or in other words, at how many Watts I'd have to run an ideal heater that loses heat ONLY through filament so that it stays at constant temperature).</p>
<ul>
<li>Power is defined in Watts as <span class="math-container">$\text W =\frac{\text ... | <p>This is very simply stated, in fact the specific heat is a function of temperature and state of the material (liquid or solid). Also you need to consider which type of specific heat you use, e.g. the one for constant volume <span class="math-container">$C_V$</span> or for constant pressure <span class="math-containe... | <h1>No.</h1>
<p>Your formula is quite off, and it starts with the nomenclature:</p>
<h2>Watt</h2>
<p>Watt is the <strong>unit</strong> of <strong>energy transfer</strong> which equals <strong>power</strong>.</p>
<p>The commonly used term "wattage" does not exist in science. It is a very despised shorthand <em... | 1,339 |
<p>I'd like to add a logo to the left of my title on my navigation bar. The title property seems to only take an NSString. What's the best way to add an image to the navigation bar?</p>
| <p>You can replace the title view with an image like this:</p>
<pre><code>navigationItem.titleView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"title_bar.png"]];
</code></pre>
| <p>You can customize <code>navigationItem.titleView</code>, class of UIView</p>
| 42,544 |
<p>I am looking for a tool to replace multiple lines through out a project. For example:</p>
<pre><code>#include "../DiscreteIO/Discrete.h"
#include "../PCI/pci.h"
#include "../Arinc429/ARINC429.h"
</code></pre>
<p>with</p>
<pre><code>#include "../PCI/pci.h"
#include "../DiscreteIO/DiscreteHW.h"
#include "../Discret... | <p>sed will do what you want.</p>
<p>See the FAQ entry about exactly this here <a href="http://sed.sourceforge.net/sedfaq4.html#s4.23.3" rel="nofollow noreferrer">http://sed.sourceforge.net/sedfaq4.html#s4.23.3</a></p>
<blockquote>
<p>If you need to match a static block of
text (which may occur any number of
ti... | <p><a href="http://www.ultraedit.com/" rel="nofollow noreferrer">Ultraedit</a> can do that. I parted with money for it.</p>
<p>There is <a href="http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/multiline_find_replace.html" rel="nofollow noreferrer">a tutorial on multi-line find & replace</a> which y... | 33,630 |
<p>I have a page that has an iframe</p>
<p>From one of the pages within the iframe I want to look back and make a panel on the default page invisible because it is overshadowing a popup</p>
<p>I tried using Parent.FindControl but it does not seem to be working. I am positive I have the right id in the findcontrol bec... | <p>I didn't completely follow your problem, but I'll take my best shot.</p>
<p>It sounds like you have an ASP.NET page, that has an iframe in it that refers to another ASP.NET page, and in that page that was requested by the iframe you want to modify the visibility of the item contained in the page that contains the i... | <p>For starters, <em>FindControl</em> isn't a function in Javascript.</p>
| 15,053 |
<p>I'm on SQL Server 2005 and I am getting an error which I am pretty sure should not be getting.</p>
<pre><code>Msg 512, Level 16, State 1, Procedure spGetSavedSearchesByAdminUser, Line 8 Subquery
returned more than 1 value. This is not permitted when the subquery
follows =, !=, <, <= , >, >= or when the ... | <p>Try rearranging the query so that the boolean expression occurs inside the subselect, e.g.</p>
<pre><code>ALTER PROCEDURE [dbo].[spGetSavedSearchesByAdminUser]
@strUserName varchar(50)
,@bitQuickSearch bit = 0
AS
BEGIN
SELECT [intSearchID] ,strSearchTypeCode ,[strSearchName]
FROM [tblAdminSearc... | <p>I don't know that you can use the CASE statement inside of an IN clause like that. I'd suggest rewriting that bit to:</p>
<pre><code>WHERE strUserName = @strUserName AND (
(@bitQuickSearch = 1 AND strSearchTypeCode = 'Quick')
OR
(strSearchTypeCode IN (SELECT strSearchTypeCode FROM tblAdvanceSearchTypes))
)... | 19,742 |
<p>I would like to know the simplest and most effective way to open and write data to a socket in the C programming language for network programming.</p>
| <p>You're right, using sockets in C has a difficult syntax. Later languages like Java and Python make it a snap by comparison. The best tutorial I've found for doing socket programming in C is <a href="http://beej.us/guide/bgnet/html/multi/index.html" rel="nofollow noreferrer">Beej's Guide to Network Programming</a>.... | <p>Reading and writing from basic sockets is not any harder than reading and writing normal files (just use recv instead of read and send instead if write). Things get a little trickey when you need to open a socket. The reason for that is because there are many different ways to communicate using sockets (TCP, UDP, ... | 39,610 |
<p>In terms of Java, when someone asks: </p>
<blockquote>
<p>what is polymorphism?</p>
</blockquote>
<p>Would <strong>overloading</strong> or <strong>overriding</strong> be an acceptable answer?</p>
<p>I think there is a bit more to it than that. </p>
<p><em>IF you had a abstract base class that defined a method ... | <p>The clearest way to express polymorphism is via an abstract base class (or interface)</p>
<pre><code>public abstract class Human{
...
public abstract void goPee();
}
</code></pre>
<p>This class is abstract because the <code>goPee()</code> method is not definable for Humans. It is only definable for the subc... | <p>Polymorphism relates to the ability of a language to have different object treated uniformly by using a single interfaces; as such it is related to overriding, so the interface (or the base class) is polymorphic, the implementor is the object which overrides (two faces of the same medal)</p>
<p>anyway, the differen... | 18,686 |
<p>I'm implementing an Apache 2.0.x module in C, to interface with an existing product we have. I need to handle FORM data, most likely using POST but I want to handle the GET case as well.</p>
<p>Nick Kew's <A href="https://rads.stackoverflow.com/amzn/click/com/0132409674" rel="nofollow noreferrer" rel="nofollow nore... | <p>I switched to G-WAN which offers a transparent ANSI C scripts interface for GET and POST forms (and many other goodies like charts, GIF I/O, etc.).</p>
<p>A couple of AJAX examples are available at the <a href="http://gwan.com/developers" rel="nofollow">GWAN developer page</a></p>
<p>Hope it helps!</p>
| <p>While, on it's surface, this may seem common, cgi-style content handlers in C on apache are pretty rare. Most people just use CGI, FastCGI, or the myriad of frameworks such as mod_perl.</p>
<p>Most of the C apache modules that I've written are targeted at modifying the particular behavior of the web server in spec... | 12,988 |
<p>My table has a large number of columns. I have a command to copy some data - think of it as cloning a product - but as the columns may change in the future, I would like to only select everything from the table and only change the value of one column without having to refer to the rest.</p>
<p>Eg instead of:</p>
<... | <p>You could do this:</p>
<pre><code>create table mytable_copy as select * from mytable;
update mytable_copy set id=new_id;
insert into mytable select * from mytable_copy;
drop table mytable_copy;
</code></pre>
| <p>i've never worked with db2 but in mssql you could solve it with following procedure. this solution only works if you dont care what new id the items get.</p>
<p>1.) create new table with same scheme but where the id column incrementes automatically. (mssql "identitity specification = 1, identity increment = 1)</p>
... | 45,912 |
<p>I have a Glade GUI description file with a <code>GtkTreeView</code> in a <code>GtkHBox</code> in a window; and there's a handler for the <code>row_activated</code> signal. Now, Glade has automatically set the "events" property (inherited from <code>GtkWidget</code>) of that treeview to some value (<code>GDK_POINTER_... | <p>It's a bug in glade, it always sets the event property of widgets it create. It has no notion of the default value of a property so it always sets it.</p>
| <p>Doesn't this mask indicate the events you're willing to receive? In this case, you'll probably want to receive notification that the user has clicked or double-clicked an item in the GtkTreeView, and you'll want to register callbacks to handle these events.</p>
| 9,008 |
<p>I have the same problem as <a href="https://www.thingiverse.com/groups/tevo-tarantula-owners/forums/general/topic:29448" rel="nofollow noreferrer">this person</a> but I don't have those lines in my <code>RAMPS.h</code> file as seen <a href="http://joxi.ru/DmBgR75UNe8k52.png" rel="nofollow noreferrer">here</a>.</p>
... | <p>Another <a href="https://3dprinting.stackexchange.com/questions/3925/how-to-switch-motor-outputs-and-use-e1-as-x-in-marlin-firmware/5786#5786">posting</a> already discusses how you can change the pins to use spare stepper controllers for broken controllers by changing the pin layout. Assuming you are using a RAMPS b... | <p>the fastest way is to slice using two extruders and assign all print work to E1.
Set the head offsets to [0,0] and that shall do the job.</p>
<p>The harder is to edit pins file and do remapping.</p>
| 880 |
<p>I know about Application.Exit() but what if I'm not in a windows forms application but in a simple class library, how do I signal for the application to exit?</p>
| <p>Environment.Exit() -- but why would you ever want to do this from a method in a class library?</p>
| <p>P/Invoke <a href="http://msdn.microsoft.com/en-us/library/ms682658(VS.85).aspx" rel="nofollow noreferrer">ExitProcess</a>, perhaps. Or if you're really in a hurry, <a href="http://msdn.microsoft.com/en-us/library/ms686714(VS.85).aspx" rel="nofollow noreferrer">TerminateProcess</a>.</p>
| 21,288 |
<p>After following the instructions in INSTALL.W64 I have two problems:</p>
<ul>
<li>The code is still written to the "out32" folder. I need to be able to link to both 32-bit and 64-bit versions of the library on my workstation, so I don't want the 64-bit versions to clobber the 32-bit libs.</li>
<li>The output is sti... | <p>To compile the static libraries (both release and debug), this is what you need to do:</p>
<ol>
<li>Install Perl - <a href="http://www.activestate.com/activeperl/downloads" rel="noreferrer">www.activestate.com</a></li>
<li>Run the "Visual Studio 2008 x64 Cross Tools Command Prompt" (Note: The regular command prompt... | <p>You can also use MSYS+<a href="http://mingw-w64.sourceforge.net" rel="nofollow noreferrer">mingw-w64</a>:</p>
<p>1) download and extract msys to C:\msys<br>
2) download and extract mingw-w64 to c:\mingw64<br>
3) run msys postinstall script. When it asks for your mingw installation, point it to C:\mingw64\bin<br>
4)... | 19,130 |
<p>I've set up wildcard mapping on IIS 6, by adding "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll", and ensured "Verify that file exists" is not checked :</p>
<ul>
<li>on the "websites" directory in IIS</li>
<li>on the website</li>
</ul>
<p>However, after a iisreset, when I go to <a href="http://mys... | <p>You need to add an HTTP Handler in your web config for gif files:</p>
<pre><code> <system.web>
<httpHandlers>
<add path="*.gif" verb="GET,HEAD" type="System.Web.StaticFileHandler" validate="true"/>
</httpHandlers>
</system.web>
</code></pre>
<p>That forces .Net to han... | <p>You can try use custom errors to do this.
Go into Custom Errors in you Website properties and set the 404 to point to a URL in your site. Like /404.aspx is that exists.</p>
<p>With aspnet_isapi, you want to use a HttpModule to handle your wildcards.
like <a href="http://urlrewriter.net/" rel="nofollow noreferrer">h... | 12,677 |
<p>I am pretty new to both Struts and Spring. I need to know how to access a Spring Service in a Struts ActionForm. Even a pointer in the right direction would be appreciated.</p>
| <p>From a struts 1 ActionForm class you'll be needing:</p>
<pre><code>WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean("yourService");
</code></pre>
| <p>Normally you add the spring contextloader listener to your web xml.</p>
<pre><code><listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</code></pre>
<p>Then you add </p>
<pre><code><constant name="struts.objectFactory" value="sp... | 46,135 |
<p><a href="http://www.realtimesoft.com/ultramon/" rel="noreferrer">Ultramon</a> is a great program for dual monitors (stretching screen across monitors), but I was wondering if there is any way do to something in Visual Studio like have one tab of code open on one monitor and a second tab of code open on the second mo... | <p>Personally, I have my windows set up so that one my main monitor, I have the main visual studio monitor, so therefore my code window, maximized, with only the toolbox docked, on the left. This means the code window takes up as much space as possible, while keeping the left hand edge of the code close to the middle o... | <p>You could try right-clicking a file in solution explorer, Open With, and then go find devenv.exe. That will open it up in a new instance of VS. Plus, it saves devenv as one of your default options in the future, so you don't have to go hunting around for devenv all the time. Not beautiful, but an option.</p>
| 2,863 |
<p>Has anyone found a good class, or other file that will convert a .doc file into html or something that I can read and turn into html? </p>
<p>I have been looking around for a couple hours now and have only found ones that require msword on the server in order to convert the file. I am pretty sure that is not an opt... | <p>intall and use abiword, like this: </p>
<pre><code>AbiWord --to=html archivo.doc
</code></pre>
<p>you can call this command from php. </p>
| <p>Install open office on your system and run this on the command line:</p>
<p>/usr/bin/soffice -headless "macro:///Standard.Convert.SaveAsHtml(test.doc)"</p>
| 31,648 |
<p>I'm working on something that needs a webpage to go full screen. The screen must become completely white. </p>
<p>Is there anyway that I can do this without flash or silverlight?
Thanks in advance</p>
<p>edit: Im not trying to force anybody into fullscreen, this will be mainly used by a couple of people. Even so ... | <p>You cant do full screen, because of security reasons the title bar is still there and so on in different browsers.</p>
<p>But a way could be to make the window larger than the screen, lets say 100 pixels wider and 100 pixels higher and position the window at -50, -50. I havent tried that but if there is no restrai... | <p>Well, I see that you are trying to simply have a button that will make the page full-screen; similar to the youtube full screen mode.</p>
<p>As well, I do NOT suggest using the "just hit <kbd>F11</kbd>" method, as people on Safari, or Mac in general, will be excluded.</p>
<p>You can use C#, which can be done by do... | 37,346 |
<p>So I've been trying to learn the boost::asio stuff to communicate to a serial device using RS232. The documementation is sparse and the examples are non-existent. Can't figure out exactly how to communicate with the device. The device can't send data so all I need to do is write, but other projects require actual... | <p>In addition to the baud rate, you may also need to set other options like: character_size, flow_control, parity and stop_bits. To write your data to the serial port you can do the following:</p>
<pre><code>boost::asio::write(port, boost::asio::buffer(commands, 4));
</code></pre>
<p>The libraries acceptance of buff... | <p>If you are wondering why his example gives a compile error, change CSIZE to C_SIZE on both lines. This is probably the only good example program on the web.<br>
<a href="https://stackoverflow.com/questions/12641149/serial-port-configuration-using-boost-asio">Thanks</a>. </p>
| 33,585 |
<p>I have a table with some duplicate rows. I want to modify only the duplicate rows as follows.</p>
<p>Before:</p>
<pre><code>id col1
------------
1 vvvv
2 vvvv
3 vvvv
</code></pre>
<p>After:</p>
<pre><code>id col1
------------
1 vvvv
2 vvvv-2
3 vvvv-3
</code></pre>
<p>Col1 i... | <p>This SQL will only update duplicates, but not the one with the lowest id :</p>
<pre><code>update tbl
set col1 = col1 + '-' + convert(varchar, id)
where exists(select * from tbl t where t.col1 = tbl.col1 and t.id < tbl.id)
</code></pre>
| <p>You might be able to do that with a sproc and cursors. I don't think it's possible in any reasonable select query.</p>
| 41,363 |
<p>I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather large (25 projects in the solution), I'd like to try VS 2008, since its theoretically faster with larger projects. </p>
<p>Before doing such thing, i'd like to know if what I've read is true: can I use VS2008 in ".net 2.0" mode? I ... | <p>yes, vs2008 can "<a href="http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx" rel="nofollow noreferrer">target</a>" a framework, but i think by default, if converting from vs2005 - vs2008 it just keeps it at framework 2.0</p>
| <p>Yes, the feature that enables this is Visual Studio 2008 is called multi-targeting. See <a href="http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx" rel="nofollow noreferrer">this link</a> for more information. To use it you simply open the Properties for your Project, and select ... | 5,033 |
<p>I've worked on a number of CMS systems using the .NET platform (the CMS management system is in ASP.NET, and the site which renders the content is both ASP.NET and PHP).</p>
<p>I've traditionally stored the generated content in classes that serialize to XML, which is stored in MSSQL 2005/2008 in a varchar(max) fiel... | <p>I personally treat the data as any other data that would be stored in the system, for example I have a module built for DNN that stores collection of text data, I have the following collection of columns in a table for it.</p>
<ul>
<li>EntryId</li>
<li>UpdatedBy</li>
<li>UpdatedDate</li>
<li>CreatedBy</li>
<li>Crea... | <p>In our CMS we use a similar structure to the one Mitchel Sellers describe, but we separate the content in its own table. This is useful when optimizing the database and allows us to easily share the functions for versioning of content. We then have one table per "entity type" like documents, products and so on, wher... | 40,370 |
<p>Could someone write-up a step by step guide to developing a C++ based plugin for FireFox on Windows? </p>
<p>The links and examples on <a href="http://www.mozilla.org/projects/plugins/" rel="nofollow noreferrer">http://www.mozilla.org/projects/plugins/</a> are all old and inaccurate - the "NEW" link was added to t... | <p>See also <a href="http://developer.mozilla.org/en/Plugins" rel="nofollow noreferrer">http://developer.mozilla.org/en/Plugins</a> . And yes, NPAPI plugins should work in Google Chrome as well.</p>
<p>[edit 2015: Chrome removes support for NPAPI soon <a href="http://blog.chromium.org/2014/11/the-final-countdown-for-n... | <p>It's fairly simple to make a plugin using NPAPI. The key header files you'll need from the Gecko distribution are npapi.h and npupp.h. You'll export functions from your plugin DLL or shared library with the names NP_Initialize, NP_Shutdown, NP_GetMIMEDescription, and NP_GetValue, and you'll need to also fill in th... | 8,850 |
<p>Several frameworks for writing web-based desktop-like applications have recently appeared. E.g. <a href="http://www.sproutcore.com/" rel="nofollow noreferrer">SproutCore</a> and <a href="http://cappuccino.org/" rel="nofollow noreferrer">Cappuccino</a>. Do you have any experience using them? What's your impression? D... | <p>Due to the speed issues these high-level frameworks cause for many larger (as in: non-trivial) applications, we only use plain jQuery. In our tests, all high-level frameworks broke down in situations where there are many draggable objects or many drop targets, and in situation where long lists (with >1000 entries) w... | <p>I don't have any experience with SproutCore or Capuccino. But have made attempts to use Dojo on top of Django for this kind of work. Can only tell you it's slow and buggy.</p>
| 17,846 |
<p>Did someone ever used a BIRT report in a desktop application. I'm comming from the .NET environment and there you can use Crystal Reports to show reports in desktop apps. Is this possible with BIRT too, without having to set up a server environment?</p>
<p>Can you give me some advice how to reach this goal?</p>
<p... | <p>If your desktop application is written using the Eclipse Rich Client Platform (RCP) it is trivial to add reporting. All you need to do is add the org.eclipse.birt.viewer plugin and then use it. </p>
<p>Here is an article that explains it:
<a href="http://digiassn.blogspot.com/2008/08/birt-launch-birt-rcp-applicat... | <p>It is possible and you can easily create a preview of the report in a JeditorPane, you have to download BIRT Runtime and then you can try with the example code posted in <a href="http://www.eclipse.org/forums/index.php/t/119253/" rel="nofollow">this</a> post on Eclipse forum.</p>
| 30,126 |
<p>I have a bunch of files (TV episodes, although that is fairly arbitrary) that I want to check match a specific naming/organisation scheme..</p>
<p>Currently: I have three arrays of regex, one for valid filenames, one for files missing an episode name, and one for valid paths.</p>
<p>Then, I loop though each valid-... | <blockquote>
<p>I want to add a rule that checks for
the presence of a folder.jpg file in
each directory, but to add this would
make the code substantially more messy
in it's current state..</p>
</blockquote>
<p>This doesn't look bad. In fact your current code does it very nicely, and Sven mentioned a good ... | <p>maybe you should take the approach of defaulting to: "the filename is correct" and work from there to disprove that statement:</p>
<p>with the fact that you only allow filenames with: 'show name', 'season number x episode number' and 'episode name', you know for certain that these items should be separated by a "-"... | 3,953 |
<p>I am using Vim for windows installed in Unix mode. Thanks to this site I now use the <code>gf</code> command to go to a file under the cursor.</p>
<p>I'm looking for a command to either:</p>
<ol>
<li>return to the previous file (similar
to <kbd>Ctrl</kbd>+<kbd>T</kbd> for ctags), or </li>
<li>remap <code>gf</code... | <p>I use <kbd>Ctrl</kbd>-<kbd>O</kbd></p>
| <p>I haven't looked at your <strong>gf</strong> command but I imagine it uses the <strong>:e</strong> or <strong>:find</strong> command.<br/>
Assuming that this is correct, simply replace the <b>:e</b> or <b>:find</b> with <b>:new</b> (or <b>:vnew</b> for a vertical split) and the file will open in a new window instead... | 16,173 |
<p>I would like to use SQL Reporting Services 2008 to generate my reports, but I want to use my own UI for specifying the report type, columns, parameters and everything. I want to be able to take these criteria, and then kick off an asynchronous request to SSRS and have the report emailed to me. Is this possible? I... | <p>Like Crystal Reports, ActiveReports and other report generators, SSRS has two basic elements behind each report: the SQL query and the report layout. No matter what tool you use for the SQL -- it can be inline SQL in the report or a call to a stored procedure -- it's going to be the same query. Multiple databases ar... | <p>I think you may be creating a rod for your own back to a certain extent as RS ships with a few interfaces for report creation.</p>
<p>Mind you the end product is an rdl file which is nothing but xml, so you can write them by hand if you really like.</p>
<p>Multiple data sources are supported, but combining them on... | 46,677 |
<p>I have following table structure:</p>
<pre><code>Table: Plant
PlantID: Primary Key
PlantName: String
Table: Party
PartyID: Primary Key
PartyName: String
PlantID: link to Plant table
Table: Customer
PartyID: Primary Key, link to Party
CustomerCode: String
</code></pre>
<p>I'd like to have Customer entity ... | <p>You can get these fields by using the reference path on the Entity Object. </p>
<p>To get the PartyName, use this syntax: <code>Customer.Party.PartyName</code></p>
<p>To get the PlantName, use this syntax: <code>Customer.Party.Plant.PlantName</code></p>
| <p>After some research, I came across this <a href="http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/010baca7-0d40-49a6-8fb3-466fb22471ac/" rel="nofollow noreferrer">thread</a> on MSDN that says you can create a read-only entity, which is enough of a downside to not use it alone, but it get... | 46,259 |
<p>I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 o... | <p>Go with 2.6 since that's what most libraries(pygame, wxpython, django, etc) target. </p>
<p>The differences in 3.0 aren't that huge, so transitioning to it later shouldn't be much of a problem.</p>
| <p>Be careful though. Libraries such as the mysql driver are still in 2.5</p>
| 44,922 |
<p>I'm doing a sitemap producer in Object Pascal and need a good function or lib to emulate the <a href="http://php.net/manual/en/function.parse-url.php" rel="nofollow noreferrer">parse_url</a> function on PHP.</p>
<p>Does anyone know of any good ones?</p>
| <p>Freepascal has the unit URIParser with the ParseURI function. An example how to use it can be found in one of the example in <a href="http://svn.freepascal.org/cgi-bin/viewvc.cgi/tags/release_2_2_2/packages/fcl-net/examples/testuri.pp?revision=11487&view=markup" rel="nofollow noreferrer">Freepascal's source</a>.... | <p>The <a href="http://www.ietf.org/rfc/rfc2396.txt" rel="nofollow noreferrer">URI RFC</a> lists this regular expression for URI parsing:</p>
<pre><code> ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
12 3 4 5 6 7 8 9
</code></pre>
<p>Where the numbers are these group... | 15,103 |
<p>For large <code>n</code> (see below for how to determine what's large enough), it's safe to treat, by the central limit theorem, the distribution of the sample mean as normal (gaussian) but I'd like a procedure that gives a confidence interval for any <code>n</code>. The way to do that is to use a Student T distrib... | <p>Here's an article on <a href="http://www.johndcook.com/standard_deviation.html" rel="nofollow noreferrer">how to compute the mean and standard deviation in a single pass</a>, not storing any data. Once you have the these two statistics, you can estimate a confidence interval. A 95% confidence interval would be <code... | <p>I think you can. I'd have to Google/Wikipidia for it so I'll leave that as an exercise for the reader.</p>
| 35,790 |
<p>I have a weird problem with a dropdownbox selectedIndex always being set to 0 upon postback. I'm not accidentally rebinding it in my code. In fact I've placed a breakpoint at the very first line of the page_load event and the value is already set to zero. The dropdown is in the master page of my project, I don't kno... | <p>Are you sure you are doing a postback and not a refresh? It is hard to help you without more context into the problem or a chunk of the code.</p>
| <p>This may simply be a syntax error, but shouldn't</p>
<pre><code> If Page.IsPostBack Then
GetUIValues()
Else
</code></pre>
<p>Look like this</p>
<pre><code> If NOT Page.IsPostBack Then
GetUIValues()
Else
</code></pre>
| 9,910 |
<p>I need to use the ReSharper Unit Test Runner to run my MSTest Unit Tests on VS 2008. I have heard of using "Gallio" to do this but I don't know what Gallio is (it seemed like some all purpose VS extensibility framework). Does anyone know the best way to run MSTest Unit Tests using ReSharper Test Runner?</p>
| <p>See:</p>
<p><a href="https://stackoverflow.com/questions/94057/using-resharper-unit-test-runner-for-mstest-via-gallio">Using Resharper Unit Test Runner for MSTest via Gallio</a></p>
<p>and</p>
<p><a href="http://www.jameskovacs.com/blog/IntroducingVstsUnitPluginForReSharper.aspx" rel="nofollow noreferrer">http://... | <p>I tried the latest ReSharper 4.5 nightly build (27 Feb 2009/#1181) and it works pretty well but I have to explictly add the tests or fixtures to a unit test session. I can't run all tests from the project or solution unfortunately.</p>
| 47,024 |
<p>What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int is in the range of valid values?</p>
| <pre><code>(char)myint;
</code></pre>
<p>for example:</p>
<pre><code>Console.WriteLine("(char)122 is {0}", (char)122);
</code></pre>
<p>yields:</p>
<blockquote>
<p>(char)122 is z</p>
</blockquote>
| <p>gimel's answer in PowerShell seems to be:</p>
<pre><code>> [char]65
A
> [char]48
0
> [char]97
a
</code></pre>
| 36,919 |
<p>I'm comparing between two techniques to create partitioned tables in SQL 2005.</p>
<ul>
<li>Use partitioned views with a standard version of SQL 2005 (described <a href="http://www.sqlservercentral.com/articles/SQL+Server+2005/61676/" rel="nofollow noreferrer">here</a>)</li>
<li>Use the built in partition in the En... | <p>Yes and no. Cases can be linked to each other, but if you're looking for a tree of cases (prerequisites and such), you need FogBugz 7 or later.</p>
<p>If you're using FogBugz 7.3 or greater, you can now use the <a href="http://www.fogcreek.com/fogbugz/plugins/plugin.aspx?ixPlugin=57" rel="nofollow noreferrer">Case ... | <p>FogBugz 7 now supports sub-cases. This may or may not solve your problem, depending on how you want to handle it.</p>
| 4,682 |
<p>Imagine the following scenario - we have Page1 which contains controls Control A and Control B.</p>
<p>Say Control A has a button, and on the click of this button we want Control B to react.
But we want to do this in an abstract fashion, i.e. we can't have Control B knowing anything about Control A, and vice versa.... | <ol>
<li>Control A should raise an event</li>
<li>The page housing the controls subscribes to the event & then calls the appropriate method in the other control</li>
<li>Control B should process the message()</li>
</ol>
| <p>Check out the <a href="http://www.codeplex.com/MEFContrib" rel="nofollow noreferrer">Managed Extensibility Framework</a> Contrib project. They have just a sample website that is just what you want.</p>
| 35,647 |
<p>Dependency injection seems to be a good thing. In general, should dependencies be injected at the methods that require them, or should they be injected in the contructor of the class?</p>
<p>See the samples below to demonstrate the two ways to inject the same dependency.</p>
<pre><code>//Inject the dependency int... | <p>The major benefit of constructor injection is that it allows your fields to be marked final. For example:</p>
<pre><code>class Foo {
private final Bar _bar;
Foo(Bar bar) {
_bar=bar;
}
}
</code></pre>
<p>The following page has a great list of the pro's and con's: <a href="http://code.google.com... | <p><a href="http://crazybob.org" rel="nofollow noreferrer">Crazy Bob Lee</a> says use constructor injection whenever possible. Only use method injection when you don't have control over instantiation (like in a servlet).</p>
| 26,233 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.