instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I have a div container and have defined its style as follows:</p>
<pre><code>div#tbl-container
{
width: 600px;
overflow: auto;
scrollbar-base-color:#ffeaff
}
</code></pre>
<p>This gives me both horizontal and vertical scroll bars automatically once I populate my table which is contained by this... | <p>You shouldn't get both horizontal and vertical scrollbars unless you make the content large enough to require them.</p>
<p>However you typically do in IE due to a bug. Check in other browsers (Firefox etc.) to find out whether it is in fact only IE that is doing it.</p>
<p>IE6-7 (amongst other browsers) supports t... | <p>We should set to <code>overflow: auto</code> and hide a scrollbar which we don't use for working on unsupporting CSS3 browser.
Look at this <a href="http://xme.im/css-overflow-strict-how-to-display-horizontal-or-verticle-only" rel="nofollow">CSS Overflow; XME.im</a></p>
| 32,254 |
<p>I need to put an LDAP contextSource into my Java EE container's JNDI tree so it can be used by applications inside the container.</p>
<p>I'm using Spring-LDAP to perform queries against ORACLE OVD. For development, I simply set up the contextSource in the Spring xml configuration file. For production, however, I ne... | <p>Specifically in reference to the actual pooling of LDAP connections, if you are using the built in JNDI LDAP provider, the connections are pooled already using semantics similar to JDBC data sources where separate pools are maintained for different LDAP URLs and security properties.</p>
<p>When creating a JNDI <cod... | <p>Any chance you can setup a dev version of LDAP and use that? Then you can use a jndi.properties file, which would be environment specific, but agnostic to your system.</p>
<p>Edit: the difference here is that when you build your app, your admin can deploy it to the production system, thereby protecting the precious... | 43,418 |
<p>I am currently in the process of searching for a rules engine that works in .NET. Our logic is pretty simple, +, -, *, /, and, or, basic order of operations stuff. However we are going to need to store this information in the database and then generate the rules file when a new version is pulled from the database.... | <p>My experience with WWF has been pretty bad. Its great for developing a workflow that you know is going to exist (such as "this document goes to a person's manager, then to HR, if its invalid it goes back to the submitter") but a real pain if you want dynamic configuration. As you can tell we tried to use it for a ... | <p>the fact that biztalk is not going to be replaced easily by wwf is true. The objectives are very different between them, drools compares to biztalk and not with wwf, reasons, both use the same alogorithm (rete)!!</p>
<p>Now, using drools is something else, biztalk also functions as an ESB, can drools do that?</p>
| 28,471 |
<p>I am working on interactive SVG/AJAX interfaces where elements are created and repositioned on-the-fly by users. I'd like to support the ability for users to export their current view to a PNG image and/or an SVG document. I'd really like the SVG document to be as simple as possible (without a lot of nested transfor... | <p>I'm assuming you need this to work only in browsers that support SVG.</p>
<p>Firefox, Safari, and Opera provide the non-standard <code>XMLSerializer</code> API, so you could do something like this:</p>
<pre><code>var svg = document.getElementById('svg_root'); // or whatever you call it
var serializer = new XMLSeri... | <p>Opera has implementation of <a href="http://www.w3.org/TR/DOM-Level-3-LS/load-save.html" rel="nofollow noreferrer">W3C's DOM→XML serializer</a>. In XML mode <code>innerHTML</code> returns well-formed XML in Gecko.</p>
<p>HTML5 <code><canvas></code> can export its content as PNG file using <code>toDataURL()</c... | 28,111 |
<p>For my Java apps with very long classpaths, I cannot see the main class specified near the end of the arg list when using ps. I think this stems from my Ubuntu system's size limit on /proc/pid/cmdline. How can I increase this limit?</p>
| <p>You can't change this dynamically, the limit is hard-coded in the kernel to PAGE_SIZE in fs/proc/base.c:</p>
<pre><code> 274 int res = 0;
275 unsigned int len;
276 struct mm_struct *mm = get_task_mm(task);
277 if (!mm)
278 goto out;
279 if (!mm->arg_end)
28... | <p>Perhaps the 'w' parameter to ps is what you want. Add two 'w' for greater output. It tells ps to ignore the line width of the terminal.</p>
| 24,273 |
<p>What does Java do with long variables while performing addition?</p>
<p>Wrong version 1:</p>
<pre><code>Vector speeds = ... //whatever, speeds.size() returns 2
long estimated = 1l;
long time = speeds.size() + estimated; // time = 21; string concatenation??
</code></pre>
<p>Wrong version 2:</p>
<pre><code>Vector ... | <p>My guess is you are actually doing something like:</p>
<pre><code>System.out.println("" + size + estimated);
</code></pre>
<p>This expression is evaluated left to right:</p>
<pre><code>"" + size <--- string concatenation, so if size is 3, will produce "3"
"3" + estimated <--- string concatenation, ... | <p>I suspect you're not seeing what you think you're seeing. Java doesn't do this.</p>
<p>Please try to provide a <a href="http://pobox.com/~skeet/csharp/complete.html" rel="nofollow noreferrer">short but complete program</a> which demonstrates this. Here's a short but complete program which demonstrates correct behav... | 30,100 |
<p>I am developing a prototype for a game, and certain gameplay rules are to be defined in an ini file so that the game designers can tweak the game parameters without requiring help from me in addition to a re-compile. This is what I'm doing currently:</p>
<pre><code>std::ifstream stream;
stream.open("rules.ini");
i... | <p>You are assuming that the <strong>working directory</strong> is the directory that your executable resides in. That is a bad assumption.</p>
<p>Your executable can be run from any working directory, so it's usually a bad idea to hard-code relative paths in your software.</p>
<p>If you want to be able to access fi... | <p>(wild assumption here) you are using visual studio. During debug, your program is going to search the project directory for "rules.ini"</p>
<p>However, if you try executing your program from "myproject/debug/myexe.exe", it should run fine because it is going to search "/debug" for rules.ini</p>
<p>Like its been me... | 46,679 |
<p>How to get function's name from <a href="http://en.wikipedia.org/wiki/Function_pointer" rel="noreferrer">function's pointer</a> in C?</p>
<p>Edit: The real case is: I'm writing a linux kernel module and I'm calling kernel functions. Some of these functions are pointers and I want to inspect the code of that functio... | <p>That's not directly possible without additional assistance.</p>
<p>You could:</p>
<ol>
<li><p>maintain a table in your program mapping function pointers to names</p></li>
<li><p>examine the executable's symbol table, if it has one.</p></li>
</ol>
<p>The latter, however, is hard, and is not portable. The method w... | <p>You can't. The function name isn't attached to the function by the time it's compiled and linked. It's all by memory address at that point, not name.</p>
| 45,708 |
<p>I have a really large VB6 code base with a ton of 3rd party controls. Want to move it to .NET. Rewriting it is out of question - the client sees no value in spending money to get the same thing. Moving to .NET with the built-in upgrade wizard is basically a non-starter.</p>
<p>Has anyone tried the VB Migration P... | <p>I am the lead author of the VB Migration Partner tool (featured at www.vbmigration.com). In general we answer very quickly to all requests coming from existing or potential customers. I am sorry if found it difficult to contact us. Please try again at <a href="http://www.vbmigration.com/contactus.aspx" rel="noreferr... | <p>I've never worked with the VB migration guys before, however I would highly recommend against migrating the code base to .NET. It really doesn't add value.</p>
<p>What I've had great success doing is adding new functionality in .NET and getting at it via COM interop from the VB6 application. This is pretty effort... | 33,112 |
<p>I have an HTTPHandler that is reading in a set of CSS files and combining them and then GZipping them. However, some of the CSS files contain a Byte Order Mark (due to a bug in TFS 2005 auto merge) and in FireFox the BOM is being read as part of the actual content so it's screwing up my class names etc. How can I ... | <p>Expanding on <a href="https://stackoverflow.com/questions/288111/remove-byte-order-mark-from-a-file-readallbytes-byte#comment21871755_288111">Jon's comment</a> with a sample.</p>
<pre><code>var name = GetFileName();
var bytes = System.IO.File.ReadAllBytes(name);
System.IO.File.WriteAllBytes(name, bytes.Skip(3).ToAr... | <p>For larger file, use the following code; memory efficient!</p>
<pre><code>StreamReader sr = new StreamReader(path: @"<Input_file_full_path_with_byte_order_mark>",
detectEncodingFromByteOrderMarks: true);
StreamWriter sw = new StreamWriter(path: @"<Output_file_without_byte_order_mark&g... | 36,665 |
<p>What's the deal with Visual Studio?</p>
<p>I tried importing the Caching App Block and got this message:</p>
<blockquote>
<p>The assembly or one of its dependencies you're are trying to import requires a later version of .NET Framework.</p>
</blockquote>
<p>I went to the properties of my application in Visual S... | <p>Found it....went to "Advanced Compile Options" on Compile Tab.....weird!</p>
| <p>Go to the properties of a project (Solution Explorer --> Project --> Properties or Menu Bar --> Project --> Properties) and on the Application tab you'll see Target Framework.</p>
| 22,793 |
<p>I use Intellij Idea 7 for Java dev. My dev is 'limited' to all J2SE features plus light JSP, Servlets, and super light usage of JPA. No J2EE, no massive use of random frameworks, etc.</p>
<p>Is it worth upgrading to ver 8? "Worth it" to me means better "core functionality" in terms of speed (ESPECIALLY startup sp... | <p>It also seems to be easier to configure a new project over top of a complex collection of existing code.</p>
<p>For example, something that you would naturally configure into 5 or more modules.</p>
| <p>IntelliJ 8 has a configure plugins feature that allows you to disable plugins with dependencies. Nothing trial and error couldn't replicate, but it is nice.</p>
| 46,637 |
<p>At what point is it better to switch from java.net to java.nio? .net (not the Microsoft entity) is easier to understand and more familiar, while nio is scalable, and comes with some extra nifty features.</p>
<p>Specifically, I need to make a choice for this situation: We have one control center managing hardware at... | <p>Scalability will probably drive your choice of package. java.net will require one thread per socket. Coding it will be significantly easier. java.nio is much more efficient, but can be hairy to code around.</p>
<p>I would ask yourself how many connections you expect to be handling. If it's relatively few (say,... | <p>The number of connections you're talking about tells me you should use java.net. Really, there's no reason to complexify your task with non-blocking I/O. (Unless your remote systems are underpowered, but then why are you using Java on them?)</p>
<p>Take a look at <a href="http://ws.apache.org/xmlrpc/" rel="nofoll... | 33,526 |
<p>When making changes using <code>SubmitChanges()</code>, LINQ sometimes dies with a <code>ChangeConflictException</code> exception with the error message <code>Row not found or changed</code>, without any indication of either the row that has the conflict or the fields with changes that are in conflict, when another ... | <p>Here's a way to see where the conflicts are (this is an MSDN example, so you'll need to heavily customize):</p>
<pre><code>try
{
db.SubmitChanges(ConflictMode.ContinueOnConflict);
}
catch (ChangeConflictException e)
{
Console.WriteLine("Optimistic concurrency error.");
Console.WriteLine(e.Message);
... | <p>"and also is there a way of getting LINQ to ignore the issue and simply commit the data regardless?"</p>
<p>You can set the 'Update Check' property on your entity to 'Never' to stop that field being used for optimistic concurrency checking.</p>
<p>You can also use:</p>
<pre><code>db.SubmitChanges(ConflictMode.Con... | 5,264 |
<p>I am trying to install PHP onto my development box (XP SP3 / IIS 5.1) I've got PHP 5.2.6 stable downloaded (the MSI installer package) and I am getting an error "Cannot find httpd.conf". After that the install seems to breeze by quickly (more quickly than I would have expected) and when I try to execute a simple P... | <p>Not sure if you already have this but I use WAMP from <a href="http://www.wampserver.com/en" rel="nofollow noreferrer">http://www.wampserver.com/en</a></p>
<p>It's easy and simple to set up, it has an icon in the system tray to show that its active and you can make it go online or available to the outside by clicki... | <p>Probably the installer didn't configure your server to use PHP properly. Check out Microsoft's page on <a href="http://www.iis.net/php" rel="nofollow noreferrer">enabling PHP on IIS</a> or alternatively switch to Apache if that's a viable option.</p>
| 15,198 |
<p>I have this piece of Javascript and it just won't work. I allready checked JSlint but that said everything works. Still doesn't work. The javascript is located not in the HTML but is linked in the <code><head></code></p>
<p>note: I am working with a local server, so pageload in instant.</p>
<pre><code>functi... | <p>This sounds like the DOM object doesn't exist at the time of referencing it. Perhaps change your code to execute once the document has fully loaded (or place the javascript at the bottom of your page)</p>
<blockquote>
<p>note: I am working with a local server, so pageload in instant.</p>
</blockquote>
<p>that's ... | <p>You need to wrap your code in a window.onload event handler, a domReady event handler (available in most modern js frameworks and libraries) or place at the bottom of the page.</p>
<p>Placing at the bottom of the page works fine, as you can see <a href="http://jsbin.com/azoke/edit" rel="nofollow noreferrer">here</a... | 35,348 |
<p>When using the unmanaged API for the .NET framework to profile a .NET process in-process, is it possible to look up the IL instruction pointer that correlates to the native instruction pointer provided to the StackSnapshotCallback function?</p>
<p>As is probably obvious, I am taking a snapshot of the current stack,... | <p>In order to translate from a native instruction pointer as provided by <code>ICorProfilerInfo2::DoStackSnapshot</code> to an intermediate language method offset, you must take two steps since <code>DoStackSnapshot</code> provides a <code>FunctionID</code> and native instruction pointer as a virtual memory address.</... | <pre><code>Console.WriteLine("StackTrace: '{0}'", Environment.StackTrace);
</code></pre>
<p>Make sure your build generates symbols.</p>
<p>Expanding on the discussion:</p>
<blockquote>
<blockquote>
<p>As is probably obvious, I am taking a snapshot of the current stack, and would like to provide file and line n... | 24,224 |
<p>On a server I have to take care of, errors from a vhost do not go to the standard PHP error log.</p>
<p>In the php.ini we have </p>
<pre><code>log = /var/log/file
</code></pre>
<p>and <code>phpinfo()</code> does not show any difference between the vhost and the whole server.</p>
<p>But the callback function set... | <p>Perhaps the errors that aren't logged <a href="http://php.net/error-reporting" rel="nofollow noreferrer">aren't supposed to be logged</a>? The <a href="http://php.net/set_error_handler" rel="nofollow noreferrer">error reporting settings have no effect when set_error_handler is used</a>, hence you see more errors tha... | <p>I would take a look at error_log, log_error and error_reporting directive in php.ini and also take a look in the httpd.conf because directives can also be added there using "php_admin_value" and others.</p>
| 22,079 |
<p>Just need to use find a simple way to have AD authenticate as the login for a Sharepoint site. This fairly quick and simple to get going ? </p>
<p>Thanks! </p>
| <p>For SharePoint 2007, see this <a href="http://technet.microsoft.com/en-us/library/cc262350.aspx" rel="nofollow noreferrer">article</a>. You probably want to set it up to do Windows integrated authentication with NTLM. Getting authentication working is probably not too hard, getting your site setup the way you want... | <p>Here is a decent discussion of SharePoint security links</p>
<p><a href="http://blogs.msdn.com/joelo/archive/2007/06/29/sharepoint-groups-permissions-site-security-and-depreciated-site-groups.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/joelo/archive/2007/06/29/sharepoint-groups-permissions-site-security-a... | 39,607 |
<p>When I generate CSS or JavaScript files using PHP I like to use .js.php or .css.php file extensions. so that I know what's going on.</p>
<p>Is there a way of associating these "compound" file extensions to their respective languages?</p>
| <p>I don't use NetBeans or PHP, but the following trick helped me in a similar setting:</p>
<pre><code><?php if(0) { ?><script><?php } ?>
# code goes here
<?php if(0) { ?></script><?php } ?>
</code></pre>
<p>Simply surround the js code with <code><script></code> or <code><... | <p>What I usually do is condense such "compound" extensions into one, following the tradition of condensing .tar.gz into .tgz.</p>
| 40,184 |
<p>I have been using anonymous namespaces to store local data and functions and wanted to know when the data is initialized? Is it when the application starts in the same way as static data or is it compiler dependent? For example:</p>
<pre><code>// foo.cpp
#include "foo.h"
namespace {
const int SOME_VALUE = 42;
... | <p>C++ Standard, <strong>3.6.2/1</strong> :</p>
<blockquote>
<p>Zero-initialization and
initialization with a constant
expression are collectively called
static initialization; all other
initialization is dynamic
initialization. Objects of POD types
(3.9) with static storage duration
initialized with c... | <p>For the right answer to your actual question see Mathieu's answer.</p>
<p>However, note that the anonymous namespace doesn't affect the beginning and end of the lifetimes of global and / or static objects. In other words, you're just as vulnerable to <a href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10... | 42,880 |
<p>I am using Apache Axis to connect my Java app to a web server. I used wsdl2java to create the stubs for me, but when I try to use the stubs, I get the following exception:</p>
<blockquote>
<p>org.apache.axis.ConfigurationException: No service named <code><web service name></code> is available</p>
</blockquo... | <p>According to the <a href="http://wiki.apache.org/ws/FrontPage/Axis/DealingWithCommonExceptions">documentation</a> linked to by @arnonym, this exception is somewhat misleading. In the first attempt to find the service a ConfigurationException is thrown and caught. It is logged at DEBUG level by the ConfigurationExcep... | <p>This is what my code looks like. It seems to work fine.
Are you using a service locator or just creating your service?</p>
<pre><code>SomeServiceLocator locator = new SomeServiceLocator();
SomeService service = null;
try
{
service = locator.getSomeServiceImplPort();
}
catch (ServiceException e)
{
e.printSta... | 9,107 |
<p>Is there a way to determine how many capture groups there are in a given regular expression?</p>
<p>I would like to be able to do the follwing:</p>
<pre><code>def groups(regexp, s):
""" Returns the first result of re.findall, or an empty default
>>> groups(r'(\d)(\d)(\d)', '123')
('1', '2', '... | <pre><code>def num_groups(regex):
return re.compile(regex).groups
</code></pre>
| <p>Might be wrong, but I don't think there is a way to find the number of groups that would have been returned had the regex matched. The only way I can think of to make this work the way you want it to is to pass the number of matches your particular regex expects as an argument.</p>
<p>To clarify though: When finda... | 15,462 |
<p>In PHP, I am able to use a normal function as a variable without problem, but I haven't figured out how to use a static method. Am I just missing the right syntax, or is this not possible?</p>
<p>(EDIT: the first suggested answer does not seem to work. I've extended my example to show the errors returned.)</p>
<... | <p>PHP handles callbacks as strings, not function pointers. The reason your first test works is because the PHP interpreter assumes <strong>foo1</strong> as a string. If you have E_NOTICE level error enabled, you should see proof of that.</p>
<p>"Use of undefined constant foo1 - assumed 'foo1'"</p>
<p>You can't cal... | <p>"A member or method declared with static can not be accessed with a variable that is an instance of the object and cannot be re-defined in an extending class"</p>
<p>(<a href="http://theserverpages.com/php/manual/en/language.oop5.static.php" rel="nofollow noreferrer">http://theserverpages.com/php/manual/en/language... | 23,346 |
<p>I am developing a web app which requires a username and password to be stored in the web.Config, it also refers to some URLs which will be requested by the web app itself and never the client.</p>
<p>I know the .Net framework will not allow a web.config file to be served, however I still think its bad practice to l... | <ul>
<li><a href="http://msdn.microsoft.com/en-us/library/zhhddkxy.aspx" rel="noreferrer">Encrypting and Decrypting Configuration Sections</a> (ASP.NET) on MSDN</li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2006/01/09/434893.aspx" rel="noreferrer">Encrypting Web.Config Values in ASP.NET 2.0</a> on ScottGu's ... | <p>Use aspnet_setreg.exe <a href="http://support.microsoft.com/kb/329290" rel="nofollow noreferrer">http://support.microsoft.com/kb/329290</a></p>
| 7,781 |
<p>Is there a .NET Framework compiler for the Ruby language? I've heard of the DLR (Dynamic Language Runtime), is this going to enable Ruby to be used with .NET development?</p>
| <p><a href="http://www.ironruby.net/" rel="noreferrer">IronRuby</a> is a project supported by Microsoft, built on the Dynamic Language Runtime.</p>
| <p><a href="http://rubydotnet.googlegroups.com/web/Home.htm?gda=8ES3fzoAAACraJYLasopJnHm_A4zSrefscDsHtcsS-deqHbu90w8mzCLtOtCUOXSAV3CbWid_sX97daDQaep90o7AOpSKHW0" rel="nofollow noreferrer">Yep, the Ruby.NET project</a>. Note, it hasn't been updated since November 2007, so I'm not sure what the support's like now. </p>... | 24,342 |
<p>I would like to completely reset the scroll position of a UITableView, so that every time I open it, it is displaying the top-most items. In other words, I would like to scroll the table view to the top every time it is opened.</p>
<p>I tried using the following piece of code, but it looks like I misunderstood the ... | <p>August got the UITableView-specific method. Another way to do it is:</p>
<pre><code>[tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];
</code></pre>
<p>This method is defined in UIScrollView, the parent class to UITableView. The above example tells it to scroll to the 1x1 box at 0,0 - the top left... | <p>What I ended up doing was this:</p>
<p>Swift 4</p>
<pre><code>self.tableView.contentOffset = CGPoint.zero
DispatchQueue.main.async {
self.tableView.reloadData()
}
</code></pre>
| 39,640 |
<p>Would you recommend me the best approach to edit SQL query with Visual Studio 2008 Professional, please?</p>
<p>I know I can open Query window from context menu in Server Explorer and edit text in SQL Pane. But unfortunately I am not allowed to save query to a file and Find and Replace commands are not working ther... | <p>If you create a Database project within your solution in Visual Studio, then you can set up a default database connection for that project. Then any *.sql files that are included in the database project can be executed against that connection. What I usually do is select the text to be exectued and right-click it, t... | <p>Wow you are right, this is a real pain. Would it be acceptable for you to use a local copy of the SQL Management Studio (the name might be wrong)? You would be outside of VS but you could still edit your query and run it at the same time. Definitely not optimal but better than nothing.</p>
<p>Good luck.</p>
| 23,929 |
<p>What are you using for binding XML to Java? JAXB, Castor, and XMLBeans are some of the available choices. The comparisons that I've seen are all three or four years old. I'm open to other suggestions. Marshalling / unmarshalling performance and ease of use are of particular interest.</p>
<p>Clarification: I'd like ... | <p><a href="http://www.jibx.org" rel="noreferrer">JiBX</a>. Previously I used <a href="http://www.castor.org/xml-framework.html" rel="noreferrer">Castor XML</a>, but JiBX proved to be significantly better, particularly in terms of performance (a straight port of some application code from Castor XML to JiBX made it 9x... | <p>We use Castor. It suits our needs fairly well.</p>
| 25,210 |
<p>I really like the way gmail has the archive system implemented. I can archive any file after adding a tag to it (if needed) and I can search for it whenever I want to.
Is there any program in Windows/Linux which behaves in a similar fashion?</p>
| <p>When you "Archive" in gmail you are just removing a hidden tag ("INBOX").
It does not seem a useful thing to do in your own file system, since you are not actually "archiving" anything.
Good luck!</p>
| <p>You might like google's GoogleDesktop... it doesn't have tagging per-se, but it seems to have pretty effective desktop search.</p>
| 23,893 |
<p>How do you make the authentication for a browser-based application dependent on the client machine? Say the admin can login only from <b>this</b> machine.</p>
<p>Assumptions: There is complete control over the network and all machines (client and server) involved.</p>
<p>I am looking for an apache/linux solution.<... | <p>You need to come up with some way of identifying <strong>this</strong> machine. What iis important in your application? Physical location? IP address?</p>
<p>If you have complete control over the machines I would use SSL with client certficates, and put the client certificate only on the machine that must be used. ... | <p>If you are worried about malicious attempts to spoof the client workstation on the network, you could look into setting up IPSEC on the client and server, then you can simply use the IP address and treat it as trusted - i.e. use standard Apache techniques to control access by IP. </p>
<p>Or if you consider your net... | 47,664 |
<p>We have a C# service that is deployed to a remote customer system. The application writes a substantial amount of "diagnostic" information to the console (i.e. Console.WriteLine()). The service isn't "doing what it should." How can we capture the console output from the service in another application?</p>
<p>A W... | <p>Are you able to change the service code <em>at all</em>? If so, using Console.SetOut to write to a file instead would be the most obvious first port of call. Then change to using a proper logging library for the next release :)</p>
| <p>I found <a href="http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/2e827551-6cbc-4b3d-a04f-e4dc6c262ae1" rel="nofollow noreferrer">this post</a> on MSDN which binds the Console output to a rich text box, worked for me very quickly and easily.</p>
<p>It overrides WriteLine, and could be expan... | 24,623 |
<p>I have a multidimensional array. I need to search it for a specific range of values, edit those values and return the edited data.</p>
<p>Example array:</p>
<pre><code>array(3) {
["first"]=>
array(1) {
[0]=>
string(4) "baz1"
}
["second"]=>
array(1) {
[0]=>
string(4) "foo1"
}... | <p>If your array will not be extremely deep, this can work.
($array being what you want to replace later with yours)</p>
<pre><code>$array= array('first' => array('bazi1'), 'second' => array('foo1'), 'third' => array('foo2') );
function modify_foo(&$item, $key)
{
$item = str_replace('foo', 'foo-bar', $... | <pre><code> function test_replace1(&$input, $search, $replace) {
$result = array();
$numReplacements = 0;
foreach ($input as &$value) {
if (is_array($value)) {
$result = array_merge($result, test_replace1($value, $search, $replace));
} else {
$value = str_repl... | 33,018 |
<p>I was wondering what and why you would choose to be able to make a database that can support no more than 100 users with no more than 10 using it at once with a Visual Studio 2008 C# Windows Form front end to access it by. I have to access the database over a network connection, not just on the local machine. I also... | <p>If it is not for comercial purposes you can try SQL Server 2008 Express. It can integrate nicely with Visual Studio 2008 for development and has support for LINQ, Entity Data Model and ADO.NET Entity Framework to make it easy to create next generation data-enabled applications.</p>
<p><a href="http://www.microsoft.... | <p>I know using mssql you can pick between different connection strings for all of your db calls, just do something like</p>
<p>Command.Connection = GetMyConnectionWithWhateverLogicINeed();</p>
| 13,504 |
<p>When calling a remote service (e.g. over RMI) to load a list of entities from a database using Hibernate, how do you manage it to initialize all the fields and references the client needs?</p>
<p>Example: The client calls a remote method to load all customers. With each customer the client wants the reference to th... | <p>I have used 1 in the past and it worked well.</p>
| <p>This remote service... is it another part of the same application? if so, there's no problem sharing classes and sending instances back and forth (same goes for RMI, using stubs).
<P>Then there's the option of accessing a web-service or something similar, where the two applications communicating share no classes, an... | 14,559 |
<p><strong>Edited:</strong>
What is the easiest way to <s>scrape</s> extract SharePoint list data to a separate SQL Server table? One condition: you're in a work environment where you don't control the SQL Server behind the SharePoint Server, so you can't just pull from the <em>UserData</em> table. </p>
<p>Is there ... | <p>There is a SSIS SharePoint task you can use to grab the data info a regular dataflow:
<a href="http://www.codeplex.com/SQLSrvIntegrationSrv" rel="noreferrer">http://www.codeplex.com/SQLSrvIntegrationSrv</a></p>
| <p>Depending on the exact nature of the data you need to insert, it may be possible to just use the auto generated RSS feed to get the information you want, a process will need to read the rss and formulate a query.</p>
<p>Otherwise a consoleapp/service could use the object model to do the same thing, but with more co... | 39,596 |
<p>i would to know how to write a profiler? What books and / or articles recommended? Can anyone help me please?</p>
<p>Someone has already done something like this?</p>
| <p>Encouraging lot, aren't we :)</p>
<p>Profilers aren't too hard if you're just trying to get a reasonable idea of where the program's spending most of its time. If you're bothered about high accuracy and minimum disruption, things get difficult.</p>
<p>So if you just want the answers a profiler would give you, go for... | <p>As another answer, I just looked at LukeStackwalker on sourceforge. It is a nice, small, example of a stack-sampler, and a nice place to start if you want to write a profiler.</p>
<p>Here, in my opinion, is what it does right:</p>
<ul>
<li>It samples the entire call stack.</li>
</ul>
<p>Sigh ... so near yet so fa... | 48,158 |
<p>I want to do something like this: </p>
<p>page A has a link to page B<br>
page B gets content from a database and processes it<br>
the result from page B is displayed on a div in page A </p>
<p>Please notice that I don't want to leave page A while page B processes the information of the database.</p>
<p>What I... | <p>You want AJAX!</p>
<p>AJAX will do that, but the steps will be a little different from what you describe</p>
<ul>
<li>page A has a link that calls a javascript function</li>
<li>the javascript function makes an AJAX call to page B which gets content from a database and processes it</li>
<li>the result from page B... | <p>Short answer: no.</p>
<p>You will need some client side scripts or AJAX to do this.</p>
| 49,152 |
<p>I've noticed that plenty of opensource project doesn't use BITWISE flags anymore, even if it's fully supported by programming enviroment common for web ( php/Mysql).
It's that a "lost practise" for some effective problem, or is just that a lot of php programmers don't know how to handle this type of implementation?<... | <p>I'll stick my neck out and say that every technical position requires a sound understanding of bitwise operations.</p>
<p>And I have an anecdote that indirectly addresses the topic.</p>
<p>January 2007 I was in Cochin, India, recruiting for permanent development staff. Since I wasn't involved in the preliminary s... | <p>I still use bitwise operators, though as my main language of choice (and professionally) is C# I often use Flag enums for it :) But yeah, I think alot of people who code in things like PHP are self taught, and don't know about bitwise operations or the usages of them.</p>
<p>Being self taught myself, I didn't know ... | 27,789 |
<p>We have a windows application that contains an ActiveX WebBrowser control. As part of the regular operation of this application modifications are made to the pages that are displayed by the ActiveX WebBrowser control. Part of these modifications involve setting a JavaScript variable in a web page being loaded into t... | <p>These two articles helped us find a solution to our problem. They outline the basics of what one needs to know:</p>
<p><a href="http://www.codeproject.com/KB/cs/mshtml_automation.aspx" rel="nofollow noreferrer">Microsoft Web Browser Automation using C#</a></p>
<p><a href="http://www.codeproject.com/KB/cs/advhost.a... | <p>The usual method we use is to add a hidden text input box (the ASP.Net control version) on the page. That way you can easily set its value in the C# codebehind and read the value in client side JavaScript (and vice-versa, of course).</p>
| 16,487 |
<p>Let's say I have a complex .NET class, with lots of arrays and other class object members. I need to be able to generate a deep clone of this object - so I write a Clone() method, and implement it with a simple BinaryFormatter serialize/deserialize - or perhaps I do the deep clone using some other technique which i... | <p>You method of testing will depend on the type of solution you come up with. If you write some custom cloning code and have to manually implement that in each cloneable type then you should really test the cloning of each one of those types. Alternatively, if you decide to go a more generic route (where the aforeme... | <p>Here is a sample of how I implemented this a while back, although this will need to be tailored to the scenario. In this case we had a nasty object chain that could easily change and the clone was used as a very critical prototype implementation and so I had to patch (hack) this test together.</p>
<pre><code>public... | 3,216 |
<p>I have a table with a view_name field (varchar(256)) and I would like to use that field in an sql query.</p>
<p>Example :</p>
<p>TABLE university_members</p>
<p><strong>id | type | view_name | count</strong></p>
<p>1 | professors | view_professors | 0</p>
<p>2 | students | view_students2 | 0</p>
<p>3 | staff |... | <p>To do this you would have to do it as a bit of dynamic SQL, something like this might work, obviously you would need to edit to actually match what you are trying to do.</p>
<pre><code>DECLARE @ViewName VARCHAR(500)
SELECT @ViewName = view_name
FROM University_Members
WHERE Id = 1
DECLARE @SQL VARCHAR(MAX)
SET @... | <p>The way I see it, you could generate SQL code in a VARCHAR(MAX) variable and then execute it using EXEC keyword. I don't know of any way to do it directly, as you tried.</p>
<p>Example:</p>
<pre><code>DECLARE @SQL VARCHAR(MAX)
SET @SQL = ''
SELECT @SQL = @SQL + 'UPDATE university_members SET count = (SELECT COUNT(... | 43,349 |
<p>What is the C++ equivalent to <code>GetObject</code> in <a href="http://en.wikipedia.org/wiki/JavaScript" rel="nofollow noreferrer">JavaScript</a> and <a href="http://en.wikipedia.org/wiki/VBScript" rel="nofollow noreferrer">VBScript</a>?</p>
<p>The closest match I found to my question is:</p>
<p><a href="http://c... | <p>I figured out the issue. The object I wanted to access was </p>
<p><code>
winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv
</code></p>
<p>I mistakenly took \\ for an escapement. In C++ the correct query is :</p>
<p><code>
::CoGetObject(L"winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\... | <p>If asking for IUnknown returns NULL, there is no object by that name. Each COM object implements IUnknown.</p>
| 44,163 |
<p>Does anyone know how function indexes work in databases?</p>
| <p>The main difference is that InnoDB supports transactions while MyISAM does not.</p>
<p>There are numerous other differences, however the common one's i am aware of are:</p>
<ul>
<li>MyISAM has typically been considered faster at searching, but recent InnoDB improvements are removing this difference and improving h... | <p>Here is a description of differences between InnoDB and MyIsam:</p>
<p><a href="http://tag1consulting.com/MySQL_Engines_MyISAM_vs_InnoDB" rel="nofollow noreferrer">Differences between InnoDB and MyIsam</a></p>
<p>Few differences:</p>
<ul>
<li><strong>MYISAM</strong> doesnt support any database transactions, </li>... | 35,011 |
<p>I am working with a large Java web application from a commercial vendor. I've received a patch from the vendor in the form of a new .class file that is supposed to resolve an issue we're having with the software. In the past, applying patches from this vendor have caused new and completely unrelated problems to ar... | <p>It's possible that they just compiled it with a new version of the java compiler, or with different optimization settings etc, so that the functionality is the same, and the code is the same, but the output bytecode is slightly different.</p>
| <p>You could try using a diff tool (such as SourceGear's free DiffMerge tool) on the decompiled sources. That should pick up the file differences, although it will likely pick up "insignificant" differences, for example if variables have been named differently in the two versions.</p>
<p><a href="http://www.sourcegea... | 11,380 |
<p>When someone uses the term XXX architecture I tend to cringe. It often indicates that there's another architectural discipline or perspective that I'm probably not considering. What perspectives of architecture are you considering and do you have any good resources for information on them?</p>
<p>I hope this help... | <p>Architecture and architectural decisions are primarily about the "non-functional" requirements of a system; <em>pace</em> RoadWarrier, but each of the things he mentions are consequences of the architectural decisions more than independent in and of themselves. (Proof: what leads to a particular choice in any of th... | <ul>
<li>testability</li>
<li>scalability</li>
<li>fault-tolerance</li>
<li>performance degradation (gracefully, one hopes)</li>
<li>upgradability (hardware and software)</li>
</ul>
<p>BTW these are all reasons why I like enterprise service busses (ESBs)!</p>
| 48,820 |
<p>Sometimes I find myself in the situation where I want to execute several sequential commands like such:</p>
<pre><code>try:
foo(a, b)
except Exception, e:
baz(e)
try:
bar(c, d)
except Exception, e:
baz(e)
...
</code></pre>
<p>This same pattern occurs when exceptions simply need to be ignored.</p>
... | <p>You could use the <a href="https://www.python.org/dev/peps/pep-0343/" rel="noreferrer"><code>with</code> statement</a> if you have python 2.5 or above:</p>
<pre><code>from __future__ import with_statement
import contextlib
@contextlib.contextmanager
def handler():
try:
yield
except Exception, e:
... | <p>In your specific case, you can do this:</p>
<pre><code>try:
foo(a, b)
bar(c, d)
except Exception, e:
baz(e)
</code></pre>
<p>Or, you can catch the exception one step above:</p>
<pre><code>try:
foo_bar() # This function can throw at several places
except Exception, e:
baz(e)
</code></pre>
| 15,702 |
<p>What VM technologies exist for Linux, their pros and cons, and which is recommended for which application?</p>
<p>Since this kind of question can be asked for X other than "VM technologies for Linux", and since the answer changes with progress, I suggest to define a template for this kind of pages. Those pages wil... | <p>This is a job for ... <strong><a href="http://en.wikipedia.org/wiki/Main_Page" rel="nofollow noreferrer">Wikipedia</a></strong>!</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Virtualization" rel="nofollow noreferrer">Types of Virtualization</a></li>
<li><a href="http://en.wikipedia.org/wiki/Platform_virtualiza... | <h1>2008 Oct</h1>
<p>To be filled in at October to reflect the market status then.</p>
<h1>2008 Sept</h1>
<h2>Products/services/technologies currently existing</h2>
<ol>
<li><a href="http://www.vmware.com" rel="nofollow noreferrer">VMware</a></li>
<li><a href="http://www.xen.org" rel="nofollow noreferrer">Xen</a></li>
... | 13,503 |
<p>From what I have gleaned from reflector, RunWithElevatedPriveleges simply reverts the current thread identity to the base (non-impersonated) identity. This makes perfect sense in the case of code running inside the WSS application pool, since the base service account is a super-user. Does it have any effect when r... | <p>Normally Runwithelevatedprivileges will get your code running as the app pool identity, but it doesn't work from the console. What we've done in this case is either use <a href="http://technet.microsoft.com/en-us/library/cc781769.aspx" rel="nofollow noreferrer">runas</a> or
a set the identity of a scheduled task t... | <p>RunWithElevatedPriveleges don't work when HTTPContext is null. In console, HTTPContext is null.</p>
| 14,776 |
<p>The <code>unzip</code> command doesn't have an option for recursively unzipping archives.</p>
<p>If I have the following directory structure and archives:</p>
<pre>
/Mother/Loving.zip
/Scurvy/Sea Dogs.zip
/Scurvy/Cures/Limes.zip
</pre>
<p>And I want to unzip all of the archives into directories with the same name... | <p>If you want to extract the files to the respective folder you can try this</p>
<pre><code>find . -name "*.zip" | while read filename; do unzip -o -d "`dirname "$filename"`" "$filename"; done;
</code></pre>
<p>A multi-processed version for systems that can handle high I/O:</p>
<pre><code>find . -name "*.zip" | xar... | <p>this works for me</p>
<pre><code>def unzip(zip_file, path_to_extract):
"""
Decompress zip archives recursively
Args:
zip_file: name of zip archive
path_to_extract: folder where the files will be extracted
"""
try:
if is_zipfile(zip_file):
... | 13,336 |
<p>Microsoft <a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx" rel="nofollow noreferrer">recently announced</a> that the Javascript/HTML DOM library <strong>jQuery will be integrated</strong> into the ASP.NET MVC framework and into ASP.NET / Visual Studio.</p>
<p>What is the best pr... | <p>For me, problems arise when using UpdatePanels and jQuery (no problem with MVC, which doesn't have a Page Life-Cycle and is truly stateless). For instance, the useful jQuery idiom </p>
<pre><code>
$(function() {
// some actions
});
</code></pre>
<p>used to enhance your DOM or attach events to the DOM elements ma... | <p>There's a small issue which is mentioned by David Ward here: <a href="http://encosia.com/2008/09/28/avoid-this-tricky-conflict-between-aspnet-ajax-and-jquery/" rel="nofollow noreferrer">http://encosia.com/2008/09/28/avoid-this-tricky-conflict-between-aspnet-ajax-and-jquery/</a></p>
<p>But there should not be any ma... | 17,858 |
<p>It looks interesting and I've played around with it some --- but the development IDE in a web browser seems to be nightmare eventually.</p>
<p>Does anyone have experience using it and what are your thoughts?</p>
| <p>We evaluated GI a few months ago for a project but didn't end up selecting it.</p>
<p>The IDE-in-a-browser (which is itself build with GI) actually works surprisingly well, though there are some features you normally expect from an editor that it lacks, most notably (and irritatingly) an Undo command. It's also imp... | <p>Kieron does a good job of summarizing GI. It's really for enterprise web applications, not consumer-y widgets. The overhead of loading the entire GI framework and waiting a second or two for it to load doesn;t seem like much if you're firing up a call center or an employee provisioning application you're going to ... | 3,357 |
<p>We created several custom web parts for SharePoint 2007. They work fine. However whenever they are loaded, we get an error in the event log saying:</p>
<blockquote>
<p>error initializing safe control - Assembly: ...</p>
</blockquote>
<p>The assembly actually loads fine. Additionally, it is correctly listed in th... | <p>You need to add a safecontrol entry to the web,config file, have a look at the following:</p>
<pre><code><SafeControls>
<SafeControl
Assembly = "Text"
Namespace = "Text"
Safe = "TRUE" | "FALSE"
TypeName = "Text"/>
...
</SafeControls>
</code></pre>
<p><a href="http://msdn.micro... | <p>This is because of the amount of list items in the lists. Your server takes to much time to migrate all the list items and it fails, try deleiting the list items or configuring the server.</p>
<p>Regards,
Mariano.</p>
| 4,546 |
<p>Macs are renowned (or bemoaned) for having an extensive number of shortcuts. However, OS X itself pales in comparison to the shortcut lists in <a href="http://macromates.com/" rel="noreferrer">TextMate</a> and its bundles.</p>
<p>What are some useful keyboard shortcuts you use?</p>
| <p>These are my favorite shortcuts:</p>
<ul>
<li><kbd>cmd</kbd>+<kbd>t</kbd> Start typing name of a file to open it</li>
<li><kbd>ctrl</kbd>+<kbd>w</kbd> Select word</li>
<li><kbd>cmd</kbd>+<kbd>r</kbd> Run the ruby or php-script that is open</li>
<li><kbd>cmd</kbd>+<kbd>opt</kbd>+<kbd>m</kbd> Define a new macro</li>
... | <p>(these are mostly html-related) </p>
<ul>
<li><kbd>cmd</kbd> + <kbd>option</kbd> <kbd>+</kbd> closes current open html tag </li>
<li><kbd>shift</kbd> + <kbd>cmd</kbd> + <kbd>w</kbd> wrap selection in tags</li>
<li><kbd>ctrl</kbd> + <kbd>return</kbd> insert escaped line end, i.e. <code>\n</code> or <code><br>... | 12,503 |
<p>I need to know this since this is a pre-req for .NET 3.5 and if I'm including the .NET bootstrapper, I should also see if Windows Installer 3.1 is needed.</p>
<p>Right now I'm checking for the registry key:</p>
<pre><code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP3\KB893803v2
</code></pre>
<p>Whi... | <p>locate the installer msi.dll with this registry path:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer</p>
<p>value: InstallerLocation</p>
<p>then get the version information from that file.</p>
<p>update:
the way above is old!
new way to detect the version is documented here:
<a href="http:... | <p>Please check <a href="http://www.pitribe.com/posts.aspx?id=2603.1467569276_check-windows-installer-version" rel="nofollow">this link</a> may help you as already <strong>works for me</strong> for <strong>Windows 7</strong>, hopefully may work for other versions of <strong>windows</strong> as well to check Windows Ins... | 40,757 |
<p>Are there any commonly used patterns in Javascript for storing the URL's of endpoints that will be requested in an AJAX application?</p>
<p>For example would you create a "Service" class to abstract the URL's away?</p>
| <p>You could create a collection of ValuePairs where you'd store each URL value and an identifier:</p>
<pre><code>function ControlValuePair(Id, Value)
{
this.Id = Id;
this.Value = Value;
}
function CreateCollection(ClassName)
{
var obj=new Array();
eval("var t=new "+ClassName+"()");
for(_it... | <p>Is your question similar to <a href="https://stackoverflow.com/questions/108853/relative-urls-for-javascript-files">this already-answered question</a>? If so, does the answer apply to your code also?</p>
| 17,455 |
<p>Which industry-class database has the most <strong>unique</strong> features? (with "unique" meaning that no other RDBMS has them)</p>
<p>I think my choice here is Oracle 11g:</p>
<ol>
<li>Flashback query (you can estract data as it was a moment in the past)</li>
<li>ASM - automatic storage management</li>
<li>Nati... | <p>Funny, I rate vendors by their conformance with the ANSI/ISO SQL Standards e.g. for SQL Server my shopping list is deferrable <code>CHECK</code> constraints that support subqueries and proper support for <code>DOMAIN</code>s and <code>ASSERTION</code>s -- and these date from as long ago as SQL-92. For me, vendors sh... | <p><a href="http://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems</a> && <a href="http://en.wikipedia.org/wiki/Comparison_of_object-relational_database_management_systems" rel... | 27,588 |
<p>I've got the a SQL Server stored procedure with the following T-SQL code contained within:</p>
<pre><code>insert into #results ([ID], [Action], [Success], [StartTime], [EndTime], [Process])
select
'ID' = aa.[ActionID],
'Action' = cast(aa.[Action] as int),
'Success' = aa.[Success],
'StartTime' = aa.[... | <p>Just offhand, you can simplify these:</p>
<pre><code> 2 = case
when (@startDate is null) then 2
when (@startDate is not null and aa.[StartTime] >= @startDate) then 2
end
</code></pre>
<p>to this:</p>
<pre><code> (@startDate is null OR aa.[StartTime] >... | <p>Your inserting into a temp table in your example which causes the SP to be recompiled every time because it cannot be precompiled. </p>
<p>This is one of the differences between using temp tables and table variables - a good article on the differences can be found <a href="http://www.codeproject.com/KB/database/SQP... | 41,314 |
<p>I am putting together a Samba-based server as a Primary Domain Controller, and ran into a cute little problem that should have been solved many times over. But a number of searches did not yield a result. I need to be able to remove an existing user from an existing group with a command line script. It appears th... | <p>Web Link: <a href="http://www.ibm.com/developerworks/linux/library/l-roadmap4/" rel="nofollow noreferrer">http://www.ibm.com/developerworks/linux/library/l-roadmap4/</a></p>
<p>To add members to the group, use the gpasswd command with the -a switch and the user id you wish to add:</p>
<p>gpasswd -a userid mygroup... | <p>It looks like <em>deluser --group [groupname]</em> should do it.</p>
<p>If not, the <em>groups</em> command lists the groups that a user belongs to. It should be fairly straightforward to come up with some Perl to capture that list into an array (or <em>map</em> it into a hash), delete the unwanted group(s), and f... | 15,677 |
<p>I was in need of a way to compress images in .net so i looked into using the .net GZipStream class (or DeflateStream). However i found that decompression was not always successful, sometimes the images would decompress fine and other times i would get a GDI+ error that something is corrupted.</p>
<p>After investiga... | <p>You need to <code>Close()</code> the <code>ZipStream</code> after adding all the data you want to compress; it retains a buffer of unwritten bytes internally (even if you <code>Flush()</code>) that needs to be written.</p>
<p>More generally, <code>Stream</code> is <code>IDisposable</code>, so you should also be <co... | <p>Also - keep in mind the DeflateStream in System.IO.Compression does not implement the most efficient deflate algorithm. If you like, there is an alternative to the BCL GZipStream and DeflateStream; it is implemented in a fully-managed library based on zlib code, that performs better than the built-in {Deflate,GZip... | 34,107 |
<p>The code below continues many lines until it ends with a expected /veotherwise /vechoose. I started working on a development firm a little ago where they use this html version called vhtml. I have search the web but it brings different definitions for vhtml. I have seen some posts in Joomla about vhtml but they d... | <p>I looked through the help and didn't see a full list...so poking around the code it appears the compiler warning constants are all listed in:
CodeGear\RAD Studio\6.0\sources\toolsapi\DCCStrs.pas</p>
<p>Search for "Implicit_String_Cast_Loss" and you'll see the constant
sIMPLICIT_STRING_CAST_LOSS = 'DCC_IMPLICIT_STR... | <p>If you press <em>Ctrl+O</em> twice it will add all the compiler directives to the top of the unit including all the warnings. Find the one you want and delete the rest.</p>
| 49,330 |
<p>Is there any way to set the style for the lineends for the TCanvas.LineTo method? It seems to default to rounded ends, which looks very bad for several lines in a row of different colours when Pen.Width is set to a large value (e.g. 9).</p>
<p>It looks like this (rounded ends):</p>
<pre><code> ********........****... | <p>Maybe <a href="https://msdn.microsoft.com/en-us/library/dd162705(v=vs.85).aspx" rel="nofollow noreferrer">ExtCreatePen</a> helps. Check the <code>PS_ENDCAP_*</code> and <code>PS_JOIN_*</code> flags.</p>
| <p>Sample code from <a href="https://www.delphipraxis.net/92808-tcanvas-pen-und-die-abgerundeten-ecken.html" rel="nofollow noreferrer">DelphiPraxis forum (German language)</a></p>
<pre><code>procedure TForm1.FormCreate(Sender: TObject);
var LogBrush:TLOGBRUSH;
begin
ZeroMemory(@LogBrush, SizeOf(LogBrush));
Lo... | 48,100 |
<p>I want to be able to apply a style at runtime to an object <strong>ONLY</strong> if the current style is the default style. I don't want to override any user defined styles. Anyone know how to do this?</p>
| <p>It appears you can do it this way:</p>
<pre><code>DependencyPropertyHelper.GetValueSource(
someControl, FrameworkElement.StyleProperty).BaseValueSource
== BaseValueSource.Default;
</code></pre>
<p>You can wrap that up in an extension method like this:</p>
<pre><code>static public bool HasDefaultStyle(thi... | <p>Check the DefaultStyleKeyProperty, which is a static property of any custom control.</p>
<pre><code>string styleKeyName = DefaultStyleKeyProperty.Name;
</code></pre>
<p>Usually if there is no style associated with the control, the Name will be "DefaultStyleKey"</p>
| 43,978 |
<p>If for example you follow the link:</p>
<p><code>data:application/octet-stream;base64,SGVsbG8=</code></p>
<p>The browser will prompt you to download a file consisting of the data held as base64 in the hyperlink itself. Is there any way of suggesting a default name in the markup? If not, is there a JavaScript sol... | <p>Use the <code>download</code> attribute:</p>
<pre><code><a download='FileName' href='your_url'>
</code></pre>
<p><a href="http://caniuse.com/#search=download" rel="noreferrer">The <code>download</code> attribute works on</a> Chrome, Firefox, Edge, Opera, desktop Safari 10+, iOS Safari 13+, and not IE11.</p>
| <pre><code>var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
var sessionId ='\n';
var token = '\n';
var caseId = CaseIDNumber + '\n';
var url = casewebUrl+'\n';
var uri = sessionId + token + caseId + url;//data in file
var fileName = "file.i4cvf";// any file name with any extension
if (isIE)
... | 36,017 |
<p>I'm wondering how the few Delphi users here are doing unit testing, if any? Is there anything that integrates with the IDE that you've found works well? If not, what tools are you using and do you have or know of example mini-projects that demonstrate how it all works?</p>
<h3>Update:</h3>
<p>I forgot to mention t... | <p><a href="http://dunit.sourceforge.net/" rel="noreferrer">DUnit</a> is a xUnit type of unit testing framework to be used with win32 Delphi. Since Delphi 2005 DUnit is integrated to a certan point into the IDE. Other DUnit integration tools for the Delphi IDE can be found <a href="http://www.elvenware.com/charlie/conf... | <p>We tried to use DUnit with Delphi 5, but it didn't work well. Specially if you are implementing COM interfaces, we found many dependencies to setup all the test infrastructure. I don't know if the test support has improved in newer versions.</p>
| 3,890 |
<p>XP-specific answers preferred, but others are welcome too.</p>
| <p>From <code>%windir%\System32\Shell32.dll</code></p>
| <p>From <code>%windir%\System32\Shell32.dll</code></p>
| 21,994 |
<pre><code><div style="width: 300px">
<div id="one" style="float: left">saved</div><input type="submit" id="two" style="float: right" value="Submit" />
</div>
</code></pre>
<p>I would like div#one to be centred in the space between the left edge of the parent div and the left edge of the ... | <p>A few more ways to do it:</p>
<pre><code><div style="width: 300px">
<input type="submit" id="two" style="float: right" value="Submit" />
<div id="one" style="text-align:center;">saved</div>
</div>
</code></pre>
<p>It's hard to tell that the text <code>saved</code> isn't center... | <p>This is an example of a general problem with CSS, which is that there is no way to compute the 'remaining space' in various layouts. </p>
<p>I've run into situations where you (a) need an exact layout, and (b) where you don't know the size of the floating item.</p>
<p>Example:</p>
<blockquote>
<p>[---- input fi... | 28,382 |
<p>I get an Access is Denied error message when I use the strong name tool to create a new key to sign a .NET assembly. This works just fine on a Windows XP machine but it does not work on my Vista machine.</p>
<pre><code>PS C:\users\brian\Dev\Projects\BELib\BELib> sn -k keypair.snk
Microsoft (R) .NET Framework S... | <blockquote>
<p>Yes I have tried running PS and the
regular command prompt as
administrator. The same error message
comes up.</p>
</blockquote>
<p>Another possible solution could be that you need to give your user account access to the key container located at C:\Documents and Settings\All Users\Application Da... | <p>Are you running your PowerShell or Command Prompt as an Administrator? I found this to be the first place to look until you get used to User Access Control or by turning User Access Control off.</p>
| 3,300 |
<p>I'm looking to run a Jabber server on a Windows 2003 server(web farm) and like some practical advice from anyone who has run a live environment with ~500 concurrent users.</p>
<p>Criteria for comment:</p>
<ul>
<li>Performance</li>
<li>Capacity (ie ~number of concurrent users)</li>
<li>Stability</li>
</ul>
| <p>OpenFire is a good gpl java implementation of a jabber server.
It has plenty of option plugins you can use and it can intergrate quite well with Active Directory <a href="http://www.igniterealtime.org/projects/openfire/index.jsp" rel="noreferrer">OpenFire</a></p>
| <p>I think you're going to need to be a bit more explicit - you looking for server configurations, or software e.g. Jabber Server?</p>
<p>If you're thinking Jabber server, <a href="http://www.ejabberd.im/" rel="nofollow noreferrer">EJabberD</a> is probably the most stable, flexible, capable of being clustered etc.</p>... | 12,833 |
<p>(y/N)</p>
<p>Edit: Read-only access is fine.</p>
| <p>I haven't tried this yet, but I think I've found a workaround.</p>
<p>Adobe AIR cannot write to Windows Registry, but you can, however, launch a native process in AIR 2. Here's a blog post that shows how to do that: <a href="http://www.adobe.com/devnet/air/flex/quickstart/articles/interacting_with_native_process.h... | <p>You could theoretically modify the actual registry files, but I would highly discourage that idea.</p>
| 2,573 |
<p>What is the difference between <code>int *a[3]</code> and <code>int (*a)[3]</code>?</p>
| <p>There is no difference between <code>int a[3]</code> and <code>int (a)[3]</code>, they both declare <code>a</code> as an array of 3 <code>int</code>s. There is a difference between <code>int *a[3]</code> and <code>int (*a)[3]</code>, the former declares an array of 3 pointers to <code>int</code> whereas the second ... | <p><code>int *a[3]</code> : a is a array of 3 pointers to integer type</p>
<p><code>int (*a)[3]</code> : a is a pointer to an array of 3 integer type</p>
| 31,114 |
<p>How do I convert function input parameters to the right type?</p>
<p>I want to return a string that has part of the URL passed into it removed.</p>
<p><strong>This works, but it uses a hard-coded string:</strong></p>
<pre><code>function CleanUrl($input)
{
$x = "http://google.com".Replace("http://", "")
re... | <p>The concept here is correct.</p>
<p>The problem is with the variable name you have chosen. $input is a reserved variable used by PowerShell to represent an array of pipeline input. If you change your variable name, you should not have any problem.</p>
<p>PowerShell does have <a href="https://technet.microsoft.com/... | <p>This worked for me:</p>
<pre><code>function CleanUrl($input)
{
return $input.Replace("http://", "")
}
</code></pre>
| 3,586 |
<p>I am working on developing an on-screen keyboard with java. This keyboard has a <code>JComponent</code> for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currently on focus. The keyboard itself is within a <code>JFrame</code> with no de... | <p>Apparently the only way to do this is to have a JNI layer that will make the conversion from java to native. Java has no easy way to provide such funcionality.</p>
<p>This could be an interesting concept for a small, third party library for someone who wants to learn JNI...</p>
| <p>have you tried to call native setfocus() or setactivewindow() functions to move focus before you use robot class?</p>
| 18,989 |
<p>how to validate letters and whitespaces using Zend Framework ?</p>
| <p>The Zend Framework does have a <a href="http://framework.zend.com/manual/en/zend.validate.set.html#zend.validate.set.alpha" rel="nofollow noreferrer">Zend_Validate_Alpha</a> (as well as an <a href="http://framework.zend.com/manual/en/zend.validate.set.html#zend.validate.set.alnum" rel="nofollow noreferrer">alphanume... | <p>i think Zend_Validate_Regex is best for this situation</p>
| 44,190 |
<p>How do you select a datagridview row on a right-click?</p>
| <p>Make it behave similarly to the left mouse button? e.g.</p>
<pre><code>private void dataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
dataGridView.CurrentCell = dataGridView[e.ColumnIndex, e.RowIndex];
}
}
</code></pre>
| <p>You can use JvR's code in the MouseDown event of your DataGridView.</p>
| 20,879 |
<p>I ran into this bug where an element of an array, if its index is the string "0", is inaccessible. </p>
<p>It's not a bug with unserialize, either, as this occurred in my code without invoking it.</p>
<pre><code>$arr = unserialize('a:1:{s:1:"0";i:5;}');
var_dump($arr["0"]); //should be 5, but is NULL
var_dump($arr... | <p>Yes, it looks as though it is a bug, related to PHPs automatic conversion of strings to integers. More information is available here: <a href="http://bugs.php.net/bug.php?id=43614" rel="nofollow noreferrer">http://bugs.php.net/bug.php?id=43614</a></p>
<pre><code>var_dump( $arr ); // => array(1) { ["0"]=> int... | <p>Actually, the code in your question yields</p>
<pre><code>int(5)
</code></pre>
| 40,842 |
<p>What is the best way to create reverse index for full text search in Common Lisp ? Is there any proven and (relatively) bug-free open library for SBCL or LispWorks ?</p>
<p>I managed to create my own library on top of AllegroCache - it was fairly easy to create, reliable and fast, but lacks advanced search options ... | <p><a href="http://www.cl-user.net/asp/libs/montezuma" rel="noreferrer">montezuma</a> is the same thing as lucene, but written in lisp.</p>
<p>i don't think anyone uses this actively, nor that it's heavily tested... but it's a good start if you want to work on the thing itself. it already has the most used features. r... | <p>I know you're asking about Common Lisp, but there are a number of inverted text search service oriented applications. One well known and respected on is <a href="http://lucene.apache.org/" rel="nofollow noreferrer">Lucene</a>.</p>
<p>Could a solution be to use that search engine, but interface your Common Lisp co... | 15,568 |
<p>In short, how do you unit test an error condition such as EINTR on a system call.</p>
<p>One particular example I'm working on, which could be a case all by itself, is whether it's necessary to call fclose again when it returns EOF with (errno==EINTR). The behavior depends on the implementation of fclose:</p>
<pre... | <p>I don't think there is an easy way to actually test this at will.</p>
<p>EINTR will be generated if the fclose operation is interrupted by a signal.
This implies that fclose was in a background thread which received a signal as it was processing the close request.</p>
<p>Good luck trying to reproduce that set of c... | <p>As Kris suggests, temporarily replace calls to the "real" <code>fclose()</code> with your own implementation defined in your unit test code. Your implementation could do something as simple as:</p>
<pre><code>int my_fclose(FILE *fp)
{
errno = EINTR;
return EOF;
}
</code></pre>
<p>But, as fizzer points out, you... | 21,264 |
<p>I have a requirement to be be able to embed scanned tiff images into some SSRS reports.</p>
<p>When I design a report in VS2005 and add an image control the tiff image displays perfectly however when I build it. I get the warning :</p>
<p><code>Warning 2 [rsInvalidMIMEType] The value of the MIMEType property ... | <p>Assuming you're delivering the image file via IIS, use an ASP.NET page to change image formats and mime type to something that you <em>can</em> use. </p>
<pre><code>Response.ContentType = "image/png";
Response.Clear();
using (Bitmap bmp = new Bitmap(tifFilepath))
bmp.Save(Response.OutputStream, ImageFormat.Png);
... | <p>Thanks <a href="https://stackoverflow.com/users/19931/peter-wone">Peter</a> your code didn't compile but the idea was sound.</p>
<p>Here is my attempt that works for me.</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "image/jpeg";
Response.Clear();
... | 15,397 |
<p>I was watching a tutorial on Rails and was very impressed that you could so easily create an editing system for a class just by defining it.</p>
<p>Can this be done in ASP.NET?</p>
<p>I know there are ORMs out there, but do they come with an editing system?</p>
<p>To explain what I mean by an editing system, cons... | <p>First of all, change your function to <code>return</code> the value. <code>print</code>ing it will complicate things since you want to get the value back. Suppose your <code>MyModule.py</code> looks like this:</p>
<pre><code>import thirdparty
def MyFunc(some_arg):
result = thirdparty.go()
return result
</c... | <p>You should be able to return the result from MyFunc, which would then end up in the variable you are currently calling "ignored". This eliminates the need to access it in any other way.</p>
| 26,523 |
<p>In a client-server system, is it considered good architecture for a server method to "ask the client" for more information? If so, what's the best way to design such a scenario? Is there a "pattern" for this?</p>
<p>For example, suppose the end user selects a set of records they want to delete in the client UI, t... | <p>Some sort of reply that say "Records x, y and z were not deleted, try again with <code>I_RELLY_WANT_TO</code> set to delete them" would seem like a reasonable solution to me.</p>
<p>General pattern; don't ask, do stuff and report back, let the client decide what to do next. This could be done in the context of a pe... | <p>I think that kind of arrangement is totally fine. There's nothing preventing the server from replying with a query to the client for more information and for the client to provide it. As long as the socket connection is open, you have free reign to send messages back and forth.</p>
<p>I've seen an arrangement where... | 47,164 |
<p>we'd like to add movable panels to an application. presently we've used DevExpress docking library but have found them to be disappointingly quirky & difficult to work with. it also has some limitations that aren't so great.</p>
<p>auto-hide, pinning, and moving of pages by drag-and-drop are all features we'd... | <p>AutomatedDocking
<a href="http://www.automatedqa.com/products/aqdocking/index.asp" rel="nofollow noreferrer">http://www.automatedqa.com/products/aqdocking/index.asp</a></p>
<p>and for free one JVCL Docking
<a href="http://jvcl.delphi-jedi.org/" rel="nofollow noreferrer">http://jvcl.delphi-jedi.org/</a></p>
| <p>I'm glad to read your post, I'm using Automated QA' docking components, and I'm fed up with them. I was considering switching to DevExpress, but I think I willl give it a second thought now.
The most problematic with AutomatedQA's component is bugs, sometimes floating windows disappears, when pinned panels are unpin... | 28,231 |
<p>I have some code in a javascript file that needs to send queries back to the server. The question is, how do I find the url for the script that I am in, so I can build a proper request url for ajax.</p>
<p>I.e., the same script is included on <code>/</code>, <code>/help</code>, <code>/whatever</code>, and so on, wh... | <p>For this I like to put <code><link></code> elements in the page's <code><head></code>, containing the URLs to use for requests. They can be generated by your server-side language so they always point to the right view:</p>
<pre><code><link id="link-action-1" href="${reverse_url ('action_1')}"/>
</... | <p>I include the following code in my libraries main entry point (main.php):</p>
<pre><code>/**
* Build current url, depending on protocal (http/https),
* port, server name and path suffix
*/
$site_root = 'http';
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")
$site_root .= "s";
$site_root .... | 13,418 |
<p>Is it possible to receive DllMain like notifications about thread attach/detach in stand-alone exe without using any extra dlls?</p>
<p><strong>Edit:</strong> This is just a theoretical question that has to do with some testing I'm doing. not a real life situation.</p>
| <p>There is no external code that runs on the thread and loads the executable, hence no thread attach/detach notifications [1]. The code in the executable usualy control the threading [2].</p>
<p>If you describe your scenario, people might be able to give you some ideas how to achieve it.</p>
<hr>
<p>[1] Well, most ... | <p>Your question is to get notification while the process is getting loaded and unloaded. This is more applicable for DLLs as they are getting loaded by other processes.</p>
<p>For Exes, you have InitInstance and ExitInstance which you can handle equivalently!</p>
| 22,567 |
<p>I am searching for a host for a new commercial website. Among other things, I'd like to know what the various OS - Webserver combinations have in terms of vulnerabilities. What are the vulnerabilities of Redhat + Apache?</p>
| <p>See: <a href="http://httpd.apache.org/security/vulnerabilities_20.html" rel="nofollow noreferrer">http://httpd.apache.org/security/vulnerabilities_20.html</a></p>
| <p>Its kind of a difficult question to answer, the development life cycles are so active you're asking for something that's likely to have been solved already ( and if its been reported so that we know of it, the likelihood its fixed is really high )</p>
<p>What you need is a 0-day hack for them, and asking this list ... | 11,302 |
<p>Is there a way to select data where any one of multiple conditions occur on the same field?</p>
<p>Example: I would typically write a statement such as:</p>
<pre><code>select * from TABLE where field = 1 or field = 2 or field = 3
</code></pre>
<p>Is there a way to instead say something like:</p>
<pre><code>selec... | <p>Sure thing, the simplest way is this:</p>
<pre><code>select foo from bar where baz in (1,2,3)
</code></pre>
| <p>while <code>in</code> is a shortcut for <code>or</code> and I wasn't sure how I could combine <code>in</code> with <code>and</code>, I did it this way</p>
<pre><code> SELECT * FROM table
WHERE column1='x' AND (column2='y' OR column2='z');
</code></pre>
| 3,845 |
<p>I need to launch a server on the remote machine and retrieve the port number that the server process is lsitening on. When invoked, the server will listen on a random port and output the port number on stderr.</p>
<p>I want to automate the process of logging on to the remote machine, launching the process, and ret... | <blockquote>
<pre><code>s = p.stderr.readline()
</code></pre>
</blockquote>
<p>I suspect it's the above line. When you invoke a command directly through ssh, you don't get your full pty (assuming Linux), and thus no stderr to read from.</p>
<p>When you log in interactively, stdin, stdout, and stderr are set up for y... | <p>what if you do the following:</p>
<h2><code>ssh <remote host> '<your command> ;<your regexp using awk or something>'</code></h2>
<p>For example</p>
<h2><code>ssh <remote host> '<your program>; ps aux | awk \'/root/ {print $2}\''</code></h2>
<p>This will connect to , execute and the... | 5,354 |
<p>Is there anyway to disable the repair option so that if a user runs the msi again it automatically uninstalls without prompting for Repair/Remove options?</p>
<p>Edit: This is for a controlled corporate environment and has been passed down as a requirement.</p>
| <p>After reading your edit, I'll try to give a guess, though I don't really know if it's possible just with an msi file. A tool "orca" can be downloaded from Microsoft (unrelated to "orcas" which was code name for a Visual Studio version). "Orca" can edit some properties of msi files, so that would be one place I'd l... | <p>Isn't that really an unfriendly thing to do? Shouldn't the user get to decide whether they want a repair or an uninstall? Write a separate uninstall program if you want to provide an uninstaller with one less click.</p>
| 46,306 |
<p>What do you think the benefits of functional programming are? And how do they apply to programmers today?</p>
<p>What are the greatest differences between functional programming and OOP? </p>
| <p>The style of functional programming is to describe what you want, rather than how to get it. ie: instead of creating a for-loop with an iterator variable and marching through an array doing something to each cell, you'd say the equivalent of "this label refers to a version of this array where this function has been ... | <p>If you don't already know functional programming then learning it gives you more ways to solve problems.</p>
<p>FP is a simple generalization that promotes functions to first class values whereas OOP is for large-scale structuring of code. There is some overlap, however, where OOP design patterns can be represented... | 15,589 |
<p>If you want a cryptographically strong random numbers in Java, you use <code>SecureRandom</code>. Unfortunately, <code>SecureRandom</code> can be very slow. If it uses <code>/dev/random</code> on Linux, it can block waiting for sufficient entropy to build up. How do you avoid the performance penalty?</p>
<p>Has any... | <p>If you want true random data, then unfortunately you have to wait for it. This includes the seed for a <code>SecureRandom</code> PRNG. Uncommon Maths can't gather true random data any faster than <code>SecureRandom</code>, although it can connect to the internet to download seed data from a particular website. My gu... | <p>Something else to look at is the property securerandom.source in file lib/security/java.security
<P>There may be a performance benefit to using /dev/urandom rather than /dev/random. Remember that if the quality of the random numbers is important, don't make a compromise which breaks security.</p>
| 16,594 |
<p>I am writing an xmpp library and I am trying to write a stream to support the zlib compressed data. I have two different versions one based on zlib.net and the other using SharpZipLib. The zlib.net version doesn't recognize the compression and the SharpZipLib version enters an infinite loop. You can find the appr... | <p>This isn't a direct solution to your problem but have you tried System.IO.Compression.GZipStream or DeflateStream?</p>
| <p>I haven't looked in depth, but it is curious that your SharpZipLib wrapper ignores <code>offset</code> and <code>count</code> in BeginRead:</p>
<pre><code>public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback cback, object state)
{
_outBuff = buffer;
if ( _in.IsNeedingInput... | 42,703 |
<p>i want to find the mime-type for a given file extension on an IIS ASP.NET web-server from the code-behind file.</p>
<p>i want to search the same list that the server itself uses when serving up a file. This means that any mime types a web-server administrator has added to the <em>Mime Map</em> will be included.</p... | <p>Here's one I made earlier:</p>
<pre><code>public static string GetMimeTypeFromExtension(string extension)
{
using (DirectoryEntry mimeMap =
new DirectoryEntry("IIS://Localhost/MimeMap"))
{
PropertyValueCollection propValues = mimeMap.Properties["MimeMap"];
foreach (object value ... | <p>IIS stores the MIME information in its own database. Searching for "MimeMap IIS" on the internet will reveal how to read it or even change it. See for example <a href="http://blog.crowe.co.nz/archive/2006/06/02/647.aspx" rel="nofollow noreferrer">C# - How to display MimeMap entries to the console from an instance of... | 21,087 |
<p>For my application there are several entity classes, User, Customer, Post, and so on</p>
<p>I'm about to design the database and I want to store the date when the entities were created and updated. This is where it gets tricky. Sure one option is to add created_timestamp and update_timestamp columns for each of the... | <p>The single-log-table-for-all-tables approach has two main problems that I can think of:</p>
<ol>
<li>The design of the log table will (probably) constrain the design of all the other tables. Most likely the log table would have one column named TableName and then another column named PKValue (which would store the... | <p>How often will you need to include the created/updated timestamps in your presentation layer? If the answer is anything more than "once in a great great while", I think you would be better served by having those columns in each table.</p>
| 29,359 |
<p>I'm creating a invoice crystal report for sage mas 500 AR module. In it, I'm attempting to add the <code>tarinvoice.balance</code> field with the following formula: </p>
<pre><code>if {tarPrintInvcHdrWrk.Posted} = 1 then
ToText({tarInvoice.Balance})
</code></pre>
<p>I'm assuming that when the <code>{tarPrintI... | <p>I believe the conditional statement fails immediately if you encounter a NULL, so your formula needs to test <strong>IsNull({tarPrintInvcHdrWrk.Posted})</strong> before it tests equality with "1".</p>
| <p>You can change the way Crystal handles a null value for a value in a formula. At the top of the Formula Workshop there is a drop down box that usually says "Exceptions For Nulls".<br>
Change this to the other option "Default Values For Nulls" and your formula should no longer bomb out. You used to be able to speci... | 24,801 |
<p>The questions says everything, take this example code: </p>
<pre><code><ul id="css-id">
<li>
<something:CustomControl ID="SomeThingElse" runat="server" />
<something:OtherCustomControl runat="server" />
</li>
</ul>
</code></pre>
<p>Now if an error gets thrown som... | <p>You can catch all exception not handled elswhere in the Global.asax page / class.
Look at:</p>
<pre><code>protected void Application_Error(Object sender, EventArgs e)
</code></pre>
<p>method.</p>
| <p>Add a global.asax en implement the Application_Error handler. Use the Server.GetLastError() function to get a handle on the exception thrown.</p>
| 16,702 |
<p>How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?</p>
<p>I have seen <a href="http://en.wikipedia.org/wiki/Scheme_%28programming_language%29" rel="noreferrer">the Scheme ... | <p>A closure is a pairing of:</p>
<ol>
<li>A function and</li>
<li>A reference to that function's outer scope (lexical environment)</li>
</ol>
<p>A lexical environment is part of every execution context (stack frame) and is a map between identifiers (i.e. local variable names) and values.</p>
<p>Every function in JavaS... | <h1>The simplest, shortest, most-easy-to-understand answer:</h1>
<p>A closure is a block of code where each line can reference the same set of variables with the same variable names.</p>
<p>If "this" means something different than it does somewhere else, then you know it is two different closures.</p>
| 13,626 |
<p>We're working on a very large .NET WinForms composite application - not CAB, but a similar home grown framework. We're running in a Citrix and RDP environment running on Windows Server 2003. </p>
<p>We're starting to run into random and difficult to reproduct "Error creating window handle" error that seems to be ... | <p>I have tracked down a lot of issues with UIs not unloading as expected in WinForms. </p>
<p>Here are some general hints:</p>
<ul>
<li>alot of the time, a control will stay in use because controls events are not properly removed (the tooltip provider caused us really large issues here) or the controls are not prop... | <p>I ran into the same .Net runtime error but my solution was different. </p>
<p><strong>My Scenario:</strong>
From a popup Dialog that returned a DialogResult, the user would click a button to send an email message. I added a thread so the UI didn't lock up while generating the report in the background. This scenario... | 11,455 |
<p>It seems with the built in friendly routing library in .NET MVC, it would allow us to do something like this.</p>
<p>In case it's not obvious what I want to with the built in stuff in .NET MVC, I want to a url starting with www to be automatically redirected to a non-www url using the MVC framework.</p>
| <p>There are a number of ways to do the 301 redirect from the www to the not-www. I prefer to keep this redirection logic at the ASP.NET level (i.e. in my app) in some projects, but others require better performing things, like IIS7 url rewriting.</p>
<p>It was <a href="http://forums.asp.net/t/1324018.aspx" rel="nofol... | <p>try to add this into your <strong><em>Global.asax</em></strong> :</p>
<pre><code>if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://YourSite.com"))
{
HttpContext.Current.Response.Status = "301 Moved Permanently";
HttpContext.Current.Response.AddHeader("Location", R... | 37,471 |
<p>Short version is in the title.</p>
<p>Long version:
I am working on a program for scientific optimization using Java. The workload of the program can be divided into parallel and serial phases -- parallel phases meaning that highly parallelizable work is being performed. To speed up the program (it runs for hours... | <p>All graphics operations run on a single thread in swing. If they are rendering to the screen they will effectively be contending for access to this thread.</p>
<p>If you are running on Windows, all graphics operations run on a single thread no matter what. Other operating systems have similar limitations.</p>
<p>I... | <p>You try to use the full CPU capability for your calculations but the OS itself uses resources as well. So be aware that the OS will block some of your execution in order to satisfy its needs.</p>
| 43,196 |
<p>We have a web application that was implemented using GWT. What it presents is fetched from a Jboss/Seam server using the remoting mechanism, and this works fine. However, the application is now extended to support sessions and users. The Seam GWT service doesn't seem to provide a way to let me log in such that Seam ... | <p>It turns out that things are "just working" as I hoped. By using Seam's Identity and login mechanism, I can access the current logged in user via <code>Identity.instance().getUsername();</code> in the service code that gets requests from the GWT portion of the application.</p>
<p>I tried to put a <code>@Restrict</c... | <p>How about this complete GWT app on google code -- <a href="http://code.google.com/p/tocollege-net/" rel="nofollow noreferrer">http://code.google.com/p/tocollege-net/</a> ?</p>
| 13,177 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.