instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the <em>back</em> button appears first in the markup when you press <kbd>Enter</kbd>, it will use that button to submit the form.</p>
<p>Example:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-consol... | <p>I'm just doing the trick of <code>float</code>ing the buttons to the right.</p>
<p>This way the <code>Prev</code> button is left of the <code>Next</code> button, but the <code>Next</code> comes first in the HTML structure:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="f... | <p>Using the example you gave:</p>
<pre><code><form>
<input type="text" name="field1" /><!-- Put your cursor in this field and press Enter -->
<input type="submit" name="prev" value="Previous Page" /> <!-- This is the button that will submit -->
<input type="submit" name="n... | 2,245 |
<p>Is there a way to deploy a Java program in a format that is not reverse-engineerable? </p>
<p>I know how to convert my application into an executable JAR file, but I want to make sure that the code cannot be reverse engineered, or at least, not easily. </p>
<p>Obfuscation of the source code doesn't count... it mak... | <p>You could obfuscate your JAR file with <a href="http://www.yworks.com/en/products_yguard_about.htm" rel="noreferrer">YGuard</a>. <strong>It doesn't obfuscate your source code</strong>, but the compiled classes, so there is no problem about maintaining the code later.</p>
<p>If you want to hide some string, you coul... | <p>With anything interpreted at some point it has to be processed "in the clear". The string would show up clear as day once the code is run through JAD. You could deploy an encryption key with your app or do a basic ceasar cipher to encrypt the host connect info and decrypt at runtime...</p>
<p>But at some point d... | 18,066 |
<p>Documentation can be found <a href="http://github.com/madrobby/scriptaculous/wikis/droppables" rel="nofollow noreferrer">here</a></p>
<p>It says in the example:</p>
<p><strong>onDrop:
Called whenever a Draggable is released over the Droppable and the Droppable is accepts it. The callback gets three parameters: the... | <p>Going by the example further down the page, the callback function can take as many of the parameters as you need:</p>
<pre><code>onDrop: function() { $('droppable_demo').highlight(); }
</code></pre>
<p>In this case, they have used none of the callback parameters. To this end, presumably to access all three as men... | <p>I added this example to the documentation...</p>
<pre><code> Droppables.add('shopping_cart', {
accept: 'products',
onDrop: function(dragged, dropped, event) {
alert('Dragged: ' + dragged.id);
alert('Dropped onto: ' + dropped.id);
alert('Held ctrl key: ' + event.ctrlKey);
}
});
</code></pre>
| 14,318 |
<p>I am writing a shell script that takes file paths as input.</p>
<p>For this reason, I need to generate recursive file listings with full paths. For example, the file <code>bar</code> has the path:</p>
<pre><code>/home/ken/foo/bar
</code></pre>
<p>but, as far as I can see, both <code>ls</code> and <code>find</code... | <p>If you give <code>find</code> an absolute path to start with, it will print absolute paths. For instance, to find all .htaccess files in the current directory:</p>
<pre><code>find "$(pwd)" -name .htaccess
</code></pre>
<p>or if your shell expands <code>$PWD</code> to the current directory:</p>
<pre><code>find "$P... | <p><code>find / -print</code> will do this</p>
| 30,551 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/83547/algorithm-to-find-which-numbers-from-a-list-of-size-n-sum-to-another-number">Algorithm to find which numbers from a list of size n sum to another number</a> </p>
</blockquote>
<p>What is a good algorithm ... | <p>You are looking for the coin change problem:</p>
<ul>
<li><p><a href="http://en.wikipedia.org/wiki/Coin_problem" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Coin_problem</a></p></li>
<li><p><a href="http://www.egr.unlv.edu/~jjtse/CS477/DP%20Coin%20Change.html" rel="nofollow noreferrer">http://www.egr.unl... | <p>Start with the largest bills and work down. With each denomination, start with the largest number of those bills and work down. You might need fewer of a large denomination because you need multiple smaller ones to hit a value on the head.</p>
| 9,257 |
<p>I want to check whether the user is viewing my site from a mobile device or PC. If it's a mobile device, I want to redirect my site URL like Google does...</p>
<p>If possible I would like to implement this in JavaScript. How can I do this?</p>
| <p>You typically use the User-Agent header to detect the browser.</p>
<p>Here's JavaScript code that does basically that (only for mainstream browsers though, you'd have to add the Mobile User-Agents)</p>
<p><a href="http://www.quirksmode.org/js/detect.html" rel="nofollow noreferrer">http://www.quirksmode.org/js/dete... | <p>Here is a simple answer for this query. This won't detect the mobile browser, but it redirects the page to our <code>mobile.html</code> page, through the following script;</p>
<p>Find out the browser window size and redirect it.. </p>
<pre><code>winWidth=document.all?document.body.clientwidth:window.innderwidth;
i... | 34,982 |
<p>I have a WinForms program written on .NET 2 which hosts a webbrowser control and renders asp.net pages from a known server.</p>
<p>I would like to be able to drag, say, a tree node from a treeview in my winforms app into a specific location in the hosted web page and have it trigger a javascript event there.
Curren... | <p>Take a look at the <a href="http://browserplus.yahoo.com/" rel="nofollow noreferrer">BrowserPlus</a> project at Yahoo.</p>
<p>It looks like they have built a toolkit so that you don't have to do the gritty work of writing the browser plugin yourself.</p>
| <p>If you can find out the on screen position of the part of the page you are interested in, you could compare this with the position of the mouse when you receive the drop event. I'm not sure how practical this is if you can get the info out of the DOM or whatnot.</p>
<p>As an alternative could you implement the mous... | 2,682 |
<p>I am trying to send mail from a local iis app using localhost as my smtp server after installing free smtp but I am getting the following error:</p>
<pre><code>Mailbox unavailable. The server response was: Invalid
</code></pre>
<p>recipient: 'validAddress'@hotmail.com</p>
<p>Any idea what the problem could be?</... | <p>it sounds like your free (3rd party) smtp app is not leaving your network and might be trying to see if it has that mailbox itself. Try and see if there is a setting to allow the smtp server to access external connections, etc. What is the name of the free smtp app, btw?</p>
<p>Alternatively, can u use the built in... | <p>Write and test a simple smtp sender in C. It needs 3 minutes with RFC</p>
| 42,561 |
<p>Was wondering if there was a way to put a wildcard in the schema.ini for example
[*.txt]
FMT=TabDelimited</p>
<p>I've got an app that is imported tab delimited files and the only place I can seem to get the FMT="TabDelimited" is in the schema.ini (doesn't work in the connection string for some reason), but I will h... | <p>I guess I could potentially rename the file temporarily to match whatever I decide to put in the schema.ini or potentially modify the schema.ini on the fly and put the correct filename in there, but I'd love to do know if there was a better way.</p>
| <p>A single schema.ini file can contain multiple
[fileName.txt] entries and format
descriptions, (for all the files in the
Directory), so you might consider creating the .ini
file dynamically from the directory file names. </p>
| 9,931 |
<p>In db2 a query with a 'with ur' clause allows the query to be an uncommitted read and so does the 'with nolock' clause in mysql. Is there such an option in oracle too... If not why??</p>
| <p>Tom provides a great answer to this: <a href="http://www.oracle.com/technetwork/issue-archive/2005/05-nov/o65asktom-082389.html" rel="noreferrer">On Transaction Isolation Levels</a></p>
<p>He says:</p>
<blockquote>
<p>The READ UNCOMMITTED
isolation level allows dirty reads.
Oracle Database doesn't use dirty
... | <p>While the above answers are truly correct, you can take a look at Autonomous Transactions but keep in mind that they are not recommended and you can take a look at here <a href="https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/autonotransaction_pragma.htm" rel="nofollow noreferrer">Autonomous Transactions</a> ... | 25,542 |
<p>I want to build a secure web-service betweeen a Java producer and a Java consumer. I want to authenticate using Active Directory using the domain accounts that the producer and consumer are running under. </p>
<p>Could you give me an example of this? </p>
<p>(ie: AD trusted automated alternative to manual keystore... | <p>Look at <a href="http://static.springframework.org/spring-ws/sites/1.5/" rel="nofollow noreferrer">Spring WS</a> and the and <a href="http://static.springframework.org/spring-ws/sites/1.5/reference/html/security.html#security-certificate-authentication" rel="nofollow noreferrer">security certificate authentication</... | <p>Look at <a href="http://static.springframework.org/spring-ws/sites/1.5/" rel="nofollow noreferrer">Spring WS</a> and the and <a href="http://static.springframework.org/spring-ws/sites/1.5/reference/html/security.html#security-certificate-authentication" rel="nofollow noreferrer">security certificate authentication</... | 42,178 |
<p>I'm trying to get a UIDatePicker with a UIButton to show up in a UIActionSheet. Unfortunately it gets cropped off and the entire Date Picker is not visible. I have not even attempted to add the UIButton yet. Can anyone suggest on getting the entire view to fit properly? I'm not sure how to add the proper dimensions ... | <p>You can use something like this (adjust the coordinates):</p>
<pre><code> UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker"
delegate:self
cancelButtonTitle:@"Cancel"
... | <p>Make sure you show the UIActionSheet in the right view when inside a UITabBarController to avoid interactivity problems at the bottom:</p>
<p><code>
[actionSheet showInView:self.parentViewController.tabBarController.view];
</code></p>
| 45,523 |
<p>I am trying to develop a custom application which has a built-in serial port terminal, but it will be able to suspend terminal and do some I/O in the custom command and data format.</p>
<p>e.g. When I click "Get Data" button, the software will send some binary command and get some binary data in return and do its s... | <p>Please look at</p>
<p><a href="http://www.easysw.com/~mike/serial/serial.html" rel="nofollow noreferrer">http://www.easysw.com/~mike/serial/serial.html</a></p>
| <p>Have you checked the <a href="http://www.faqs.org/docs/Linux-mini/IO-Port-Programming.html" rel="nofollow noreferrer">Linux IO-Port Programming mini-HowTo</a>?</p>
| 48,490 |
<p>From day 1 of my programming career, I started with object-oriented programming. However, I'm interested in learning other paradigms (something which I've said here on SO a number of times is a good thing, but I haven't had the time to do). I think I'm not only ready, but have the time, so I'll be starting functiona... | <p>Read the <a href="http://mitpress.mit.edu/sicp/" rel="noreferrer">SICP</a>.</p>
<p>Also, there is a <a href="http://deptinfo.unice.fr/~roy/sicp.pdf" rel="noreferrer">PDF Version</a> available.</p>
| <p>It is all about pure functions and how to compose them to build larger abstractions. This is actually a hard problem for which a <a href="http://www.haskellforall.com/2012/08/the-category-design-pattern.html" rel="nofollow">robust mathematical background</a> is needed. Luckily, there are several patterns with deep f... | 23,342 |
<p>Is it possible to prevent the Windows Installer from running every time Access 2003 and Access 2007 are started, when they are both installed on the same machine at the same time..?</p>
<p>Like many developers I need to run more than 1 version of MS Access. I have just installed Access 2007. If I open Access 2003... | <p>This is caused by Windows Installer, which is used by both installers. Advertised shortcuts as used by both Office 2003 and Office 2007 invoke Windows Installer to check that the entire feature is installed properly; the installer detects that something else (in this case the other product) has registered the file e... | <p>The best workaround I've found for this is to use VMWare Thinapp to virtualize one (or more) of the offending versions of Access:</p>
<p><a href="http://www.vmware.com/products/thinapp/" rel="nofollow noreferrer">http://www.vmware.com/products/thinapp/</a></p>
<p>It's a little more lightweight than a full Virtual ... | 18,419 |
<p>What are the JVM implementations available on Windows Mobile?</p>
<p><a href="http://www.esmertec.com/40.html" rel="noreferrer">Esmertec JBed</a> is the one on my WinMo phone.</p>
<p>Wondering how many other JVM vendors are in this zone. Are there any comparison or benchmarking data available?</p>
| <p>JVM Choices for Windows CE in general (including Pocket PC and Windows Mobile):</p>
<ul>
<li>CrE-ME</li>
<li><a href="http://www2s.biglobe.ne.jp/~dat/java/project/jvm/index_en.html" rel="noreferrer">Mysaifu</a></li>
<li><a href="http://www.skelmir.com/solutions/handheld.html" rel="noreferrer">Skelmir CEEJ</a></li>
... | <p>This is not really an answer, but wouldn't it make more sense to target your software at the .NET framework compact edition if you're developing for WinMo?</p>
| 7,904 |
<p>I have been using LINQ to SQL for a while, and there is one thing that has always bothered me. Whenever I modify the schema of a table, in order to refresh it in the designer, I have to delete it and then add it back. That's fine, but this means I have to actually <em>find</em> the table in the designer. I have ab... | <p>Some people use <a href="http://msdn.microsoft.com/en-us/library/bb386987.aspx" rel="nofollow noreferrer" title="Like to MSDN's explanation of SqlMetal">SqlMetal</a> to 'refresh/update' their Linq2Sql designer. The designer does not have support for refreshing the schema, when the DB changes. You have to manuall... | <p>I personally <em>detest</em> using the designer, and I've had various issues with it whenever I've dared to use it.</p>
<p>I mostly use LINQ for very simple CRUD (no linked entities or anything), and if that's the case with you, it might be worth straying from the designer crutch. Especially since defining LINQ-to-... | 44,920 |
<p>I have some strings of xxh:yym format where xx is hours and yy is minutes like "05h:30m". What is an elegant way to convert a string of this type to TimeSpan?</p>
| <p>This seems to work, though it is a bit hackish:</p>
<pre><code>TimeSpan span;
if (TimeSpan.TryParse("05h:30m".Replace("m","").Replace("h",""), out span))
MessageBox.Show(span.ToString());
</code></pre>
| <p>Are <a href="http://msdn.microsoft.com/en-us/library/system.timespan.parse.aspx" rel="nofollow noreferrer">TimeSpan.Parse</a> and <a href="http://msdn.microsoft.com/en-us/library/system.timespan.tryparse.aspx" rel="nofollow noreferrer">TimeSpan.TryParse</a> not options? If you aren't using an "approved" format, you... | 4,633 |
<p>I have the problem, to get a failed run-time check in Visual C++ 2008 because of casting a too big number to a smaller type. The failure is in an external dll, so I can not fix it there. So how can I switch off this run time check for an external project.</p>
| <p>If the cast (and check) is happening in this DLL which you can't recompile, then you can't easily turn off the check.</p>
<p>The only thing you could do is change the data which you pass to the DLL to avoid the problem. Or patch the binary to disable the check, which probably wouldn't be terribly difficult as tha... | <p>You can always just turn off the cast to smaller type check in the project settings.</p>
<p>If that doesn't work as the check is compiled into the dll, then you can try linking to the non-debug version dll, as the check can only be on for debug "optimized" build. It might affect your debugging though of course.</p>... | 19,503 |
<p>How can I convert a character to its ASCII code using JavaScript?</p>
<p>For example:</p>
<blockquote>
<p>get 10 from "\n".</p>
</blockquote>
| <pre><code>"\n".charCodeAt(0);
</code></pre>
| <p>For those who want to get a sum of all the ASCII codes for a string with average value:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const ASCIIAverage = (str) =>Mat... | 11,966 |
<p>I have a server with .Net 2.0 sp1 installed and have no ability to install the AJAX extensions on the server. </p>
<p>Is there anyway I could work around this to incorporate ASP.NET AJAX functionality?</p>
| <p>You don't need to install the AJAX extensions into the server's GAC.</p>
<p>You can locally reference System.Web.Extensions.dll from your applications BIN folder....I've done it half a dozen times.</p>
<p>Copy that DLL to your projects local bin. Reference it from your project. Remember to deploy the DLL when you ... | <p>Note that most of AJAX is done on the client side (in the browser) in Javascript. </p>
<p>While there are some server-side libraries to make responding to a AJAX query easier, for the most part they are unnecessary. Any server technology that can server a web page to a browser can handle an AJAX request just as we... | 34,442 |
<p>I am trying to evaluate the answer <a href="https://stackoverflow.com/questions/108081/are-there-any-high-level-easy-to-install-gui-libraries-for-common-lisp">provided here</a>, and am getting the error: <code>"A file with name ASDF-INSTALL does not exist"</code> when using clisp:</p>
<pre><code>dsm@localhost:~$ cl... | <p>try this before anything else:</p>
<pre><code>(require :asdf)
</code></pre>
<p>you can steal some ideas from the environment we use. it's available at: <a href="http://dwim.hu/darcsweb/darcsweb.cgi?r=HEAD%20hu.dwim.environment;a=summary" rel="nofollow noreferrer">darcsweb</a></p>
<p>see environment.lisp that load... | <p>try this before anything else:</p>
<pre><code>(require :asdf)
</code></pre>
<p>you can steal some ideas from the environment we use. it's available at: <a href="http://dwim.hu/darcsweb/darcsweb.cgi?r=HEAD%20hu.dwim.environment;a=summary" rel="nofollow noreferrer">darcsweb</a></p>
<p>see environment.lisp that load... | 13,424 |
<p>The class method to create an index path with one or more nodes is:</p>
<pre><code>+ (id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length
</code></pre>
<p>How do we create the "indexes" required in the first parameter? </p>
<p>The documentation listed it as <em>Array of indexes to make up the ... | <p>You are correct. You might use it like this:</p>
<pre><code>NSUInteger indexArr[] = {1,2,3,4};
NSIndexPath *indexPath = [NSIndexPath indexPathWithIndexes:indexArr length:4];
</code></pre>
| <p>I did this in 2 lines of code</p>
<pre><code> NSMutableArray *indexPaths = [[NSMutableArray alloc] init];
for (int i = firstIndexYouWant; i < totalIndexPathsYouWant; i++) [indexPaths addObject:[NSIndexPath indexPathForRow:i inSection:0]];
</code></pre>
<p>Short, clean, and readable. Free code, don't knock ... | 21,900 |
<p>Ours is an upcoming company, so we cannot buy two three third party controls and find out by ourselves which the best one is.(One of the better solutions)
We have a budget to buy just one.
So we would like to know which is third party control is the best to use in ASP.NET based on your experiences.</p>
<p>And also I... | <p>For all those requirements, there's only two companies to choose from: <a href="http://www.telerik.com/" rel="nofollow noreferrer">Telerik</a> and <a href="http://www.devexpress.com/" rel="nofollow noreferrer">DevExpress</a>. Both have fantastic support and incredible ASP.NET products. They release often, and are ... | <p>I would add Componentone to the list of good companyes who make great components. Check out their studio for Asp.Net package. Full of nice components. Most of them use Ajax. You can check out samples of all components on their homepage and you can download and try before buy. </p>
<p>The licenses are developer-base... | 38,639 |
<p>There are many ways to check programs for memory leaks. You end up with that list of pointers to leaked memory blocks, but is there a good way to find out more information for each block? For example: if I know that the object was a string, the actual string value could make finding the leak a lot easier.</p>
<p>Is... | <p>RTTI may not help you. RTTI only works if the classes have virtual methods, and not all allocations are of objects with virtual methods.</p>
<p>What you really need to do is have some way to attach a stack trace to your allocations. Then you can get information about where the memory was allocated. You'd look fo... | <p>like norman i advocate for <strong>valgrind</strong>.
It is really a good advice for analyzing the stack trace!</p>
<p>I use it build in KDevelop.</p>
| 45,846 |
<p>I've encountered the term "multi-agent computing" as of late, and I don't quite get what it is. I've read a book about it, but that didn't answer the fundamental question of what an agent was.</p>
<p>Does someone out there have a pointer to some reference which is clear and concise and answers the question without ... | <p>A multi-agent system is a concept borrowed from AI. It's almost like a virtual world where you have agents that are able to observe, communicate, and react. To give an example, you might have a memory allocation agent that you have to ask for memory and it decides whether or not to give it to you. Or you might have ... | <p>You can find a concentration of white papers concerning agents <a href="http://recursionsw.com/About_Us/wp_mobileagents.html" rel="nofollow noreferrer">here</a>.</p>
| 5,623 |
<p>In Python I could've converted it to Unicode and do '(?u)^[\w ]+$' regex search, but PHP doesn't seem to understand international \w, or does it?</p>
| <p>Although I haven't tested myself, looking at <a href="http://us3.php.net/manual/en/reference.pcre.pattern.syntax.php" rel="noreferrer">http://us3.php.net/manual/en/reference.pcre.pattern.syntax.php</a> suggests the following: '/^[\p{L} ]+$/u' would work - the \p{L} will match any unicode letter. Additionally, you c... | <p>Getting UNICODE working properly everywhere in the code base is one of the "big" features of PHP6. </p>
<p>Until then the word is you are recommended <strong>NOT</strong> to use UNICODE in php due to numerous security problems that can develop from it. </p>
<p>A lot of the code just isn't UNICODE aware, and thus n... | 36,297 |
<p>I'm currently using <a href="http://magpierss.sourceforge.net/" rel="noreferrer">Magpie RSS</a> but it sometimes falls over when the RSS or Atom feed isn't well formed. Are there any other options for parsing RSS and Atom feeds with PHP?</p>
| <p>I've always used <a href="http://us2.php.net/simplexml" rel="noreferrer">the SimpleXML functions built in to PHP</a> to parse XML documents. It's one of the few generic parsers out there that has an intuitive structure to it, which makes it extremely easy to build a meaningful class for something specific like an RS... | <p>Another great free parser - <a href="http://bncscripts.com/free-php-rss-parser/" rel="nofollow">http://bncscripts.com/free-php-rss-parser/</a>
It's very light ( only 3kb ) and simple to use!</p>
| 31,195 |
<p>How do some programs edit whats being displayed on the terminal (to pick a random example, the program 'sl')? I'm thinking of the Linux terminal here, it may happen in other OS's too, I don't know. I've always thought once some text was displayed, it stayed there. How do you change it without redrawing the entire s... | <p>Many applications make use of the <a href="http://en.wikipedia.org/wiki/Curses_(programming_library)" rel="noreferrer">curses</a> library, or some language binding to it.</p>
<p>For rewriting on a single line, such as updating progress information, the special character "<a href="http://en.wikipedia.org/wiki/Carria... | <p>To build on @Corporal Touchy's answer, there are libraries available that will handle some of this functionality for you such as <a href="http://en.wikipedia.org/wiki/Curses_(programming_library)" rel="nofollow noreferrer">curses/ncurses</a></p>
| 10,341 |
<p>I am looking hard at the basic principles of storing the state of an executing program to disk, and bringing it back in again. In the current design that we have, each object (which is a C-level thingy with function pointer lists, kind of low-level home-made object-orientation -- and there are very good reasons for... | <p>I don't think serializing only "some threads" of a program can work, since you will run into problems with synchronization (some of the problems are described here <a href="http://java.sun.com/j2se/1.3/docs/guide/misc/threadPrimitiveDeprecation.html" rel="nofollow noreferrer">http://java.sun.com/j2se/1.3/docs/guide/... | <p>You should NOT try to serialize a state that your program has to disk. Because your program <strong>will never have full control over its' state</strong> unless it is allowed to by the operating system, in which case... it is part of the operating system.</p>
<p>You <strong>can not guarantee that a pointer to some ... | 22,253 |
<p>Most importantly, why did it fail?</p>
<p>What I'm looking for here is pathologies that anyone, whether new to the team or just waking up one day,can spot.</p>
| <p>Read '<a href="https://rads.stackoverflow.com/amzn/click/com/013143635X" rel="nofollow noreferrer" rel="nofollow noreferrer">Death March</a>'. That pretty much sums up pathologies etc.</p>
| <p>A project that had no end. No one knew when it was finished. All we knew was that we had to keep doing whatever that we were doing. And yes sadly it was just as vague as I explained it. </p>
<p>Did it fail. In my opinion it did since we never saw what happened to it at the end, we were moved on to another project, ... | 15,202 |
<p>I have a single form for editing an event, in which the user can (a) edit the details of the event (title, description, dates, etc.) in a FormView and (b) view and edit a ListView of contacts who are registered for the event. </p>
<p>Here's my LinqDataSource, which allows me to add and remove contacts to the event... | <p>So effectively you want to wrap the two LinqDataSources in a single transaction. There is a sneaky way to leverage the LinqDataSource databinding and events and still do only one commit. Using this method you can still use Dynamic Data, FormView, GridView, validation, etc. It only relies on hooking into the data sou... | <p>Do you you have a foreign key set between tables?
if you do - then it should throw an exception when saving list for new event.</p>
<p>And on topic there is a way to create an event + list records at the same time programmaticaly.</p>
<p>but you will have to write some code.</p>
<pre><code>create all list items p... | 34,376 |
<p>I have an AdvancedDataGrid with a GroupingCollection and a SummaryRow. How do I display the summary row data in bold? Below is my code:</p>
<pre><code><mx:AdvancedDataGrid width="100%" height="100%" id="adg" defaultLeafIcon="{null}" >
<mx:dataProvider>
<mx:GroupingCollection id="gc" sou... | <p>in the past when I have need to do this I had to put a condition in my style function to try and determine if it is a summary row or not. </p>
<pre><code>public function dataGrid_styleFunction (data:Object, column:AdvancedDataGridColumn) : Object
{
var output:Object;
if ( data.children != null )... | <p>If I've understood <a href="http://livedocs.adobe.com/flex/3/html/advdatagrid_10.html" rel="nofollow noreferrer">the documentation</a> correctly, you should be able to do this by specifying the item renderer in the <code>rendererProviders</code> property, and linking the summary to the rendererProvider using a dummy... | 13,842 |
<p>I'm in search of a JavaScript month selection tool. I'm already using jQuery on the website, so if it were a jQuery plugin, that would fit nicely. I'm open to other options, as well.</p>
<p>Basically, I'm after a simplified version of the <a href="http://docs.jquery.com/UI/Datepicker" rel="noreferrer">jQuery UI Dat... | <p>To anyone <em>still</em> looking forward into this (as I was), here is an beautiful, easy to use, jQuery UI compatible, well documented, tested alternative:</p>
<p><img src="https://i.stack.imgur.com/o8h3F.gif" alt="Month picker example"></p>
<p>Its default usage is simple as doing the following:</p>
<pre><code>$... | <p>I just had a pick a date picker the other day. I found two other interesting examples that <em>might</em> help you out, but I'm not sure how you are going to do this without showing the calendar. Most "date pickers" just assume you are going to want to see a calendar. You might do better to look for a custom drop... | 23,789 |
<p>Which type of filament material(s) is safe to use as an in-wall box for regular, 120v wiring? For instance, an electrical outlet box.</p>
<p>In case it matters, location is the state of Washington, USA.</p>
| <h1>Safety is not the same as legality</h1>
<p>Something might be perfectly safe, but it doesn't make it legal to do or allowed to use. Parking your car over double-yellow lines is one example that is perfectly safe but violates the traffic codes.</p>
<p>Any 3D printed box would violate for example <a href="https://app... | <p>I haven't tested the commercial "blue boxes" used to hold 120/240 V electrical outlets, switches, and splices to see how they behave when heated. As such, this argument is based on intuition, which is intrinsically flawed as a logic device. Never-the-less, I think the no extruded molten plastic (FFF) 3D print... | 1,562 |
<p>In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and <code>Proc.new</code> on the other. </p>
<ul>
<li>What are those differences?</li>
<li>Can you give guidelines on how to decide which one to choose?</li>
<li>In Ruby 1.9, proc and lambda are different. What's the deal?</li>
</ul>
| <p>Another important but subtle difference between procs created with <code>lambda</code> and procs created with <code>Proc.new</code> is how they handle the <code>return</code> statement:</p>
<ul>
<li>In a <code>lambda</code>-created proc, the <code>return</code> statement returns only from the proc itself</li>
<li>I... | <p>The difference in behaviour with <code>return</code> is IMHO the most important difference between the 2. I also prefer lambda because it's less typing than Proc.new :-)</p>
| 2,305 |
<p>High temperature PTFE tape is rated up to 550°F, which is 288°C. I'm wondering if it would be useful for components on the hot end to prevent oozing. Has anyone tried it?</p>
| <p>That is perfectly viable these days in Marlin firmware, there are options for setting this up using the configuration file, e.g.:</p>
<pre><code>// :[0, 1, 2, 3, 4, 5, 6, 7, 8]
#define EXTRUDERS 1
...
...
...
// A dual extruder that uses a single stepper motor
//#define SWITCHING_EXTRUDER
#if ENABLED(SWITCHING_EXTRU... | <p>You'll need a custom firmware.</p>
<p>Yur custom firmware will have to react to the "Change extruder" command differently than a normal firmware: instead of just swapping to a different extruder, you'll need to perform some operations to alter the gearing (possibly a solenoid?), and possibly include some k... | 1,807 |
<p>Sometimes Eclipse comes up saying "hey you should debug this line!!!" but doesn't actually close the program. I can then continue to play big two, and even go through the same events that caused the error the first time and get another error box to pop up!</p>
<p>The bug is simple, I'll fix it, I just want to know ... | <p>Programming mistakes can be categorized in these categories:</p>
<ol>
<li>Compile-time errors, which are caught by the compiler at the time of compilation and without correcting them, it's not possible to run the program at all.</li>
<li>Run-time errors, which are not caught by the compiler but put the computer in ... | <p>For example, imagine a piece of software used by your bank.</p>
<p>In you savings account they have made the follwoing line:</p>
<pre><code>Account -= Interest;
</code></pre>
<p>Which obviously is a bug, but it does not crash the system.</p>
| 48,073 |
<p>I'm fairly new to deploying desktop applications, so this is the first time I'm building an installer for my software. Currently, the first time I run my software after installing it, it crashes. After that, it runs fine. I'm still in the process of debugging this issue, but I've noticed that a reboot immediately... | <p>Generally, reboots between install and running are because you're replacing system DLLs that are locked. The installer sets up a run-once registry entry that copies the DLLs during boot before they're locked by Windows, and then your application can use the new DLL that you laid down.</p>
<p>In general, this is hi... | <p>We've got a case with an installer I maintain where we need to force a reboot for vista only due to UAC and privilege elevation. Once the setup is complete we need to trigger a program as the <em>current</em> user context, not the elevated Vista context. </p>
<p>In your case, I suspect that some files haven't been ... | 29,387 |
<p>In a HTML page references to Javascript files are rewritten with one additional subdirectory at the end:</p>
<p>/+sfgRmluamFuX1R5cGU9amF2YV9zY3JpcHQmRmluamFuX0xhbmc9dGV4dC9qYXZhc2NyaXB0+. </p>
<p>Why is that and can it be a source to potential problems?</p>
<p>In our source code we have Javascript includes like t... | <p>Edit: Proxy issue. See Ivan's solution to his own problem.</p>
<p><em>Is this really HTML? You wouldn't happen to be in ASP.NET would you, cause that looks alot like a cookieless session string.
You can very easily test to make sure you're scripts are loaded by checking firebug's net tab, or failing that just putti... | <p>We use Java and JSF with JBoss. </p>
<p>Originally the code is like this one:</p>
<pre><code><script src="/js/tiny_mce/tiny_mce.js" type="text/javascript"><!--
//--></script>
</code></pre>
<p>And it gets rewritten to this one:</p>
<pre><code><script src="/js/tiny_mce/+sfgRmluamFuX1R5cGU9amF... | 49,441 |
<p>I want to select a blob col from one table, base64 encode it and insert it into another tables. Is there any way to do this without round tripping the data out of the DB and through my app?</p>
| <p>I was looking for the same thing and I've just seen that MySQL 5.6 has a couple of new string functions supporting this functionality: <a href="http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64" rel="noreferrer">TO_BASE64</a> and <a href="http://dev.mysql.com/doc/refman/5.6/en/string-fu... | <p>create table encrypt(username varchar(20),password varbinary(200))</p>
<p>insert into encrypt values('raju',aes_encrypt('kumar','key'))
select *,cast(aes_decrypt(password,'key') as char(40)) from encrypt where username='raju';</p>
| 46,749 |
<p>Is it possible to create, for instance, a box model hack while using in-line CSS?</p>
<p>For example:</p>
<p><code><div id="blah" style="padding: 5px; margin: 5px; width: 30px; /*IE5-6 Equivalent here*/"></code></p>
<p>Thanks! </p>
| <p>You can use the "prefixing" hack in inline styles as well:</p>
<pre><code><div style="*background:red"></div>
</code></pre>
<p>Just make sure you put the IE hacks at the end of the style attribute. However I second the opinion that inline styles should be avoided when possible. Conditional comments and... | <p>The most appropriate answer is <strong>don't</strong>. (Edit: to be clear, I mean don't do it inline, I don't mean don't use CSS hacks.)</p>
<p>Edit: This doesn't work, IE ignores the conditional comment. Leaving the answer here to not be a bastard.</p>
<p>The next most appropriate answer is conditional comments:<... | 26,220 |
<p>Given : </p>
<blockquote>
<p>Group hasMany Persons</p>
</blockquote>
<p>but the relationship is independent (ie. Persons can exist without belonging to a Group), should the foreign key in the persons' table (ie group_id) be set to 0 (or NULL) when deleting a group? If you do not, the person will try to belong to... | <p>Yes, the foreign keys should be set to NULL (or 0, if this is your chosen 'no group' value) or you lose referential integrity. If your database supports it, you should be able to set an 'On delete' trigger or a cascade rule in your framework to enforce this. And the behaviour in CakePHP seems correct. If the value i... | <p><em>> If you do not, the person will try to belong to a group that does't exist.</em></p>
<p>There is also a worse scenario: in the future a new group B may appear that will reuse the id of deleted group A. Then all former A group's users will be "magically" enlisted into new group B.</p>
| 17,853 |
<p>I need to see if a string value matches with an object value, but why won't this work?</p>
<pre><code>public int countPacks(String flavour) {
int counter = 0;
for(int index = 0; index < packets.size(); index++) {
if (packets.equals(flavour)) {
counter ++;
}
... | <p>What is "packets"? It's not going to be a string - so how would it equal a string?</p>
<p>I suspect you meant your test to be:</p>
<pre><code>if (packets.get(index).equals(flavour))
</code></pre>
<p>However you're still going to print out "You have not entered a correct flavour" for every packet of the "wrong" fl... | <p>You should do it this way to be certian you really are comparing strings in the most foolproof way possible.</p>
<p>I also fixed your loop </p>
<pre><code>public int countPacks(String flavour, List packets)
{
int counter = 0;
for (Iterator iter = packets.iterator(); iter.hasNext();) {
... | 33,452 |
<p>I'm doing something bad in my ASP.NET app. It could be the any number of CTP libraries I'm using or I'm just not disposing something properly. But when I redeploy my ASP.NET to my Vista IIS7 install or my server's IIS6 install I crash an IIS worker process.</p>
<p>I've narrowed the problem down to my HTTP crawler, ... | <p>Download Debugging tools for Windows:
<a href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx" rel="noreferrer">http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx</a></p>
<p>Debugging Tools for Windows has has a script (ADPLUS) that allows you to create dumps when a process CRASHES:
<a hre... | <p>A quick search found <a href="http://www.iisfaq.com/default.aspx?view=P197" rel="nofollow noreferrer">IISState</a> - it relies on the <a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" rel="nofollow noreferrer">Windows debugging tools</a> and needs to be running when a crash occurs, but given th... | 7,688 |
<p>I'm compiling some C# and VB code at run time using the CodeDomProvider, CompilerInfo, and CompilerParameters. It works great, and I really like being able to add scripting support to my application, but it only seems to support .NET 2.0 syntax. For example, the var keyword isn't supported in C#, and the If(bool, st... | <p>OK, I found a big hint here from <a href="http://andersnoras.com/blogs/anoras/archive/2008/04/13/codedomproviders-and-compiler-magic.aspx" rel="noreferrer">Anders Norås</a> that there is a constructor for the CSharpCodeProvider constructor that takes some options, including the compiler version. When I checked the <... | <p>Not sure where you are going with the app.config's but heres how you can tell it to use 3.5 framework.</p>
<pre><code>var csc = new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", "v3.5" } });
</code></pre>
<p><a href="http://blogs.msdn.com/lukeh/archive/2007/07/11/c-3-0-and-codedo... | 49,765 |
<p>I have an Excel spreadsheet that I want to import select columns into my SQL Server 2008 database table. The wizard didn't offer that option.</p>
<p>Do any easy code options exist?</p>
| <p>Once connected to Sql Server 2005 Database, From Object Explorer Window, right click on the database which you want to import table into. Select Tasks -> Import Data.
This is a simple tool and allows you to 'map' the incoming data into appropriate table.
You can save the scripts to run again when needed.</p>
| <p>The import wizard does offer that option. You can either use the option to write your own query for the data to import, or you can use the copy data option and use the "Edit Mappings" button to ignore columns you do not want to import.</p>
| 49,201 |
<p>I'm trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can't grow the left div to match the height of the right one. My right div typically has a lot of content. </p>
<p>Here's a paired down example of my template to illustrate the problem.</p>
<pre><code><div style="... | <p>Your simplest answer lies in the next version of css (3), which currently no browser supports.</p>
<p>For now you are relegated to calculating heights in javascript and setting them on the left side. </p>
<p>If the navigation is so important to be positioned in such a way, run it along the top.</p>
<p>you could a... | <p>@hoyhoy</p>
<p>If a designer can make this work in html, then he can have this design. If he is a true master of web design, he will realize that this is a limitation of the media, as video is not possible in magazine ads.</p>
<p>If he would like to simulate weight by giving the 2 columns equal importance, than ch... | 5,624 |
<p>I've a terrible memory. Whenever I do a CONNECT BY query in Oracle - and I do mean <em>every</em> time - I have to think hard and usually through trial and error work out on which argument the PRIOR should go.</p>
<p>I don't know why I don't remember - but I don't.</p>
<p>Does anyone have a handy memory mnemonic s... | <p>I always try to put the expressions in <code>JOIN</code>'s in the following order:</p>
<pre><code>joined.column = leading.column
</code></pre>
<p>This query:</p>
<pre><code>SELECT t.value, d.name
FROM transactions t
JOIN
dimensions d
ON d.id = t.dimension
</code></pre>
<p>can be treated either l... | <p>Part of the reason that this is difficult to visualise each time, is because sometimes the data is modelled as <code>id</code> + <code>child_id</code>, and sometimes it is modelled as <code>id</code> + <code>parent_id</code>. Depending on which way round your data is modelled, you have to place your <code>PRIOR</co... | 33,791 |
<p>I am curious to learn <a href="http://www.boost.org/" rel="noreferrer">Boost</a>. But I wanted to ask:</p>
<ul>
<li>How important is it to make the effort to learn Boost?</li>
<li>What prerequisites should one have before jumping on Boost?</li>
</ul>
<p>Why I am curious to know about Boost is that many people are ... | <p>I think anyone that is seriously considering C++ development as a career should learn Boost, and learn it well. Once you get into serious programming you will realize how beneficial these libraries can be and how much more productive they can make you. Not only are they cross-platform, but once you get into data cru... | <p>Judging (scientifically :-) by the huge quantity of questions on SO about C++ which have top-rated answers along the lines of "Use Boost::SomethingOrOther", I would say it's very important.</p>
<p>The thing that drew me from C to Java instead of C++, was the <strong>huge</strong> quantity of supplied classes in Jav... | 46,753 |
<p>My code works great in IE8, Firefox and Safari. But it doesn't work properly in Opera.
What happens is that the DIV is hidden but the space occupied by the DIV remains to appear in my web-page.</p>
<pre><code><div style=" z-index:-1;height :380; width:760; position:relative; text-align:center" id="new-add">
... | <p>You might try the style.display property:</p>
<blockquote>
<p>Hide</p>
<p>document.getElementById('YourElem').style.display = 'none';</p>
<p>Show</p>
<p>document.getElementById('YourElem').style.display = '';</p>
</blockquote>
<p><strong>EDIT:</strong> Took PorneL comment into acocunt in this answer</p>
| <p>I don't know if it will solve your problem, but you can try to use :</p>
<pre><code>document.getElementById("xxx").display = "none";
</code></pre>
<p>instead of </p>
<pre><code>document.getElementById("xxx").style.visibility = "hidden";
</code></pre>
| 33,176 |
<p>I am doing the following in PHP:</p>
<pre><code>exec('java -jar "/opt/flex3/lib/mxmlc.jar" +flexlib "/opt/flex3/frameworks" MyAS3App.as -default-size 360 280 -output MyAS3App.swf');
</code></pre>
<p>When I run this from the command line, it runs fine and finishes in a second or two.</p>
<p>When I run this command... | <p>Turns out it was a bug specific to the PHP stack MAMP (<a href="http://www.mamp.info/" rel="noreferrer">http://www.mamp.info/</a>).</p>
<p>Turns out any invocation of the JVM following fails under MAMP, e.g.:</p>
<pre><code>exec('java -version');
</code></pre>
<p>The fix is to prefix the command with </p>
<pre><... | <p>Exec is always tricky, on any language :-)</p>
<p>Try to:</p>
<ul>
<li>use background execution (add &
symbol at the end) </li>
<li>use shell_exec instead </li>
<li>specify the full path to
java executable (may be the one
available to PHP is not the one you
need?) </li>
<li>run a simple HelloWorld java
app to ... | 35,214 |
<p>I'm looking for a command line to remove all view-private files and directories from a ClearCase view on Windows. I have Cygwin available as well.</p>
<p>The script available at <a href="http://www.ibm.com/developerworks/rational/library/4687.html" rel="noreferrer">this article</a> is not quite what I want, since ... | <p>A few remarks:</p>
<ul>
<li><code>ct lsprivate</code> is great for dynamic views, not snapshot views</li>
<li><code>ct ls -rec -view_only</code> as well as <code>ct lsprivate</code> also list your checked-out files... I am not sure you want to delete those...</li>
</ul>
<p>For listing private files (only private o... | <p>what about use the of cygpath command instead of sed?<br>
you can found more info about cygpath.exe here:<br>
<a href="http://www.cygwin.com/cygwin-ug-net/using-utils.html" rel="nofollow noreferrer">link text</a></p>
<p>a way to link cygpath.exe with other programs is to use xargs.<br>
example: processA | xargs cyg... | 48,287 |
<p>I've heard that creating a new process on a Windows box is more expensive than on Linux. Is this true? Can somebody explain the technical reasons for why it's more expensive and provide any historical reasons for the design decisions behind those reasons?</p>
| <p>mweerden: NT has been designed for multi-user from day one, so this is not really a reason. However, you are right about that process creation plays a less important role on NT than on Unix as NT, in contrast to Unix, favors multithreading over multiprocessing.</p>
<p>Rob, it is true that fork is relatively cheap w... | <p>All that plus there's the fact that on the Win machine most probably an antivirus software will kick in during the CreateProcess... That's usually the biggest slowdown.</p>
| 7,013 |
<p>I have implemented a pretty simple picture viewer that will allow the user to browse through a collection of images. They are loaded from the Internet, and displayed on the device through a <code>UIImageView</code> object. Something like this:</p>
<pre><code>UIImage *image = [[UIImage alloc] initWithData:imageData]... | <p>I was just going through your post and had exactly the same requirement. The problem with all above solutions is, you will have to incorporate the logic of transition into your controller. In the sense the approach is not modular. Instead I wrote this subclass of UIImageView:</p>
<p><strong>TransitionImageView.h fi... | <p>here is what i have done: a fading.
i put another UIImageView with the same UIImage and dimension called tmp.
i replace the UIImage of the base UIImageView.
Then i put the right image on the base (still covered by tmp).</p>
<p>Next step is
- to set alpha of tmp to zero,
- to stretch the base UIImageView to right ... | 26,139 |
<p>I normally store all my configs in the registry.
Even though I have started using LINQ I would not like to have the DSN in the web.config, but rather let it stay in the registry and attach it (maybe in the Application Start Event) to the System Config.</p>
<p>How can this be done?</p>
<p>Thanx for any ideas!</p>
... | <p>Here's what I do. I have a a base class for my DataContext. It's called DataContextBase and is generated by sqlmetal.exe. I have a derived class called DataContext which is what is used in my Linq calls. It looks like this:</p>
<pre><code>public class DataContext : DataContextBase
{
public DataContext()
... | <p>This is a fairly reasonable requirement when working with legacy code.</p>
<p>The DataContext class is a partial class, so I just add a static factory method that loads the configuration setting and creates the datacontext result.</p>
| 33,026 |
<p>Method signature in Java:</p>
<pre><code>public List<String> getFilesIn(List<File> directories)
</code></pre>
<p>similar one in ruby</p>
<pre><code>def get_files_in(directories)
</code></pre>
<p>In the case of Java, the type system gives me information about what the method expects and delivers. In ... | <p>What it comes down to is that <code>get_files_in</code> is a bad name <em>in Ruby</em> - let me explain.</p>
<p>In java/C#/C++, and especially in objective C, the function arguments <em>are part of the name</em>. In ruby they are not.<br>
The fancy term for this is <a href="http://en.wikipedia.org/wiki/Method_overl... | <p>It's by no means a maintenance nightmare, just another way of working, that calls for consistence in the API and good documentation. </p>
<p>Your concern seems related to the fact that any dynamic language is a dangerous tool, that cannot enforce API input/output contracts. The fact is, while chosing static may see... | 21,328 |
<p>I am trying to use the same http cookie (in effect a asmx sessionid), in multiple WCF client endpoints. </p>
<p>The server has several endpoints, one of them is: </p>
<p>AuthenticationService.asmx<br>
Login() <- Creates a HTTP cookie that is the servers ASP.NET sessionid<br>
Logout() <- Destroys th... | <p>Have a look at <a href="http://blogs.msdn.com/drnick/archive/2008/01/17/custom-cookie-handling.aspx" rel="nofollow noreferrer">this article</a>.<br/>It explains how to manually manage cookies in a WCF client proxy. More precisely WCF exposes an API to let you extract cookies from an HTTP response, and in the same wa... | <p>If you enabled asp.net compatibility mode, you can access the http session from within your WCF service, so you shouldn't need to add any cookies to do this.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms752234.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms752234.aspx</a></p>... | 24,558 |
<p>I have an AVI file, which I want to re-encode to fit on a CD of size 650 MB. How can I encode such that file size does not exceed the given size? Which program can I use ?</p>
| <p>I assume you want to do this programmatically: </p>
<p><strong>For Windows:</strong></p>
<p>You can use directshow to transcode your video by building a filter graph.</p>
<p>Get (if you don't already have) the platform SDK for windows. Then browse here to check out some of the directshow examples which construct... | <p>Calculate the number of seconds the AVI is. Then, take the file size and divide by the length. Convert to kilobits per second, and use that as your bitrate median. (Use Google to do the math and conversion easily.)</p>
<p>You can weigh the video and audio bitrates as you desire. Usually 96 kbps is good enough w... | 40,725 |
<p>I am trying to control some LEDs wired to the parallel port on Windows XP. The easiest solution would be <a href="http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html" rel="nofollow noreferrer">Inpout32.dll</a> from <a href="http://logix4u.net/" rel="nofollow noreferrer">Logix4u.... | <p>The generic way to access native code from Java is <a href="http://en.wikipedia.org/wiki/Java_Native_Interface" rel="nofollow noreferrer">JNI</a>.</p>
<p>However, there are frameworks like <a href="https://github.com/twall/jna/" rel="nofollow noreferrer">JNA</a> and/or <a href="http://www.jinvoke.com" rel="nofollow... | <p>There is also <a href="http://www.teamdev.com/jniwrapper/index.jsf" rel="nofollow noreferrer">JNIWrapper</a></p>
| 49,684 |
<p>3D printing should be relatively safe, however, the inherent nature of 3D printers, with all of the heated parts, constitutes a fire risk. A well designed 3D printer should be designed to be as safe as possible, especially one used in the home... Yes, the recommendation is, when printing, to watch the 3D printer at ... | <p>Whether you should use a thermal fuse or not depends on what other safety measures you've taken. You can't look at the safety features of a printer in isolation, you need to look at what other measures are in place.</p>
<p>The main fire hazard in printers is unfortunately (still) the fact that some manufacturers us... | <p>I haven't found a good way to flood the entire machine, including the electronics, with CO2 gas or another extinguisher when the alarm sounds.</p>
<p>A servo or some other actuator attached to a fire extinguisher, and then attach it to a thermocouple or some other sensor. Maybe a knockoff Arduino, which the small ... | 602 |
<pre><code><?php
class Box {
var $contents;
function Box($contents) {
$this-&gt;contents = $contents;
}
function get_whats_inside() {
return $this-&gt;contents;
}
}
?>
</code></pre>
<p>I am going through a OO tutorial. I am familiar with PHP and the concept of OO but... | <p>It should read $this->contents instead of $this-&gt;contents</p>
| <p>I guess it should be</p>
<pre><code>$this->contents = $contents;
return $this->contents;
</code></pre>
<p>instead of </p>
<pre><code>$this-&gt;contents = $contents;
return $this-&gt;contents;
</code></pre>
<p>Seems there was some HTML involved...</p>
| 40,467 |
<p>I'm working on moving a client/server application created with C# and WinForms into the SOA/WPF/Silverlight world. One of the big hurdles is the design of the UI. My current UI is MDI driven and users rely heavily on child windows, having many open at the same time and toggling back and forth between them. </p>
<p>... | <p>I think the answer is really going to be up to your users -- I'd set up some prototypes with multiple paradigms and let them provide some input. The last thing you want to do is introduce a new UI paradigm without having any end-user input.</p>
<p>Tabs are really popular now, but don't allow side-by-side viewing, ... | <p>Did you try <a href="http://www.netikatech.com/products/default.aspx" rel="nofollow noreferrer">GOA WinForms</a>?</p>
| 7,328 |
<p>Can someone explain to me why this code prints 14? I was just asked by another student and couldn't figure it out.</p>
<pre><code>int i = 5;
i = ++i + ++i;
cout<<i;
</code></pre>
| <p>The order of side effects is undefined in C++. Additionally, modifying a variable twice in a single expression has no defined behavior (See the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf" rel="nofollow noreferrer">C++ standard</a>, §5.0.4, physical page 87 / logical page 73).</p>
<p>... | <p>Because the prefix increment has precedence:</p>
<pre><code>int i = 5;
i = i+1; // First ++i, i is now 6
i = i+1; // Second ++i, i is now 7
i = i + i // i = 7 + 7
cout << i // i = 14
</code></pre>
| 44,209 |
<h2>How would you unittest a safe-publication guarantee in Java?</h2>
<p>To be concrete:</p>
<p>I have a Cache interface that has a method getOrLoad(K key, ObjectLoader loader). Thing is, if a Cache cannot find an object for the given key, then it must load it from the ObjectLoader instance. However, the Cache is req... | <p>I discovered a <a href="http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-2220&yr=2007&track=5" rel="nofollow noreferrer">JavaOne presentation</a> by Bill Pugh, Brian Goetz and Cliff Click on the subject of testing concurrent code. They suggested this approach, witch I think is the best I... | <p>Actually getting an error due to unsafe publication is very difficult (if anyone knows how, let me know). Static analysis is your best bet for an automated solution. I would stick to code review, and not worrying about it unduly.</p>
| 24,548 |
<p>I've got a website that has windows authentication enable on it. From a page in the website, the users have the ability to start a service that does some stuff with the database.</p>
<p>It works fine for me to start the service because I'm a local admin on the server. But I just had a user test it and they can't ge... | <p><em>Note: This doesn't address enumerating services as a different user, but given the broader description of what you're doing, I think it's a good answer.</em></p>
<p>I think you can simplify this a lot, and possibly avoid part of the security problem, if you go directly to the service of interest. Instead of cal... | <p>You can try using ASP.NET impersonation in your web.config file and specify a user account that has the appropriate permissions:</p>
<pre><code> <system.web>
<identity impersonate="true" userName="Username" password="Password" />
</system.web
</code></pre>
<p>Take a look at <a href="ht... | 25,809 |
<p>How to send array in Httpservice in Adobe Flex3</p>
| <p>I am not quite sure what you mean by sending an array to a httpservice. If you mean to send an array to a httpservice with the same field name, you can pass an array as field value.</p>
<pre><code>var service:HTTPService = new HTTPService();
service.useProxy = true;
service.destination = "myservicet";
service.resul... | <p>if it is a simple string array, you can <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Array.html#join()" rel="nofollow noreferrer">join</a> it with a well know separator char, and on the other site, split the string with the same separator back to an array.</p>
| 31,515 |
<p>I got a call from a tester about a machine that was failing our software. When I examined the problem machine, I quickly realized the problem was fairly low level: Inbound network traffic works fine. Basic outbound command like ping and ssh are working fine, but anything involving the <code>connect()</code> call is ... | <p>I would check firewall configuration on that machine. It is possible for iptables (I guess your SUSE has iptables firewall) to be setup to let trough only ping ICMP packets.</p>
| <p>Firewall is always possible, but it does say that ssh can connect, so that seems unlikely.
I'd say have a look at the routes ("route" command on Linux), and make sure you don't have like two default routes, or weird ones or whatever. All in all I'd say test ping and ssh and your program on the same distant IP, and i... | 12,167 |
<p>I purchased a new 4.2.7 (256k) board for my Ender 5 Pro and added the CR Touch. I got everything connected and flashed the board with the "Ender-5 Pro- Marlin2.0.1 - V1.1.1 - ALT - TMC2235.bin" firmware from the creality.com/download > Accessory Firmware > CR Touch Firmware for 32-bit Motherboard >... | <p>If you have an empty spool of the same brand, you could weigh the empty spool and the one you're trying to "measure" to get an approximate weight of the remaining filament. Divide by the (presumably available from manufacturer) weight per meter to get a rough length in meters, if that's more useful to you... | <p>Besides using the window on a spool that estimates the amount of filament left, I've used large calipers to measure the diameter of an empty spool and the diameter of the filament left on the spool.</p>
| 2,111 |
<p>I'm setting up an Internet-facing ASP.NET MVC application, on Windows 2008. It uses SQL Server 2008 for its database. I'm looking for best-practices for securing it.</p>
<p>I found <a href="http://www.enterprisenetworkingplanet.com/netsecur/article.php/3552711" rel="nofollow noreferrer">this article</a>, but it's a... | <p>I would definitely avoid the second approach - you don't want to hit the database everytime you databind a parent item. As DOK says, try and architect your system properly. For me that would mean populating a collection of business objects and binding to it. I do something similar with a custom menu control (note th... | <p>If you do two separate queries, you can still make them in one call to the database, and get back two resultsets.</p>
<p>Instead of DataSets, you could use the more efficient DataReader (with two resultsets). Loop through the resultsets and populate Question objects with associated Tag objects or properties. Put th... | 34,815 |
<p>I've got some code that uses the Component Categories manager to load all of the classes that implement a particular category.</p>
<p>Is there an easy way to get a description, path and version information from the loaded DLL or EXE?</p>
| <p>When the object is loaded in-proc (i.e. from a DLL) in the same apartment, there are potentially some tricks you could do to find the DLL in memory. For instance, if you look in the virtual method table (vtable) for code pointers into the live object, they would usually point into the DLL. You could then use some s... | <p>One way to get this information, assuming that it's only being used for logging purposes, is to simply wait until all the initialisation's done, and then to enumerate loaded modules, dumping details about each to the log file.</p>
<p>Obviously, this only works for inproc objects, and it won't work if the applicatio... | 21,450 |
<p>I need to send PUT and DELETE along with POST, GET to a REST API how can I do it?</p>
| <p>Delphi 7 comes with <a href="http://www.indyproject.org/Sockets/index.EN.aspx" rel="nofollow noreferrer">Indy</a>. See the <a href="http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=!!MEMBEROVERVIEW_TIdHTTP.html" rel="nofollow noreferrer">TIdHTTP component</a> and specificly the Get and P... | <p>Check out the <a href="http://www.overbyte.be/frame_index.html" rel="nofollow noreferrer">ICS</a> components, they are suitable for the job.</p>
| 46,827 |
<p>I get asked this question a lot and I thought I'd solicit some input on how to best describe the difference.</p>
| <p>They are actually two very different things. "Delegate" is actually the name for a variable that holds a reference to a method or a lambda, and a lambda is a method without a permanent name.</p>
<p>Lambdas are very much like other methods, except for a couple subtle differences.</p>
<ol>
<li>A normal method is def... | <p>Well, the really oversimplified version is that a lambda is just shorthand for an anonymous function. A delegate can do a lot more than just anonymous functions: things like events, asynchronous calls, and multiple method chains.</p>
| 9,891 |
<p>I need to use encryption (and signature) for a web-service (server side). I use axis2 and successfully added the rampart module (for WS-Security implementation).
But rampart page (<a href="http://ws.apache.org/axis2/modules/rampart/1_2/security-module.html" rel="nofollow noreferrer">http://ws.apache.org/axis2/module... | <p>Would it be possible to simply use SSL (https)? That would certainly simplify things.</p>
| <p>I found many answers in this book : <a href="http://agileskills2.org/DWSAA/index.html" rel="nofollow noreferrer">http://agileskills2.org/DWSAA/index.html</a> (chapter 9)
So even if I didn't finished I'll try to answer my own question :</p>
<ul>
<li>Even if the policy is in the WSDL the current Axis 2 version (1.4) ... | 25,138 |
<p>I have a new Creality Ender 2 Pro with a Creality 4.2.3 mainboard. I'm attempting to compile Marlin to fix a bug. How can I tell what driver chips I have on this board?</p>
<p>I've narrowed it down to likely <code>A4988</code> or <code>TMC2208_STANDALONE</code> or possibly the <code>TMC2225</code>. Strangely Crealit... | <p>According to <a href="https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995206382" rel="nofollow noreferrer">'The-EG' comment</a> in this GitHub issue, <a href="https://github.com/MarlinFirmware/Configurations/pull/633" rel="nofollow noreferrer">Add Creality Ender 2 Pro config #633</a>, you can ... | <p>MS35775 appears to be TMC208 compatible. You can find the data sheet on relmon.com here is the overview:</p>
<ul>
<li>2-Phase stepping motor peak current of 2A</li>
<li>Step / dir interface 2, 4, 8, 16, or 32 microstep</li>
<li>Internal 256 micro steps</li>
<li>Quiet mode</li>
<li>Fast mode</li>
<li>HS Rdson 0.29 Ω... | 2,071 |
<p>Is it possible to cache database connections when using PHP like you would in a J2EE container? If so, how?</p>
| <p>There is no <strong>connection pooling</strong> in php.<br>
<strong>mysql_pconnect</strong> and <strong>connection pooling</strong> are two different things.
There are many problems connected with <code>mysql_pconnect</code> and first you should read the manual and carefully use it, but this is not connection poolin... | <p>You cannot instantiate connection pools manually.</p>
<p>But you can use the "built in" connection pooling with the <a href="http://de.php.net/manual/en/function.mysql-pconnect.php" rel="nofollow noreferrer">mysql_pconnect</a> function.</p>
| 6,090 |
<p>We're creating a metamodel of our report definitions within our central metadata repository. We know how to "harvest" SSRS reports since they are XML. IS there any easy way to do the same for Crystal Reports. We're interested in getting to anything CR understands about the report (similar in concept to the SSRS R... | <p>You can get a report definition text file if you export the crystal report as...you guessed it "Report Definition(TXT)" It has the crystal version and lots of info for each section such as datafields, formatting, etc...</p>
| <p>AFAIK, there is no way to do this. CR files are in a closed and proprietary format. :-(</p>
| 43,124 |
<p>I was just listening to some older .Net Rocks! episodes, and I <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=D91887EA-5128-4BB1-B861-1DC1F9564941&displaylang=en" rel="nofollow noreferrer">found #329 on DSLs</a> to be interesting. My problem is that I can't find any good online resources for p... | <p>The architects of the DSL Tools team wrote a book, <a href="https://rads.stackoverflow.com/amzn/click/com/0321398203" rel="nofollow noreferrer" rel="nofollow noreferrer">Domain-Specific Development with Visual Studio DSL Tools.</a> The book's <a href="http://www.domainspecificdevelopment.com/" rel="nofollow noreferr... | <p>A fantastic option for DSLs is <a href="http://boo.codehaus.org/" rel="nofollow noreferrer">Boo</a>. I've been using it for things like setting up my IoC container, defining routes, validation rules. <a href="http://www.ayende.com/Blog/" rel="nofollow noreferrer">Ayende Rahien</a> is writing an fantastic book on t... | 2,646 |
<p>I have this HTML structure and want to convert it to an accordion.</p>
<pre><code><div class="accor">
<div class="section">
<h3>Sub section</h3>
<p>Sub section text</p>
</div>
<div class="section">
<h3>Sub section</h3>
... | <p>Ah, I found the solution.</p>
<p>Using <code>$.each()</code></p>
<pre><code>$headings.each(function(i, el) {
var $this = $(el), $p = $this.parent();
$this.insertBefore($p);
});
</code></pre>
<p>Is there a better solution than this, though? Perhaps just using the vanilla Accordion options?</p>
| <p>How about this:</p>
<pre><code>$('.accor .section').each(function() {
$('h3', this).insertBefore($(this));
});
</code></pre>
| 26,753 |
<p>I'm trying to alpha blend sprites and backgrounds with <a href="http://www.devkitpro.org/" rel="noreferrer">devkitPro</a> (including libnds, libarm, etc).</p>
<p>Does anyone know how to do this?</p>
| <p>As a generic reference, i once wrote <a href="http://sylvainhb.blogspot.com/2006/09/alpha-blending.html" rel="nofollow noreferrer">a small blog entry</a> about that issue. Basically, you first have to define which layer is alpha-blended against which other layer(s). Afaik,</p>
<ul>
<li>the source layer(s) must be o... | <p>It's been a <i>long</i> time since I've done any GBA programming, but as I recall, the DS supports most (if not all) of the stuff that GBA supports. <a href="http://www.coranac.com/tonc/text/gfx.htm" rel="nofollow noreferrer">This</a> link has a section on how to do alpha blending for GBA (section 13.2). I don't kno... | 2,880 |
<p>I am trying to find the index of a substring in a string that matches another string under a specific culture (provided from a System.CultureInfo). </p>
<p>For example the string "ass" matches the substring "aß" in "straße" under a German culture.</p>
<p>I can find the index of the start of the match using</p>
<... | <p>If you use a capture group, you can capture the exact match that was found, and from that you can determine how many characters were matched.</p>
<p>I'm a bit timestressed right now to give an example, so I hope you can figure it out from my description.</p>
<p>Perhaps I'll ammend my answer later.</p>
<p>Dave</p>... | <p>Does regular expressions handle that distinction of ss vs. ß?</p>
| 22,037 |
<p>I have a BulletedList in asp.net that is set to DisplayMode="LinkButton". I would like to trigger the first "bullet" from a javascript, can this be done? And if so, how?</p>
| <p>Say you have the BulletedList as</p>
<pre><code><asp:BulletedList runat="server" ID="MyLovelyBulletedList" DisplayMode="LinkButton">
<asp:ListItem Text="My Lovely Text 1" />
<asp:ListItem Text="My Lovely Text 2" />
</asp:BulletedList>
</code></pre>
<p>... then you can fire the "oncl... | <p>After a lot of testing it seems the only dependent way to do this is by manually firing the __doPostBack-script like so:</p>
<pre><code>__doPostBack('MyLovelyBulletedList', '0');
</code></pre>
<p>as suggested by <a href="https://stackoverflow.com/users/25427/alexander-gyoshev">Alexander Gyoshev</a></p>
| 22,069 |
<p>In particular what strengths does it have over caching features of Asp.net</p>
| <p>memcached is a distributed cache -- the whole cache can be spread into multiple boxes. so for example you can use memcached to store session data in cluster environment, so this data is available to any box of the cluster.</p>
<p>memcached can be compared to Microsoft's Velocity (<a href="http://blogs.msdn.com/velo... | <p>Another nice feature is that memcached runs as a stand alone service. If you take your application down, the cached data will remain in memory as long as the service runs.</p>
| 35,054 |
<p>I'd like to log the output of a command to <code>stdout</code> as well as to a log file. I've got Cygwin installed and I'm trying to use the <code>tee</code> command to accomplish this.</p>
<pre><code>devenv mysolution.sln /build myproject "Release|Win32" | tee build.log
</code></pre>
<p>Trouble is that <code>tee<... | <blockquote>
<p>tee seems to insist on waiting for the
end of file before outputting anything
to either stdout or the log file.</p>
</blockquote>
<p>This should definitely not be happening - it would render tee nearly useless. Here's a simple test that I wrote that puts this to the test, and it's definitely not... | <p>You can output to the file and tail -f the file.</p>
<p>devenv mysolution.sln /build myproject "Release|Win32" > build.log &</p>
<p>tail -f build.log</p>
| 13,212 |
<p>My installation of APEX has come pear shaped on a Oracle 9.2.0.5.0 instance, all the packages are invalid.</p>
<p>I've tried recompiling everything with DBMS_UTILITY.compile_schema, but still all the packages are invalid. So, tried recompiling individual packages,</p>
<pre><code>SQL> ALTER PACKAGE FLOWS_020000.... | <p>I know this answer is kind of late but just want to let you know that you can also use:</p>
<pre class="lang-sql prettyprint-override"><code>ALTER PACKAGE your_package_name_here COMPILE PACKAGE;
ALTER PACKAGE your_package_name_here COMPILE BODY;
</code></pre>
<p>then if warning was shown, you can use the below sc... | <p>I had the same issue today. I found that I was doing (as XXX):</p>
<pre><code>alter package XXX.my_package compile body;
</code></pre>
<p>It would error, and then a <code>show err</code> would not actually show any error.</p>
<p>Removing the 'XXX.' allowed me to see the errors.</p>
| 35,867 |
<p>I've found the standard hashing function on VS2005 is painfully slow when trying to achieve high performance look ups. What are some good examples of fast and efficient hashing algorithms that should void most collisions?</p>
| <p>I worked with <a href="http://research.microsoft.com/~PALARSON/" rel="noreferrer">Paul Larson</a> of Microsoft Research on some hashtable implementations. He investigated a number of string hashing functions on a variety of datasets and found that a simple multiply by 101 and add loop worked surprisingly well.</p>
... | <p>If your strings are on average longer than a single cache line, but their length+prefix are reasonably unique, consider hasing just the length+first 8/16 characters. (The length is contained in the std::string object itself and therefore cheap to read)</p>
| 12,365 |
<p>How can I change the system-default regional settings in windows XP for use by services (run by the system user)?</p>
<p>Regional and Language Options in the control panel modify the settings for the logged-in user. However, services don't use the user's settings - they use the system settings. I know that they can... | <p>There is no documented way to do that. </p>
<p>A quick look in the Regional Settings Applet dll shows that it calls a totally undocumented API: NlsUpdateSystemLocale().</p>
<p>Why do you want to do that? Do you want to control the locale of a service of yours? Then let your service run under a user account you con... | <p>IM not sure if this will help</p>
<p>First type in gpedit.msc from the run command and a dialog box should now open.
Navigate to User Configuration > Administrative Templates > Control Panel > Regional Settings.</p>
<p>This shows the group polcies for the PC/s, maybe you can just set it so en_gb is the only optio... | 26,001 |
<p>We have a large ASP classic code base but I'm looking to do future development in ASP.NET (and potentially in the future port across what we have). The natural choice of language seems to be VB (existing code is VBScript) but am I being too hasty? Does the choice of language, in the long run, even make a difference?... | <p>It's learning .Net (framework) that takes the time.</p>
<p>The specific language doesn't matter and is more a matter of taste. I'd normally recommend trying a few play projects in both languages (and any others that may take your fancy), and then decide which one you're more comfortable with (or have more success w... | <p>Not much of a difference, but there is some difference (mostly syntactical in nature). If your old site is VBScript, it's probably easier to go with VB.NET.</p>
| 12,597 |
<p>I read a properties-file at the webapplication startup phase (contextInitialized()) and I started to think about how to make these settings 'visible' to the servlets. Do I need to loop through the keys and add each and every one to the context, like this</p>
<pre><code>Iterator i = settings.keySet().iterator();
whi... | <p>why not store the entire contents in your servlet context?</p>
<pre><code>context.setAttribute("mySettings", settings);
</code></pre>
<p>setAttribute's signature is:</p>
<pre><code>public void setAttribute(String name, Object object)
</code></pre>
| <p>What about using the JNDI context. JNDI is a more common way to pass properties to a webapp.</p>
<p>Any Properties may be specified in the META-INF/context.xml for tomcat or any application specific setup.</p>
| 34,663 |
<p>We want migrate from Delphi 7.0 to Delphi 2009, to stay up with a modern IDE and current technology. Our target platform is .NET. What is best way, to achieve this goal?</p>
| <p>I'd take onboard the Unicode situation with string handling that came in from D2007 to D2009 - the changes involved in this step might affect your application a lot (only you can tell this). Also, you will need to consider what third party tools/libraries/components you are using. Not everything has made the jump to... | <p>Porting is never easy. However the semantics between Delphi and .NET are very close, since both had Anders Hejlsberg as their lead architect. You'll most likely need to replace the Win32 VCL calls to their equivalent VCL.NET stuff.</p>
<p>You might want to upgrade to the CodeGear RAD Studio, as that will let you ha... | 16,040 |
<p>With so many languages and frameworks that exist, and with new ones appearing all the time, I don't have the time to download, install, and configure each one to evaluate it. In the past I've run across webapps that allow one to write or paste code into a window, and see the results in realtime in the browser, usual... | <p><a href="http://www.w3schools.com/" rel="nofollow noreferrer">W3Schools.com</a> includes mini-sandboxes in many lessons of their tutorials. Each example is used to illustrate that particular lesson, but you can add to or change the code to use it as a sandbox. There are examples for Javascript, DOM scripting, Ajax, ... | <p>eXist-db has a <a href="http://demo.exist-db.org/sandbox/sandbox.xql" rel="nofollow noreferrer">sandbox</a> that is very helpful for playing with XQuery/XPath.</p>
| 25,088 |
<p>I am trying to write a decorator to do logging:</p>
<pre><code>def logger(myFunc):
def new(*args, **keyargs):
print 'Entering %s.%s' % (myFunc.im_class.__name__, myFunc.__name__)
return myFunc(*args, **keyargs)
return new
class C(object):
@logger
def f():
pass
C().f()
</co... | <p>Claudiu's answer is correct, but you can also cheat by getting the class name off of the <code>self</code> argument. This will give misleading log statements in cases of inheritance, but will tell you the class of the object whose method is being called. For example:</p>
<pre><code>from functools import wraps # ... | <p>You can also use <code>new.instancemethod()</code> to create an instance method (either bound or unbound) from a function.</p>
| 39,379 |
<p>I've gotten used to the idea that if I want/need to use alpha-trans PNGs in a cross-browser manner, that I use a background image on a div and then, in IE6-only CSS, mark the background as "none" and include the proper "filter" argument.</p>
<p>Is there another way? A better way? Is there a way to do this with the ... | <p>The bottom line is, if you want alpha transparency in a PNG, and you want it to work in IE6, then you need to have the AlphaImageLoader filter applied.</p>
<p>Now, there are numerous ways to do it: Browser specific hacks, Conditional Comments, Javascript/JQuery/JLibraryOfChoice element iteration, Server-Side CSS-se... | <p>The usual solution for img elements is to change the src to point to a 1x1 pixel transparent GIF and then use the same filter hack.</p>
| 15,804 |
<p>What are the downsides to using static methods in a web site business layer versus instantiating a class and then calling a method on the class? What are the performance hits either way?</p>
| <p>The performance differences will be negligible.</p>
<p>The downside of using a static method is that it becomes less testable. When dependencies are expressed in static method calls, you can't replace those dependencies with mocks/stubs. If all dependencies are expressed as interfaces, where the implementation is p... | <p>If the method uses static data, this will actually be shared amongst all users of your web application.</p>
<p>Code-only, no real problems beyond the usual issues with static methods in all systems.</p>
| 25,429 |
<p>I am using a RichTextBox in WPF, and am trying to set the default paragraph spacing to 0 (so that there is no paragraph spacing). While I could do this in XAML, I would like to achieve it programmatically if possible. Any ideas?</p>
| <p>I did it <strong>with style</strong> (pun indented)</p>
<pre><code><RichTextBox Margin="0,51,0,0" Name="mainTextBox" >
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0"/>
</Style>
... | <p>I know this question was posted before I even started coding but I found that simply setting <code>ShowSelectedMargin</code> to <code>true</code> did the trick</p>
| 42,087 |
<p>I have a multi-threaded program whereas each thread, at the start of execution, acquires a single connection from a MySql connection pool class. The thread then uses a number of database table wrapper classes to do its business logic by passing its database connection to the wrapper classes. The operations on these ... | <p>Sounds like you have to associate the transactions with the table wrappers better than just on a thread by thread basis. IOW, you need to create a transaction class. The transaction class acquires/releases connections from/to the connection pool as the transaction opens and closes.</p>
<p>The transaction then becom... | <p>If I understand the problem correctly I believe that your only option is to implement some kind of transaction queue that allows your multiple threads to share the single connection. Each of your threads can then add "tasks" to the queue which require execution within a transaction. You then have a process which pic... | 46,737 |
<p>I have a UserControl with some predefined controls (groupbox,button,datagridview) on it, these controls are marked as protected and the components variable is also marked as protected.</p>
<p>I then want to inherit from this base UserControl to another UserControl, however the DataGridView is always locked in the d... | <p>By the looks of it, DataListView (and some other controls) do not support visual inheritance. There's a connect issue <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=116457" rel="noreferrer">logged here</a> which doesn't look hopeful.</p>
<p>There have been similar issues l... | <p>Change property to defined [private] to [protected] defined at xx.designer.cs
which is originally machine generated code.</p>
<p>for example</p>
<pre><code> private System.Windows.Forms.Button btnSave;
</code></pre>
<p>to</p>
<pre><code> protected System.Windows.Forms.Button btnSave;
</code></pre>
<p>and ... | 25,425 |
<p>I'm trying to perform a SQL query through a linked SSAS server. The initial query works fine:</p>
<pre><code>SELECT "Ugly OLAP name" as "Value"
FROM OpenQuery( OLAP, 'OLAP Query')
</code></pre>
<p>But if I try to add:</p>
<pre><code>WHERE "Value" > 0
</code></pre>
<p>I get an error</p>
<blockquote>
<p>In... | <p>This should work:</p>
<pre><code>SELECT A.Value
FROM (
SELECT "Ugly OLAP name" as "Value"
FROM OpenQuery( OLAP, 'OLAP Query')
) AS a
WHERE a.Value > 0
</code></pre>
<p>It's not that Value is a reserved word, the problem is that it's a column alias, not the column name. By making it an inline view, "Value" bec... | <p>Oh, bummer. I just saw, you select AS FOO. Don't you need a HAVING claus in this case?</p>
<pre><code>SELECT whatever AS value FROM table HAVING value > 1;
</code></pre>
<p>I still would not use "value". But to be sure, look it up in your docs!</p>
| 6,846 |
<p>Although perhaps a bizare thing to want to do, I need to create an Array in .Net with a lower bound > 0. This at first seems to be possible, using:</p>
<pre><code>Array.CreateInstance(typeof(Object), new int[] {2}, new int[] {9});
</code></pre>
<p>Produces the desired results (an array of objects with a lower boun... | <p>The reason why you can't cast from one to the other is that this is evil.</p>
<p>Lets say you create an array of object[5..9] and you pass it to a function F as an object[].</p>
<p>How would the function knows that this is a 5..9 ? F is expecting a general array but it's getting a constrained one. You could say it... | <p>Know it's old question, but to fully explain it.</p>
<p>If type (in this case a single-dimension array with lower bound > 0) can't be created by typed code, simply reflected type instance can't be consumed by typed code then.</p>
<p>What you have noticed is already in documentation:</p>
<p><a href="https://learn.... | 8,040 |
<p>I <del>understand (I think) the basic idea behind RESTful-ness. Use HTTP methods semantically - GET gets, PUT puts, DELETE deletes, etc... Right?</del> thought I understood the idea behind REST, but I think I'm confusing that with the details of an HTTP implementation. What is the driving idea behind rest, why is ... | <p>This is what REST might look like:</p>
<pre><code>POST /user
fname=John&lname=Doe&age=25
</code></pre>
<p>The server responds:</p>
<pre><code>201 Created
Location: /user/123
</code></pre>
<p>In the future, you can then retrieve the user information:</p>
<pre><code>GET /user/123
</code></pre>
<p>The ser... | <p>REST is an architecture where resources are defined and addressed. </p>
<p>To understand REST best, you should look at the <a href="http://en.wikipedia.org/wiki/Resource_oriented_architecture" rel="noreferrer">Resource Oriented Architecture (ROA)</a> which gives a set of guidelines for when actually implementing th... | 30,156 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.