instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Is it possible to use a TabContainer inside a templated FormView like so:
</p>
<pre><code> <ItemTemplate>
<cc1:TabContainer ID="TabContainer1" runat="server">
<cc1:TabPanel ID="Tab1" runat="server">
<HeaderTemplate>Tab One</H... | <p>Haven't used the Tab container much but you need to define unique ID's for each element on the page. </p>
<pre><code><cc1:TabContainer ID="TabContainer1" runat="server">
<cc1:TabContainer ID="TabContainer2" runat="server">
</code></pre>
| <p>I solved this the hard way, by, changing the duplicate field names in each of the tabs.</p>
| 37,250 |
<p>How do I have two effects in jQuery run in <code>sequence</code>, not simultaneously? Take this piece of code for example:</p>
<pre><code>$("#show-projects").click(function() {
$(".page:visible").fadeOut("normal");
$("#projects").fadeIn("normal");
});
</code></pre>
<p>The <code>fadeOut</code> and the <code... | <p>You can supply a callback to the effects functions that run after the effect has completed.</p>
<pre><code>$("#show-projects").click(function() {
$(".page:visible").fadeOut("normal", function() {
$("#projects").fadeIn("normal");
});
});
</code></pre>
| <p>Does there have to be a target? surely you can use a random target to queue events sequentially so long as the target is constant...below I'm using the parent of an animation target to store the queue.</p>
<pre><code>//example of adding sequential effects through
//event handlers and a jquery event trigger
jQuery( ... | 10,072 |
<p>I'm looking for very simple obfuscation (like encrypt and decrypt but not necessarily secure) functionality for some data. It's not mission critical. I need something to keep honest people honest, but something a little stronger than <a href="http://en.wikipedia.org/wiki/ROT13" rel="noreferrer">ROT13</a> or <a href=... | <p>Other answers here work fine, but AES is a more secure and up-to-date encryption algorithm. This is a class that I obtained a few years ago to perform AES encryption that I have modified over time to be more friendly for web applications (e,g. I've built Encrypt/Decrypt methods that work with URL-friendly string). ... | <p>I think this is the worlds simplest one !</p>
<pre><code>string encrypted = "Text".Aggregate("", (c, a) => c + (char) (a + 2));
</code></pre>
<p>Test</p>
<pre><code> Console.WriteLine(("Hello").Aggregate("", (c, a) => c + (char) (a + 1)));
//Output is Ifmmp
Console.WriteLine(("Ifmmp").Aggregate... | 20,026 |
<p>I would like to know if there is some way to share a variable or an object between two or more Servlets, I mean some "standard" way. I suppose that this is not a good practice but is a easier way to build a prototype.</p>
<p>I don't know if it depends on the technologies used, but I'll use Tomcat 5.5</p>
<hr>
<p>... | <p>I think what you're looking for here is request, session or application data.</p>
<p>In a servlet you can add an object as an attribute to the request object, session object or servlet context object:</p>
<pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) {
String shared ... | <p>Here's how I do this with Jetty.</p>
<p><a href="https://stackoverflow.com/a/46968645/1287091">https://stackoverflow.com/a/46968645/1287091</a></p>
<p>Uses the server context, where a singleton is written to during startup of an embedded Jetty server and shared among all webapps for the life of the server. Can als... | 15,041 |
<p>I have an executable on Linux that loads <code>libfoo.so.1</code> (that's a <code>SONAME</code>) as one of its dependencies (via another shared library). It also links to another system library, which, in turn, links to a <strong>system</strong> version, <code>libfoo.so.2</code>. As a result, <strong>both</strong> <... | <p>You may be able to do some version script tricks:</p>
<p><a href="http://sunsite.ualberta.ca/Documentation/Gnu/binutils-2.9.1/html_node/ld_26.html" rel="noreferrer">http://sunsite.ualberta.ca/Documentation/Gnu/binutils-2.9.1/html_node/ld_26.html</a></p>
<p>This may require that you write a wrapper around your lib ... | <p>I can only come up with a work-around. Which would be to statically link a version of the "system library" that you are using. For your static build, you could make it link against the same old version as the third-party library. Given that it does not rely on the newer version...</p>
<p>Perhaps it is also possible... | 28,232 |
<p>I'm looking for a way to generate a set of random sided, but regular, polygons, inside a given rectangle or sector of a circle. To better explain, my given 2d space should have a random arrangement of regular polygons with various numbers of sides, so, e.g, if two hexagons are separated by a rectangle equal in leng... | <p>Another approach, I can think of:
First decide on how many objects you want. Say 'N'</p>
<p>Randomly Select 3 Points in your 2D Space.</p>
<p>Make use of 3 points to get a virtual triangle. </p>
<p>Now Select another point such a way that the point is outside the virtual triangle. Now form another virtual triangl... | <p>Generate N random points on a plane and extract the convex hull of the object (that is, if all polygons should be convex).</p>
<p>You can trivially reject before generating the convex hull if one of the points is inside another polygon. If it's not you still need to test the generated polygon against other polygons... | 46,920 |
<p>I'm planning to write a simple J2SE application to aggregate information from multiple web sources.</p>
<p>The most difficult part, I think, is extraction of meaningful information from web pages, if it isn't available as RSS or Atom feeds. For example, I might want to extract a list of questions from stackoverflow... | <p>You could look at how httpunit does it. They use couple of decent html parsers, one is nekohtml.
As far as getting data you can use whats built into the jdk (httpurlconnection), or use apache's </p>
<p><a href="http://hc.apache.org/httpclient-3.x/" rel="nofollow noreferrer">http://hc.apache.org/httpclient-3.x/</a><... | <p>In short, you may either parse the whole page and pick things you need(for speed I recommend looking at SAXParser) or running the HTML through a regexp that trims of all of the HTML... you can also convert it all into DOM, but that's going to be expensive especially if you're shooting for having a decent throughput.... | 9,701 |
<p>I know it's by design that you can't control what happens when an object is destroyed. I am also aware of defining some class method as a finalizer.</p>
<p>However is the ruby idiom for C++'s RAII (Resources are initialized in constructor, closed in destructor)? How do people manage resources used inside objects ... | <p>So that users don't "<em>have to remember to do the whole begin-rescue-ensure chacha</em>" combine <code>rescue</code>/<code>ensure</code> with <code>yield</code>.</p>
<pre><code>class SomeResource
...
def SomeResource.use(*resource_args)
# create resource
resource = SomeResource.new(*resource_args) # p... | <p>See <a href="http://www.rubycentral.com/pickaxe/tut_exceptions.html" rel="nofollow noreferrer">http://www.rubycentral.com/pickaxe/tut_exceptions.html</a></p>
<p>In Ruby, you would use an <code>ensure</code> statement:</p>
<pre><code>f = File.open("testfile")
begin
# .. process
rescue
# .. handle error
ensure
... | 26,382 |
<p>There are certain common components that are used across projects:</p>
<ol>
<li>User Authentication and Authorization</li>
<li>Exception Handling</li>
<li>Logging</li>
<li>E-mail</li>
<li>DataBase Access</li>
<li>Caching etc</li>
</ol>
<p>Is there a consistent design pattern that can be used for each of these comm... | <p>Perhaps not a pattern per se, but I've always thought that the spring annotations approach was quite clever. Essentially you annotate the methods that need to be secured. Providing that you have a nice tiered architecture then this should make things pretty straightforward! It does all of the hard work for you. <a h... | <p>I don't know for design patterns for the user authentication/authorization but... if you want to be able to mock them easily, in .NET we use Providers.</p>
<p>We can then configure which component we use for the authentication and authorization directly through our configuration file.</p>
<p>What do you think?</p>... | 29,528 |
<p>I was just wondering, since the <strong>sealed</strong> keyword's existence indicates that it's the class author's decision as to whether other classes are allowed to inherit from it, why aren't classes sealed by default, with some keyword to mark them explicitly as extensible?</p>
<p>I know it's somewhat different... | <p>I'd say it was just a mistake. I know many people (including myself) who believe that classes should indeed be sealed by default. There are at least a couple of people in the C# design team in that camp. The pendulum has swung somewhat away from inheritance since C# was first designed. (It has its place, of course, ... | <p>For the same reason why objects are not private by default</p>
<p>or</p>
<p>to be consistent with the object analogue, which is objects are not private by default</p>
<p>Just guessing, coz at the end of the day it's a language's design decision and what the creators say is the canon material.</p>
| 31,431 |
<p>Is it possible to run more than one website on IIS 5.1 (Windows XP)?</p>
<p>I'm able to create multiple websites through adminscripts in IIS, but only one website can be active at a time.</p>
<p>Is there is any workaround, trick, or script for this limitation?</p>
<p>Thanks,</p>
| <p>As far as I know, you can only have one active at any one time, but see <a href="http://www.codinghorror.com/blog/archives/000329.html" rel="nofollow noreferrer">this link</a> by Jeff for more info on how to uncripple IIS.</p>
| <p>Check the Port No for each website you created, By default you get port no 80. But here if you dont have Host Headers for the Application then you have to create Each website with each port no like 80, 8080, 8081...etc and try.</p>
| 31,025 |
<p>Is it possible to configure Visual Studio 2008 to automatically remove whitespace characters at the end of each line when saving a file? There doesn't seem to be a built-in option, so are there any extensions available to do this?</p>
| <p>CodeMaid is a very popular Visual Studio extension and does this automatically along with other useful cleanups.</p>
<ul>
<li>Download: <a href="https://github.com/codecadwallader/codemaid/releases/tag/v0.4.3" rel="noreferrer">https://github.com/codecadwallader/codemaid/releases/tag/v0.4.3</a></li>
<li>Modern Downl... | <p>This is a really good example of how to remove trailing whitespace. There are a few things that I would change based on what I discovered using this macro. First of all, the macro automatically converts tabs to spaces. This is not always desirable and could lead to making things worse for people that love tabs (t... | 10,865 |
<p>Ruby on Rails has a lot of ways to generate JavaScript. Particularly when it comes to Ajax. Unfortunately, there are a few problems that I often see with the JavaScript that it generates. </p>
<ul>
<li><p>Rails typically uses inline event handling.</p>
<pre><code><a onclick="somejavascript(); return false;" /&g... | <p>If you prefer jQuery you can use the <a href="http://ennerchi.com/projects/jrails" rel="nofollow noreferrer">jQuery on Rails Project</a>. A drop in to replace Prototype with jQuery.</p>
<p>Some of what Rails does with Javascript generation is good and some is bad. In the bad instances, write it yourself and keep ... | <p>Let Rails do as much as possible. Then when you have problems, start rewriting it with hand coded versions.</p>
| 27,644 |
<p>I have a C# .NET application with which I've created a custom image display control. Each image display represents its own display context and draws the image using glDrawPixels (Yes I know it would be better to use textures, I plan to in the futures but this app is already too far along and my time is limited).</p>... | <p>Its difficult telling what's wrong with what you do since you give so little detail. Here are some pointers which may help.<br>
- before doing something in a context, make sure you make it the current one. If you want to pan two contexts, make the first one current, pan it and then make the second one current and pa... | <p><code>Invalidate</code> doesn't force an immediate redraw. It marks the window invalid, and when the message queue runs out of other messages, a paint message will be created and processed. But that won't happen until you finish processing the current message and return to the main message loop, and it may be dela... | 41,302 |
<p>I need to resize PNG, JPEG and GIF files. How can I do this using Java?</p>
| <p>After loading the image you can try:</p>
<pre><code>BufferedImage createResizedCopy(Image originalImage,
int scaledWidth, int scaledHeight,
boolean preserveAlpha)
{
System.out.println("resizing...");
int imageType = preserveAlpha ? BufferedImage.TYPE_INT_RGB : BufferedI... | <p>I have developed a solution with the freely available classes ( AnimatedGifEncoder, GifDecoder, and LWZEncoder) available for handling GIF Animation.<br>
You can download the jgifcode jar and run the GifImageUtil class.
Link: <a href="http://www.jgifcode.com" rel="nofollow">http://www.jgifcode.com</a></p>
| 30,267 |
<p>Using LINQ to Entities sounds like a great way to query against a database and get actual CLR objects that I can modify, data bind against and so forth. But if I perform the same query a second time do I get back references to the same CLR objects or an entirely new set? </p>
<p>I do not want multiple queries to ge... | <p>Within the same DataContext, my understanding is that you'll always get the same objects - for queries which return full objects instead of projections.</p>
<p>Different DataContexts will fetch different objects, however - so there's a risk of seeing stale data there, yes.</p>
| <p>[oops; note that this reply applies to Linq-to-SQL, not Entity Framework.]</p>
<p>I've left it here (rather than delete) because it is partly on-topic, and might be useful.</p>
<hr>
<p>Further to the other replies, note that the data-context also has the ability to avoid doing a round-trip for simply "by primary ... | 35,435 |
<p>Given the following inheritance tree, what would be the best way of implementing it in a way that works?</p>
<pre><code>abstract class Foo<T> : IEnumerable<T>
{
public abstract Bar CreateBar();
}
class Bar<T> : Foo<T>
{
// Bar's provide a proxy interface to Foo's and limit access ni... | <p>Okay, new answer:</p>
<ol>
<li>Split Bar into an interface and a concrete class.</li>
<li>Express the public abstract method in terms of IBar.</li>
<li>Make Bar a private nested class in Foo, implementing IBar. Give it an internal constructor which you can call from Foo.</li>
<li>Write a protected method in Foo whi... | <p>C# doesn't provide a direct equivalent of the C++ friend keyword. Seems like your design is requiring this sort of construct.</p>
<p>In C++ you could designate that a specific class has access to the private/protected members of another class by using "friend". Note: this is not the same as C# internal, modifier ... | 24,397 |
<p>What is the difference between a <code>const_iterator</code> and an <code>iterator</code> and where would you use one over the other?</p>
| <p><code>const_iterator</code>s don't allow you to change the values that they point to, regular <code>iterator</code>s do.</p>
<p>As with all things in C++, always prefer <code>const</code>, unless there's a good reason to use regular iterators (i.e. you want to use the fact that they're not <code>const</code> to cha... | <p>(as others have said) const_iterator doesn't allow you modify the elements to which it points, this is useful inside of const class methods. It also allows you to express your intent.</p>
| 39,883 |
<p>OK since I am in a holding pattern on this issue perhaps someone has seen these symptoms and can provide some sage advice. (Note: I have learned only enough Active Directory information to build this feature and I only have read access to the Active Directory.)</p>
<p>I updated the company intranet to allow the au... | <p>Nobody has yet mentioned the obvious and trivial way to stack the letters of an arbitrary string vertically (without rotating them) using pure XAML:</p>
<pre class="lang-xml prettyprint-override"><code><ItemsControl
ItemsSource="Text goes here, or you could use a binding to a string" />
</code></pre>
<p>Th... | <p>I will offer a solution based on the converter:</p>
<pre class="lang-cs prettyprint-override"><code>using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;
namespace Converters
{
[ValueConversion(typeof(object), typeof(string))]
pub... | 45,527 |
<p>How can I continuously capture images from a webcam?</p>
<p>I want to experiment with object recognition (by maybe using java media framework). </p>
<p>I was thinking of creating two threads</p>
<p>one thread:</p>
<ul>
<li>Node 1: capture live image</li>
<li>Node 2: save image as "1.jpg"</li>
<li>Node 3: wait 5 ... | <p>This JavaCV implementation works fine.</p>
<p>Code:</p>
<pre><code>import org.bytedeco.javacv.*;
import org.bytedeco.opencv.opencv_core.IplImage;
import java.io.File;
import static org.bytedeco.opencv.global.opencv_core.cvFlip;
import static org.bytedeco.opencv.helper.opencv_imgcodecs.cvSaveImage;
public class Te... | <p>I believe the web-cam application software which comes along with the web-cam, or you native windows webcam software can be run in a batch script(windows/dos script) after turning the web cam on(i.e. if it needs an external power supply). In the bacth script , u can add appropriate delay to capture after certain tim... | 34,839 |
<p>Our application executes a long, hairy stored procedure with multiple result sets. The users are experiencing long wait times for this query, so I set out to determine what is causing the delay.</p>
<p>I put a Stopwatch on executing and reading the data, and it takes 6-7 seconds each time. I timed the execution o... | <p>When you execute a stored proc from a .Net command, the results will start streaming as soon as SQL has them ready. </p>
<p>This means that you may start seeing results in your .Net app before the entire stored proc has been executed. </p>
<p>Your bottleneck is probably in the stored procedure, run a sql server tr... | <p>The answer will be dependent on what RDBMS you are using.</p>
<p>If its SQL Server and .NET then from my experience:</p>
<ol>
<li>Check other open transactions on the same connection which is used to invoke the sproc. They may have row locks on the table one of your selects is executing against. You can try addi... | 28,553 |
<p>My application pops a form as a child of the main form. On the form is<br>
User Control with a Panel where Graphics are rendered. When executed
from Visual Studio in debug mode the drawing is often rendered as expected,
imagine a simply XY graph. If the panel's graphic aren't drawn then adding
two or three break poi... | <p>Ctrl + Space in immediate if you don't have the intellisense coming up automatically. Like Joel, intellisense seems to come in go in the immed window.</p>
| <p>When debugging in Visual Studio 2008, you can get intellisense to pop up by pressing ctrl+space. Also, it will pop up in a quick watch window with the same keystroke. Very handy.</p>
| 36,698 |
<p>I'm writing a service that has five different methods that can take between 5 seconds and 5 minutes to run.</p>
<p>The service will schedule these different methods to run at different intervals.</p>
<p>I don't want any of the methods to run concurrently, so how do I have the methods check to see if another method... | <p>If you want <em>simple</em>, and all the methods are in the same class, ou can just use <code>[MethodImpl]</code>:</p>
<pre><code>[MethodImpl(MethodImplOptions.Synchronized)]
public void Foo() {...}
[MethodImpl(MethodImplOptions.Synchronized)]
public void Bar() {...}
</code></pre>
<p>For instance methods, this lo... | <p>In general, I strongly discourage using the MethodImpl(MethodImplOptions.Synchronized) attribute to do thread synchronization. If you are going to do multi-threaded programming you really should think very carefully about exactly where and how you should be locking.</p>
<p>I may be exaggerating a bit but I find too... | 42,430 |
<p>What are the advantages and limitations of dynamic type languages compared to static type languages?</p>
<p><strong>See also</strong>: <a href="https://stackoverflow.com/questions/42934/whats-with-the-love-of-dynamic-languages">whats with the love of dynamic languages</a> (a far more argumentative thread...)</p>
| <p>The ability of the interpreter to deduce type and type conversions makes development time faster, but it also can provoke runtime failures which you just cannot get in a statically typed language where you catch them at compile time. But which one's better (or even if that's always true) is hotly discussed in the co... | <p><strong>Static Typing:</strong>
The languages such as Java and Scala are static typed.</p>
<p>The variables have to be defined and initialized before they are used in a code.</p>
<p>for ex.
int x;
x = 10;</p>
<p>System.out.println(x);</p>
<p><strong>Dynamic Typing:</strong>
Perl is an dynamic typed language.</p>... | 15,237 |
<p>Anybody knows how to do this? I got all the information of the email (body, subject, from , to, cc, bcc) and need to generate an .eml file out of it.</p>
| <p>You can construct <a href="https://javaee-spec.java.net/nonav/javadocs/javax/mail/internet/MimeMessage.html" rel="noreferrer"><code>javax.mail.Message</code></a> object (or have it already constructed from the mail server) and then you can use <a href="https://javaee-spec.java.net/nonav/javadocs/javax/mail/internet/... | <p>If you want to add HTML Stuff you have to add </p>
<pre><code>content.setHeader("Content-Type", "text/html");
</code></pre>
<p>(as Marco Sulla said) but also change</p>
<pre><code>message.setContent(multipart);
</code></pre>
<p>to</p>
<pre><code>message.setContent(multipart,"text/html");
</code></pre>
| 19,020 |
<p>I have a view that I would like the user to rotate around its center, by tapping and holding somewhere and just move their finger round and round.</p>
<p>I have all the geometry worked out; What I do is store the initial touch angle relative to the center as offsetAngle, then my touchesMoved method looks like this:... | <p>I would use the coordinate system of the superview, since it is unaffected by the rotation:</p>
<pre><code>- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint location = [[touches anyObject] locationInView:self.superview];
CGPoint relativeTouch = [MathHelper translatePoint:location re... | <p>Just save the original transform in an ivar and call it a day.</p>
| 38,076 |
<p>I have a table that got into the "db_owner" schema, and I need it in the "dbo" schema.</p>
<p>Is there a script or command to run to switch it over?</p>
| <p>In SQL Server Management Studio:</p>
<ol>
<li>Right click the table and select modify (it's called "Design" now)<br></li>
<li>On the properties panel choose the correct owning schema.</li>
</ol>
| <p>You need to firstly stop all connections to the database, change the ownership of the tables that are 'db_owner' by running the command </p>
<pre><code>sp_MSforeachtable @command1="sp_changeobjectowner ""?"",'dbo'"
</code></pre>
<p>where ? is the table name.</p>
| 11,510 |
<p>Is there a practical algorithm that gives "multiplication chains"</p>
<p>To clarify, the goal is to produce a multiplication change of an <b>arbitrary and exact </b> length<br>
Multiplication chains of length 1 are trivial.</p>
<p>A "multiplication chain" would be defined as 2 numbers, {start} and {multiplier}, us... | <p>You are asking for nontrivial solutions to the following modular equation:</p>
<pre><code>s * m^N = C (mod 2^D)</code></pre>
<p>where</p>
<ul>
<li>s is the starting constant</li>
<li>m is the multiplier</li>
<li>N is the number of iterations (given by the problem)</li>
<li>C is the final constant (given by the pr... | <p>Why wouldn't this satisfy the requirements?</p>
<pre><code>start = constant;
multiplier = 1;
</code></pre>
<p>Update: I see now that the number of loops is one of the input parameters. It sounds like this problem is a special case of, or at least related to, the <a href="http://mathworld.wolfram.com/DiscreteLogari... | 31,884 |
<p>I am able to serialize an object into a file and then restore it again as is shown in the next code snippet. I would like to serialize the object into a string and store into a database instead. Can anyone help me?</p>
<pre><code>LinkedList<Diff_match_patch.Patch> patches = // whatever...
FileOutputStream fil... | <p>Sergio:</p>
<p>You should use <a href="http://docs.oracle.com/javase/6/docs/api/java/sql/Blob.html" rel="noreferrer">BLOB</a>. It is pretty straighforward with JDBC. </p>
<p>The problem with the second code you posted is the encoding. You should additionally encode the bytes to make sure none of them fails.</p>
... | <p>you can use UUEncoding</p>
| 16,279 |
<p>I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. </p>
<p>For example, let's say I have three files. Using <a href="http://docs.python.org/library/functions.html#execfile" rel="noreferrer">execfile</a>:</p>
<ul>
<li><code>script_1.py<... | <p>p1.py:</p>
<pre><code>execfile("p2.py")
</code></pre>
<p>p2.py:</p>
<pre><code>import inspect, os
print (inspect.getfile(inspect.currentframe())) # script filename (usually with path)
print (os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) # script directory
</code></pre>
| <p>I used the approach with __file__<br>
<code>os.path.abspath(__file__)</code><br>
but there is a little trick, it returns the .py file
when the code is run the first time,
next runs give the name of *.pyc file<br>
so I stayed with:<br>
<code>inspect.getfile(inspect.currentframe())</code><br>
or<br>
<code>sys._getfr... | 7,327 |
<p>To complete some testing I need to load the 64 bit version of an assembly even though I am running a 32 bit version of Windows. Is this possible?</p>
| <p>I'm not sure why you would want to do this, but I suppose you could. If you don't do anything to tell it otherwise, the CLR will load the version of the assembly that is specific to the CPU you are using. That's usually what you want. But I have had an occasion where I needed to load the neutral IL version of an ... | <p>32 bit Windows can not run 64 bit executables without a VM/emutalor</p>
<p>32 bit Windows can compile for execution on 64 bit Windows</p>
| 13,277 |
<p>In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a <code>std::string</code>).<br>
<a href="http://rapidxml.sourceforge.net/" rel="nofollow noreferrer">RapidXml</a> has been recommended to me, but I can't see how to retrieve the XML back as a text stri... | <p>Althoug the documentation is poor on this topic, I managed to get some working code by looking at the source. Although it is missing the xml header which normally contains important information. Here is a small example program that does what you are looking for using rapidxml:</p>
<pre><code>#include <iostream&g... | <p>If you aren't yet committed to Rapid XML, I can recommend some alternative libraries:</p>
<ul>
<li><p>Xerces - This is probably the defacto C++ implementation.</p></li>
<li><p>XMLite - I've had some luck with this minimal XML implementation. See the article at <a href="http://www.codeproject.com/KB/recipes/xmlite.... | 5,896 |
<p>Specifically this is regarding when using a client session cookie to identify a session on the server.</p>
<p>Is the best answer to use SSL/HTTPS encryption for the entire web site, and you have the best guarantee that no man in the middle attacks will be able to sniff an existing client session cookie?</p>
<p>And... | <p>Encrypting the session value will have zero effect. The session cookie is already an arbitrary value, encrypting it will just generate another arbitrary value that can be sniffed.</p>
<p>The only real solution is HTTPS. If you don't want to do SSL on your whole site (maybe you have performance concerns), you might ... | <p>Protect by:</p>
<pre><code>$ip=$_SERVER['REMOTE_ADDER'];
$_SESSEION['ip']=$ip;
</code></pre>
| 4,290 |
<p>I am coding a feature in a program where users can edit documents stored in a database, it saves the document to a temporary folder then uses Process.Start to launch the document into the editing application, let's say Microsoft Word for example.</p>
<p>Then my app needs to wait until they've closed the called proc... | <p>Personally I'm not sure I agree with this approach at all. Displaying a modal form might get you out of this situation, but in most cases when a solution seems hard to find, it's helpful to change the problem you're trying to solve.</p>
<p><strong>Option 1:</strong></p>
<p>In this case, I'd recommend a checkout/c... | <p>I'm not sure about the starting a new process, but have you considered this logic for waiting until exit:</p>
<p>while (Process.IsRunning) {}</p>
<p>basically just a holder loop until your process is done.</p>
| 38,973 |
<p>What is the difference in ASP/VBScript between <code>Int()</code> and <code>CInt()</code>?</p>
| <ul>
<li><a href="http://www.w3schools.com/Vbscript/func_int.asp" rel="noreferrer">Int()</a></li>
</ul>
<blockquote>
<p>The Int function returns the integer part of a specified number.</p>
</blockquote>
<ul>
<li><a href="http://www.w3schools.com/VBScript/func_cint.asp" rel="noreferrer">CInt()</a></li>
</ul>
<block... | <p>Here is another difference:</p>
<p>Script:</p>
<pre><code>wscript.echo 40.91 * 100
wscript.echo Int(40.91 * 100)
wscript.echo CInt(40.91 * 100)
</code></pre>
<p>result:</p>
<pre><code>4091
4090 (????)
4091
</code></pre>
<p>Any thoughts?</p>
| 4,100 |
<p>Let's assume that some developer in my team shelved his changes that he did in branch A. And I am working on branch B. Can I unshelve his changes into branch B? (By GUI or command prompt) </p>
| <p>The <a href="http://msdn.microsoft.com/en-us/vstudio/bb980963.aspx" rel="noreferrer">Visual Studio Power Tools</a> should let you do this.</p>
<pre><code>C:\src\2\Merlin\Main>tfpt unshelve /?
tfpt unshelve - Unshelve into workspace with pending changes
Allows a shelveset to be unshelved into a workspace with pe... | <p>I spent good amount of time to get this done and I had few issues to overcome. It is possible but here few issues and few rules to follow to avois these issues </p>
<p>Error:</p>
<blockquote>
<p>unable to determine the workspace</p>
</blockquote>
<p>This particular issue was solved by running the command from <... | 14,287 |
<p>I'm very happy with the output from SandCastle, but I would also like to have some search functionality included in the HTML output, is this possible?</p>
| <p>The Website output from SandCastle Help File Builder contains <strong>index.aspx</strong> and <strong>index.html</strong>.</p>
<p>If you display <strong>index.html</strong> then you don't get the search or index options:
<a href="http://www.ewoodruff.us/shfbdocs/index.html" rel="noreferrer">http://www.ewoodruff.us/... | <p>According the the <a href="http://shfb.codeplex.com/" rel="nofollow">site</a> it is, but I have not looked at how to configure it:</p>
<blockquote>
<p>The website output contains an HTML
and an ASP.NET index page with tree
view that can be used to navigate the
table of contents and a full-text
index searc... | 44,723 |
<p>Can you give me some pointers on making C# code and Java code interoperate?
Let's define the interoperation as something simple: allow (from Java code) the instantiantion and method calling of a class defined in C#, and, possibly, the other way around as well.</p>
<p>Is this even possible <em>natively</em>? (i.e. ... | <p>I've used <a href="http://www.ikvm.net/" rel="nofollow noreferrer">IKVM</a> to accomplish this successfully.</p>
| <p>There are a few third-party products that can do .NET-Java interop natively. <a href="http://j-integra.intrinsyc.com/" rel="nofollow noreferrer">J-Integra</a> is the one I'm most familiar with (I don't work for them nor do I have any economic interest in them).</p>
<p>If you're ok with proxies and the like, you hav... | 23,270 |
<p>Boost is a very large library with many inter-dependencies -- which also takes a long time to compile (which for me slows down our <a href="http://cruisecontrol.sourceforge.net/" rel="noreferrer"><strong>CruiseControl</strong></a> response time).</p>
<p>The only parts of boost I use are boost::regex and boost::form... | <p>First, you can use the bcp tool (can be found in the tools subfolder) to extract the headers and files you are using. This won't help with compile times, though. Second, you don't have to rebuild Boost every time. Just pre-build the lib files once and at every version change, and copy the "stage" folder at build tim... | <p>Precompiled headers are the word of the day! Include the boost headers you need in your precompiled header - tada!</p>
| 20,890 |
<p>I have some HTML that is generated via a Rich Text Editor outside of my Flex application but would like to display it inside Flex. </p>
<p>The HTML is simple HTML tags, things like styles, anchors, and possibly image tags, is there a control that would let me render this HTML in flex or am I going to have to roll u... | <p>If the HTML is <em>really</em> simple, you can display it in a normal label or textarea component, If it is more complex, I'll quote what I answered <a href="https://stackoverflow.com/questions/22909/is-there-some-way-to-show-html-content-inside-flash">in this question</a>. The discussion there also has a little mor... | <p>@mmattax</p>
<p>Indeed you can display images in a TextArea component. The approach <a href="http://aralbalkan.com/239" rel="nofollow noreferrer">is not entirely without problems though</a>...</p>
| 7,384 |
<p>How do I <code>grep</code> and show the preceding and following 5 lines surrounding each matched line?</p>
| <p>For <strong>BSD</strong> or <strong>GNU</strong> <code>grep</code> you can use <code>-B num</code> to set how many lines before the match and <code>-A num</code> for the number of lines after the match.</p>
<pre><code>grep -B 3 -A 2 foo README.txt
</code></pre>
<p>If you want the same number of lines before and af... | <pre><code>$ grep thestring thefile -5
</code></pre>
<p><code>-5</code> gets you <code>5</code> lines above and below the match 'thestring' is equivalent to <code>-C 5</code> or <code>-A 5 -B 5</code>.</p>
| 3,055 |
<p>Has anyone had a chance to dig into how <a href="http://blogs.msdn.com/andrewkennedy/archive/2008/08/20/units-of-measure-in-f-part-one-introducing-units.aspx" rel="noreferrer">F# Units of Measure</a> work? Is it just type-based chicanery, or are there CLR types hiding underneath that could (potentially) be used fro... | <p>According to a <a href="http://blogs.msdn.com/andrewkennedy/archive/2008/08/22/units-of-measure-in-f-part-two-unit-conversions.aspx#8920660" rel="noreferrer">response</a> on the next related blog post, they are a purely static mechanism in the F# compiler. So there is no CLR representation of the units data.</p>
<p... | <p>The best (and I think official) place to find out about this is on Andrew Kennedy's blog.</p>
<p>Here are the (current) relevant posts.</p>
<ul>
<li><a href="https://learn.microsoft.com/en-us/archive/blogs/andrewkennedy/units-of-measure-in-f-part-one-introducing-units" rel="nofollow noreferrer">Units of Measure in F... | 6,211 |
<p>What do you think is the best set-up for RoR in a Win Vista environment? I've tried the radrails eclipse plug-in, and it just seemed too bulky for me, I've also started to just use Textpad and the command line, but I'm used to having somewhat of an IDE to work with.</p>
| <p>I don't know about "best", because that's a subjective question, but I can tell you what setup I use and recommend:</p>
<p><strong>Editor</strong>: <a href="http://e-texteditor.com" rel="noreferrer">E Text Editor</a><br>
TextMate seems to be the editor of choice for Rails on Mac. E Text Editor is essentially TextMa... | <p>You might want to take a look at this:</p>
<p><a href="http://www.sapphiresteel.com/" rel="nofollow noreferrer">http://www.sapphiresteel.com/</a></p>
<p>There's a free personal edition too</p>
<p>(Updated: Assuming that you already have Visual Studio Full Fat Edition)</p>
| 2,554 |
<p>I have a List of strings that is regenerated every 5 seconds. I want to create a Context Menu and set its items dynamically using this list.
The problem is that I don't have even a clue how to do that and manage the Click action for every item generated (which should use the same method with different parameter DoSo... | <p>So, you can clear the items from the context menu with:</p>
<pre><code>myContextMenuStrip.Items.Clear();
</code></pre>
<p>You can add an item by calling:</p>
<pre><code>myContextMenuStrip.Items.Add(myString);
</code></pre>
<p>The context menu has an ItemClicked event. Your handler could look like so:</p>
<pre>... | <p>Another alternative using a <code>ToolStripMenuItem</code> object:</p>
<pre><code>//////////// Create a new "ToolStripMenuItem" object:
ToolStripMenuItem newMenuItem= new ToolStripMenuItem();
//////////// Set a name, for identification purposes:
newMenuItem.Name = "nameOfMenuItem";
//////////// Sets the text that... | 27,857 |
<p>Is there anything out there (for Java specifically) that allow you to automatically test the behavior of an interface? As an example, let's say I have a bunch of tests for the Comparable interface, that should apply to anything that implements Comparable. What I'd like is to be able to include "ComparableTests" auto... | <p>Based on your last paragraph, what you're trying to do is inject some 'extra methods' into unit testing since you're already testing a specific class. I do not know of a testing harness that allows you to attach tests based on the hierarchy of a class.</p>
<p>However, with your own suggestion of using TestNG for bu... | <p>In .NET it would be pretty simple to set up a method that looks through an assembly and identifies each class's inheritance/implementation hierarchy. I'm sure you could do it in Java, too, if you research the <a href="http://www.onjava.com/pub/a/onjava/2007/03/15/reflections-on-java-reflection.html" rel="nofollow n... | 13,435 |
<p>This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together:</p>
<ul>
<li><p><strong>Firstly</strong>: Given an established C# project, what are some decent ways to speed it up beyond just plain in-code optimization?</p></li>
<li><p><strong>Secondly</strong>: ... | <p>Off the top of my head:</p>
<ul>
<li>Replace non-generic variants of container classes by their generic counterparts</li>
<li>Cut down on boxing/unboxing. Specifically, use generics where possible and generally avoid passing value types as <code>object</code>.</li>
<li>For dialogs using many dynamic controls: suspe... | <p>For Windows Forms on XP and Vista: Turn double buffering on across the board. It does cause transparency issues, so you would definitely want to test the UI:</p>
<pre><code>protected override System.Windows.Forms.CreateParams CreateParams {
get {
CreateParams cp = base.CreateParams;
cp.ExSt... | 22,122 |
<p>I've got a WPF browser-like application with a few pages. When I switch between pages, I'd like to set the keyboard focus.</p>
<p>When a page is loaded the first time, this works by calling <code>Control.Focus()</code> in the constructor.</p>
<p>But when I switch between pages this does not work anymore - the focu... | <p>Try Adding FocusManager.FocusedElement="{Binding ElementName=[...]}"``
to the first Element in your Page and set [...] to the name of the element which should get the focus.</p>
| <p>Have you tried setting the focus in the Loaded event handler rather than the constructor? Pages aren't re-constructed when you navigate back to them, but they are reloaded if I recall correctly.</p>
| 21,442 |
<p>There doesn't seem to be much info on this topic so I'm going to outline my specific problem then maybe we can shape the question and the answer into something a bit more universal.</p>
<p>I have this rewrite rule</p>
<pre><code>RewriteEngine On
RewriteBase /bookkeepers/
RewriteCond %{REQUEST_FILENAME} !-f
Rewrite... | <p>As @Paul Tomblin said, the .+ is being greedy; that is, it's matching as much as it can.</p>
<p><code>^(.+[^/])/?$</code> tells it to match anything, followed by a character that isn't a /, then followed by an optional /. This has the effect of not capturing the trailing /.</p>
<p>The most probable reason your CS... | <p>It looks like the (.+) is being greedy matched. In that case, you could try</p>
<pre><code>RewriteRule ^(.+[^/])/?$ index.php?franchise=$1
</code></pre>
<p>This makes sure that the first group (in the brackets) doesn't end in a slash.</p>
| 40,646 |
<p>I'm an application packager trying to make sense of how the COM registry keys (SelfReg) interrelate to the given .dll in Windows.</p>
<p>ProgID's, AppID's, TypeLibs, Extensions & Verbs are all tied around the CLSID right?
Do CLSID's always use Prog/App IDs or could you just have a file extension class?
Which bi... | <p>The first thing to realise, is that COM dlls register themselves. They will put all the required entries into the correct places in the registry.</p>
<p>I think the answer to your central question about which bits are optional is probably that they are all optional for different types of objects. Automation objec... | <p>I used an answer cos the comments seem so limited. Not sure how SO will interpret this (maybe I'll be deemed mad for talking to myself?)</p>
<blockquote>
<p>"how does it work" question will require a really, really long answer</p>
</blockquote>
<p> Thanks - what I'm trying to acheive is an understanding of that... | 25,981 |
<p>We've developed a Java application and would like to use this application from a C# client. The application has dependencies on Spring, Log4j, ... </p>
<p>What would be the most efficient mechanism - make DLL(s) from Java code, ... - to achieve this ?</p>
| <p><a href="http://www.ikvm.net/" rel="noreferrer">IKVM!</a></p>
<p>It is really awesome. The only problem is that it DOES add ~30MB to the project.
log4net and Spring .NET are available as well, but if living with existing code, go the ikvm route.</p>
| <p>alternatively you could write a webservice/xmlrpc layer between the two.</p>
<p>I seem to remember that there is a tool calles grassshopper that will compile your .Net code into JVM bytecode.</p>
<p>I've also heard good things about IKVM</p>
| 15,788 |
<p>I've been trying to get into F# on and off for a while but I keep getting put off. Why?</p>
<p>Because no matter which 'beginners' resource I try to look at I see very simple examples that start using the operator <code>-></code>.</p>
<p>However, nowhere have I found as yet that provides a clear simple explana... | <p>'->' is not an operator. It appears in the F# syntax in a number of places, and its meaning depends on how it is used as part of a larger construct.</p>
<p>Inside a type, '->' describes function types as people have described above. For example</p>
<pre><code>let f : int -> int = ...
</code></pre>
<p>says th... | <p>The nice thing about languages such as Haskell (it's very similar in F#, but I don't know the exact syntax -- this should help you understand ->, though) is that you can apply only parts of the argument, to create <em>curried</em> functions:</p>
<pre><code>adder n x y = n + x + y
</code></pre>
<p>In other words: "... | 13,026 |
<p>I have a set of Berkeley DB files on my Linux file system that I'd like to examine.</p>
<p>What useful tools exist for getting a quick overview of the contents? I can write Perl scripts that use BDB modules for examining them, but I'm looking for some CLI utility to be able to take a look inside without having to s... | <p>Check out the <strong>db-utils</strong> package. If you use apt, you can install it with the following: <code>apt-get install db-util</code> (or <code>apt-get install db4.8-util</code> or whatever version you have or prefer.)</p>
<p>Additional links:</p>
<ul>
<li><a href="http://rpmfind.net/linux/rpm2html/search... | <p>Under Amazon Linux you can install it with:</p>
<p><strong>yum install db43-utils</strong></p>
| 5,841 |
<p>I recall there is a difference between some methods/properties called directly on the <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable(VS.71).aspx" rel="noreferrer">DataTable</a> class, and the identically named methods/properties on the <a href="http://msdn.microsoft.com/en-us/library/system.d... | <p>In .Net 1.1, <code>DataRowCollection.Clear</code> calls <code>DataTable.Clear</code></p>
<p>However, in .Net 2.0, there is a difference.
If I understand the source correctly, <code>DataTable.Clear</code> will clear unattached rows (created using <code>DataTable.NewRow</code>) whereas DataRowCollection.Clear won't.<... | <p>The both do the same thing. One is just an inherited method from the Collections class. And the Table.Clear() just calls that method.</p>
| 20,065 |
<p>I'm making a mini ORM for a Java program I'm writing... there is a class for each table in my db, all inheriting from <code>ModelBase</code>.</p>
<p><code>ModelBase</code> is abstract & provides a bunch of static methods for finding & binding objects from the db, for example:</p>
<pre><code>public static A... | <p>Albeit, I totally agree in the point of "Static is the wrong thing to be using here", I kind of understand what you're trying to address here. Still instance behavior should be the way to work, but if you insist this is what I would do:</p>
<p>Starting from your comment "I need to create an instance of it just to g... | <p>I agree with Gizmo: you're either looking at annotations or some sort of configuration file. I'd take a look at Hibernate and other ORM frameworks (and maybe even libraries like log4j!) to see how they handle loading of class-level meta-information.</p>
<p>Not everything can or should be done programmatically, I f... | 18,293 |
<p>I have seen a few suggestions on making emacs portable (on Windows). I have this in my site-start.el:</p>
<pre><code>(defvar program-dir (substring data-directory 0 -4))
(setq inhibit-startup-message t)
(setenv "HOME" program-dir)
</code></pre>
<p>I changed the HOME variable so that not only my .emacs init files ... | <p>Quoth <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Invoking-emacsclient.html" rel="nofollow noreferrer">the Emacs manual</a>:</p>
<blockquote>When you start the Emacs server (by calling server-start), Emacs creates a file with information about TCP connection to the server: the host where Emacs... | <p>There is an initial packaging of a Portable Apps version of emacs 23.2 <a href="http://portableapps.com/node/23470" rel="nofollow noreferrer">here.</a> Initial test works here.</p>
| 46,896 |
<p>Whats the normal procedure of clearing a form after POST? Just loop through the textboxes and cleat all text? I have an ASP.NET application with several forms and I am trying to avoid them sending the data twice?</p>
<p>Thanks</p>
| <p>You can avoid double sending/doing by putting your code inside an if(!isPostBack) block. This will tell the page not to do the specified actions when posting.</p>
| <p>You can inject some javascript code to execute after postback.</p>
<pre><code>document.forms[0].reset();
document.forms[1].reset();
</code></pre>
<p>From server side, I haven't found an easy way to reset the form contents other than iterating through the controls inside a loop or doing a <a href="http://support.mi... | 32,577 |
<p>I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle".</p>
<p>Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms... | <p>A quick Google search turns up a couple papers that cover this in some detail: one on <a href="http://web.archive.org/web/20170329021919/http://www.cse.psu.edu:80/~pxr3/optslides.pdf" rel="nofollow noreferrer">Parallel Combinatorial Search</a>, and one on <a href="http://icaps08.cecs.anu.edu.au/TUTORIALS/Edelkamp-Ha... | <p>For my current experience, on how to solve an 8 puzzle.
it is required to create nodes. keep track of each step taken
and get the manhattan distance from each following steps, taking/going to the one with the shortest distance.
update the nodes, and continue until reaches the goal</p>
| 12,057 |
<p>I have a new project which simply put, is an attempt to formalize the look and feel of all of our departmental pages. I Googled around and found many tutorials which discussed the pros and cons of several techniques. And from what I've been reading, the thing I'm ooking for is controls. Basically, I want a common he... | <p><a href="http://www.odetocode.com/Articles/419.aspx" rel="nofollow noreferrer">Masterpages</a> would seem to be what you are looking for.</p>
| <p>Conceptually, I think you're very much on the right track. It's much easier to conceive of a page model in terms of some very simple containers (header, footer, content). You can take it a step further by defining blocks of display logic (top navbar, footer links, left ad bar, etc.) that you can use to populate th... | 42,254 |
<p>Good file comparison tools were already discussed to the pain, but my problem is more exotic. Is there any visual text comparison tool (like WinMerge) that would allow me easily do visual comparison on two sections within the same file?</p>
<p>I have multiple configurations within vcproj file and need to maintain t... | <p>I use <a href="http://www.scootersoftware.com/" rel="noreferrer">Beyond Compare</a> (not free, but I think a shareware version is available). You can select the same file for left and right sides, then right-click the beginning of your section on each side and select "Align Manually". This would allow you to compa... | <p>I use UltraEdit for most of my text editing and they have a product called <a href="http://www.ultraedit.com/products/ultracompare.html" rel="nofollow noreferrer">UltraCompare</a> that does a visual compare.</p>
<hr>
<p><strong>Update by Mofi</strong></p>
<p>UltraCompare Professional supports also a comparison of... | 47,221 |
<p>It seems that everybody is jumping on the dynamic, non-compiled bandwagon lately. I've mostly only worked in compiled, static typed languages (C, Java, .Net). The experience I have with dynamic languages is stuff like ASP (Vb Script), JavaScript, and PHP. Using these technologies has left a bad taste in my mouth ... | <p>I think the reason is that people are used to statically typed languages that have very limited and inexpressive type systems. These are languages like Java, C++, Pascal, etc. Instead of going in the direction of more expressive type systems and better type inference, (as in Haskell, for example, and even SQL to som... | <p>Because it's fun fun fun. It's fun to not worry about memory allocation, for one. It's fun not waiting for compilation. etc etc etc</p>
| 6,453 |
<p>I have two tables, we'll call them <code>Foo</code> and <code>Bar</code>, with a one to many relationship where <code>Foo</code> is the parent of <code>Bar</code>. Foo's primary key is an integer automatically generated with a sequence. </p>
<p>Since <code>Bar</code> is fully dependent on <code>Foo</code> how wou... | <p>Give Bar an automatic primary key the same as with Foo. Add a foreign key FooID column to Bar.</p>
<p>Unless I'm missing something, there doesn't seem to be a reason why it wouldn't work.</p>
| <p>from your description i'm assuming that your database does not support auto-increment identifier fields (MS SQL does, Oracle has 'sequences' which are just as good if not better, I don't remember MySql has).</p>
<p>If it does, then all you need is an auto-increment FooId and an auto-increment BarId, and Bar also ha... | 46,559 |
<p>The following Perl statements behave identically on Unixish machines. Do they behave differently on Windows? If yes, is it because of the magic \n?</p>
<pre><code> split m/\015\012/ms, $http_msg;
split m/\015\012/s, $http_msg;
</code></pre>
<p>I got a <a href="http://www.nntp.perl.org/group/perl.cpan.testers/... | <p>For these regexes:</p>
<blockquote>
<pre><code>m/\015\012/ms
m/\015\012/s
</code></pre>
</blockquote>
<p>Both /m and /s are meaningless.</p>
<ul>
<li>/s: makes <code>.</code> match <code>\n</code> too.
Your regex doesn't contain <code>.</code></li>
<li>/m: makes <code>^</code> and <code>$</code> match next to emb... | <p>Why did you add the <code>/m</code>? Are you trying to split on line? To do that with <code>/m</code> you need to use either <code>^</code> or <code>$</code> in the regex:</p>
<pre><code>my @lines = split /^/m, $big_string;
</code></pre>
<p>However, if you want to treat a big string as lines, just open a filehandl... | 26,366 |
<p>Building the same project (without any changes) produces <strong>binary different</strong> exe-files: some small regions of them are different. Empty project, version information (and auto-increment on every build) is turned off.</p>
<p>Why it happens? And is it possible to make delphi produce binary equal files fo... | <p>The various structures in the PE executable file format used by Windows include timestamps that are set by the compiler and linker.</p>
<p>It is possible to post-process the file to reset these values to a defined constant (I wrote a tool to do exactly this for a secure product that needed exact hash values), but t... | <p>it may be, that some actual time-stamps are compiled into the exe-file.</p>
| 41,885 |
<p>I have a windows form application that uses a Shared class to house all of the common objects for the application. The settings class has a collection of objects that do things periodically, and then there's something of interest, they need to alert the main form and have it update.</p>
<p>I'm currently doing this ... | <p>I think it is a threading problem too. Are you using Control.Invoke() in your event handler? .NET usually catches violations when you debug the app but there are cases it can't. NotifyIcon is one of them, there is no window handle to check thread affinity.</p>
<p>Edit after OP changed question:</p>
<p>A classic... | <p>Use Control.InvokeRequired to determine if you're on the proper thread, then use Control.Invoke if you're not.</p>
| 34,476 |
<p>I am using Visual Studio 2005 and StarTeam 2008 (cross-platform client and VS integration). At some point, I added an 'App.config' to a project. I notice now that this file will not check-in.</p>
<ol>
<li><p>The 'StarTeam Pending Checkins' window in VS reports the file 'Not in View'. Selecting it for check in and c... | <p>By using reflection you can do that. In C# it looks like that;</p>
<pre><code>PropertyInfo[] propertyInfo = myobject.GetType().GetProperties();
</code></pre>
<hr>
<p>Added a VB.Net translation:</p>
<pre><code>Dim info() As PropertyInfo = myobject.GetType().GetProperties()
</code></pre>
| <p>You can use reflection... With Reflection you can examine every member of a class (a Type), proeprties, methods, contructors, fields, etc.. </p>
<pre><code>using System.Reflection;
Type type = job.GetType();
foreach ( MemberInfo memInfo in type.GetMembers() )
if (memInfo is PropertyInfo)
{
... | 40,568 |
<p>I need to get the Folder size and display the info on a report (SSRS). I need to do this for a number of Databases (loop!). These DB's are websites' backends.</p>
<p>Are any samples available for this? Does xp_filesize and the like the right solution?</p>
| <p>Looking at the question and Tomalak's response, and I'm assuming the reporting server will be able to reach the folders held in the DB:</p>
<p>Firstly set up the query to get you back the result-set of paths - I assume you'll have no trouble with this part. Next you'll need to add a custom code function to your rep... | <p>Could you clarify who should do what in your scenario? Do you want SQL Server do get the info or do you want Reporting Server do that? </p>
<p>What exactly do you mean by "folder size"? Is "one folder, sum up each file" enough or does it need to be recursive? Either way, I'd go for a little custom .NET function tha... | 19,862 |
<p>In Python, if I do this:</p>
<pre><code>print "4" * 4
</code></pre>
<p>I get</p>
<pre><code>> "4444"
</code></pre>
<p>In Perl, I'd get</p>
<pre><code>> 16
</code></pre>
<p>Is there an easy way to do the former in Perl?</p>
| <pre><code>$ perl -e 'print "4" x 4; print "\n"'
4444
</code></pre>
<p>The x operator is documented in perldoc <a href="http://perldoc.perl.org/perlop.html" rel="noreferrer">perlop</a>. Here binary means an operator taking two arguments, not composed of bits, by the way.</p>
<blockquote>
<p>Binary &... | <p>Came this way looking for an answer. Didn't quite find what I was looking for so I thought I'd share my learning. I wanted to compose dynamic SQL CRUD statements with the appropriate number of placeholders.</p>
<pre><code>$table = "ORDERS";
@fields = ("ORDER_ID", "SALESMAN_ID", "C... | 35,015 |
<p>Is there a better way to negate a boolean in Java than a simple if-else?</p>
<pre><code>if (theBoolean) {
theBoolean = false;
} else {
theBoolean = true;
}
</code></pre>
| <pre><code>theBoolean = !theBoolean;
</code></pre>
| <p>
Before:</p>
<pre class="lang-java prettyprint-override"><code>boolean result = isresult();
if (result) {
result = false;
} else {
result = true;
}
</code></pre>
<p>After:</p>
<pre class="lang-java prettyprint-override"><code>boolean result = isresult();
result ^= true;
</code></pre>
| 27,710 |
<p>Suppose I have a non-recurring event that needs to be raised X seconds from now such as a timeout. Intuitively it would make sense to create a System.Timers.Timer, set its interval to X*1000, wire its tick up to the event and start it. Since this is a non-recurring event and you only want it raised once you would ... | <p>This <a href="http://msdn.microsoft.com/en-us/library/ah1h85ch.aspx" rel="nofollow noreferrer">constructor</a> for the System.Threading.Timer allows you to specify a <strong>period</strong>. If you set this parameter to -1, it will disable periodic signaling and only execute once.</p>
<pre><code>public Timer(
... | <p>just set it to tick after X seconds, and in the code of the tick, do:</p>
<p>timer.enabled = false;</p>
<p>worked for me.</p>
| 17,900 |
<p>I'd like to create a module in DNN that, similar to the Announcements control, offers a template that the portal admin can modify for formatting. I have a control that currently uses a Repeater control with templates. Is there a way to override the contents of the repeater ItemTemplate, HeaderTemplate, and FooterT... | <p>Building on the previous answer, a better solution that includes the label for the group box:</p>
<pre><code>groupBox1.Paint += PaintBorderlessGroupBox;
private void PaintBorderlessGroupBox(object sender, PaintEventArgs p)
{
GroupBox box = (GroupBox)sender;
p.Graphics.Clear(SystemColors.Control);
p.Graphics.... | <p>This tweak to Jim Fell's code placed the borders a little better for me, but it's too long to add as a comment</p>
<p>...</p>
<pre><code> Rectangle rect = new Rectangle(this.ClientRectangle.X,
this.ClientRectangle.Y + (int)(strSize.Height / 2),
... | 10,209 |
<p>This is a simple one. I want to replace a sub-string with another sub-string on client-side using Javascript.</p>
<p>Original string is <code>'original READ ONLY'</code></p>
<p>I want to replace the <code>'READ ONLY'</code> with <code>'READ WRITE'</code></p>
<p>Any quick answer please? Possibly with a javascript ... | <p><code>String.replace()</code> is regexp-based; if you pass in a string as the first argument, the regexp made from it will not include the <strong>‘g’</strong> (global) flag. This option is essential if you want to replace all occurances of the search string (which is usually what you want).</p>
<p>An alternative <... | <pre><code>stringObject.replace(findstring,newstring)
</code></pre>
| 31,518 |
<p>I am trying to use a Generic Linked List to hold some WorkFlow steps in my application. Here is how I'm persisting it to my database.</p>
<p>OrderID WorkFlowStepID ParentWorkFlowStepID<br/>
178373 1 ... | <p>So do you mean you're using the <a href="http://msdn.microsoft.com/en-us/library/he2s3bh7.aspx" rel="nofollow noreferrer">linked list class in the framework</a>?</p>
<p>If so, the <code>Find</code> method doesn't really do what you want it to. Basically you want a version which takes a predicate. This would be easi... | <p>Define a comparison function and then call the list .Sort() method with the comparison function passed in as a delegate. The function should take 2 objects(e.g. X and Y) and return -1 if X is greater than Y, 0 if they are equal or 1 if Y is greater than X. </p>
| 38,444 |
<p>I have some legacy code that uses VBA to parse a word document and build some XML output; </p>
<p>Needless to say it runs like a dog but I was interested in profiling it to see where it's breaking down and maybe if there are some options to make it faster.</p>
<p>I don't want to try anything until I can start meas... | <p>Using a class and #if would make that "adding code to each method" a little easier...</p>
<p><strong><em>Profiler</em> Class Module:</strong>:</p>
<pre><code>#If PROFILE = 1 Then
Private m_locationName As String
Private Sub Class_Initialize()
m_locationName = "unknown"
End Sub
Public Sub Start(locationName A... | <p>Insert a bunch of</p>
<pre><code>Debug.Print "before/after foo", Now
</code></pre>
<p>before and after snippets that you think might run for long terms, then just compare them and voila there you are.</p>
| 30,166 |
<p>What are some good examples of coding guidelines. I'm not really looking for anything specific to a single language.</p>
<p>But what should I be doing/evaluating as I write coding guidelines? Such as how flexible should the guidelines and how much should decisions be left to the programmer or to someone else or eve... | <p>There are generally three purposes for coding standards:</p>
<ul>
<li>Reduce the likelihood of bugs</li>
<li>Reduce the time required to analyze code written by someone else</li>
<li>Give someone a power trip</li>
</ul>
<p>Obviously, the third is a waste of everyone else's time, but you do need to consider it, spe... | <p>Coding guidelines are behavioural rules for your teammembers, so that you can read eachothers code without too much trouble.</p>
<p>It also gets the "bracket on newline or on same line" discussions out of the way at your code review sessions, which saves a lot of time ;-)</p>
<p>When writing code guidelines, make ... | 44,507 |
<p>How long should it take to run </p>
<pre><code>ALTER DATABASE [MySite] SET READ_COMMITTED_SNAPSHOT ON
</code></pre>
<p>I just ran it and it's taken 10 minutes.</p>
<p>How can I check if it is applied?</p>
| <p>You can check the status of the READ_COMMITTED_SNAPSHOT setting using the <strong><code>sys.databases</code></strong> view. Check the value of the <strong><code>is_read_committed_snapshot_on</code></strong> column. Already <a href="https://stackoverflow.com/questions/51969/how-to-detect-readcommittedsnapshot-is-en... | <p>Try Shut off the other SQL services so that only the SQL server service is running. </p>
<p>Mine ran for 5 minutes then I cancelled it because it was obvious nothing was happening. Its a brand new server so there are no other users connected. I shut off the SQL Reporting Services and then ran it again.. took le... | 28,754 |
<p>I'm new to this game, and recently upgraded the hotend on my Ender 3 Pro to a <em>clone</em> of an E3D V6, as I'm keen to do nylon prints at some point. I noticed however that this one I got has a teflon liner which seems to negate the advantage of a metal hotend entirely.</p>
<p>I'm wondering what temperature it's ... | <p>There are many types of <a href="https://3dprinting.stackexchange.com/questions/10998/e3d-v6-original-vs-clone/11012#11012">heatbreak clones</a>. In cour case, your clone effectively turns your hotend into an e3d Lite6, not an all-metal e3d v6. To function properly, the PTFE liner needs to butt against the nozzle or... | <p>Long story short, you can print Nylon with a Teflon tube. I've done it. P.S. The nylon absorbs water like nothing you've ever seen. Even after the part is printed, it absorbs water, and expands!</p>
| 1,712 |
<p>I'm working on a new project, a web application, where I need to focus the user on a particular task. Therefore I want to eliminate all other "System Generated Noise", like Browser Menus, Buttons, Address Bar, OS Task Bar and so forth. I have seen implementations like Lightbox, but this modal approach is limited to ... | <p>this may help you:</p>
<p><a href="http://www.programmersheaven.com/2/FAQ-JavaScript-Maximize-Browser-Window-To-Screen" rel="nofollow noreferrer">http://www.programmersheaven.com/2/FAQ-JavaScript-Maximize-Browser-Window-To-Screen</a></p>
| <p>OK, so I've been looking around for other options, or alternate ways I can do this. One solution I found, only works with Firefox 2.0+ or IE6+, is to toggle the browsers Full Screen mode. Maybe even do a little pro Open Source and support only Firefox and urge the user to get that browser...but hell, if I'm telling ... | 49,349 |
<p>I use the Eclipse IDE to develop, compile, and run my Java projects. Today, I'm trying to use the <code>java.io.Console</code> class to manage output and, more importantly, user input.</p>
<p>The problem is that <code>System.console()</code> returns <code>null</code> when an application is run "through" Eclipse. Ec... | <p>I assume you want to be able to use step-through debugging from Eclipse. You can just run the classes externally by setting the built classes in the bin directories on the JRE classpath.</p>
<pre><code>java -cp workspace\p1\bin;workspace\p2\bin foo.Main
</code></pre>
<p>You can debug using the remote debugger and ... | <p>Let's say your Eclipse workspace is C:\MyWorkspace,
you created your java application inside a maven project MyProject,
and your Java main class is com.mydomain.mypackage.MyClass.</p>
<p>In this case, you can run your main class that uses <code>System.console()</code> on the command line:</p>
<pre><code>java -cp... | 12,982 |
<p>Did Installing OneCare cause a "Generating user instances in SQL Server is disabled" error?</p>
<p>The only change that I've made to my computer is uninstalling AVG and installing the trial for Microsoft OneCare. Did OneCare change the SQLServer installation somehow?</p>
<p>This is a very "odd" question but is som... | <p>I would look more at the uninstalling of AVG as the culprit. OneCare does not care or even notice SQL Server instances as far as I can tell where as AVG does. </p>
<p>I would look into your SQL Server instance and check the jobs. One or more may have been added by AVG. You should remove them. You might also wa... | <p>I didn't see anything odd in the event viewer or any db's for avg in SQLServer. btw I installed SQL server after AVG. it's curious anyway. I'll just make a VM and do a fresh install of SQLExpress so I can finish a few projects.</p>
<p>it's been over a year so it's time for the annual reformat and reinstall ;-)</p>
| 5,946 |
<p>We have a major VB6 trading application which uses MS Access (Don't ask!) It is always blasting trades into an MS Access database.</p>
<p>The rest of the infrastructure here has moved on considerably and I want to read this Access database periodically and copy any new trades into a SQL server database.</p>
<p>The... | <p>To build on Matt's answer, I would recommend a combination of adOpenForwardOnly and adLockReadonly: ForwardOnly because you just need to insert those trades into SQL Server, and Readonly so you aren't locking out other processes (what else would hit these tables?). Fortunately, these are the default options. :) </p>... | <p>Just an idea ... but have you thought about upgrading the database so that the tables themselves are actually stored in SQL Server and Access just become the front end? It's been a little while, but if I remember correctly, Access should have a wizard (yuck!) to help you do this.</p>
<p>With old ADO you could set ... | 37,026 |
<p>I want to add a <em>column</em> to an existing legacy <em>database</em> and write a <em>procedure</em> by which I can assign each record a different value. Something like adding a <em>column</em> and autogenerate the data for it.</p>
<p>Like, if I add a new <em>column</em> called "ID" (number) I want to then initia... | <p>This will depend on the database but for SQL Server, this could be achieved as follows:</p>
<pre><code>alter table Example
add NewColumn int identity(1,1)
</code></pre>
| <p>Depends on the database as each database has a different way to add sequence numbers. I would alter the table to add the column then write a db script in groovy/python/etc to read in the data and update the id with a sequence. Once the data has been set, I would add a sequence to the table that starts after the top ... | 13,360 |
<p>Using the Java URL class, I can connect to an external <code>HTTPS</code> server (such as our production site), but using a local URL I get following exception. </p>
<pre><code>"SunCertPathBuilderException: unable to find valid certification path to requested target".
</code></pre>
<p>How do I get a valid certifi... | <p>Here was my solution that incorporates some of the ideas in this thread and peiced together with code from around the net.
All I do call this function and it sets the default Trust Manager and HostName Verifier for HttpsURLConnection. This might be undesirable for some because it will effect all HttpsURLConnections ... | <p>The problem it's complaining about is that when you create an SSL connection, the server must present a valid certificate to the client. You can write an appropriate endpoint in Java (HTTPServerSocket will do it I think) but it would require some hacking about to set it up. It's probably easier to set up a local w... | 48,849 |
<p>Can someone tell me what Strong typing and weak typing means and which one is better?</p>
| <p>That'll be the theory answers taken care of, but the practice side seems to have been neglected...</p>
<p>Strong-typing means that you can't use one type of variable where another is expected (or have restrictions to doing so). Weak-typing means you can mix different types. In PHP for example, you can mix numbers a... | <p>Weak typing means that you don't specify what type a variable is, and strong typing means you give a strict type to each variable.</p>
<p>Each has its advantages, with weak typing (or dynamic typing, as it is often called), being more flexible and requiring less code from the programmer. Strong typing, on the other... | 41,849 |
<p>I'm developing a set of applications that work together to create a system for processing metering data. There's several reasons I want to have them loosely coupled and the system should be extensible by third parties, so the apps will be tied together via messaging.</p>
<p>I'm looking for a messaging system that o... | <p>activemq</p>
<p><a href="http://activemq.apache.org/cross-language-clients.html" rel="noreferrer">http://activemq.apache.org/cross-language-clients.html</a></p>
<p>Supports all the following protocols</p>
<ul>
<li>OpenWire</li>
<li>REST</li>
<li>Stomp</li>
<li>WS Notification</li>
<li>XMPP</li>
<li>AMQP</li>
</ul... | <p><a href="https://mq.dev.java.net/" rel="nofollow noreferrer">Open Message Queue (Open MQ)</a> is included in the GlassFish application Server and also runs stand-alone. It starts up in a few seconds, and supports Java and C client. Stomp support is currently in development in version 4.4.</p>
| 32,285 |
<p>I want to paint my ABS parts. But I foresee a problem that will arise from 0.16mm layer - those layers will be perfectly visible, even with primer. Sanding them wouldn't be a good idea, because walls are just 0.8-1mm thick, and probably acetone bath isn't right thing too. I want to use some sort of cement or paste, ... | <p>The Prusha I3 design uses two rods to guide the Y axis, which moves along the rods on linear bearings. If the rods are not strictly planar, there will be movement of the bed as it moves to and fro. You would not be able to correct this with the leveling screws.</p>
<p>Be sure that the rods are planar, and that th... | <p>The Prusha I3 design uses two rods to guide the Y axis, which moves along the rods on linear bearings. If the rods are not strictly planar, there will be movement of the bed as it moves to and fro. You would not be able to correct this with the leveling screws.</p>
<p>Be sure that the rods are planar, and that th... | 738 |
<p>i have a server - client application that runs on java 1.3; i want to change to java 1.6 step by step, meaning first few clients, than rest of the clients and finally server...
i was wondering could you direct me to some common problems that can come along and what should i look after?</p>
| <p>Sun tries to keep a high level of backward-compatibility, so you possibly simply can install the new JVM and restart your application with it.</p>
<p>A document describing the backward-incompatibilities from Java 1.6 with earlier version is <a href="http://java.sun.com/javase/6/webnotes/compatibility.html" rel="nof... | <p>My experience is that the compatibility is quite high. I've only found one app ever that I couldn't get to run on a current version. For whatever reason (not having source, so I didn't dig into it) that one app wouldn't run on anything other than 1.4.2. Everything else I've ever dealt with (some of them quite siz... | 32,746 |
<p>Is there a script to display a simple world clock (time in various places around the world) on a *nix terminal?</p>
<p>I was thinking of writing a quick Python script, but I have a feeling that's gonna be more work than I think (e.g. due to config and output format) - not to mention reinventing the wheel...</p>
| <p>I have this bourne shell script:</p>
<pre><code>#!/bin/sh
PT=`env TZ=US/Pacific date`
CT=`env TZ=US/Central date`
AT=`env TZ=Australia/Melbourne date`
echo "Santa Clara $PT"
echo "Central $CT"
echo "Melbourne $AT"
</code></pre>
| <p>I like the script <a href="https://stackoverflow.com/users/111036/mivk">mivk</a> provided.
As I want to be able to specify multiple zones without regex, I adapted the script to use bash when I couldn't get bourne shell to deal with arrays.
Anyway, enjoy and thanks for a great forum:</p>
<pre><code>#!/usr/bin/env ba... | 48,338 |
<p>I'm not sure if this is something I should do in T-SQL or not, and I'm pretty sure using the word 'iterate' was wrong in this context, since you should never iterate anything in sql. It should be a set based operation, correct? Anyway, here's the scenario:</p>
<p>I have a stored proc that returns many uniqueidentif... | <p>This may not be the most efficient, but I would create a temp table to hold the results of the stored proc and then use that in a join against the target table. For example:</p>
<pre><code>CREATE TABLE #t (uniqueid int)
INSERT INTO #t EXEC p_YourStoredProc
UPDATE TargetTable
SET a.FlagColumn = 1
FROM TargetTable... | <p>An ugly solution would be to have your procedure return the "next" id each time it is called by using the other table (or some flag on the existing table) to filter out the rows that it has already returned</p>
| 17,975 |
<p>Does anyone know of a script to colorize C++ code the same as the default MSVC IDE does?</p>
| <p>If it's for the web I can recommend you <a href="http://code.google.com/p/google-code-prettify/" rel="nofollow noreferrer">prettify</a>, it's the script that StackOverflow uses for code colorization, and it's really easy to get it working...</p>
| <p>Notepad++ is pretty good and I use it when I'm on a windows system and doing C++.</p>
<p>Here is the title off the sourceforge page:
Notepad++ is a generic source code editor (it tries to be anyway) and Notepad replacement written in c++ with win32 API. The aim of Notepad++ is to offer a slim and efficient binary w... | 32,650 |
<p>I'm working on a project where I have 2 web services that need the same entity. The 2 web services are on the same server so on the back-end, they share the same classes. </p>
<p>On the front-end side, my code consumes <em>both</em> web services and sees the entities from both services as separate (in different nam... | <p>I think that you can not do that from inside VS but you can manually use the <code>wsdl.exe</code> utility like this:</p>
<pre><code>wsdl.exe /sharetypes http://localhost/MyService1.asmx?wsdl http://localhost/MyService2.asmx?wsdl
</code></pre>
<p>Notice the <code>/sharetypes</code> option which turns on the type s... | <p>Can you check the namespace of the entity? Make sure it is the same in both the web services. </p>
| 21,161 |
<p>I have implemented a YUI split button with a menu. The button with menu appears in a scrolling div between header and a footer divs. When exposing the menu near the footer div, the menu appears behind the div.</p>
<p>I have tried positioning the footer div with a z-index of -1. I have tried positioning the div (... | <p>In addition to setting the <strong>z-index</strong> property, you also have to change the <strong>position</strong> property. The easiest thing to change it to is <strong>position:relative</strong>.</p>
<p>Try setting both of those properties.</p>
<p>I don't think YUI layout will assist you in this particular prob... | <p>I started using YUI layout and my issues no longer exist.</p>
| 30,881 |
<p>I am using sql express 2008 and vs2008, writing in c#.</p>
<p>I have a db table with a Geography column in it, into which I need to put gps data I collected. When I tried creating an Entity-Framework mapping for this table, it just ignored the column with some warning about not being able to map such column types.
... | <p>I don't know much about EF, but NHibernate allows you to extend it's type framework using <code>IUserType</code>. There's a bit about it on <a href="http://www.lostechies.com/blogs/rhouston/archive/2008/03/23/mapping-strings-to-booleans-using-nhibernate-s-iusertype.aspx" rel="nofollow noreferrer">Ray Houston's Blog<... | <p>At this time Entity Framework v1 does not support SQL UDT - 2008 Spacial type is UDT.</p>
<p>You can store your long/lat data using WKB (byte[]/varbinary).</p>
<p>As a side note i did not notice any support for UDT during the Microsoft MIX09 for the next version (1.5 CTP). Perhaps i missed something.</p>
| 25,465 |
<p>I write a large static method that takes a generic as a parameter argument. I call this method, and the framework throws a System.InvalidProgramException. This exception is thrown even before the first line of the method is executed.</p>
<p>I can create a static class which takes the generic argument, and then make... | <p>I would imagine using <code>blur()</code> would do the trick:</p>
<pre><code><script type="text/javascript">
YAHOO.util.Event.onDOMReady(function() {
document.getElementById("input").focus();
document.getElementById("input").blur();
});
</script>
</code></pre>
| <p>Your idea is right, but there is a little problem.</p>
<pre><code>document.getElementById("main").focus();
<div id="main">
</code></pre>
<p>as shown in your code, actually the div HTMLElement doesn't have a focus method.</p>
<p>so you can call other elements that have a focus method or cal... | 27,155 |
<p>If I have a usercontrol (in Silverlight) that I've written, that uses XAML to define it's appearance, how can I make a customised version of it?</p>
<p>i.e. I have MyControl.xaml & MyControl.xaml.cs</p>
<p>What do I need to do if I want a "SpecialisedControl" child class? I assume I just make a new code file, ... | <p>I wrote this thinking you were talking about WPF, rather than Silverlight, but there may be enough overlap for this to be helpful, so I'm posting it, anyway.</p>
<p>If by "change the appearance of the base class" you mean "provide a new template", then what you need is probably a CustomControl, not a UserControl.</... | <p>You can solve this by using a wrapper as described in the link above.
But you can also use the strategy pattern to solve this problem.</p>
<p>In this post I explain how you implement these two methods.
<a href="http://www.lab101.be/2008/07/silverlight-usercontrol-inheritance/" rel="nofollow noreferrer">http://www.l... | 27,923 |
<h2>Caution: This question is over nine years old!</h2>
<p>Your best option is to search for newer questions, or to search the answers below looking for your specific version of MVC, as many answers here are obsolete now. </p>
<p>If you do find an answer that works for your version, please make sure the answer cont... | <p>Html.CheckBox is doing something weird - if you view source on the resulting page, you'll see there's an <code><input type="hidden" /></code> being generated alongside each checkbox, which explains the "true false" values you're seeing for each form element.</p>
<p>Try this, which definitely works on ASP.NET ... | <p>How about something like this?</p>
<pre><code>bool isChecked = false;
if (Boolean.TryParse(Request.Form.GetValues(”chkHuman”)[0], out isChecked) == false)
ModelState.AddModelError(”chkHuman”, “Nice try.”);
</code></pre>
| 27,082 |
<p>For some reason I can't find a way to get the equivalents of sqlite's interactive shell commands:</p>
<pre><code>.tables
.dump
</code></pre>
<p>using the Python sqlite3 API. </p>
<p>Is there anything like that?</p>
| <p>You can fetch the list of tables and schemata by querying the SQLITE_MASTER table:</p>
<pre><code>sqlite> .tab
job snmptarget t1 t2 t3
sqlite> select name from sqlite_master where type = 'table';
job
t1
t2
snmptarget
t3
sqlite> .schema job
CREATE TABLE job (
id INTEG... | <p>I've implemented a sqlite table schema parser in PHP, you may check here: <a href="https://github.com/c9s/LazyRecord/blob/master/src/LazyRecord/TableParser/SqliteTableDefinitionParser.php" rel="nofollow">https://github.com/c9s/LazyRecord/blob/master/src/LazyRecord/TableParser/SqliteTableDefinitionParser.php</a></p>
... | 39,272 |
<p>The GUI for managing plugins in Eclipse got a bit of an overhaul in version 3.4.0.
This GUI is accessed via the "Software Updates..." option in the Help menu.</p>
<p>The option to remove the selected Mylyn plugin is greyed out. In fact, this is true of virtually every installed plugin. I know that the Myly... | <p><strong>The following text is quoted from the Eclipse help docs:</strong></p>
<p>The Uninstall wizard allows you to review and uninstall items in your configuration. This wizard is shown when you select items and press Uninstall... from the Installed Software page. To uninstall software from your system: </p>
<ol>... | <p>I'm running (a relatively fresh copy of) 3.4.1. I was able to select the same plug-in shown in your screen shot (Mylyn Bridge: Java Development) to get an enabled "Uninstall..." button. I'd suggest getting the latest updates and trying again.</p>
| 48,313 |
<p>I have a page that is hitting a webservice every 5 seconds to update the information on the page. I'm using the DynamicPopulateExtender from the Ajax Control Toolkit to just populate a panel with some text.</p>
<p>What I was wanting to do, is if a certain condition is met, to refresh the page completely. </p>
<p>A... | <ul>
<li>You can't do anything from your ASMX.</li>
<li>You can refresh the page from JavaScript by using a conventional page reload or by doing a postback that would perform server-side changes and then update via your UpdatePanel or, more simply, a Response.Redirect. </li>
</ul>
| <p>You can force a Postback from Javascript, see this Default.aspx page for a example:</p>
<hr>
<h2>Default.aspx</h2>
<pre><code><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">... | 23,369 |
<p>I use <code>ftp_put / ftp_nb_put</code> to upload files from my PHP server to another machine. I am frequently (90% of the time) getting absurd error messages like:</p>
<pre><code>Warning: ftp_nb_put(): 2 matches total
Warning: ftp_nb_put(): Transfer complete
Warning: ftp_nb_continue(): Opening BINARY mode data co... | <p>The messages where symptoms of some arcane networking problems the server had. PHP does not diagnose such problems correctly and outputs seemingly random snippets from the communication between servers.</p>
<p>Not actually a programming question, rather a "server fault" issue (or rather a "get a better webhoster" i... | <p>This is not extremly helpful, but I also suggest that while you watch the php error log, open the ftp's in another window and try to figure out all things related. Most ftp servers have their own logfiles, or log to syslog.</p>
<p>Maybe you can replicate the environment with a vmware disk image, or in virtualbox (o... | 49,195 |
<p>I am trying to create a Data Source in SharePoint Designer that connects to a SharePoint List via XML Web Services. I have created the Data Source and connected to the list in question. I can view all the data using GetListItems, and I want to filter it using the query parameter.</p>
<p>The query parameter takes ... | <p>There is a bug in SharePoint Designer. You cannot pass a Query object to a SOAPDataSource like this - the XML gets overencoded. Nothing you can do to fix it, except use Visual Studio.</p>
<p>I'll let you know if there's ever a hotfix available.</p>
<p>If anyone wants to quote this answer in a new answer, I'll ac... | <p>Having worked with the list Title field, it does not return values for me unless I used "Contains".</p>
<p>This may not fix your error however.</p>
| 46,036 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.