instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>When supplying dates to a stored procedure via a parameter I'm a little confused over which format to use for the dates. My original VBA syntax used the ADO Connection object to execute the stored procedure:</p>
<pre><code>Set SentDetailRS = Me.ADOConnectionToIntegrity.Execute("dbo.s_SelectAggregatedSentDetailList ... | <p>Be careful, and do not believe that ADO is taking care of the problem. Universal SQL date format is 'YYYYMMDD', while both SQL and ACCESS are influenced by the regional settings of the machine in the way they display dates and convert them in character strings.</p>
<p>Do not forget that Date separator is # in Acces... | <p>I would guess that fCSQLDate function is culture-specific - i.e. it will parse the date based on the user's locale settings. That's why you see the problem.</p>
<p>Anyway, using queries with concatenated strings is always a bad idea (injection attacks). You are better off if you use parameters.</p>
| 10,869 |
<p>I am looking for methods to reduce the amount of noise produced by my CR-10. I have the printer in my downstairs study and if I'm doing a long print job, you can hear it upstairs in my son's bedroom and I don't want it keep him awake.</p>
<p>I've seen there are noise reduction feet available on Thingiverse but appa... | <p>Personally for vibration reduction I use a large mouse pad I cut to size, but I'd imagine the carpet would perform just fine. I would also recommend enclosing your printer (this had the most profound effect for me) and upgrading your stepper drivers.</p>
| <p>If you hear it from a floor to the other the only thing to change is the base of the printer. Nothing else matters.</p>
<p>CNC Kitchen performed measurements especially to avoid noise being transferred to other rooms, the result is that placing the printer not on elastic feet, but on a single slab of concrete which ... | 660 |
<p>Just downloaded the CodeRush trial version and I can't easily find the one feature that I really wanted. I would like to be able to start typing a class name and to jump to its definition, sort of like the quick navigator but I want it to search in closed files within my solution as well as open ones. I know R# ha... | <p>1) <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Q</kbd> (this will bring up the Quick Nav)</p>
<p>2) Start typing the name of the Type, Variable, etc. </p>
<p>3) Hit Enter to select when the target shows in the top of the list</p>
<p>If the scope is not already set to "Solution" (you can tell via the drop-down on th... | <p>A quick remark to the excellent answer by Troy, if the version you downloaded is the newer one, 3.2, the Quick Nav has been remapped to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Q</kbd>.</p>
| 7,878 |
<p>Is there a built in VB.NET function to format a number as an Ordinal or do I have to write my own?</p>
<p><a href="https://stackoverflow.com/questions/20156/ordinals-in-c">There isn't in C# so I'm thinking there isn't :(</a> </p>
| <p>Already answered in <a href="https://stackoverflow.com/questions/20156/ordinals-in-c">Ordinals in C#</a>
Search is your friend . . .</p>
<p>Basically "No, there is no method provided in the framework", but there are good answers about how to do it.</p>
<p><strong>EDIT</strong> </p>
<p>Apologies to whom ever thoug... | <p>If an implementation were available for VB.NET, it would be available for C# as well - you can call into the VB-specific "standard libraries" from C#.</p>
<p>In other words - I don't believe there's anything in the framework.</p>
| 33,216 |
<p>i get the following error when trying to run a flex application (which has been working fine!). I was playing around with some different setttings trying to optimize the compiled size. I've put these settings back to the defaults as much as I thought but still getting issues.</p>
<p>I remember getting this error be... | <p>No, there isn't support for that in JavaScript. And that workaround seems very problematic as you now lose the ability to have forward slashes.</p>
<p>I've run into this issue myself when I needed to build an alert message or something from an ASP.NET back end, and stick it in a JavaScript alert on the front end. T... | <p>I'll re-iterate what's been said before - verbatim strings aren't possible in javascript. It's actually easy to escape valid escape characters like <code>\n \\ \t</code> etc but the problem comes from escaping non-valid characters due to the way they are handled in the different functions they become incompatible. ... | 35,938 |
<p>I'm trying to decide on the best strategy for accessing the database. I understand that this is a generic question and there's no a single good answer, but I will provide some guidelines on what I'm looking for.
The last few years we have been using our own persistence framework, that although limited has served as ... | <blockquote>
<p>Improve our current framework - Problem is that it needs a good deal of effort</p>
</blockquote>
<p>In your question, you have not given a reason why you should rewrite functionality which is available from so many other places. I would suggest that reinventing an ORM is not a good use of your time,... | <p><a href="http://ibatis.apache.org/" rel="nofollow noreferrer">iBATIS</a> is my favourite because you get a better grain of control over the SQL</p>
| 24,513 |
<p>I am using VS 2008 to write my Javascript code ( mostly in JQuery). However the js file was not updated when I was done with the editing and pressed F5 to call out the debugger. I need to close my vs2008 and reopen it in order to see the latest changes in js file.</p>
<p>Any idea on how to fix this?</p>
| <p>Do a CTRL-F5 in the browser to force a hard refresh of all files the page is using.</p>
| <p>js is heavily cached. Use a timestamp and append it to the url:</p>
<p>script.js?_s=12345678</p>
<p>this will force a refresh</p>
| 43,227 |
<p>I have a list of about 600 jobs that I can't delete from the command line because they are attached to changelists. The only way I know how to detach them is via the GUI, but that would take forever. Does anyone know a better (i.e., faster) way?</p>
| <p>I figured it out using the "fix" and "fixes" commands. Here's the procedure:</p>
<p>Dump the output of the "fixes" command to a file</p>
<pre><code>p4 fixes > tmp.txt
</code></pre>
<p>The file will contain a bunch of lines like this:</p>
<pre><code>job005519 fixed by change 3177 on 2007/11/06 by raven@raven1... | <p>Perforce's -x argument is very handy; it "instructs p4 to read arguments, one per line, from the named file [or] standard input". Also, I believe "job -d" allows jobs to be deleted even when they are associated with changes. So, to delete all jobs associated with a changelist, do something like this (untested):</p... | 27,427 |
<p>In PHP, is there an easy way to convert a number to a word? For instance, <em>27</em> to <em>twenty-seven</em>.</p>
| <p>I <a href="http://bloople.net/num2text/cnumlib.txt" rel="noreferrer">found</a> some (2007/2008) source-code online and as it is copyright but I can use it freely and modify it however I want, so I place it here and re-license under CC-Wiki:</p>
<pre><code><?php
/**
* English Number Converter - Collection of PHP... | <p>I have generated this using a recursive function,.</p>
<pre><code>$wordnum = numberToWord($number);
echo $wordnum."<BR>";
function singledigit($number){
switch($number){
case 0:$word = "zero";break;
case 1:$word = "One";break;
case 2:$word = "two";break;
... | 35,031 |
<p>Here's a question for those of you with experience in larger projects and API/framework design.</p>
<p>I am working on a framework that will be used by many other projects in the future, so I want to make it nice and extensible, but at the same time it needs to be simple and easy to understand.</p>
<p>I know that ... | <p>Your class includes data members; methods that perform basic internal operations on those data members where the functionality should never change should always be private. So methods that do basic operations with your data members such as initialization and allocation should be private. Otherwise, you run the ris... | <p>No, you can't have "too many." However, the idea that we should just make every protected instead of private or avoid "sealed" at all costs is just silly. I would keep "helper methods" and internal data structures private. </p>
| 41,288 |
<p>I need to periodically download, extract and save the contents of <a href="http://data.dot.state.mn.us/dds/det_sample.xml.gz" rel="noreferrer">http://data.dot.state.mn.us/dds/det_sample.xml.gz</a> to disk. Anyone have experience downloading gzipped files with C#?</p>
| <p>To compress:</p>
<pre><code>using (FileStream fStream = new FileStream(@"C:\test.docx.gzip",
FileMode.Create, FileAccess.Write)) {
using (GZipStream zipStream = new GZipStream(fStream,
CompressionMode.Compress)) {
byte[] inputfile = File.ReadAllBytes(@"c:\test.docx");
zipStream.Write(input... | <p>You can use the <code>HttpContext</code> object to download a csv.gz file</p>
<p>Convert you <code>DataTable</code> into string using <code>StringBuilder</code> (<code>inputString</code>)</p>
<pre><code>byte[] buffer = Encoding.ASCII.GetBytes(inputString.ToString());
HttpContext.Current.Response.Clear();
HttpContext... | 3,754 |
<p>I am developing a website that will manage data for multiple entities. No data is shared between entities, but they may be owned by the same customer. A customer may want to manage all their entities from a single "dashboard". So should I have one database for everything, or keep the data seperated into individua... | <p>Personally, I prefer separate databases, specifically a database for each entity. I like this approach for the following reasons:</p>
<ol>
<li>Smaller = faster regarding the queries.</li>
<li>Queries are simpler.</li>
<li>No risk of ever accidentally displaying one customer's data to another.</li>
<li>One database ... | <p>One good argument for keeping them in separate databases is that its easier to scale (you can simply have multiple installations of the server, with the client databases distributed across the servers).</p>
<p>Another argument is that once you are logged in, you don't need to add an extra where check (for client ID... | 4,068 |
<p>My current development project has two aspects to it. First, there is a public website where external users can submit and update information for various purposes. This information is then saved to a local SQL Server at the colo facility.</p>
<p>The second aspect is an internal application which employees use to ma... | <p>This is a pretty common integration scenario, I believe. Personally, I think an asynchronous messaging solution using a queue is ideal. </p>
<p>You should be able to achieve near real time synchronization without the overhead or complexity of something like replication. </p>
<p>Synchronous web services are not ide... | <p>I'd say just have a job that copies the data in the pub database input table into a private database pending table. Then once you update the data on the private side have it replicated to the public side. If you don't have any of the replicated data on the public side updated it should be a fairly easy transactional... | 3,442 |
<p>I'm just concerned about Windows, so there's no need to go into esoterica about Mono compatibility or anything like that.</p>
<p>I should also add that the app that I'm writing is WPF, and I'd prefer to avoid taking a dependency on <code>System.Windows.Forms</code> if at all possible.</p>
| <p>Give this a shot...</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
namespace WMITestConsolApplication
{
class Program
{
static void Main(string[] args)
{
AddInsertUSBHandler();
AddRemoveUSBHandler();
... | <p>The simplest way would be to create an Autoplay Handler:</p>
<p><a href="http://www.codeproject.com/KB/system/AutoplayDemo.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/system/AutoplayDemo.aspx</a></p>
<blockquote>
<p>Autoplay Version 2 is a feature in
Windows XP that will scan the first
four... | 34,104 |
<p>I am looking for example code that provides a unit test to serialize and deserialize an object from a memory stream. I have found <a href="https://stackoverflow.com/questions/236599/how-to-unit-test-if-my-object-is-really-serializablable">examples using C# 2.0</a>, however my current project uses VB.NET 1.1 (don't ... | <p>This is the pattern I've settled upon:</p>
<pre><code><Test()> _
Public Sub SerializationTest()
Dim obj As New MySerializableObject()
'Perform additional construction as necessary
Dim obj2 As MySerializableObject
Dim formatter As New BinaryFormatter
Dim memoryStream As New MemoryStream()
... | <p>Hmm...so you are trying to write a unit test for serialization? Or for streams? This is hopefully done by MS already...but if you don't trust or implement something on your own...you could just fill object with some data, save it, restore it, and check if the fields values are in place?</p>
| 38,350 |
<p>I am using some code which was originally taken from the Apple sample ViewTransitions to swap two views with each other.</p>
<pre><code>CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionFade];
[animation setDuration:0.3f];
[animation setTimingFunction:... | <p>For those interested in what I've ended up doing, here's a summary:</p>
<p>I've looked at several possibilities. They fall into runtime patching, and static binary file patching.</p>
<p>As far as file patching is concerned, I essentially tried two approaches:</p>
<ol>
<li><p>modifying the assembly in the code
seg... | <p>Interesting problem. If I understand you correctly, you'd like to add the ability to remotely call functions in a running executable. </p>
<p>If you don't really need the whole application, you might be able to strip out the main function and turn it into a library file that you can link against. It'll be up to ... | 32,860 |
<p>Before you answer this I have never developed anything popular enough to attain high server loads. Treat me as (sigh) an alien that has just landed on the planet, albeit one that knows PHP and a few optimisation techniques.</p>
<hr>
<p>I'm developing a tool in <strong>PHP</strong> that could attain quite a lot of ... | <p>No two sites are alike. You really need to get a tool like <a href="http://jakarta.apache.org/jmeter/" rel="noreferrer">jmeter</a> and benchmark to see where your problem points will be. You can spend a lot of time guessing and improving, but you won't see real results until you measure and compare your changes. </p... | <p>@<a href="https://stackoverflow.com/questions/24675/tactics-for-using-php-in-a-high-load-site#24689">Gary</a></p>
<blockquote>
<p>Don't use MySQLi -- PDO is the 'modern' OO database access layer. The most important feature to use is placeholders in your queries. It's smart enough to use server side prepares and o... | 4,432 |
<p>Treating my repository as a SVN repo, I get:</p>
<pre><code>svn co http://myrepo/foo/trunk foo
...
foo/
bar/
baz/ -> http://myrepo/baz/trunk
</code></pre>
<p>Treating it as a Git repo, I get:</p>
<pre><code>git svn clone http://myrepo/foo --trunk=trunk --branches=branches --tags=tags
...
foo/
bar/
</code... | <p>The solution I ended up using was just to symlink to other <code>git-svn</code> clones on my local box. This worked pretty well: it allows me to commit changes back, and it allows me to make local changes on project A just to get them into project B.</p>
| <p>I decided to write a "simple" perl script to handle all this stuff for me. I've put it recently to github, try it out, maybe it would help: <a href="http://github.com/sushdm/git_svn_externals/" rel="nofollow noreferrer">http://github.com/sushdm/git_svn_externals/</a>.</p>
<p>It essentially does git-svn clone for al... | 45,648 |
<p>I have saved input from a textarea element to a TEXT column in MySQL. I'm using PHP to pull that data out of the database and want to display it in a p element while still showing the whitespace that the user entered (e.g. multiple spaces and newlines). I've tried a pre tag but it doesn't obey the width set in the... | <p>You can cause the text inside the <code>pre</code> to wrap by using the following CSS</p>
<pre><code>pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-wor... | <p>Regarding the problem with the div, you can always make it scroll, or adjust the font down (this is even possible dynamically based on length of longest line in your server-side code).</p>
| 18,831 |
<p>Im looking for a method (or function) to strip out the domain.ext part of any URL thats fed into the function. The domain extension can be anything (.com, .co.uk, .nl, .whatever), and the URL thats fed into it can be anything from <a href="http://www.domain.com" rel="noreferrer">http://www.domain.com</a> to www.doma... | <p><a href="http://www.php.net/manual/en/function.parse-url.php" rel="noreferrer">parse_url</a> turns a URL into an associative array:</p>
<pre><code>php > $foo = "http://www.example.com/foo/bar?hat=bowler&accessory=cane";
php > $blah = parse_url($foo);
php > print_r($blah);
Array
(
[scheme] => htt... | <p>I spent some time thinking about whether it makes sense to use a regular expression for this, but in the end I think not. </p>
<p>firstresponder's regexp came close to convincing me it was the best way, but it didn't work on anything missing a trailing slash (so <a href="http://example.com" rel="nofollow noreferrer... | 21,236 |
<p>I have 2 classes for accessing the database:</p>
<p>MovieDAO - access database using "select" statements only; the purpose is for retrieving data for displaying in the web browser.</p>
<p>and </p>
<p>MovieExtendedDAO (extends MovieDAO) - which is more complete and allows for creating/updating/deleting a movie in ... | <p>it's not a bad method, it's basically a <a href="http://martinfowler.com/eaaCatalog/rowDataGateway.html" rel="nofollow noreferrer">row data gateway</a>. in that sense i would think of your movieDAO as more of a finder, (same terminology fowler uses), and your movieextendeddao as a gateway (ie MovieFinder, and MovieG... | <p>The main problem I see here is that you are mixing <em>permissions</em> ( Control ) with <em>database access</em> ( Model ). I goes against the <em>Model - View - Controler</em> architecture but no I am not saying everybody needs to use it. It is a kind of complex pattern. It may have advantages over your solution. ... | 23,675 |
<p>I have databound a listbox to a simple custom object collection. Next, I added a button to remove the selected item from the object collection. The problem is that when certain items are removed and the listbox is showing the vertical scroll bar, the scrollbar appears to reset to a new position, although what I re... | <p>You need to preserve the TopIndex property of the listbox when removing the item. Preserving SelectedIndex does not stop the scrollbar from jumping. The code below does what I think you want.</p>
<pre><code> private void btnRemove_Click(object sender,EventArgs e)
{
int topIndex = listBox1.TopIndex;
... | <p>I can think of one way to dampen the error (note this might not be the most accurate solution) . I just added a few things to the button click event. I am not sure if they solve your requirements completely since you would be the best judge of that, but nonetheless here you go. </p>
<pre><code> private void btnRemo... | 30,944 |
<p>I've looked for this a few times in the past, to no avail. I would like a simple <code>php/ajax</code> web chat interface, that, and this is the critical part, will interface with my <code>IM client (Pidgin)</code> ... via Jabber or Aim. <code>Plugoo</code> is almost what I want, except it is hosted, and flash based... | <p>This wouldn't be that hard, if you implement the Oscar protocol that AIM uses. It's not very complex, and that would allow you to build a nice web based AIM client for your website. There may be a 3rd party solution that you could use, but as far as I know, Oscar is pretty trivial.</p>
| <p>How much does this product cost? Re <a href="https://stackoverflow.com/questions/114590/simple-web-live-chat-software-lamp-stack-that-integrates-with-jabber-aim/115453#115453">this response</a> from Joe Hildebrand.</p>
| 13,991 |
<p>How can you convert a byte array to a hexadecimal string and vice versa?</p>
| <p>You can use <a href="https://learn.microsoft.com/en-us/dotnet/api/system.convert.tohexstring" rel="noreferrer"><code>Convert.ToHexString</code></a> starting with .NET 5. <br />
There's also a method for the reverse operation: <a href="https://learn.microsoft.com/en-us/dotnet/api/system.convert.fromhexstring" rel="no... | <p>I suspect the speed of this will knock the socks off most of the other tests...</p>
<pre><code>Public Function BufToHex(ByVal buf() As Byte) As String
Dim sB As New System.Text.StringBuilder
For i As Integer = 0 To buf.Length - 1
sB.Append(buf(i).ToString("x2"))
Next i
Return sB.ToString
End... | 40,099 |
<h3>How does the JVM handle a primitive "long", which is 64bits, on a 32bit processor?</h3>
<p><br>
Can it utilise mulitple cores in parallel when on a Multi-Core 32bit machine?<br>
How much slower are 64bit operations on a 32bit machine?</p>
| <p>It may use multiple cores to run different threads, but it does not use them in parallel for 64 bit calculations. A 64 bit long is basically stored as two 32 bit ints. In order to add them, two additions are needed, keeping track of the carry bit. Multiplication is kind of like multiplying two two-digit numbers, ... | <p>From <a href="http://www.talkingtree.com/blog/index.cfm/2007/8/29/CF8-Performance-64-bit" rel="noreferrer">TalkingTree</a>, and the <a href="http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_performance" rel="noreferrer">Java HotSpot FAQ</a>:</p>
<blockquote>
<p>Generally, the benefits of being able to addre... | 29,370 |
<p>I've been building an error logging app recently and was after a way of accurately timestamping the incoming data. When I say accurately I mean each timestamp should be accurate relative to each other (no need to sync to an atomic clock or anything like that).</p>
<p>I've been using datetime.now() as a first stab, ... | <p>time.clock() only measures wallclock time on Windows. On other systems, time.clock() actually measures CPU-time. On those systems time.time() is more suitable for wallclock time, and it has as high a resolution as Python can manage -- which is as high as the OS can manage; usually using gettimeofday(3) (microsecond ... | <p>I wanted to thank J. Cage for this last post. </p>
<p>For my work, "reasonable" timing of events across processes and platforms is essential. There are obviously lots of places where things can go askew (clock drift, context switching, etc.), however this accurate timing solution will, I think, help to ensure that... | 19,041 |
<p>Is there any way to interpret Reverse Polish Notation into "normal" mathematical notation when using either C++ or C#? I work for an engineering firm, so they use RPN occasionally and we need a way to convert it. Any suggestions?</p>
| <p>Yes. Think of how a RPN calculator works. Now, instead of calculating the value, instead you add the operation to the tree. So, for example, <code>2 3 4 + *</code>, when you get to the +, then rather than putting 7 on the stack, you put <code>(+ 3 4)</code> on the stack. And similarly when you get to the * (your sta... | <p>One approach is to take the example from the second chapter of the <a href="https://rads.stackoverflow.com/amzn/click/com/0321486811" rel="nofollow noreferrer" rel="nofollow noreferrer">dragon book</a> which explains how to write a parser to convert from infix to postfix notation, and reverse it. </p>
| 13,850 |
<p>I have a series of messages that are defined by independent structs. These structs share a common header are sent between applications. I am creating a decoder that will take the raw data captures in the messages that were built using these structs and decode/parse them to some plain text.</p>
<p>I have over 1000 d... | <p>Hidden - This is the best approach for actions that are never available to the current user. There is no point in having the user waste mental effort figuring out why something is disabled if there is no action they can take to change this. </p>
<p>Disabled - This is the best approach for actions that are sometime... | <p>I have a particular hatred of applications that disable buttons. If you're an end user - you want to know why you can't use that button. Having it greyed out doesn't tell you anything. How do you get to the state to enable it? Tooltips are one solution, but they aren't the best, a lot of users will struggle with too... | 48,612 |
<p>I have an Ender 3 Pro modded with the Hero Me Gen 6 air ducts, installed a Creality 4.2.7 mainboard, and updated Marlin firmware to the latest for now 2.1.1 version. I'm printing with PLA only.</p>
<p>It was printing well enough. The nozzle started to wear down so I replaced the nozzle (standard brass one) but also ... | <p>I would go back to the brass nozzle and try again for comparison.</p>
<p>We had a batch of 10 cheap steel nozzles all of which caused problems.</p>
| <p>I think the answer is printing temperature. This shiny PLA I'm using is Eryone Silk PLA. Although the working temperature is stated as 190-220 °C, my 205 °C was too much for it. A temperature of 190-195 °C produces good results though not as shiny anymore. It is three layers printed on the sample below with no probl... | 2,221 |
<p>I'm new to 3D printing, but my printer supports Linear Advance. I heard that it offers improvements in print quality. I used <a href="https://marlinfw.org/tools/lin_advance/k-factor.html" rel="nofollow noreferrer">Marlin Linear Advance Pattern Generator</a> to generate a print with horizontal lines at a variety of k... | <p>As a general answer to evaluate the effectiveness of the K-factor, when the K-factor Calibration Pattern generator output print is inconclusive (probably not in this case), printing a tower at various K-factor values might give you more insight, e.g. like:</p>
<p><a href="https://i.stack.imgur.com/G8AWx.png" rel="no... | <p>Go with the sort of tower 0scar suggested and look for corner bulge/rounding. It's a lot more useful than the single-layer test pattern from the Marlin site, which I've found can be misleading.</p>
<p>With that said, just looking at your test print, I would go with the lowest K factor that gives acceptable-looking r... | 2,094 |
<p>How do I enable assembly bind failure logging (Fusion) in .NET?</p>
| <p>Add the following values to</p>
<pre>
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion
Add:
DWORD ForceLog set value to 1
DWORD LogFailures set value to 1
DWORD LogResourceBinds set value to 1
DWORD EnableLog set value to 1
String LogPath set value to folder for logs (e.g. C:\FusionLog\)
</pre>
<p>Make sure you <stron... | <p>In my case helped type disk name in lower case</p>
<p><strong>Wrong</strong> - C:\someFolder</p>
<p><strong>Correct</strong> - c:\someFolder</p>
| 31,903 |
<p>I want to make a transparent dialog. I capture the OnCtlColor message in a CDialog derived class...this is the code:</p>
<pre><code>HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(bSetBkTransparent_)
{
pDC->SetBkMode(... | <p>You have two options.</p>
<p>You can not use Common Controls v6 (the XP-Styled controls), which will make your app lose the fanciness of newer windows versions. However IIRC the groupbox will respect the CTLCOLOR issue. If you are not using that anyway, and it is still not respecting your color, then you only have ... | <p>Simply set the WS_EX_TRANSPARENT extended window style for the group box.</p>
| 32,494 |
<p>I'm using Junit 4.4 and Ant 1.7. If a test case fails with an error (for example because a method threw an unexpected exception) I don't get any details about what the error was.</p>
<p>My build.xml looks like this:</p>
<pre><code><target name="test" depends="compile">
<junit printsummary="withOutAndErr"... | <p>Figured it out :)</p>
<p>I needed to add a "formatter" inside the junit block.</p>
<pre><code><formatter type="plain" usefile="false" />
</code></pre>
<p>What a PITA.</p>
<p>-Dan</p>
| <p>If you're going to have a lot of tests there are two change you might want to consider:</p>
<ol>
<li>run all the tests rather than stopping at the first error</li>
<li>create a report showing all the test results</li>
</ol>
<p>And it is pretty easy to do with the junitreport task:</p>
<pre><code><target name="... | 42,412 |
<p>Is there a way to modify existing .NET assemblies without resorting to 3rd party tools? I know that <a href="http://www.postsharp.org/" rel="noreferrer">PostSharp</a> makes this possible but I find it incredibly wasteful that the developler of PostSharp basically had to rewrite the functionality of the whole <code>S... | <p>You can use <strong>MethodInfo.GetMethodBody().GetILAsByteArray()</strong>, modify that, and then plug it back into <strong>MethodBuilder.CreateMethodBody()</strong>.</p>
| <p>You could load the assembly using IronRuby, and mixin all the functionality you can dream of</p>
| 15,029 |
<p>How to post a username, password and multiple binary files from a single html form and process it using php? I'm not allowed to use ajax.</p>
| <p>first off check out these pages on PHP.net</p>
<ol>
<li><a href="http://us3.php.net/features.file-upload" rel="noreferrer">file upload info</a></li>
<li><a href="http://us3.php.net/manual/en/function.move-uploaded-file.php" rel="noreferrer"><code>move_uploaded_file</code></a></li>
</ol>
<p>But to get you started h... | <p>You should use the <code>$_FILES</code> superglobal and <code>move_uploaded_file()</code> function to see which files were uploaded successfully and move them to their final location in case they were.</p>
<p>The <code>$_POST</code> superglobal will contain the submitted username and password.</p>
| 16,659 |
<p>I received a dump file of a SVN repository that I'm moving to my server. Let's call it myserver.com/svn. The load statement prints out a long list of files loaded and reports no error. However, once I try to access the repository for checkout, or relocate my existing checkout, I'm told:</p>
<pre><code>Repository... | <p>subversion generates a UUID (Universally Unique ID) whenever it creates a repository. I believe that in order to use the UUID from your original repo you need to ad "--force-uuid" to your svnadmin load command.</p>
<p><a href="http://svnbook.red-bean.com/en/1.5/svn.ref.svnadmin.c.load.html" rel="nofollow noreferre... | <p>I think someone has added a hook script to inform you that your repository is now at another URL.</p>
<p>If this was not expected, it might indicate a security issue.</p>
| 47,944 |
<p>How do you detect if <code>Socket#close()</code> has been called on a socket on the remote side?</p>
| <p>The <code>isConnected</code> method won't help, it will return <code>true</code> even if the remote side has closed the socket. Try this: </p>
<pre><code>public class MyServer {
public static final int PORT = 12345;
public static void main(String[] args) throws IOException, InterruptedException {
Se... | <p>The method Socket.Available will immediately throw a SocketException if the remote system has disconnected/closed the connection.</p>
| 18,267 |
<p>I have simple application that uses dbExpress to connect Informix database.
If I compile it with TurboDelphi it works on both WinXP and Win2003.</p>
<p>When I use new Deplhi 2009 my app works ok on WinXP but do not start on Win2003.
No MessageBox with error, only info in EventLog:</p>
<blockquote>
<p>Faulting ap... | <p>Which turbo version do you have (the .net version or the Win32 version)? Do you have .net framework installed on 2003?</p>
| <p>Hm maybe a strange suggestion, but one of the big differences introduces in Delphi 2009 is Unicode. All strings are now Unicode strings. Could that possibly be an explanation for the problem? </p>
| 16,738 |
<p>for testing purposes i need an recursive directory with some files, that comes to maximum path-length.</p>
<p>The Script used for the creation consists only of two for-loops, as followed:</p>
<pre><code>for /L %%a in (1 1 255) do @(
mkdir %%a
&& cd %%a
&& for /L %%b in (1 1 %random%) do... | <p>I don't think you need the '@'s in front of the parens or the '&&' within the for loop body; the parens take care of handling multiple statements in the for loop.</p>
<p>The following works for me:</p>
<pre><code>@echo OFF
for /L %%a in (1 1 255) do (
@echo a = %%a
mkdir %%a
cd %%a
for /L ... | <p>I don't think you need the '@'s in front of the parens or the '&&' within the for loop body; the parens take care of handling multiple statements in the for loop.</p>
<p>The following works for me:</p>
<pre><code>@echo OFF
for /L %%a in (1 1 255) do (
@echo a = %%a
mkdir %%a
cd %%a
for /L ... | 46,836 |
<p>I've written <a href="http://www.automatous-monk.com/bluepoles/BluePoles.htm" rel="nofollow noreferrer">a Java applet</a>. A user reports that he tried to run it in Firefox 3.0.3 on OS X 10.5.5 but no go. It wants him to download a plug-in, but when he tells it to install missing plug-ins it can't find the appropri... | <p>You have to get java from Apple, not Sun. Here's a link for it on the <a href="http://www.apple.com/downloads/macosx/apple/application_updates/javaformacosx105update2.html" rel="nofollow noreferrer">download page</a>.</p>
| <p>I had to make a change in my HTML. I had to change:</p>
<pre><code><param name = "type" value = "application/x-java-applet;version=1.6">
</code></pre>
<p>to </p>
<pre><code><param name = "type" value = "application/x-java-applet;version=1.5">
</code></pre>
<p>and </p>
<pre><code>type = "application... | 35,143 |
<p>I'm not happy with the rendering of HTML by Swing's JEditorPane. In particular bullets for unordered lists are hideous. Customising the rendering seems extremely difficult. Therefore I'm looking for a replacement with better HTML rendering.</p>
<p>Does this exist? (I asked Google, and found nothing except a promisi... | <p><a href="http://today.java.net/pub/a/today/2004/05/24/html-pt1.html" rel="nofollow noreferrer">http://today.java.net/pub/a/today/2004/05/24/html-pt1.html</a></p>
| <p>Cobra did the trick. Almost a drop-in replacement for JEditorPane, with very nice HTML rendering. One complaint: it's a big jar to add to my little application.</p>
<p>Thanks for the responses.</p>
| 18,927 |
<p>Is it correct to link a static library (.lib) compiled with VS 2005 with a program which is compiled with VS 2008? Both library and my program are written in C++. This program is run on Windows Mobile 6 Professional emulator.</p>
<p>This seems to work, there are no linking errors. However the program crashes during... | <p>VS2005 and VS2008 use different STL implementations. When the VS2005 code returns a vector, the object has memory layout different from what VS2008 expects. That should be the reason for the broken values you see in the returned date.</p>
<p>As a rule of thumb, you should always compile all C++ modules of a project... | <p><strong>Addition:</strong> As <a href="https://stackoverflow.com/a/49423/4792058">Timbo has pointed out</a>, VS 2005 and VS 2008 use different STL implementations. However, you can use VS 2008 to build against the old STL if VS 2005 is installed, too:</p>
<ol>
<li><p>Open your library project in VS 2008.</p></li>
<... | 7,184 |
<p>I've had a couple of complaints that one of our managed apps is using 20-25Mb of RAM. I normally push back and say that memory's cheap; get over it.</p>
<p>Is this reasonable for a Windows Forms app?</p>
| <p>20-25MB is nothing.</p>
<p>The .Net framework doesn't always recycle RAM right away anyway. Over time I've seen apps grow to peak at a few hundred MB of RAM during an "expensive" process, and then just sit there even after the "expensive" process finished. However, this is misleading. The app wasn't using this R... | <p>If you have repeatedly caused raised eyebrows with your application's memory footprint, you should at least have a little look at whether you really need this amount or if it is just accumulated inefficiency. Reducing the memory footprint often also brings a speed increase, and that in turn increases customer happi... | 43,324 |
<p>I would like to be able to predict what will be in the resulting binary when I call Write in Ada to serialize a record. Do you know where I can look this up?</p>
<p>I have some legacy Ada software that produces a binary file by Write-ing a record, and I need to debug a C++ program that is supposed to write a compat... | <p>As mentioned by others, without additional instruction the compiler will make its own decisions about record layout. The best approach would be to change the original code to write the record using a specific layout. In particular, the <a href="http://adahome.com/rm95/rm9x-13-05-01.html" rel="nofollow noreferrer">re... | <p>The <a href="http://archive.adaic.com/standards/ada95.html" rel="nofollow noreferrer">Ada95 Language Reference Manual</a> says (section 13.13.2):</p>
<p>"For elementary types, the representation in terms of stream elements is implementation defined. For composite types, the Write or Read attribute for each componen... | 11,018 |
<p>I am printing using an Ender3 Pro with eSUN PLA+ 215/45 and I am getting this issue on two corners, the other two corners look fine.</p>
<p>Any idea on what can be causing this?</p>
<p>The bad corners</p>
<p><a href="https://i.stack.imgur.com/kr4VD.jpg" rel="noreferrer" title="Bad corners"><img src="https://i.sta... | <p>This has nothing to do with speed, temperature, adhesion, and whatever you do, <strong>DO NOT</strong> extrude more material per line (increase flow rate), as this will make the problem that much worse. </p>
<p>This is a fairly simple problem with an even simpler fix: you're over extruding. Reduce your flow rate ... | <p>Looks like it treated those corners a bit differently in the slice routine. Normally something like this different treatment would be too slight to matter, but (probably due to the slight overhang?) it appears to have caused some layers to not adhere to the bottom ones and get pulled along to a different shape (red... | 1,489 |
<p>In your experience, how often should Oracle database statistics be run? Our team of developers recently discovered that statistics hadn't been run our production box in over 2 1/2 months. That sounds like a long time to me, but I'm not a DBA.</p>
| <p>At my last job we ran statistics once a week. If I remember correctly, we scheduled them on a Thursday night, and on Friday the DBAs were very careful to monitor the longest running queries for anything unexpected. (Friday was picked because it was often just after a code release, and tended to be a fairly low tra... | <p>In the case of a data warehouse-type system you can consider collecting no statistics at all, and relying on dynamic sampling (setting optimizer_dynamic_sampling to level 2 or above).</p>
| 10,458 |
<p>Maybe this is a silly question, but I've always assumed each number delineated by a period represented a single component of the software. If that's true, do they ever represent something different? I'd like to start assigning versions to the different builds of my software, but I'm not really sure how it should be... | <p>In version <em>1.9.0.1</em>:</p>
<ul>
<li><p><strong>1</strong>: Major revision (new UI, lots of new features, conceptual change, etc.)</p></li>
<li><p><strong>9</strong>: Minor revision (maybe a change to a search box, 1 feature added, collection of bug fixes)</p></li>
<li><p><strong>0</strong>: Bug fix release</p... | <p>A combination of major, minor, patch, build, security patch, etc.</p>
<p>The first two are major & minor-- the rest will depend on the project, company and sometimes community. In OS's like FreeBSD, you will have 1.9.0.1_number to represent a security patch.</p>
| 9,142 |
<p>Note: I am using .Net 1.1, although I am not completely against answer that use higher versions.</p>
<p>I am displaying some dynamically generated objects in a PropertyGrid. These objects have numeric, text, and enumeration properties. Currently I am having issues setting the default value for the enumerations so t... | <p>I'm not sure how to get the attribute to work, but there is another option that may be easier.</p>
<p>In addition to checking for the DefaultValueAttribute, the PropertyGrid also uses reflection to look for a method named "ShouldSerializeProperty Name", where [Property Name] is the name of the property in question.... | <p>I'm not sure how to get the attribute to work, but there is another option that may be easier.</p>
<p>In addition to checking for the DefaultValueAttribute, the PropertyGrid also uses reflection to look for a method named "ShouldSerializeProperty Name", where [Property Name] is the name of the property in question.... | 10,135 |
<p>What is the best way, using Bash, to rename files in the form:</p>
<pre><code>(foo1, foo2, ..., foo1300, ..., fooN)
</code></pre>
<p>With zero-padded file names:</p>
<pre><code>(foo00001, foo00002, ..., foo01300, ..., fooN)
</code></pre>
| <p>In case <code>N</code> is not a priori fixed:</p>
<pre><code>for f in foo[0-9]*; do
mv "$f" "$(printf 'foo%05d' "${f#foo}")"
done
</code></pre>
| <p>Here's a quick solution that assumes a fixed length prefix (your "foo") and fixed length padding. If you need more flexibility, maybe this will at least be a helpful starting point.</p>
<pre><code>#!/bin/bash
# some test data
files="foo1
foo2
foo100
foo200
foo9999"
for f in $files; do
prefix=`echo "$f" | cut... | 7,960 |
<p>I would like to print fancy plastic cutlery sets or plastic glasses.</p>
<p>Is it safe to do it? Or bad for your health, if so, why?</p>
| <p>As others have pointed out, PLA isn't specifically not food safe, but materials that have been printed previously can contaminate the PLA.</p>
<p>Additionally, anything 3D printed is extremely porous. Once a part is used for food, moisture and bacteria will accumulate in the pores, and can never be completely clean... | <p>Having performed a quick search through all the resources at the FDA Food Contact Substance resource, I cannot find PLA in any list except an occasional notification that a specific manufacturer has obtained approval for use in specific circumstances, with the notice that such notifications are only valid for that m... | 120 |
<p>How can I start a project in CodePlex.com?</p>
| <p>Try going to CodePlex and <a href="http://www.codeplex.com/CodePlex/Wiki/View.aspx?title=CodePlex%20FAQ&referringTitle=Home" rel="noreferrer">reading how to do this</a> there. <a href="https://www.codeplex.com/site/register" rel="noreferrer">Register</a></p>
| <p>There is a <a href="http://www.codeplex.com/Project/ProjectCreation.aspx" rel="nofollow noreferrer">Create New Project</a> link on the left side of the page.</p>
<p>You will likely have to <a href="https://www.codeplex.com/site/register" rel="nofollow noreferrer">register</a> first.</p>
<p>Did you have a more spec... | 14,464 |
<p>We use oracle as the back-end database for our product. I have been running series of stress tests on our system and I have started noticing that oracle is much faster right after the database was restarted. Over time (a couple hours or so) the database seems to get slower and slower and I will see the database mach... | <p>What version of oracle are you running? Do you have statspack or AWR setup? if you do, check those to show you what the database is doing over time.</p>
| <p>Are you sure the stress test is releasing the sessions that it uses? The accumulation of sessions, then subsequent time out of those sessions could produce this kind of behavior.</p>
<p>Moved this query from the comments to the body of my answer per request...</p>
<pre><code>select
username,
osuser,
lockwai... | 15,845 |
<p>I'm creating my own dictionary and I am having trouble implementing the <a href="http://msdn.microsoft.com/en-us/library/ms132143(VS.85).aspx" rel="noreferrer">TryGetValue</a> function. When the key isn't found, I don't have anything to assign to the out parameter, so I leave it as is. This results in the followin... | <p>You are looking for the <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/statements-expressions-operators/default-value-expressions" rel="nofollow noreferrer"><code>default</code></a> keyword.</p>
<p>For example, in the example you gave, you want something like:</p>
<pre><code>class MyEmp... | <pre><code>return default(int);
return default(bool);
return default(MyObject);
</code></pre>
<p>so in your case you would write:</p>
<pre><code>class MyEmptyDictionary<K, V> : IDictionary<K, V>
{
bool IDictionary<K, V>.TryGetValue (K key, out V value)
{
... get your value ...
... | 47,950 |
<p>anyone have any experience of using them together? How well does it work? or is it just too much grief?</p>
| <p>You don't want to do that. Both ReSharper and CodeRush want the keyboard. Specifically, CodeRush remaps the escape key (ESC) for its own purposes. ReSharper does not like that (note: ReSharper doens't do anything special with the escape key, but it still doesn't like it).</p>
<p>As for choosing between them...th... | <p>There is a <a href="https://stackoverflow.com/questions/4080511/how-to-install-coderush-and-resharper-coderush-shortcut-missing">related question</a>. In one of the answers to that question an article was suggested that seems to be useful:</p>
<blockquote>
<p>Jim Holmes has an awesome blog post that goes through ... | 48,728 |
<p>I'm writing a program (for Mac OS X, using Objective-C) and I need to create a bunch of .webloc files programmatically.</p>
<p>The .webloc file is simply file which is created after you drag-n-drop an URL from Safari's location bar to some folder.</p>
<p>Generally speaking, I need an approach to create items in a ... | <p>It is little known - but there is also a simple plist based file format for weblocs.</p>
<p>When creating webloc files you <em>DO NOT NEED</em> to save them using the resource method the other three posters describe. You can also write a simple plist:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<... | <p>This does the basic task, without needing any third party libraries. (Be warned: minimal error checking.)</p>
<pre><code>// data for 'drag' resource (it's always the same)
#define DRAG_DATA_LENGTH 64
static const unsigned char _dragData[DRAG_DATA_LENGTH]={
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0... | 17,648 |
<p>I compile my project with VIsual Studio 2005 Express Edition, and get this linking error. Can anyone suggest how to solve that?</p>
| <p>I downloaded VS2005 Service Pack 1 from Microsoft, installed it and it fixed the problem.</p>
| <p>That exact question is asked and answered at <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1512436&SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1512436&SiteID=1</a>.</p>
<p>Try re-installing. It appears to be an install of the wrong service pack... | 16,036 |
<p>I have a BlackBerry app running in the background that needs to know when a "Missed call" system dialog is brought up by the system, and programmatically close it without user intervention. How can I do that?</p>
<p>I could actually almost know when the dialog is brought up, i.e. a little later I programmatically e... | <p>Key press injection for device <em>Close</em> button looks like this: </p>
<pre><code>KeyEvent inject = new KeyEvent(KeyEvent.KEY_DOWN, Characters.ESCAPE, 0);
inject.post();
</code></pre>
<p>Don't forget to set permissions for device release:
Options => Advanced Options => Applications => [Your Application] =>Edi... | <p>(Haven't tried this myself) Your app could periodically poll the system for the foreground app. Once it's the Phone app, you could check what's this app's topmost screen. If it's the Missed Call screen, as magically identified by the screen's class, some special field, text of a field, and the likes, pop this screen... | 41,168 |
<p>Given an array of items, each of which has a <code>value</code> and <code>cost</code>, <strong>what's the best algorithm determine the items required to reach a minimum value at the minimum cost?</strong> eg:</p>
<pre><code>Item: Value -> Cost
-------------------
A 20 -> 11
B 7 -> 5
C 1 ... | <p>This is the knapsack problem. (That is, the decision version of this problem is the same as the decision version of the knapsack problem, although the optimization version of the knapsack problem is usually stated differently.) It is NP-hard (which means no algorithm is known that is polynomial in the "size" -- numb... | <p><strong>Edit This answer is redacted on account of being factually incorrect. Following the advice in this will only cause you harm.</strong></p>
<p>This is not actually the knapsack problem, because it assumes that you cannot pack more items than there is space for in some container. In you case you want to find t... | 41,763 |
<p>Is there any security issue if let say in one application we do a hidden post to another application to make use of that application functionality?</p>
| <p>More generally, all JSF components have an ID.
If you don't provide one, JSF will create an automatic ID, using the format j<code>_</code>idXXX (<em>XXX</em> is a incremented number).</p>
<p>Some components implement the javax.faces.component.NamingContainer interface, in particular <code><h:form></code>.
Thi... | <p>For most pages which contain a view, form and some components, the clientID will be the colon seperated string contained the form-id and component-id. Example:</p>
<p>
</p>
<p>The input text client ID would be "myForm:myInputText". If you have nested within a subview, then that will be the first thing... | 33,231 |
<p>I'm going to make a space/trading/combat game that is completely procedurally generated. But, I know that storing all of the details of the whole galaxy in memory is unfeasable. As a result, I've been think that I can use a seed to generate a solar system, and from that solar system, you can use jumpgates to travel ... | <p>If you're feeling brave, you could do worse than look at how <a href="http://www.iancgbell.clara.net/elite/text/index.htm" rel="noreferrer">Ian Bell did it</a> for the original version of Elite</p>
| <p>I can vaguely recall this being done before. During the early 90's fractals were all the rage and I remember one company offering worlds to game programmers. The had created a whole infinite universe full of galaxies with suns and planets, event down to the valleys and textures of places on the planets. They were of... | 45,325 |
<p>I used to have one class for one file. For example <em>car.cs</em> has the class <em>car</em>. But as I program more classes, I would like to add them to the same file. For example <em>car.cs</em> has the class <em>car</em> and the <em>door</em> class, etc.</p>
<p>My question is good for Java, C#, PHP or any other ... | <p>I think you should try to keep your code to 1 class per file.</p>
<p>I suggest this because it will be easier to find your class later. Also, it will work better with your source control system (if a file changes, then you know that a particular class has changed). </p>
<p>The only time I think it's correct to use... | <p>One class per file is simpler to maintain and much more clear for anyone else looking at your code. It is also mandatory, or very restricted in some languages.</p>
<p>In Java for instance, you cannot create multiple top level classes per file, they have to be in separate files where the classname and filename are ... | 47,067 |
<p>I'm migrating to Nhibernate 2.0 GA but have some trouble with setting cache expirations in memcached provider.</p>
<p>I see in the NHibernate.Caches.MemCache sources that there is a property for expiration and a default value for 300 seconds. </p>
<p>There are also properties for cache regions but the config secti... | <p>Use default_expiration.</p>
<pre><code><property name="default_expiration" >YOUR_INTERVAL_IN_SECONDS</property>
</code></pre>
<p>I have seen in the source that the default expiration value is set to 300 second. But you can override this value by setting default_expiration property form the NHibernate c... | <p>Use expiration.</p>
<pre><code><property name="expiration" >YOUR_INTERVAL_IN_SECONDS</property>
</code></pre>
<p>After that, when you run app with logging you can see:</p>
<pre><code>NHibernate.Caches.MemCache.MemCacheClient: 20:57:55,762 DEBUG MemCacheClient:0 - using expiration of YOUR_INTERVAL_IN_S... | 46,172 |
<p>I'm building a small Winform in which I can view types of food in my kitchen.</p>
<p>My entire stock can be displayed by a datagrid view.</p>
<p>Now, I have a filtermenu which contains a dropdownlist of items that can be checked and unchecked.</p>
<p>Based on which items in that list are checked, the display in t... | <p>This will work in all sane databases (<em>wink, wink</em>) and will return the rows for which name is not null nor empty</p>
<pre><code>select name,age from members where name is not null and name <> ''
</code></pre>
| <p>nvl(Name, 'some dumb string') this will return Name if Name is not null and different of '' (oracle, don't know for others). It will be equal to 'some dumb string' if null or equal to ''.</p>
| 42,131 |
<p>On the safari browser, the standard <asp:Menu> doesn't render well at all. How can this be fixed?</p>
| <p>Thanks for the advice, it led me into the following solution;</p>
<p>I created a file named "safari.browser" and placed it in the App_Browsers directory. The content of this file is shown below;</p>
<pre><code><browsers>
<browser refID="safari1plus">
<controlAdapters>
<... | <p>Oooof - was hoping it would be a simmple case of adding a browserCaps item in web.config with appropriate values or similar...</p>
| 15,393 |
<p>In my web application I include all of my JavaScripts as js files that are embedded resources in the assembly, and add them to the page using <code>ClientScriptManager.GetWebResourceUrl()</code>. However, in some of my js files, I have references to other static assets like image urls. I would like to make those ass... | <p>I'd suggest that you emit the web resources as a dynamic javascript associative array.</p>
<p>Server side code:</p>
<pre><code>StringBuilder script = new StringBuilder();
script.Append("var imgResources = {};");
script.AppendFormat("imgResources['{0}'] = '{1}';",
"drophint",
Page.ClientScript.GetWebResou... | <p>I don't particularly care for the exact implementation <a href="https://stackoverflow.com/questions/46489/referencing-embedded-resources-from-other-resources-in-c#47242"><strong>@Jon</strong></a> suggests, but the idea behind it is sound and I would concur that emitting these would be a good thing to do. </p>
<p>A ... | 6,862 |
<p>Is it possible to get a report of the records that are updated using a update query, without using a recordset?</p>
<p>Ex:</p>
<p><code>sqltext = update table employees set bonus = 0 where salary > 50000<br>
DoCmd.RunSQL sqltext</code></p>
<p>After this query runs, is it possible to get the name of the employe... | <p>It's never a good idea to use <code>DoCmd.RunSQL</code> as it generates a prompt (which you have to turn off if you don't want it), and it completes the updates even if errors occur, and doesn't report the errors. Much better is to replace it with a function that executes the same SQL:</p>
<pre><code>Public Functio... | <p>I don't see any way at this time to get the information after the update query has run unless you have another distinguishing field (maybe an updated date field). Why not run a select query for it and run a report off of that data, THEN run the update query to change the values for 'bonus'.</p>
<p>Let me know if t... | 43,282 |
<p>I am trying to teach ASP.NET MVC to students (undergrads) that have been studying ASP.NET for the last 8 weeks (I know that doesn't sound like much time, but the class is 4 hours per day, 5 days per week with Labs, Quizzes, Exams, and Wrestles).</p>
<p>I haven't gotten the question yet...but I know it is coming...<... | <p>Statelessness is a good one word to explain as already highlighted by the members.
Apart from this ask the following questions to the students?</p>
<p>If they have to do the following with ASP.NET (no MVC), how easy will it be?</p>
<ol>
<li>Test your views</li>
<li>Mock Http objects.</li>
<li>Viewstate reduction (... | <p>For someone with experience (and pains) in Winforms - the biggest difference is no more Viewstate. The state of controls on the form is kept on the client, in the browser and sent to the server for each request. </p>
<p>If you use Javascript, it is easier to make changes on the browser side, while the server side g... | 46,275 |
<p>I'm in the process of refactoring a project. I've got an entire subfolder which is known to be broken. Is there any declarative way to exclude that folder from the compile temporarily while I test the refactoring thus far?</p>
<p>I realize I could delete the folder, but I'd like to do this through configuration i... | <p>You could set the Build Action (in the Properties Window) to <strong>None</strong> for the files you want excluded. You could also right-click on the folder and choose <strong>Exclude from Project</strong>.</p>
| <p>In Visual Studio 2010 you need to right click the project in the Solution Explorer and choose <strong>Unload Project</strong></p>
| 26,998 |
<p>I have a database table and one of the fields (not the primary key) is having a unique index on it. Now I want to swap values under this column for two rows. How could this be done? Two hacks I know are:</p>
<ol>
<li>Delete both rows and re-insert them.</li>
<li>Update rows with some other value
and swap and then u... | <p>I think you should go for solution 2. There is no 'swap' function in any SQL variant I know of.</p>
<p>If you need to do this regularly, I suggest solution 1, depending on how other parts of the software are using this data. You can have locking issues if you're not careful.</p>
<p>But in short: there is no other ... | <p>Oracle has deferred integrity checking which solves exactly this, but it is not available in either SQL Server or MySQL.</p>
| 2,306 |
<p>What is the best datatype to use for storing moderate amounts of text in SQL Server (2005)?</p>
<p>For example, imagine a table, storing information on downloads available on a website.
I want a title for the download which is brief, say varchar(20). A path, say varchar(255) then I want to store some user friendly ... | <p>The PAD (Portable Application Description) specification highest character limit for program description is 2000 chars *see Program Descriptions section.</p>
<p><a href="http://www.asp-shareware.org/pad/spec/spec.php" rel="nofollow noreferrer">http://www.asp-shareware.org/pad/spec/spec.php</a></p>
<p>Download site... | <p>Size should be dependant on the size of the data being stored. Don't use varchar (max) for a state field with only 2 characters. I usually look at the largest value I expect to get and then add a fudge factor of 10-20% when determining the size. Don't forget to use nvarchar if you need to store unicode characters.</... | 24,929 |
<p>Given the schema</p>
<pre>
PERSON { name, spouse }
</pre>
<p>where PERSON.spouse is a foreign key to PERSON.name, NULLs will be necessary when a person is unmarried or we don't have any info.</p>
<p>Going with the argument against nulls, how do you avoid them in this case?</p>
<p>I have an alternate schema</p>
... | <p>I think that enforcing no NULLs and no duplicates for this type of relationship makes the schema definition way more complicated than it really needs to be. Even if you allow nulls, it would still be possible for a person to have more than one spouse, or to have conflicting records e.g:</p>
<pre><code>PERSON { A, ... | <p>Well, begin with using a key other than name, perhaps a int seed. But to prevent someone from having more than one spouse, simply add a unique index to the parent(name1) in the spouse table. that will prevent you from ever inserting the same name1 twice.</p>
| 48,139 |
<p>I write a Text Editor with Java , and I want to add Undo function to it </p>
<p>but without UndoManager Class , I need to use a Data Structure like Stack or LinkedList but the Stack class in Java use Object parameters e.g : push(Object o) , Not Push(String s)
I need some hints or links .
Thanks</p>
| <p>Assuming you are using Java 5, Stack is a generic class. You can instantiate it according to the objects it should hold.</p>
<p>You can then use:</p>
<pre><code>Stack<String> stack = new Stack<String>();
String string = "someString";
stack.push(string);
</code></pre>
<p>Also note that in the case you ... | <p>Ok i solve it</p>
<p>I must push the text in the textArea not the character from the keyboard </p>
<p>thanks guys</p>
| 42,171 |
<p>I am just looking at the <a href="https://github.com/BlogEngine/BlogEngine.NET" rel="nofollow noreferrer">source code</a> of <a href="https://learn.microsoft.com/en-us/iis/publish/deploying-application-packages/blogenginenet" rel="nofollow noreferrer">BlogEngine.Net</a> and was intrigued at how it stores applicati... | <p>If you have an admin area where you can alter the configuration settings, writing to web.config will cause the app to be restarted and all users to lose their session data. Using a separate config file will prevent this from happening.</p>
| <p>There are pros and cons to having properties that act as config settings accessors. </p>
<p>On one hand, having such a class with properties provides the development team with better organized and more reusable code.</p>
<p>On the other hand, every time you add a new config setting, are you going to have to updat... | 46,954 |
<p>I want to create an array with a message.</p>
<pre><code>$myArray = array('my message');
</code></pre>
<p>But using this code, <code>myArray</code> will get overwritten if it already existed. </p>
<p>If I use <code>array_push</code>, it has to already exist.</p>
<pre><code>$myArray = array(); // <-- has to be... | <p>Here:</p>
<pre><code>$myArray[] = 'my message';
</code></pre>
<p>$myArray have to be an array or not set. If it holds a value which is a string, integer or object that doesn't implement arrayaccess, it will fail.</p>
| <pre><code>if ($myArray) {
array_push($myArray, 'my message');
}
else {
$myArray = array('my message');
}
</code></pre>
| 45,698 |
<p>I have two machines in two different domains. On both I have VS 2005 installed. I want remote debug between them. Without authentication it is possible but I want to debug managed code. I don't want to debug directly since it is really crappy machine.</p>
<p>When I try to attach with debugger I get message "The tru... | <p>Gregg Miskely has a <a href="http://blogs.msdn.com/greggm/archive/2004/10/04/237519.aspx" rel="noreferrer">blog post</a> on this. You might get it to work if both local accounts have the same user name and password. You might also try dropping your good box from it's domain so that you are going from a workgroup t... | <p>I seem to remember that I have sometimes found it useful to use RunAs when you run msvcmon (or whatever it's called this week - the remote debugging stub anyway), to force it to start as the user which you have set up to be the same on both machines. </p>
<p>I would guess that on the machine you're running VS on, y... | 4,936 |
<p>I have an array filled with values (twitter ids) and I would like to find the missing data between the lowest id and the highest id? Any care to share a simple function or idea on how to do this?</p>
<p>Also, I was wondering if I can do the same with mySQL? I have the key indexed. The table contains 250k rows right... | <p>in a many-to-many relationship the relationships will be in a 3rd table, something like </p>
<pre><code>table EmployeeInstructor
EmployeeID
InstructorID
</code></pre>
<p>to find all the employees for a specific instructor, you'd use a join against all three tables.</p>
| <p>First of all, you will need a unique key in both tables. The employee number may work for the employee table, but you will need another for the instructor table. Personally, I tend to use auto incrementing identity fields called ID in my tables. This is the primary key.
Second, create a new table, InstructorEmplo... | 47,607 |
<p>The Exception class in Delphi 2009 received a number of new features. A number of them are related to getting a stacktrace:</p>
<ul>
<li><strong>property</strong> StackTrace: <strong>string</strong> <strong>read</strong> GetStackTrace;</li>
<li><strong>property</strong> StackInfo: Pointer <strong>read</strong> FSt... | <p>To me this looks like a framework where you can plug in your own stack tracing. I guess this might be used internally in the IDE with JCLDebug. Perhaps it's intended for users to be able to supply madExcept or another implementation.</p>
| <p>No, I haven't used them yet (currently using madExcept for that, and also did some experiments with JclDebug) - but thanks for the tip!</p>
| 36,437 |
<p>Needs to be secure and able to handle thousands of users.</p>
| <p>Check out ADAM and AzMan.</p>
<p>ADAM is Active Directory Application Mode. There is a how-to guide at: <a href="http://msdn.microsoft.com/en-us/library/ms998331.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms998331.aspx</a></p>
<p>AzMan is Authorization Manager. There is a how-to guid... | <p>Three alternatives to ADFS are </p>
<ul>
<li><a href="http://www.symplified.com/" rel="nofollow">Symplified</a> - Various product options</li>
<li><a href="https://www.pingidentity.com/" rel="nofollow">Ping</a> - SaaS product</li>
<li>Forgerock - This is an open platform </li>
</ul>
<p>All integrate with AD in som... | 13,648 |
<p>What is the best way to give the user feedback for a color selection?<br>
I have a dialog with a "Select Color" push button which pops a <code>QColorDialog</code>. After the selection is made I want to show the user the color selected.<br>
Usually I do this using a <code>QLabel</code> and changing it's background co... | <p>The way I'm doing it is the following :</p>
<p>I actually change the color of the button, to reflect the user choice. To do this, I'm using the Qt style sheet, which ensure it is portable :</p>
<pre><code>const QString COLOR_STYLE("QPushButton { background-color : %1; color : %2; }");
QColor ChosenColor; // Color... | <p>The method you are using is cumbersome, but what makes you think it isn't portable? It should work anywhere Qt does.</p>
<p>Besides that, I would try to make a color-filled button somehow, similar to Jérôme's answer, only I would probably make a dedicated button to do it, and mess with the palette somehow.</p>
| 35,848 |
<p>How can I find what databases I have a minimum of read access to in either basic SQL, MySQL specific or in PHP?</p>
| <p>There is a command in MySQL which can show you all of the permissions you have. The command is:</p>
<pre>
SHOW GRANTS;
</pre>
<p>It will give you output similar to:</p>
<pre>
root@(none)~> show grants;
+---------------------------------------------------------------------+
| Grants for root@localhost ... | <p>In MySQL, you can execute </p>
<p><code>SHOW DATABASES;</code></p>
<p><strong>Description</strong></p>
<p><code>SHOW DATABASES;</code>to see what you have at least minimal access to. Are you looking for something more programmatic?</p>
| 8,920 |
<p>Is there any sort of "out of the box" system within SharePoint (i.e. MOSS 2007) that is useful for tracking/managing permissions. We've got a relatively small installation, but I can easily see special permissions for special users/sites getting out of hand. I'm hoping there's something pre-baked into SharePoint t... | <p>If anyone is curious, I ended up using <a href="http://www.codeplex.com/sushi" rel="nofollow noreferrer">SharePoint SUSHI</a> for this. It has some useful "security reports" that met my needs. There's a few other goodies included as well. The best part of it all is that it's FREE. :-)</p>
| <p>The SharePoint Administration Toolkit contains a permission tool that shows the effective permissions for a user or group. Becky Bertram has a <a href="http://blog.beckybertram.com/Lists/Posts/Post.aspx?ID=56" rel="nofollow noreferrer">blog post about this</a>.</p>
<p>See information for downloading it on the <a hr... | 30,196 |
<p>I've got a virtual machine running on a server that I can't stop or reboot - I can't log onto it anymore and I can't stop it using the VMware server console. There are other VM's running so rebooting the host is out of the question. Is there any other way of forcing one machine to stop?</p>
| <p>If you are using Windows, the virtual machine should have it's own process that is visible in task manager. Use sysinternals <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer">Process Explorer</a> to find the right one and then kill it from there.</p>
| <p>Here's what I did based on </p>
<p>a) @Espo 's comments and<br>
b) the fact that I only had Windows Task Manager to play with....</p>
<p>I logged onto the host machine, opened Task Manager and used the view menu to add the PID column to the Processes tab.</p>
<p>I wrote down (yes, with paper and a pen) the PID'... | 10,749 |
<p>I've got a VB.NET class that is invoked with a context menu extension in Internet Explorer. </p>
<p>The code has access to the object model of the page, and reading data is not a problem. This is the code of a test function...it changes the status bar text (OK), prints the page HTML (OK), changes the HTML by adding... | <p>Consider using a nesting relationship (a line with a '+' in a circle at the parent end).</p>
| <p>Or you can show the inner class fully enclosed by the outer class, one rectangle inside another.</p>
| 29,763 |
<p>This question would probably apply equally as well to other languages with C-like multi-line comments. Here's the problem I'm encountering. I'm working with Java code in Eclipse, and I wanted to comment out a block of code. However, there is a string that contains the character sequence "*/", and Eclipse thinks that... | <p>Eclipse is correct. There is no interpretation context inside a comment (no escaping, etc). See <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48125" rel="noreferrer">JLS §3.7</a>.</p>
| <p>A simple test shows Eclipse is correct:</p>
<pre><code>public class Test {
public static final void main(String[] args) throws Exception {
String s = "This is the original string.";
/* This is commented out.
s = "This is the end of a comment: */ ";
*/
System.out.println(s);
}
}
</code></pre>... | 5,289 |
<p>The current top-voted to <a href="https://stackoverflow.com/questions/325862/what-are-the-most-common-security-mistakes-programmers-make">this question</a> states:</p>
<blockquote>
<p>Another one that's not so much a security issue, although it is security-related, is complete and abject failure to <strong>grok t... | <p>Hashing is a one way function (well, a mapping). It's irreversible, you apply the secure hash algorithm and you cannot get the original string back. The most you can do is to generate what's called "a collision", that is, finding a different string that provides the same hash. Cryptographically secure hash algorithm... | <p>Here's one reason you may want to use one over the other - password retrieval. </p>
<p>If you only store a hash of a user's password, you can't offer a 'forgotten password' feature.</p>
| 42,327 |
<p>I have an existing J2EE enterprise application to which I need to add auditing, i.e. be able to record CRUD operations on several important domain types (Employee, AdministratorRights, etc.).</p>
<p>The application has a standard n-tier architecture:</p>
<ul>
<li>Web interface</li>
<li>Business operations encapsul... | <p>Maybe you should have a look at <a href="http://audit4j.org/" rel="noreferrer">Audit4j</a> that provides auditing of business functionality and has several options for configuration.
Another framework is <a href="http://javers.org/" rel="noreferrer">JaVers</a> that focues more on auditing low-level modification on p... | <p>Try an <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming" rel="nofollow noreferrer">Aspect Oriented</a> programming framework.</p>
<p>From Wikipedia "Aspect-oriented programming (AOP) is a programming paradigm that increases modularity by allowing the separation of cross-cutting concerns".</p>
| 9,428 |
<p>This drop down list, displaying all the files from a folder, one of which will be selected for use. Is there a way to show which file is selected when you load the page? At the moment it says "select a file" every time.</p>
<pre><code><select name="image" type="text" class="box" id="image" value="<?=$image;?&... | <p>Type safety means that the compiler will validate types while compiling, and throw an error if you try to assign the wrong type to a variable.</p>
<p>Some simple examples:</p>
<pre><code>// Fails, Trying to put an integer in a string
String one = 1;
// Also fails.
int foo = "bar";
</code></pre>
<p>This also appli... | <p>Type-safe means that the set of values that may be assigned to a program variable must fit well-defined and testable criteria. Type-safe variables lead to more robust programs because the algorithms that manipulate the variables can trust that the variable will only take one of a well-defined set of values. Keeping ... | 32,588 |
<p>I learned about <a href="http://www.microsoft.com/bizspark/" rel="noreferrer">Microsoft BizSpark</a> the other day and started the sign up process. Has anyone else heard about it or had success with it?</p>
| <p>I can't speak for BizSpark specifically (it's so new), but Microsoft has had the similar <a href="http://www.empowerforisv.com/" rel="nofollow noreferrer">Empower</a> program in place for 5 or so years. When our company was originally getting started, we joined the program (and participated for two years) and it was... | <p>My $0.02 is that it's a trap. MS knows that many startups, especially the ones without venture capital (which in my book makes them "real" startups), are flocking to open source technologies both because of the cost savings and the control over your destiny -- the ability to fix bugs, modify things, and prevent ven... | 33,982 |
<p>I have an iterator to a map element, and I would like gdb to show me the values of the "first" and "second" elements of that iterator.
For example:</p>
<pre><code>std::map<int,double> aMap;
...fill map...
std::map<int,double>::const_iterator p = aMap.begin();
</code></pre>
<p>I can use p.first and p.se... | <p>Here is how i do it:</p>
<pre><code>This GDB was configured as "i686-pc-linux-gnu"...
(gdb) list
1 #include <iostream>
2 #include <map>
3
4 int main()
5 {
6 std::map<int, int> a;
7 a[10] = 9;
8 std::map<int, int>::iterator it = a.begin();... | <p><code>p</code> will be an iterator to <code>std::pair<const int, double></code>, so what you actually want is <code>p->first</code>. I don't think GDB handles overloaded operators well, though, so you probably want <code>p.</code>{some member that represents the <code>pair</code> object}<code>.first</code>.... | 41,725 |
<p>I've been thinking of rolling my own code for enabling my Delphi application to update seamlessly as I'll be going for "release often, release early" mentality furthermore. There are various Delphi solutions (both freeware and paid) out there and I'd like to ask if you've been using any of them or simply went on wit... | <p>Years ago I wrote a simple tool which is started instead of the real program, checks for updates, loads and installs them (if any are available), and finally starts the real application.</p>
<p>There are however problems with that approach if your program works in a properly administered environment, where users no... | <p>Same as "stg" and "GuyWithDogs", I'm using TWebUpdate from TMS. Although the documentation isn't so great, Its not so difficult to learnt. </p>
<p>With TWebUpdate, you have some options what the protocol you use, it could be done via HTTP, FTP or network access.</p>
<p>For communication layer, TWebUpdate uses WinI... | 35,020 |
<p>Is there a way to find all the class dependencies of a java main class?</p>
<p>I have been manually sifting through the imports of the main class and it's imports but then realized that, because one does not have to import classes that are in the same package, I was putting together an incomplete list.</p>
<p>I ne... | <p>I just found <a href="http://www.dependency-analyzer.org/" rel="noreferrer">Class Dependency Analyzer</a>, download, install configure and 10 min's later I have a complete class Dependency list. </p>
| <p>Here is a code snippet you can put into your main method in Java to output paths to all dependencies of your application:</p>
<pre><code>ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader) cl).getURLs();
for(URL url: urls){
System.out.println(url.getPath());
}
</code></pre>
| 24,460 |
<p>I am maintaining .net 1.1 and .net 3.5 c# code at once. For this purpose I created two csproject files, one for .net 1.1 and another for .net 3.5.</p>
<p>Now, in my source code I am adding new features that are only available in .net 3.5 version, but I also want the code to compile in VS 2003, without the new featu... | <p>You can define a different symbols in each CSPROJ file and refer to those in the C# source.</p>
| <p>If you can keep the 3.5 specific code in separate files, you could simply split the file allocation between your two .csproj files (or use 2 different build targets in NAnt) - too bad partial classes only came around in 2.0, or that would make it easier to spread the code around...</p>
<p>If you need to mix the cod... | 16,617 |
<p>I'm in the process of troubleshooting some memory problems we're having in our .NET WinForms application. I'm using <a href="http://memprofiler.com/" rel="nofollow noreferrer">SciTech's .NET Memory Profiler</a> as well as <a href="http://www.jetbrains.com/profiler/" rel="nofollow noreferrer">dotTrace</a> and they a... | <p>For really deep memory leak problems in the CLR, I find the best tool is windbg. If you can get past the cryptic syntax it's an amazingly effective debugger and leak tracker. The downside is it's not very intuitive to use and there is a very steep learning curve. </p>
<p>The best way to learn windbg though is by ... | <p>I don't know if WinDBG is going to help here. It sounds like this is truly a bug in the framework. Is there a way you can post a simple repro? If so, then I could dig into what the heck is going on and see if there is a workaround. Otherwise your better bet would be to open a ticket on <a href="http://connect.micros... | 36,572 |
<p>Previously it was .net 2.0 which is the big change in .net developement. many developers are working mostly on this. Presently microsoft has introduced .net 3.0 and yet its next version .net 4.0. So the next version is going to be major change in .net development.</p>
<p>I have listed some features of this...</p>
... | <p>You missed .NET 3.5, which is actually a bigger package than .NET 3.0; .NET 3.0 adds things like WCF/WPF/WF, which are nicer ways to do things that were (generally) already there in the framework.</p>
<p>However, .NET 3.5 adds LINQ, which is <em>huge</em> and broad-reaching. LINQ-to-Objects is the most used, provid... | <p>If you're asking which new features will the upcoming .NET 4.0 Framework present, I've heard a lot about Parallel Computing, specifically about a Task Parallel Library built in the core of the Framework, also <a href="http://msdn.microsoft.com/en-us/magazine/cc163329.aspx" rel="nofollow noreferrer">PLinq</a> or Para... | 36,365 |
<p>I've got a Visual Basic App that tends to get severely messed up if the installation runs more than once. It seems the occasionally client mistakes the installer for the shortcut to it later on down the road, runs the installer again and it messes everything up. I can't for the life of me figure out why so I decid... | <p>Why don't you FIX the installer or whatever problems are happening rather than try to make some hack to avoid it...</p>
<p>Just my $.02</p>
| <p>If you are using VB.NET with Visual Studio 2005 or 2008 you can check the 'Make Single Instance Application' option in the Windows Application Framework section of the Application tab in the project settings.</p>
| 26,258 |
<p>My schema specifies a namespace, but the documents don't. What's the simplest way to ignore namespace during JAXB unmarshalling (XML -> object)?</p>
<p>In other words, I have</p>
<pre><code><foo><bar></bar></foo>
</code></pre>
<p>instead of,</p>
<pre><code><foo xmlns="http://tempuri.or... | <p>Here is an extension/edit of VonCs solution just in case someone doesn´t want to go through the hassle of implementing their own filter to do this. It also shows how to output a JAXB element without the namespace present. This is all accomplished using a SAX Filter.</p>
<p>Filter implementation:</p>
<pre><code>imp... | <p>This is just a modification of lunicon's answer (<a href="https://stackoverflow.com/a/24387115/3519572">https://stackoverflow.com/a/24387115/3519572</a>) if you want to replace one namespace for another during parsing. And if you want to see what exactly is going on, just uncomment the output lines and set a breakpo... | 35,018 |
<p>I'd like to execute JavaScript code from within a C# assembly and have the results of the JavaScript code returned to the calling C# code.</p>
<p>It's easier to define things that I'm not trying to do:</p>
<ul>
<li><p>I'm not trying to call a JavaScript function on a web page from my code behind.</p></li>
<li><p>I... | <p>The code should be pretty self explanitory, so I'll just post that.</p>
<pre><code><add assembly="Microsoft.Vsa, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
</code></pre>
<hr>
<pre><code>using Microsoft.JScript;
public class MyClass {
public static Microsoft... | <p>Could it be simpler to use <a href="https://github.com/pivotal/jsunit" rel="nofollow noreferrer">JSUnit</a> to write your tests, and then use a <a href="http://watin.sourceforge.net/" rel="nofollow noreferrer">WatiN</a>
test wrapper to run them through C#, passing or failing based on the JSUnit results?</p>
<p>It ... | 9,329 |
<p>When I update the .dlls in my C# ASP.Net application, the transition is handled gracefully and the users are allowed to finish their requests before the code is switched over to the new code.</p>
<p>My question is do the static variables reset when that is done or do they persist through the update (if of course th... | <p>Yes, they are lost and recreated, the DLL forces the application domain to stop and restart. All cache and other items are re-filled and created as used/needed.</p>
<p>You must look at a persistent store if these values are to be retained for any actual amount of time as your AppDomain can and does restart for man... | <p>Yes, the application is restarted. If you need to persist these values, you might want to look at some sort of out-of-process caching model, such as out of process caching, SQL Server State Management, or a third-party caching solution that lives outside of the application domain.</p>
| 40,378 |
<p>I am working with fixtures on rails and I want one of the fixture fields to be blank.</p>
<p>Example:</p>
<pre><code>two:
name: test
path: - I want this blank but not to act as a group heading.
test: 4
</code></pre>
<p>But, I do not know how to leave <code>path:</code> blank without it acting as a group title. D... | <p>YAML files are based on indentation. Once you actually have correct indentation it will read everything at the same level as siblings.</p>
<pre><code>
two:
name: test
path:
test: 4
</code></pre>
| <p>Google <a href="http://groups.google.com/group/ruby-talk-google/browse_thread/thread/f8b1635528665a85" rel="nofollow noreferrer">says</a> the following should work:</p>
<pre><code>path: \"\"
</code></pre>
| 7,990 |
<p>I have a listbox on an HTML form with a Submit button. The listbox has multiple selection enabled. I am able to select multiple values in the listbox, but I don't know how to figure out what values were selected when the form is submitted. Also, I am adding user generated values to the list box dynamically using ... | <p>By naming your <code>select</code> with trailing square brackets, PHP (and likely other server languages) will put the data in an array</p>
<p>ex:</p>
<pre><code><form action="process.php" method="post">
<select name="multiSelects[]" multiple="multiple" size="5">
<option value="0">Zero</... | <p>Below you find an example of a page.</p>
<p>Note that:</p>
<ul>
<li>the select element (and any form element) needs a name to be included in the post. </li>
<li>only selected options in the select element will be posted.</li>
</ul>
<p><em>What values are selected in the box by the user?</em></p>
<p>When the use... | 49,712 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.