instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>The example below throws an InvalidOperationException, "Collection was modified; enumeration operation may not execute." when executing the code. </p>
<pre><code>var urls = new List<string>();
urls.Add("http://www.google.com");
foreach (string url in urls)
{
// Get all links from the url
List<stri... | <p>You can't, basically. What you really want here is a queue:</p>
<pre><code>var urls = new Queue<string>();
urls.Enqueue("http://www.google.com");
while(urls.Count != 0)
{
String url = url.Dequeue();
// Get all links from the url
List<string> newUrls = GetLinks(url);
foreach (string newU... | <p>Don't change the collection you're looping through via for each. Just use a while loop on the Count property of the list and access the List items by index. This way, even if you add items, the iteration should pick up the changes.</p>
<p>Edit: Then again, it sort of depends on whether you WANT the new items you ad... | 36,532 |
<p>I have jQuery but I'm not sure if it has any built-in sorting helpers. I could make a 2d array of each item's <code>text</code>, <code>value</code>, and <code>selected</code> properties, but I don't think that javascript's built in <code>Array.sort()</code> would work correctly.</p>
| <p>Extract options into a temporary array, sort, then rebuild the list:</p>
<pre><code>var my_options = $("#my_select option");
var selected = $("#my_select").val();
my_options.sort(function(a,b) {
if (a.text > b.text) return 1;
if (a.text < b.text) return -1;
return 0
})
$("#my_select").empty().ap... | <p>Seems jquery still is not particularly helpful enough for sorting options in a html select element.
Here is some plain-plain javascript code for sorting options:</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-... | 6,790 |
<p>The NetBeans 6.1 editor doesn't seem to like to wrap comments, and the code formatter seems to ignore them. For JavaDoc comments, this behaviour seems inappropriate, as you can end up spending a lot of wasted time manually reflowing paragraphs.</p>
<p>I was wondering if there's some magic setting to get the builti... | <p>This issue has been raised to the Netbeans development team and will likely be added in a "future" release of Netbeans. If you want this feature (or any other feature) to be added to the IDE, go to the issue tracking website and vote for this feature.</p>
<p><a href="http://www.netbeans.org/issues/show_bug.cgi?id=1... | <p>I'm fairly sure that you can't do this. Comments are not code and javadoc comments are not exactly plain text either as they're intended to be HTML outputted.</p>
<p>Maybe write your own plugin for this?</p>
| 12,415 |
<p>I'm building a webpage that queries a MySQL database and (currently) produces a text-only list of the findings. The queries to complete a single record are similar to:</p>
<ul>
<li>movie (title, description, etc)
<ul>
<li>actors in the movie (name, gender)</li>
<li>related movies</li>
</ul></li>
</ul>
<p>Out of c... | <p>Ultimately it's preferable to optimize when convenient of course, but 2MB of memory use sounds fine. PHP4 has a default config of 8mb, and PHP5 16mb. A lot of pre-packaged PHP builds will have different configs, of course, but generally speaking, if you can keep your app under 8mb, you can be sure it'll be highly po... | <p>As long as you plan a good caching mechanism (opcode cache, object cache, etc.), memory usage becomes less relevant. You are still way below common php framework memory usage.</p>
| 28,786 |
<p>I'm still fairly new to T-SQL and SQL 2005. I need to import a column of integers from a table in database1 to a identical table (only missing the column I need) in database2. Both are sql 2005 databases. I've tried the built in import command in Server Management Studio but it's forcing me to copy the entire table.... | <p>Inserting won't do it since it'll attempt to insert new rows at the end of the table. What it sounds like your trying to do is add a column to the end of existing rows.</p>
<p>I'm not sure if the syntax is exactly right but, if I understood you then this will do what you're after.</p>
<ol>
<li><p>Create the colum... | <p>insert into Test2.dbo.MyTable (MyValue) select MyValue from Test1.dbo.MyTable</p>
<p>This is assuming a great deal. First that the destination database is empty. Second that the other columns are nullable. You may need an update instead. To do that you will need to have a common key.</p>
| 7,561 |
<p>I'm getting into ASP.NET (C# - I know it doesn't matter for this particular question, but full disclosure and all that), and while I love that the <code>asp:</code>-style controls save me a lot of tedious HTML-crafting, I am often frustrated with certain behaviors. I encountered one last night when working with Mast... | <p>Personally, </p>
<p>I think the standard ASP.NET controls are fine for inhouse stuff - quick and dirty is good in that scenario. But, I once worked with a web developer who was also a designer and he refused to use the ASP.NET controls and only code in HTML and add runat="server" tags when needed. This was more bec... | <p>If the ID's prefix added by ASP.NET is an issue for you to access them later using JS or something... you have the .ClientID property server side.</p>
<p>If the overhead added by ASP.NET you should consider ASP.NET MVC (still preview) where you have full control over the emitted html.</p>
<p>I'm moving to MVC beca... | 4,209 |
<p>When starting a new ASP.NET application, with the knowledge that at some point in the future it must scale, what are the most important design decisions that will allow future scalability without wholsesale refactoring?</p>
| <p>My Top three decisions are </p>
<ol>
<li>Disabling or storing session state
in a database.</li>
<li>Storing as little as possible in session state. </li>
<li>Good N-Tier Architecture. Separating business logic and using Webservices instead of directly accessing DLL's ensures that you can scale out both the business... | <p>Ensure you have a solid caching policy for transient / static data. Database calls are expensive especially with separate physical servers so be aggressive with your caching.</p>
| 38,195 |
<p>Is there a best practice for avoiding a browser freeze when loading an applet?</p>
<p>For my precise needs, the applet needs to be loaded when the web application is initialized, and is not a visual component (will be in a hidden div or hidden iframe).</p>
<p>As a reference, here is an <a href="http://bugs.sun.com... | <p>Essentially, no there is not. Read the evaluation section of the bug you linked to. The issue is one of startup time for the JVM. About the best you can do is to keep the applet small so that it will load quickly. However, the browser freeze is happening because the browser has to wait for the VM to start. You ... | <p>Essentially, no there is not. Read the evaluation section of the bug you linked to. The issue is one of startup time for the JVM. About the best you can do is to keep the applet small so that it will load quickly. However, the browser freeze is happening because the browser has to wait for the VM to start. You ... | 25,534 |
<p>I have a hyper link like this :</p>
<pre><code><A Href=My_Java_Servlet?User_Action=Admin_Download_Records&User_Id=Admin onClick=\"Check_Password();\" target=_blank>Download Records</A>
</code></pre>
<p>When a user clicks on it, a password window will open, the user can try 3 times for the right pas... | <p>Clientside JavaScript is perhaps the worst possible way to provide "security". Users can just view the source to see all of your passwords, or just disable JavaScript altogether. <strong>Do not do this.</strong></p>
| <p>Why are you returning <strong>"false"</strong> instead of <strong>false</strong> ?</p>
| 31,236 |
<p>I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using <em>find</em> piped with <em>xargs grep</em>:</p>
<pre><code>find . -iname '*.py' | xargs grep -e 'YOUR_PATTERN'
</code></pre>
<p>But if I need to find patterns that spans on more than one line, ... | <p>So I discovered <a href="http://www.pcre.org/" rel="nofollow noreferrer"><em><strong>pcregrep</strong></em></a> which stands for <strong>Perl Compatible Regular Expressions GREP</strong>.</p>
<blockquote>
<p>the -M option makes it possible to search for patterns that span line boundaries.</p>
</blockquote>
<p>For ex... | <p>This answer might be useful:</p>
<p><a href="https://stackoverflow.com/questions/3717772/regex-grep-for-multi-line-search-needed/7167115#7167115">Regex (grep) for multi-line search needed</a></p>
<p>To find recursively you can use flags -R (recursive) and --include (GLOB pattern). See:</p>
<p><a href="https://sta... | 18,425 |
<p>It's about PHP but I've no doubt many of the same comments will apply to other languages.</p>
<p>Simply put, what are the differences in the different types of loop for PHP? Is one faster/better than the others or should I simply put in the most readable loop?</p>
<pre><code>for ($i = 0; $i < 10; $i++)
{
# ... | <p>For loop and While loops are entry condition loops. They evaluate condition first, so the statement block associated with the loop won't run even once if the condition fails to meet </p>
<p>The statements inside this for loop block will run 10 times, the value of $i will be 0 to 9;</p>
<pre><code>for ($i = 0; $i &... | <p>I use the first loop when iterating over a conventional (indexed?) array and the foreach loop when dealing with an associative array. It just seems natural and helps the code flow and be more readable, in my opinion. As for do...while loops, I use those when I have to do more than just flip through an array.</p>
<p... | 4,282 |
<p>In 4D printing technology or by means usage of Shape-memory alloy (non-metal, iron based, copper based or NiTi material) for 3D printing.</p>
<p>Is there any software simulation tool which I can use to simulate this material change behavior with respect to time? For example, when introducing a change in humidity or... | <p>I am going to say that this probably is a whole dimension out of scope for this group ;-)</p>
<p>That said this new type of 3d printing is still at the University level. Also 4d is not necessarily 3d printing related at all. All it has to be is self assembling. Like <a href="http://www.selfassemblylab.net/4DPrinting... | <p>(preface : I originally intent to write this as a comment, but the volume limit reached. In that tone, I'll utilize this answer space writing it..)</p>
<blockquote>
<p>to simulate those material change behavior in respect to time?</p>
</blockquote>
<p>COMSOL, ANSYS or equivalent ring a bell to be.. as long as yo... | 404 |
<p>In C# there is the static property <a href="http://msdn.microsoft.com/en-us/library/system.environment.newline.aspx" rel="noreferrer">Environment.Newline</a> that changed depending on the running platform.</p>
<p>Is there anything similar in Java?</p>
| <p><strong>As of Java 7 (and Android API level 19):</strong></p>
<pre><code>System.lineSeparator()
</code></pre>
<p>Documentation: <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#lineSeparator%28%29" rel="noreferrer">Java Platform SE 7</a></p>
<hr>
<p><strong>For older versions of Java, use... | <p>Be aware that this property isn't as useful as many people think it is. Just because your app is running on a Windows machine, for example, doesn't mean the file it's reading will be using Windows-style line separators. Many web pages contain a mixture of <code>\n</code> and <code>\r\n</code>, having been cobbled ... | 30,679 |
<p>I just finished reading this post: <a href="https://developer.yahoo.com/performance/rules.html#flush" rel="nofollow noreferrer">https://developer.yahoo.com/performance/rules.html#flush</a> and have already implemented a flush after the top portion of my page loads (head, css, top banner/search/nav).</p>
<p>Is there... | <p>The technique described looks nice, but has several pitfalls:</p>
<p>1) the time between PHP script start and end is small compared to transmission time; also, this saves the user about 0.5 seconds, according to your source. Is that a significant amount of time for you?</p>
<p>2) this technique doesn't work with g... | <p>Following Piskvor's point - if you are expecting a 20s+ wait, you may be better off providing a basic page (which can be gzipped) and using Ajax to update the page when the slow process has finished. You do start to infringe the basic usefulness of static html, though.</p>
| 45,944 |
<p>I have to read a txt file with lines formated like this:</p>
<pre>
1: (G, 2), (F, 3)
2: (G, 2), (F, 3)
3: (F, 4), (G, 5)
4: (F, 4), (G, 5)
5: (F, 6), (c, w)
6: (p, f), (G, 7)
7: (G, 7), (G, 7)
w: (c, w), (c, w)
</pre>
<p>Each line will feed a struct with its data (the 5 numbers or letters in it).<br>
What's the be... | <p>I think you could parse it along the lines of:</p>
<pre><code>fscanf(file,"%c: (%c, %c), (%c, %c)", &first,&second,&third,&fourth,&fifth);
</code></pre>
| <p>fgets() and sscanf() as I remember</p>
| 36,352 |
<p>Python 3.0 breaks backwards compatibility with previous versions and splits the language into two paths (at least temporarily). Do you know of any other language that went through such a major design phase while in maturity?</p>
<p>Also, do you believe that this is how programming languages should evolve or is the ... | <p>The only language I can think of to attempt such a mid-stream change would be Perl. Of course, Python is beating Perl to that particular finish line by releasing first. It should be noted, however, that Perl's changes are much more extensive than Python's and likely will be harder to detangle.</p>
<p>(There's a pri... | <p>gcc regularly changes how it handles C++ almost every minor release. Of course, this is more a consequence of gcc tightening how they follow the rules, and less of C++ itself changing.</p>
| 34,462 |
<p>Could somebody give me a brief overview of the differences between HTTP 1.0 and HTTP 1.1? I've spent some time with both of the RFCs, but haven't been able to pull out a lot of difference between them. Wikipedia says this:</p>
<blockquote>
<p><strong>HTTP/1.1 (1997-1999)</strong></p>
<p>Current version; persistent... | <p><strong>Proxy support and the Host field:</strong></p>
<p>HTTP 1.1 has a required Host header by spec.</p>
<p>HTTP 1.0 does not officially require a Host header, but it doesn't hurt to add one, and many applications (proxies) expect to see the Host header regardless of the protocol version.</p>
<p>Example:</p>
<... | <p>HTTP 1.1 is the latest version of Hypertext Transfer Protocol, the World Wide Web application protocol that runs on top of the Internet's TCP/IP suite of protocols. compare to HTTP 1.0 , HTTP 1.1 provides faster delivery of Web pages than the original HTTP and reduces Web traffic.</p>
<p>Web traffic Example: For ex... | 30,647 |
<p>I have been maintaining <a href="http://github.com/Pistos/watir-mirror" rel="noreferrer">the git mirror</a> of <a href="http://wtr.rubyforge.org/" rel="noreferrer">the watir project</a>. Some time a couple weeks ago, we had someone ready to submit their first git-based patch. Unfortunately, we ran into some issues... | <p>I had this same problem in trying to create a git repository from the brlcad svn repository. I solved it by doing <code>git svn reset --r XXXXX</code>, where I set XXXXX to be about 50 revisions prior to the one that originally produced the error. </p>
<p>Stepping back a single revision was not successful in resolv... | <p>i had the same problem and like Todd's case, going to a previous revision fixed the problem. </p>
<p>I think the solution is to go to two steps previous revision of the problematic file.</p>
| 25,913 |
<p>I have a website that works correctly under IIS 6.0: It authenticates users with windows credentials, and then when talking to the service that hits the DB, it passes the credentials.</p>
<p>In IIS 7.0, the same config settings do not pass the credentials, and the DB gets hit with NT AUTHORITY\ANONYMOUS.</p>
<p>Is... | <p>There has been changes between IIS7 and IIS6.0. I found for you one blog post that might actually help you (<a href="http://mvolo.com/blogs/serverside/archive/2007/12/08/IIS-7.0-Breaking-Changes-ASP.NET-2.0-applications-Integrated-mode.aspx" rel="noreferrer">click here to see it</a>).</p>
<p>Are you running your ap... | <p>Interesting... I have the opposite problem - <strong>Not being able</strong> to get the authentication to be passed from the client browser, through the webserver and onto the database within a large corporate network over firewalls.</p>
<p>I also feel that "end to end user" authentication to the database is a bad ... | 3,161 |
<p>Sounds like a weird question, but say I have something like this:</p>
<pre><code>$.post( "/myajax.php",
{ "param1": value1, "param2": value2 },
function( data, status ) {
if( status == "success" ) {
$("#someid").html( data );
}
}, "html" );
</code></pre... | <p>When a user accesses an application URL without a session cookie, he is redirected to the SSO system. He then logs into the SSO form, which then redirects him back to your app with a ticket ID that you can look up in the SSO system to get cridentials.</p>
<p>Also, take a look at <a href="http://www.atlassian.com/so... | <p>Check out <a href="http://www.ja-sig.org/products/cas/index.html" rel="nofollow noreferrer">JA-SIG CAS</a>. Even if you build your own, you should look at their architecture for ideas on how to implement.</p>
| 37,236 |
<p>Is it possible to check if a dynamically loaded assembly has been signed with a specific strong name?</p>
<p>Is it enough / secure to compare the values returned from <strong>AssemblyName.GetPublicKey()</strong> method?</p>
<pre><code>Assembly loaded = Assembly.LoadFile(path);
byte[] evidenceKey = loaded.GetName(... | <p><a href="http://www.codinghorror.com/blog/archives/000749.html" rel="noreferrer">This Post</a> by Jeff Atwood on his blog <a href="http://www.codinghorror.com" rel="noreferrer">Coding Horror</a> goes into the purpose of comments in general. Something you might think is 'duh' really isn't -- especially in the 'real ... | <h2>Inside VS</h2>
<p>Comments are relatively simple.</p>
<p>You can use for <strong>single line</strong> :</p>
<pre><code>//This is a single line comment
</code></pre>
<p>You can use for <strong>multiple line</strong>:</p>
<pre><code>/*
Multiple lines
*/
</code></pre>
<p>For <strong>method</strong> you can use ... | 39,779 |
<p>Is there a way to get an ASP.NET textbox to accept only currency values, and when the control is validated, insert a $ sign beforehand?</p>
<p>Examples: </p>
<p>10.23 becomes $10.23<br>
$1.45 stays $1.45<br>
10.a raises error due to not being a valid number </p>
<p>I have a RegularExpressionValidator that is ve... | <p>The ASP.NET <a href="https://github.com/DevExpress/AjaxControlToolkit/wiki/MaskedEdit" rel="nofollow noreferrer">MaskedEdit</a> control from the <a href="https://github.com/DevExpress/AjaxControlToolkit/wiki" rel="nofollow noreferrer">AJAX Control Toolkit</a> can accomplish what you're asking for.</p>
| <p>In the .CS you could do a pattern match along the lines of,</p>
<pre><code>string value = text_box_to_validate.Text;
string myPattern = @"^\$(\d{1,3},?(\d{3},?)*\d{3}(\.\d{0,2})|\d{1,3}(\.\d{2})|\.\d{2})$";
Regex r = new Regex(myPattern);
Match m = r.Match(value);
if (m.Success)
{
//do something -- everything... | 24,694 |
<p>I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..).</p>
<h1>1 - Via Message map:</h1>
<pre><code>BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd)
...
ON_WM_SIZE()
..
END_MESSAGE_MAP()
</code></pre>
<h1>2 - Via afx_message:</h1>
<pre><c... | <p>Both parts are necessary to add a message handler to a class. The message map should be declared inside your class, together with declarations for any message handler functions (e.g, <code>OnSize</code>).</p>
<pre><code>class CClassWnd : public CBaseClassWnd {
...
afx_msg void OnSize(UINT nType, int cx, int... | <p>Some of the Windows message are already handled by <strong>MFC</strong>, so in these cases you can get away with adding just the method to your derived class. </p>
<p>For example the <strong>CWnd</strong> class (as do many other MFC classes) already maps a few Windows messages into it's message map (i.e. <em>ON_WM_... | 24,472 |
<p>Ok, so I have this regex:</p>
<pre><code>( |^|>)(((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{2})(-)?( )?)?)([0-9]{7}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{3})(-)?( )?)?)([0-9]{6}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{1})(-)?( )?)?)([0-9]{8})))( |$|<)
</code></pre>
<p>It formats Dutch and Belgian ph... | <p>First observation: reading the regex is a nightmare. It cries out for Perl's /x mode.</p>
<p>Second observation: there are lots, and lots, and lots of capturing parentheses in the expression (42 if I count correctly; and 42 is, of course, "The Answer to Life, the Universe, and Everything" -- see Douglas Adams "Hit... | <p>Split it into multiple expressions. For example (pseudo-code)...</p>
<pre><code>phone_no_patterns = [
/[0-9]{13}/, # 0031201234567
/+(31|32)\(0\)\d{2}-\d{7}/ # +31(0)20-1234567
# ..etc..
]
def check_number(num):
for pattern in phone_no_patterns:
if num matches pattern:
return mat... | 33,734 |
<p>I use SQLite for a number of application on the desktop and PDA. Most operations are readonly, as SQLite functions as a data store for reference material in my applications.</p>
<p>Basically, I am looking for suggestions on improving performance in a scenario where you know the access to the data is only read-only.... | <p>The standard database performance tips still apply:</p>
<ul>
<li>Make sure your queries use indexes rather than full table scans</li>
<li>Be as selective as you can in your queries so you aren't pulling unneeded rows from the db</li>
<li>Select only the columns you want</li>
</ul>
| <p>You can call <a href="http://sqlite.org/c3ref/open.html" rel="nofollow noreferrer">sqlite3_open_v2()</a> with the flag <a href="http://sqlite.org/c3ref/c_open_create.html" rel="nofollow noreferrer">SQLITE_OPEN_READONLY</a>. I have no idea if sqlite3 actually uses that to optimize its behavior, or just as way to set ... | 32,230 |
<p>I need to write some methods for loading/saving some classes to and from a binary file. However I also want to be able to accept the binary data from other places, such as a binary string.</p>
<p>In c++ I could do this by simply making my class methods use std::istream and std::ostream which could be a file, a stri... | <p>The Python way to do this is to accept an object that implements read() or write(). If you have a string, you can make this happen with <a href="http://docs.python.org/library/stringio.html" rel="nofollow noreferrer">StringIO</a>:</p>
<pre><code>from cStringIO import StringIO
s = "My very long string I want to re... | <p>The <a href="http://www.python.org/doc/2.5.2/lib/module-pickle.html" rel="nofollow noreferrer">Pickle and cPickle</a> modules may also be helpful to you.</p>
| 40,025 |
<p>I need an algorithm that can compare two text files and highlight their difference and ( even better!) can compute their difference in a meaningful way (like two similar files should have a similarity score higher than two dissimilar files, with the word "similar" defined in the normal terms). It sounds easy to imp... | <p>In Python, there is <a href="https://docs.python.org/3/library/difflib.html" rel="nofollow noreferrer">difflib</a>, as also others have suggested.</p>
<p><code>difflib</code> offers the <a href="https://docs.python.org/3/library/difflib.html#difflib.SequenceMatcher" rel="nofollow noreferrer">SequenceMatcher</a> clas... | <p>One method I've employed for a different functionality, to calculate how much data was new in a modified file, could perhaps work for you as well.</p>
<p>I have a diff/patch implementation C# that allows me to take two files, presumably old and new version of the same file, and calculate the "difference", but not i... | 17,554 |
<p>I've been pulling my hear out over this problem for a few hours yesterday:</p>
<p>I've a database on MySQL 4.1.22 server with encoding set to "UTF-8 Unicode (utf8)" (as reported by phpMyAdmin). Tables in this database have default charset set to <b>latin2</b>. But, the web application (CMS Made Simple written in PH... | <p>Did you try adding the --default-character-set=name option, like this:</p>
<pre><code>mysql --default-character-set=utf8 -h ddd -u zzz -p dbname < dump.sql
</code></pre>
<p>I had that problem before and it worked after using that option.</p>
<p>Hope it helps!</p>
| <p>SOLUTION for me:</p>
<p>set this option in your php file, after <strong>mysql_connect</strong> (or after <strong>mysql_select_db</strong>)..</p>
<pre><code>mysql_query("SET NAMES 'utf8'");
</code></pre>
| 18,371 |
<p>I have a bunch of java files from which I want to remove the javadoc lines with the license [am changing it on my code].</p>
<p>The pattern I am looking for is</p>
<p><code>^\* \* ProjectName .* USA\.$</code> </p>
<p>but matched across lines</p>
<p>Is there a way sed [or a commonly used editor in Windows/Linux] ... | <p>Here's the <a href="http://www.grymoire.com/Unix/Sed.html#uh-47" rel="nofollow noreferrer">appropriate reference point</a> in my favorite sed tutorial.</p>
| <p>Yes. Are you using sed, awk, perl, or something else to solve this problem?</p>
<p>Most regular expression tools allow you to specify multi-line patterns. Just be careful with regular expressions that are too greedy, or they'll match the code between comments if it exists. </p>
<p>Here's an example: </p>
<pre><co... | 21,031 |
<p>What are the key strengths of ASP.NET Webforms (2.0-3.5)? I'm not looking for comparisons to other frameworks, I'm just am looking for feedback on ASP.NET as it stands today.</p>
| <p>One key strength (to some) is a drag-and-drop development environment integrated into Visual Studio. This allows you to get simple things up and running quickly, but can also be a liability when the time comes that you actually need to understand the underlying code.</p>
| <p>It lets you build web applications without having a good understanding of the underlying concepts such as HTTP. This has its own downsides.</p>
| 13,469 |
<p>I'm hosting Python script with Python for Delphi components inside my Delphi application. I'd like to create background tasks which keep running by script.</p>
<p>Is it possible to create threads which keep running even if the script execution ends (but not the host process, which keeps going on). I've noticed tha... | <p>Python has its own threading module that comes standard, if it helps. You can create thread objects using the threading module.</p>
<p><a href="https://docs.python.org/2/library/threading.html" rel="nofollow noreferrer">threading Documentation</a></p>
<p><a href="https://docs.python.org/3/library/threading.html" r... | <p>Threads by definition are part of the same process. If you want them to keep running, they need to be forked off into a new process; see os.fork() and friends.</p>
<p>You'll probably want the new process to end (via exit() or the like) immediately after spawning the script.</p>
| 8,907 |
<p>In chapter 2, the section on bitwise operators (section 2.9), I'm having trouble understanding how one of the sample methods works.</p>
<p>Here's the method provided:</p>
<pre><code>unsigned int getbits(unsigned int x, int p, int n) {
return (x >> (p + 1 - n)) & ~(~0 << n);
}
</code></pre>
<p>... | <p>Let's use 16 bits for our example. In that case, <code>~0</code> is equal to</p>
<pre><code>1111111111111111
</code></pre>
<p>When we left-shift this <code>n</code> bits (3 in your case), we get:</p>
<pre><code>1111111111111000
</code></pre>
<p>because the <code>1</code>s at the left are discarded and <code>0</code>... | <p>In <code>ANSI C ~0 >> n</code> causes undefined behavior </p>
<p>// the post about left shifting causing a problem is wrong.</p>
<p>unsigned char m,l;</p>
<p>m = ~0 >> 4; is producing 255 and its equal to ~0 but, </p>
<p>m = ~0;
l = m >> 4; is producing correct value 15 same as:</p>
<p>m = 255 >> 4;</p>
... | 24,045 |
<p>I have a layout which uses min-width and works great. So I came to add a footer which I want to stick to the bottom. Firefox will display everything perfectly while with IE, when min-width takes in effect and the vertical scroll bar kicks in, the horizontal scroll bar also appears even thought my content isn't even ... | <p>Have you tried using overflow:hidden;?</p>
<p><em>Edit</em>: You might also want to try overflow:auto; with your margins set to margin:0;</p>
| <p>I know that jquery ui has a slider plugin that can duplicate the functionality. Here's a demo that does something similar.
<a href="http://ui.jquery.com/repository/real-world/product-slider/" rel="nofollow noreferrer">http://ui.jquery.com/repository/real-world/product-slider/</a>
Might be a bit heavy for your appli... | 26,202 |
<p>Excel macros do not seem to allow the use of "undo" after running them. Is there any way to bake <code>undo</code> functionality into a VBA macro in Excel?</p>
| <p>Excel VBA has the <code>Application.OnUndo</code> function to handle this:</p>
<pre><code>Public Sub DoSomething
... do stuff here
Application.OnUndo "Undo something", "UnDoSomething"
End Sub
Public Sub UnDoSomething
... reverse the action here
End Sub</code></pre>
| <p>I always save immediately before running my macros (during testing at least) then, if everything goes pear-shaped, I can just exit without saving and re-open it.</p>
<p>Baking it into the actual macro, you'll have to basically record the old state of everything that changes (cell contents, formulae, formatting and ... | 44,053 |
<p>Is there a way to make a popup window maximised as soon as it is opened? If not that, at least make it screen-sized? This:</p>
<pre><code>window.open(src, 'newWin', 'fullscreen="yes"')
</code></pre>
<p>apparently only worked for old version of IE.</p>
| <p>Use <code>screen.availWidth</code> and <code>screen.availHeight</code> to calculate a suitable size for the height and width parameters in <code>window.open()</code></p>
<p>Although this is likely to be close, it will not be maximised, nor accurate for everyone, especially if all the toolbars are shown.</p>
| <p><strong>Try this. This works for me and with any link you want, or anything in the popup</strong></p>
<p>Anything you chose will be shown in a PopUp window in a full screen size within a PopUp Window.</p>
<pre><code><script language="JavaScript">
function Full_W_P(url) {
params = 'width='+screen.width;
pa... | 20,812 |
<p>When I create a new project (or even when I edit the Sample Project) there is no way to add Description to the project.</p>
<p>Or am I blind to the obvious?</p>
| <p>There's no such thing as a project description, really. There's a column in the Projects page which is used so you can see which project is the default, built-in inbox, and we couldn't think of anything better to put as the column header for that column.</p>
| <p>The description is mostly for system projects, like e-mail inbox.</p>
<p>You might be able to set one in the underlying DB table.</p>
| 3,545 |
<p>Many of our transactions are comprised of calculations that are comprised of other calculations. How did you represent the hierarchy / execution graph to users? Was there a specific control you found that worked well? </p>
<p>How would you project the result of a change to one of the formulas before committing t... | <p>I haven't had to do this, but I'd do something like the following:</p>
<p>Use a tree view-type control. Have each inner calculation be separately collapsible. The control can start out with everything collapsed, then the user can click through to see the inner calculations. (If the inner calculations have names, th... | <p>I haven't had to do this, but I'd do something like the following:</p>
<p>Use a tree view-type control. Have each inner calculation be separately collapsible. The control can start out with everything collapsed, then the user can click through to see the inner calculations. (If the inner calculations have names, th... | 42,300 |
<p>For my Frankenstein's printer I am at a loss with the hotend mount. I cannot drill holes of 16 (upper diameter) and 12 mm (clamping diameter, 6mm high) which i would need to mount the E3D V6 clone I have.</p>
<p>What I am looking for: a hotend mount plate that tightly fixes the hotend while having some holes for sc... | <p>If you do not have the tools to fabricate this component yourself, but have a 3D model available, I would suggest getting someone else to 3D print it for you.</p>
<p>There are multiple options for getting your model printed, such as:</p>
<ul>
<li>Friends</li>
<li>Your local makerspace, library or similar</li>
<li>... | <p>If you do not have the tools to fabricate this component yourself, but have a 3D model available, I would suggest getting someone else to 3D print it for you.</p>
<p>There are multiple options for getting your model printed, such as:</p>
<ul>
<li>Friends</li>
<li>Your local makerspace, library or similar</li>
<li>... | 227 |
<p>Using C# .NET 2.0, I have an owner-drawn ListView where I'm overriding the OnDrawColumnHeader, OnDrawItem and OnDrawSubitem events. If I set the View property to Details at design-time, everything works beautifully and I can switch the View property and all view modes display as they should (I'm not using Tile view... | <p>The WinForms ListView is mostly a layer of abstraction of the top of the actual Windows control, so there are aspect of its behaviour that are, well, counterintuitive is a polite way of putting things.</p>
<p>I have a vague recollection, from back in my days as a Delphi developer, that when you are Owner drawing a ... | <p>If you configure it correctly using the designer, just go into the generated designer code and see what code was emitted by Visual Studio to get it to work right. THen just emulate that code.</p>
| 19,760 |
<p>What are your opinions (as users as well as developers) on begware that e.g. at the start screen or intermittently shows a modal dialog for x seconds? What about other methods of getting the user to pay (or send you a postcard or any other kind of appreciation) instead of using the trail version?</p>
| <p>Nagware is a bit pointless Imo, any thing you do to limit the software so that the "free" version is somehow encumbered will ultimately lead to it being reverse engineered and people will just download the <strong>out dated</strong> and possibly <strong>virus infected</strong> alternative of your software, which al... | <p>I really don't find they actually accomplish that much. I've gone on using things like WinZip, without paying for a license, for years, watching it count up all 1000 days I've been using it, simply because I didn't think the price they were asking was worth not seeing the nag screen. If the person doesn't want to b... | 32,155 |
<p>Does Java impose any extra restrictions of its own. Windows (upto Vista) does not allow names to include</p>
<pre><code>\ / < > ? * :
</code></pre>
<p>I know HOW to validate names (a regular expression).</p>
<p>I need to validate filenames entered by users. </p>
<p>My application does not need to run on a... | <p>No, you can escape any character that Java doesn't allow in String literals but the filesystem allows.</p>
<p>Also, if trying to port an Windows app to Mac or Unix it is best to use:</p>
<pre><code>File.separator
</code></pre>
<p>To determine the correct file separator to use on each platform.</p>
| <p>When you create a <code>new File</code> the inputted arguments will be normalized by a platform specific implementation of the <code>java.io.FileSystem</code> class. There are no Java specific restrictions that I know of.</p>
<p>and yes, always use <code>File.separator</code>.</p>
| 8,926 |
<p>Is there a way to call an external script or program from Flash CS3 every time it builds a SWF file? I'd like to add subversion information using subwcrev - the SVN keywords don't work because they only update when the version class file is updated.</p>
| <p>I'm not sure what are JSFL capabilities these days, but I'd say inside Flash IDE is your only bet. JSFL is a language to extend the Flash IDE, but I'm not sure you can do this.</p>
<p>On a related note, adding SVN information to your SWFs is not trivial. You'd probably need SVN hooks to put the information <em>befo... | <p>With thanks to Zárate, it looks like JSFL is the answer, or at least part of it. I can't get flash to run external scripts, but I <em>can</em> get external scripts to run flash; so I have two scripts now; build.bat and build.jsfl</p>
<p>build.bat:</p>
<pre><code>subwcrev . Version.svn.as Version.as
IF ERRORLEVEL ... | 10,679 |
<p>I'm the developer of twittertrend.net, I was wondering if there was a faster way to get headers of a URL, besides doing curl_multi? I process over 250 URLs a minute, and I need a really fast way to do this from a PHP standpoint. Either a bash script could be used and then output the headers or C appliation, anything... | <p>I think you need a multi-process batch URL fetching daemon. PHP does not support multithreading, but there's nothing stopping you from spawning multiple PHP daemon processes.</p>
<p>Having said that, PHP's lack of a proper garbage collector means that long-running processes can leak memory.</p>
<p>Run a daemon whi... | <p>If you don't mind going into really low level stuff, you could send pipelined raw HTTP 1.1 requests using the socket functions.</p>
<p>It'd help to know where the bottleneck is in what you're currently using - network, CPU, etc...</p>
| 47,134 |
<p>We're developing a product that relies on the Microsoft Sync Framework to keep the data on a client app and on the server in sync. What we have noticed is when syncing about 16 tables and ~2200 records it will take about 4 minutes, which is not acceptable.</p>
<p>Using the SQL Server Profiler we found it is using ... | <p>sp_executesql is using dynamic sql. each row is being processed singularly.</p>
<p>4 minutes seems rather long, you should look at the design of your 16 tables and check the performance on them. Try using the execution plan to view where the bottleneck may be occurring.</p>
<p>check out this link that covers the b... | <p>Performance improvements are listed on MSDN in the 'What's New' section for <a href="http://msdn.microsoft.com/en-us/library/bb902854(SQL.105).aspx" rel="nofollow noreferrer">Sync Framework 2.0</a>.</p>
<blockquote>
<p><strong>Performance Improvements</strong></p>
<p>The new database providers in this release
have b... | 36,092 |
<p>Are there any good tools to generate JavaScript? I remember in .NET, there was Script# - don't know its status today. </p>
<p>Anyone have experience with any tools? </p>
| <p>I use my keyboard, a text editor and my brain to generate JavaScript.</p>
<p>:P</p>
| <p>There is currently a lot of tools to generate JavaScript, like GWT.</p>
<p>But giving you a good answer really depends on what is your originator language and what king of JavaScript functionnality you want to use.</p>
| 10,571 |
<p>I'm running an SQL query against a mainframe DB2 database using the OdbcDataReader class and ExecuteReader() method. This code is in production and has been running fine for months.</p>
<p>The query normally takes 1-2 minutes to execute. This past Friday, the query encountered a ThreadAbortException. Below is the ... | <p>Here is the answer to my own question.</p>
<p>When hosting a web service, there is some process monitoring how long a web service call is taking. If a call is taking too long, then it is killed and a ThreadAbortException will occur. The timeout can be increased.</p>
<p>For a WSE3 web service running outside of A... | <p>It might be possible that your thread was chosen as the victim in a deadlock situation resulting from optimistic locking, though in that case I would have expected the responsible layer to handle it.</p>
<p>ThreadAbortExceptions can be caused by many things, including other applications or the CLR host aborting the... | 37,953 |
<p>I want to start using dependency injection in my WPF application, largely for better unit testability. My app is mostly constructed along the M-V-VM pattern.
I'm looking at <a href="https://code.google.com/p/autofac/" rel="nofollow noreferrer">Autofac</a> for my IoC container, but I don't think that matters too much... | <p>It's actually very easy to do. We have examples of this in Prism as jedidja mentioned. You can either have the ViewModel get injected with the View or the View get injected with the ViewModel. In the Prism StockTraderRI, you will see that we inject the View into the ViewModel. Essentially, what happens is that the V... | <p>I think You have to Decide on View First or Viewmodel First then as given the other answer it Can be decide.. There are several open source framework does it same . I use Caliburn where ViewModel first is taken and its really good approach</p>
| 36,164 |
<p>I'm trying to place 4 of my image containers into a new pane, having a total of 16 images. The jQuery below is what I came up with to do it. The first pane comes out correctly with 4 images in it. But the second has 4 images, plus the 3rd pane. And the 3rd pane has 4 images plus the 4th pane. I don't know exact... | <p>I think your problem is your use of the gt() and lt() selectors. You should look up slice() instead. </p>
<p>Check out this post:
<a href="http://docs.jquery.com/Traversing/slice" rel="nofollow noreferrer">http://docs.jquery.com/Traversing/slice</a></p>
| <p>For those who are curious... this is what I did.</p>
<pre><code>$(".digi_image").slice(0, 4).wrapAll("<div class=\"digi_pane\"></div>").css("border", "2px solid red");
$(".digi_image").slice(4, 8).wrapAll("<div class=\"digi_pane\"></div>").css("border", "2px solid blue");
$(".digi_image").sl... | 18,522 |
<p>I am trying to import an STL file, I created in FreeCAD. It has a hole in the hull of the object and behind that hole there are two pins inside the object (see attached FreeCAD screenshot).</p>
<p>When I import the STL in Cura, there are no walls around the whole object where there is the hole in the hull (see atta... | <p>This is clearly overextrusion relative to the volume the material is being deposited into, but that doesn't necessarily mean your extrusion rate is wrong. It could be:</p>
<ul>
<li>Nozzle smashed down into the bed (bed way too high) but somehow still extruding</li>
<li>Problem in Z axis movement preventing the head... | <p>Bad filament is my answer. I bought PRLine and both print terrible like your picture. Suspect 2 factors, one is that the line is less than 1.75, so they underextrude and so you see those lines and in some cases gaps, second is the material itself is slippery suggesting to me that it has florinated additives.</p>
| 1,622 |
<p>According to the adobe flex docs: <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=controls_15.html" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/html/help.html?content=controls_15.html</a></p>
<p>Using an image multiple times</p>
<p>You can use the same image multiple times in your a... | <p>The best way to load an image a single time and then reuse that image multiple times in a flex application is to embed the image and tie it to a class representation, then just reference that class from then on.</p>
<p>Example:</p>
<pre><code>[Embed(source="myImage.jpg")]
[Bindable]
public var myImageClass:Class;
... | <p>The problem is the Expiration Time of your images. Configure in the application server the policy for images expiration time and the cache runs OK in all browsers.</p>
| 38,931 |
<p>We have been reading and writing Sticky Notes/Annotations/Comments to pdfs via an activex control in our application for a number of years. We have recently upgraded to Delphi2009 with Unicode Support. The following is causing problems.</p>
<p>When we call </p>
<p>CAcroPDAnnot.GetContents </p>
<p>The results se... | <blockquote>
<p>‚És‚“ú‚É•—Ž×‚ð‚Ђ¢‚½‚ç</p>
</blockquote>
<p>That's the string:</p>
<p>に行く日に風邪をひいたら</p>
<p>in CP-932 aka Shift-JIS encoding, an awful but lamentably still-popular encoding in Japan.</p>
<p>You're currently interpreting it in as CP-1252 (Windows Western European). If your PDF-reading component won'... | <p>Ok, one of the main differences between Delphi 2009 and the earlier versions is that the default string type is an unicode string. That means that if you use the same ActiveX component as in previous versions, you are passing unicode strings to ascii strings and that is usually not a good idea.</p>
<p>There are a c... | 49,113 |
<p>My model layer is being used by a handful of different projects and I'd like to use a single XML Spring Configuration file for the model regardless of which project is using it.</p>
<p>My question is: Since not all beans are used in all projects am I wasting resources to any significant amount if there not being in... | <p>Taken from the <a href="http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-lazy-init" rel="noreferrer">Spring Reference Manual</a>:</p>
<blockquote>
<p>The default behavior for ApplicationContext implementations is to eagerly pre-instantiate all singleton beans at startup. Pre-ins... | <p>Depends upon the objects.</p>
<p>But, unused code is 'cruft' and will increase the cost of maintenance.</p>
<p>Better to delete the refs and classes. You can always restore from version control if they are needed later.</p>
| 12,376 |
<p>I am trying to use regular expressions to find a UK postcode within a string.</p>
<p>I have got the regular expression working inside RegexBuddy, see below:</p>
<pre><code>\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\b
</code></pre>
<p>I have a bunch of addresses and want to grab the postcode from them, ex... | <p>repeating your address 3 times with postcode PA23 6NH, PA2 6NH and PA2Q 6NH as test for you pattern and using the regex from wikipedia against yours, the code is..</p>
<pre><code>import re
s="123 Some Road Name\nTown, City\nCounty\nPA23 6NH\n123 Some Road Name\nTown, City"\
"County\nPA2 6NH\n123 Some Road Name... | <p>Try</p>
<pre><code>import re
re.findall("[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}", x)
</code></pre>
<p>You don't need the \b. </p>
| 49,529 |
<p>I have an ASPX page where I am uploading an image to server for on a serverside button click event. In my page, it will show the available image if it exists. When I upload an image, it will replace the old one with the new one. Now after uploading also the same image is getting displayed. How can tackle this? I us... | <p>It's being cached in the browser. To overcome this - alter the url of the image. This can be done by including a timestamp, version number, or guid in the image file name.</p>
| <p>You can reload from the server side</p>
<pre><code>Response.Redirect(Request.URL)
</code></pre>
| 42,571 |
<p>Using web forms I know that you can only have one ASP.NET form on a page. I've done some implementations where I've used Javascript to add other forms to a page to support things like logon controls (that post back to Logon.aspx instead of the current page). I'm wondering if the single form per page is still prese... | <p>You'll probably want to use regular HTML forms in your MVC code with the action attribute pointing to the appropriate controller action. So you can have as many forms on the page as you want.</p>
| <p>You can have as many Html forms as you see <strong>responsible</strong> to use.</p>
| 23,741 |
<p>I'm writing out XML files using the MSXML parser, with a wrapper I downloaded from here: <a href="http://www.codeproject.com/KB/XML/JW_CXml.aspx" rel="noreferrer">http://www.codeproject.com/KB/XML/JW_CXml.aspx</a>. Works great except that when I create a new document from code (so not load from file and modify), the... | <p>Try this, I found this years ago on the web.</p>
<pre><code>#include <msxml2.h>
bool FormatDOMDocument (IXMLDOMDocument *pDoc, IStream *pStream)
{
// Create the writer
CComPtr <IMXWriter> pMXWriter;
if (FAILED (pMXWriter.CoCreateInstance(__uuidof (MXXMLWriter), NULL, CLSCTX_ALL)))
{
... | <p>Unless the library has a format option then the only other way is to use XSLT, or an external pretty printer ( I think htmltidy can also do xml)
There doen't seem to be an option in the codeproject lib but you can specify an XSLT stylesheet to MSXML.</p>
| 19,893 |
<p>I've read (and re-read) Martin Fowler's <a href="http://martinfowler.com/articles/mocksArentStubs.html" rel="noreferrer">Mocks Aren't Stubs</a>. In it, he defines <a href="http://martinfowler.com/articles/mocksArentStubs.html#ClassicalAndMockistTesting" rel="noreferrer">two different approaches to TDD: "Classical" ... | <p>I don't think you need to choose one over the other. Both have their advantages and disadvantages and both are tools for your toolbox.
"Mockist" tdd makes you a bit more flexible in what you can test while classical TDD makes your tests a bit less brittle because they tend to look more at the input/vs output instead... | <p>I am still relatively new at TDD - but the way I was taught/introduced to the differences was to think of it in terms of testing the integration between classes and so that you are not dependent on live data. For instance if I have a class that is pretty much stand-alone - not dependent on other classes I have buil... | 22,330 |
<p>I am using boost::signal in a native C++ class, and I now I am writing a .NET wrapper in C++/CLI, so that I can expose the native C++ callbacks as .NET events. When I try to use boost::bind to take the address of a member function of my managed class, I get compiler error 3374, saying I cannot take the address of a ... | <p>While your answer works, it exposes some of your implementation to the world (Managed::OnSomeEvent). If you don't want people to be able to raise the OnChange event willy-nilly by invoking OnSomeEvent(), you can update your Managed class as follows (based on <a href="http://msdn.microsoft.com/en-us/library/367eeye0(... | <p>After googling some more, I finally found a <a href="http://mr-sharpoblunto.junkship.org/2007/11/mapping-boostsignals-to-net-events.html" rel="nofollow noreferrer">nice blog post</a> about how to do this. The code in that post was a little more than I needed, but the main nugget was to use a global free function tha... | 19,797 |
<p>I would like to Debug .NET Mobile Device Application using multiple instances of Device Emulator. If I right click the project and go to Debug -> Start new instance in Visual Studio 2008 when an instance is already running I get the error</p>
<blockquote>
<p>Unable to copy file
"obj\Debug\MyMobileApp.exe" to
... | <p>I just discovered a way you can (sort of) do this. You can't deploy from two instances of Visual Studio to two instances of the same type of emulator, but you <em>can</em> deploy to instances of two <em>different</em> types of emulator. Although not without a small trick.</p>
<p>To see how this works, open two in... | <p>disconnect device, go to explore and delete all files and folder than was created. Be sure the aplication isnt runing, (taskadmin). Conect again, rebuild, deploy, then f5.</p>
<p>Good Luck</p>
| 43,806 |
<p>Does IIS create the session id when a request is received and where is that saved (client or server)?</p>
<p>How does server recognize that the request is coming from the same user/session?</p>
| <p>The answer to your first question is Yes -- if sessions are used, and Both.</p>
<p>A cookie is a short bit of text passed back and forth between client and server with every request/response.</p>
<p>IIS generates a session id, saves it, and any associated data, and passes the in a cookie to the client (browser).</... | <p>In ASP.net, there are multiple places for the session to be saved, but it's always within the server infrastructure.</p>
<p>The default is the memory of the IIS Process. This means: if you reset IIS (or the whole PC) or even just the application pool within IIS, all sessions are deleted, and the session data is los... | 47,510 |
<p>What to do automatic nightly build of .NET web application and upload to the test server. </p>
<p>Or, if this tool is overkill, please suggest something else.</p>
| <p>I have found this great tutorial: <a href="http://weblogs.asp.net/jdanforth/pages/How-to-Hook-Up-a-VS.NET-2005-Solution-With-CruiseControl.NET-in-a-Few-Minutes.aspx" rel="noreferrer">How to Hook Up a VS.NET 2005 Solution With CruiseControl.NET in a Few Minutes</a>.
It's short but uses a real .Net project to illustra... | <p>I used the instructions and example on the CruiseControl.Net website</p>
<p><a href="http://confluence.public.thoughtworks.org/display/CCNET/Setting+up+from+scratch++Part+01" rel="nofollow noreferrer">Setting up from scratch Part 01</a>.</p>
| 34,008 |
<p>I have a domain that will be accessed by a small, private group of people. So I want to control access via authentication.</p>
<p>The domain has a collection of applications installed that each have their own sub-domain. Eg: domain.com, app1.domain.com, app2.domain.com, app3.domain.com</p>
<p>I'd love to have a si... | <p>Most browsers do not respect the Digest "domain" directive and will not resend credentials for other URIs. As far as I know, Opera is the only browser that honors it.</p>
<p>For Opera, the server(s) must respond with the same "realm" string for each URI in the domain list. In other words, if domain="/test /example"... | <p>I have no experience with something like this myself. But I just took a look at the <a href="http://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html" rel="nofollow noreferrer">Apache documentation</a> and found this:</p>
<blockquote>
<p>The AuthDigestNonceLifetime directive
controls how long the server nonce ... | 46,676 |
<p>We are running Selenium regression tests against our existing code base, and certain screens in our web app use pop-ups for intermediate steps.</p>
<p>Currently we use the commands in the test:</p>
<pre><code>// force new window to open at this point - so we can select it later
selenium().getEval("this.browserbot.... | <p>It works!! Just to make it easier for the folks who prefer selenese.</p>
<p>This worked for me using IE7(normal mode). </p>
<p>What a freaking hassle. Thank the spaghetti monster in the sky for SO or there is no way I would have got this working in IE.</p>
<pre><code><tr>
<td>getEval</td>
... | <p>Try adding some wait statements around the calls that are causing you issues.</p>
<p>I've had the same errors before and the only way I was able to <i>reliably</i> resolve them was by making calls to System.Threading.Thread.Sleep(5000)..</p>
| 12,431 |
<p>I have huge number of Word files I need to merge (join) into one file, and will be time consuming to use the Word merger (one by one). Have you experienced any tool that can handle this job?</p>
| <pre class="lang-vb prettyprint-override"><code>Sub MergeAllDocuments(AllDocumentsPath as String, MasterDocumentPath as String)
Dim MasterDocument As Document
Set MasterDocument = Documents.Open(FileName:=MasterDocumentPath)
TheDocumentPath = Dir(AllDocumentsPath , vbNormal)
While TheDocumentPath <> ""
... | <p>Have you tried using the Word COM api? You can automate lots of things - maybe you can automate a merge.</p>
<p>Do you really need to do an actual merge, or do you want to join the files together. The two things are quite different.</p>
<p>Merging is used when you have two versions of an original file with (potent... | 35,007 |
<p>We run an old Windows NT Machine, fully patched running IIS4.0.</p>
<p>Today we were hit by "linuXploit_crew", and they took down our websites for a minute or two. (luckily we were quick to notice a change on the websites and fix it within minutes of the attack).</p>
<p>However -- After fixing the website, I'm lef... | <p>NT/IIS4 no longer get security updates. Any <em>new</em> exploits will remain <strong>unpatched</strong>. Time to upgrade.</p>
<p>Once you've been "owned" enough to change your site, you can't necessarily trust your logs anymore- they could have been "cleaned" by the attacker.</p>
| <p>IIS 7 + .NET 3.5 SP1 should be a nice upgrade :)</p>
| 19,313 |
<p>With reference to <a href="https://stackoverflow.com/questions/280597/problem-with-date-daymonth-reversing-on-save">Problem with date day/month reversing on save</a></p>
<p>I have further noted that even setting the Session.LCID on the page itself is making no difference what so ever.</p>
<p>How could the environm... | <p>In SQL Server Management Studio, in Security - Logins, right-click the user you're connecting as and click 'Properties'. The bottom combo box is marked 'Default language', change this to "British English" (<em>not</em> just "English").</p>
<p><code>sp_configure 'default language'</code> sets the default language <e... | <p>I encourage you to modify the code that interacts with the database. There are 2 unambiguous date formats that you can use with SQL Server.</p>
<p>You can use yyyy-mm-ddThh:mi:ss.mmm or YYYYMMDD hh:mi:ss.mmm</p>
<p>SQL Server will never mis-interpret dates if you use one of the 2 formats listed above.</p>
<p>In ... | 35,994 |
<p>I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. </p>
<p>Basically the function should return color based on the value inputted. Any ideas ?</p>
| <p>Basically, the general method for smooth transition between two values is the following function:</p>
<pre><code>function transition(value, maximum, start_point, end_point):
return start_point + (end_point - start_point)*value/maximum
</code></pre>
<p>That given, you define a function that does the transition ... | <p>Looking through <a href="http://en.wikipedia.org/wiki/Color_space" rel="nofollow noreferrer">this wikipedia article</a> I personally would pick a path through a color space, and map the values onto that path. </p>
<p>But that's a straight function. I think you might be better suited to a javascript color chooser ... | 20,381 |
<p>In ASPNET, I grew to love the Application and Cache stores. They're awesome. For the uninitiated, you can just throw your data-logic objects into them, and hey-presto, you only need query the database once for a bit of data. </p>
<p>By far one of the best ASPNET features, IMO.</p>
<p>I've since ditched Windows for... | <p>Serializing is quite safe and commonly used. There is an alternative however, and that is to cache to memory. Check out <a href="http://pecl.php.net/package/memcache" rel="noreferrer">memcached</a> and <a href="http://www.php.net/manual/en/book.apc.php" rel="noreferrer">APC</a>, they're both free and highly performa... | <p>It's in theory possible to store objects in sessions. That might get you past the file writing disabled problem. Additionally you could store the session in a mysql memory backed table to speed up the query.</p>
| 15,443 |
<p>I know a lot about C# but this one is stumping me and Google isn't helping.</p>
<p>I have an IEnumerable range of objects. I want to set a property on the first one. I do so, but when I enumerate over the range of objects after the modification, I don't see my change.</p>
<p>Here's a good example of the problem:... | <p>When you call First() it enumerates over the result of this bit of code:</p>
<pre><code>Select(i => new SubItem() {Name = "foo", MagicNumber = i});
</code></pre>
<p>Note that the Select is a lazy enumerator, meaning that it only does the select when you ask for an item from it (and does it <em>every</em> time y... | <p>I suspect something going in the background. Most likely due to the fact the IEnumerables can only be iterated once.</p>
<p>Does it work if you add a 'ToList()' after the call to Select() when assigning to 'items'?</p>
| 41,013 |
<p>With stackoveflow.com in perspective (team of 2-3 engineers building a website project intended to scale) does it make sense to spend effort early in the process of development to build a search based on Lucene/Autonomy… as opposed to a database based full text search. </p>
<p>Pros/Cons:<br>
With a mature Lucene i... | <p>Database fulltext search performance varies from database to database, but it's by far the easiest option to setup. So start with that, and move to lucene or sphinx if it proves to be too slow.</p>
| <p>You should keep it isolated though - don't start throwing SELECTS all over your code if you know you will replace them with a search engine query. Wrap your DB's full text search with a thin abstraction layer that makes sure you don't use database capabilities where you shouldn't.</p>
<p>I second the accepted answe... | 38,315 |
<p>I'm making a twitter client, and I'm evaluating the various ways of protecting the user's login information.</p>
<ul>
<li>Hashing apparently doesn't do it</li>
<li>Obfuscating in a reversable way is like trying to hide behind my finger</li>
<li>Plain text sounds and propably is promiscuous</li>
<li>Requiring the us... | <p>You could make some OS calls to encrypt the password for you.</p>
<p>On Windows:</p>
<ul>
<li>You can encrypt a file (on a NTFS filesystem)</li>
<li>Use the <a href="http://msdn.microsoft.com/en-us/library/ms995355.aspx" rel="nofollow noreferrer">DPAPI</a> from C</li>
<li>Use the DPAPI in .Net by using the <a href... | <p>You can't have your cake and eat it too. Either store the password (which you've ruled out), or don't and require it to be typed in every time (which you've ruled out.)</p>
| 27,868 |
<p>I've connected to a MySQL database using Perl DBI. I would like to find out which database I'm connected to.</p>
<p>I don't think I can use:</p>
<pre><code>$dbh->{Name}
</code></pre>
<p>because I call <a href="http://dev.mysql.com/doc/refman/5.0/en/use.html" rel="noreferrer"><code>USE new_database</code></a> ... | <p>Try just executing the query </p>
<pre><code>select DATABASE();
</code></pre>
<p>From what I could find, the DBH has access to the DSN that you initially connected with, but not after you made the change. (There's probably a better way to switch databases.)</p>
| <p>When you create a connection object it is for a certain database. In DBI's case anyway. I I don't believe doing the SQL <code>USE database_name</code> will affect your connection instance at all. Maybe there is a select_db (My DBI is rusty) function for the connection object or you'll have to create a new connecti... | 39,652 |
<p>is there a managed code (without adding COM component or wrapped called to C++ routines) way to add integrated security to a C# Managed code assembly? </p>
<p>i.e. I want to write a client-server system where the server uses Remoting instead of IIS, but I want the client to automatically pass it's credentials to t... | <p>No - there is no pure managed interface to <a href="http://msdn.microsoft.com/en-us/library/aa380493(VS.85).aspx" rel="noreferrer">SSPI</a>. But, there is an MSDN sample that <a href="http://msdn.microsoft.com/en-us/library/ms973911.aspx" rel="noreferrer">wraps SSPI for you</a>, and then <a href="http://msdn.microso... | <p>When you say "remoting instead of IIS," what exactly do you mean? A remoting endpoint (the server end) is typically hosted in IIS since this gives you lots of stuff for free, like authentication, scaling through load balancing - especially for singlecall type objects - that is to say, you don't want to keep state fo... | 38,277 |
<p>What I want is lots of nodes which can expand making a mind map.</p>
<p>I'd ideally like to expand and collapse nodes. I would like to be able to navigate by either dragging around the page, or by following expanded nodes.</p>
| <p>I have a colleague who needed that kind of functionalities to graph Maven dependencies between projects. He ended up using <a href="http://freemind.sourceforge.net/" rel="nofollow noreferrer">FreeMind</a> to do the visualization. He just had to write an XML file conforming to the FreeMind format. I even think you ca... | <p>I think you are asking for a component that does what Visio can do, except that it can be displayed on a web page. Most likely you would have to create one from scratch, because mind mapping tools are always released as products per se and not customizable components. I suggest looking for a basic drawing/illustrati... | 8,750 |
<p>How does sharepoint identify a file type? For example, SharePoint will not allow you to upload executable files. Suppose if i rename a file extension from .exe to say, .doc, will the sharepoint allow the upload of this file? </p>
| <p>Sharepoint recognize file types using their extensions.</p>
<p>If you are worried about users spreading malicious application/code in your Sharepoint Sites. I suggest you to take a look at <a href="http://www.microsoft.com/forefront/sharepoint/en/us/default.aspx" rel="nofollow noreferrer">Microsoft Forefront For Sh... | <p>I believe there are two ways to identify file types. A naive approach is to check the extension. A more secure approach would be to examine the bits of the file and see what type the file is as many file types have a few bits (<a href="http://en.wikipedia.org/wiki/File_format#Magic_number" rel="nofollow noreferrer">... | 25,218 |
<p>I have seen Jetbrain's ReSharper tool on many "must-have" tool lists. I've installed it on a few occasions over the last few years and it's turned my Visual Studio sluggish and erratic. I generally uninstall it after a week or two because it make VS flaky, I want to like it, but I can't get past the instability. </p... | <p>These previously asked questions should help in answering your <strong>duplicate</strong> question:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/23737/do-you-have-any-tips-to-improve-resharper-andor-visual-studio-performance">Do you have any tips to improve
resharper and/or visual studio
performance ?<... | <p>I've experienced a lot of what you're talking about over the years as well, but I have to say having recently moved to the 4.0 version of ReSharper, a lot of that overhead has been cut down dramatically and it seems to be quite a bit more functional to boot.</p>
<p>Try it again. What's the worst that can happen? Yo... | 20,432 |
<p>I have a .NET application that is meant to be run on a local PC and started from a file share on the LAN.</p>
<p>It works fine on 32 bit Windows XP and Vista workstations.</p>
<p>But it fails with a System.InvalidOperationException on 64 bit Windows Server 2008.</p>
<p>It runs fine locally on all three configurat... | <p>Are the projects set to run in x86 mode? Use the configuration Manager to check.</p>
| <p>My first guess would be Internet Explorer security settings. Try adding your server as a Trusted Site.</p>
| 17,823 |
<p>Let's say I have one class <code>Foo</code> that has a bunch of logic in it and another class <code>Bar</code> which is essentially the same. However, as <code>Foo</code> and <code>Bar</code> are different (but related) entities I need the difference to be apparent from my code (i.e. I can tell whether an instance i... | <p>In my opinion, it's best if <code>Foo</code> and <code>Bar</code> subclass off a common ancestor class (maybe <code>AbstractFoo</code>), which has all the functionality. What difference in behaviour should exist between <code>Foo</code> and <code>Bar</code>? Code that difference as an abstract method in <code>Abstra... | <p>Definitely use a boolean property. It's the simplest solution, unless you foresee the Bar class needing to change it's interface later (e.g. override it's methods).</p>
| 17,284 |
<p>okee, I followed all instructions I could find <a href="https://stackoverflow.com/questions/279170/utf-8-all-the-way-through">here</a>
and i could display all kinds of multilingual characters on my pages...<br>
The problem is in phpmyadmin the japanese characters are replaced by question marks, as in a bunch of <cod... | <p>Mmm, as to your first question do you have Japanese fonts installed on your system? They aren't installed by default on most OSs, but I have no idea what your OS is. Next one is silly but are your Browser settings Ok?</p>
<p>Next question, the answer is no, if you search for 吉永 小百合 it wont' match with Yoshinaga Say... | <p>The problem is that your connection collation is not set to utf-8 (most probably latin1), which you need to display the Japanese characters. You could set it manually by issuing the queries:</p>
<pre><code>SET CHARACTER SET utf8;
SET NAMES utf8;
</code></pre>
<p>Or in your MySQL configuration file:</p>
<pre><code... | 43,123 |
<p>On my homepage I got:</p>
<pre><code><ul id="login">
<li> <a id="loginswitch" href="./login-page">log-in</a> | </li>
<li> <a id="signupswitch" href="./signup-page">sign-up</a> </li>
</ul>
</code></pre>
<p>Via MooTools, I get these anchor elements by i... | <pre><code>window.location = self.location;
</code></pre>
<p><strong>This JavaScript is executing</strong>.</p>
<p>When it executes, the browser is being told to replace the value of <code>window.location</code> with a new value. <strong>Not all browsers</strong> will react the same way here. Some will probably work a... | <p>If they handed me this particular task at work I'd kick it back to design. Unless we're talking about a secure page, or an OpenID login, you should not pop up a log-in or sign-in form. Users need to learn to look for that https: at the top of their page, and never sign in if they don't see it.</p>
| 21,856 |
<p>Say I have a package "mylibrary".</p>
<p>I want to make "mylibrary.config" available for import, either as a dynamically created module, or a module imported from an entirely different place that would then basically be "mounted" inside the "mylibrary" namespace.</p>
<p>I.e., I do:</p>
<pre><code>import sys, type... | <p>You need to monkey-patch the module not only into sys.modules, but also into its parent module:</p>
<pre><code>>>> import sys,types,xml
>>> xml.config = sys.modules['xml.config'] = types.ModuleType('xml.config')
>>> import xml.config
>>> from xml import config
>>> from x... | <p>You can try something like this:</p>
<pre><code>class VirtualModule(object):
def __init__(self, modname, subModules):
try:
import sys
self._mod = __import__(modname)
sys.modules[modname] = self
__import__(modname)
self._modname = modname
self._subModules = subModules
ex... | 48,047 |
<p>I've added cookie support to SOAPpy by overriding HTTPTransport. I need functionality beyond that of SOAPpy, so I was planning on moving to ZSI, but I can't figure out how to put the Cookies on the ZSI posts made to the service. Without these cookies, the server will think it is an unauthorized request and it will... | <p>If you read the <a href="https://pywebsvcs.svn.sourceforge.net/svnroot/pywebsvcs/trunk/zsi/ZSI/client.py" rel="nofollow noreferrer">_Binding class in client.py of ZSI</a> you can see that it has a variable cookies, which is an instance of <a href="http://docs.python.org/lib/module-Cookie.html" rel="nofollow noreferr... | <p>Additionally, the Binding class also allows any header to be added. So I figured out that I can just add a "Cookie" header for each cookie I need to add. This worked well for the code generated by wsdl2py, just adding the cookies right after the binding is formed in the SOAP client class. Adding a parameter to th... | 16,846 |
<p>Consider the following piece of Java code.</p>
<pre><code>int N = 10;
Object obj[] = new Object[N];
for (int i = 0; i < N; i++) {
int capacity = 1000 * i;
obj[i] = new ArrayList(capacity);
}
</code></pre>
<p>Because in Java, all objects live on the Heap, the array does not
contain the objects themselves... | <p>Simply declaring</p>
<pre><code>Object array_of_objects[10];
</code></pre>
<p>in C++ creates 10 default-constructed objects of type Object on the stack.</p>
<p>If you want to use a non-default constructor, that's not so easy in C++. There might be a way with placement new but I couldn't tell you off the top of m... | <p>If you happen to use Qt, you can use the <a href="http://qt-project.org/doc/qt-5.1/qtcore/qvarlengtharray.html" rel="nofollow">QVarLengthArray</a></p>
<p>It takes a size as a second template parameter, and it will statically allocate an array with that size, and use that as the backing for the array instead of the ... | 41,463 |
<p>Is there a standard Java library that handles common file operations such as moving/copying files/folders?</p>
| <p>Here's how to do this with <code>java.nio</code> operations:</p>
<pre><code>public static void copyFile(File sourceFile, File destFile) throws IOException {
if(!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
sour... | <p>Interesting observation:
Tried to copy the same file via various java classes and printed time in nano seconds.</p>
<p>Duration using FileOutputStream byte stream: 4 965 078</p>
<p>Duration using BufferedOutputStream: 1 237 206</p>
<p>Duration using (character text Reader: 2 858 875</p>
<p>Duration using Buffere... | 38,531 |
<p>If I have an inner class, like this:</p>
<pre><code>public class Test
{
public class Inner
{
// code ...
}
public static void main(String[] args)
{
// code ...
}
}
</code></pre>
<p>When I compile it, I expect it should generate two files:</p>
<pre><code>Test.class
Test$Inn... | <p>The SomeClass$1.class represent anonymous inner class</p>
<p>hava a look at the anonymous inner class section <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html" rel="noreferrer">here</a> </p>
| <p>to build up on hhafez : SomeClass$1.class represents anonymous inner classes.
An example of such a class would be </p>
<pre><code>public class Foo{
public void printMe(){
System.out.println("redefine me!");
}
}
public class Bar {
public void printMe() {
Foo f = new Foo() {
public void pri... | 49,848 |
<p>I'm writing a shell script to do some web server configuration. I need to disable all currently active virtual hosts. <code>a2dissite</code> doesn't accept multiple arguments, so I can't do</p>
<pre><code>a2dissite `ls /etc/apache2/sites-enabled`
</code></pre>
<p>Should I use <code>find</code>? Is it safe to manua... | <p>Is your script Debian only? If so, you can safely delete all the symlinks in sites-enabled, that will work as long as all sites have been written correctly, in the sites-available directory.</p>
<p>For example:</p>
<pre><code> find /etc/apache2/sites-enabled/ -type l -exec rm -i "{}" \;
</code></pre>
<p>will prot... | <p>you can edit the httpd.conf and delete the include line for the virtual hosts (at the bottom of the file) </p>
| 22,137 |
<p>I want to skin a vb.net app I made ive googled some stuff and I've seen skinned vb.net apps. </p>
<p>However it seems like any time i try to find someone explaining it its a link to a pay for product.</p>
<p>Does anyone have anything useful on this?</p>
<hr>
<p>I have seen some free ways to do this programatica... | <p>I remember making a "skinnable" vb.net winforms app (a media player) when I was still a student (maybe 6 years ago).</p>
<p>It was ugly, but the way I did it was as follows:</p>
<ol>
<li><p>Select a transparency color. Wherever you use this color the app will be transparent (I used Fuchsia (#FF00FF), which I reca... | <p>Unfortunatly VB.NET does not provide 'skinning' out of the box. It simply uses the standard windows interface. The only changes to the UI are made when you change the display properties.</p>
<p>I'm not aware of an open source project that provides skinning functionality, however I have used a number of commercial p... | 29,517 |
<p>I'm currently designing a database schema that's used to store recipes. In this database there are different types of entities that I want to be able to tag (ingredients, recipe issuers, recipes, etc). So a tag has multiple n:m relations. If I use the "three table design", this would result in tables (cross table) ... | <p>I don't see anything wrong with having a single table for all tag assignments (as opposed to multiple tables - one for each taggable entity). </p>
<p>However, one important detail in your design remains ambiguous to me: if you are going to have something along these lines</p>
<pre><code>- - - - - - - - - -
Tag
... | <p>Howabout this?</p>
<p>Types( PK:<strong>Type</strong>,set_id[,TypeDesc])</p>
<p>Attributes( PK:(<strong>set_id</strong>,FK:<strong><em>Type</em></strong>),Value)</p>
<p>PS: Bold/Italics Realy Suck</p>
| 38,786 |
<p>Now this is all way simplified, but here goes:</p>
<p>I have a User Control that consists only of a single *.ascx file. The control has no code-behind: it's just a script with a few functions, like this:</p>
<pre><code><%@ Control Language="VB" EnableViewState="False" ClassName="MyControlType" %>
<script... | <p>Weird works for me.</p>
<pre><code>Imports Microsoft.VisualBasic
Public Class MyControlType
Inherits UserControl
End Class
</code></pre>
<p>.</p>
<pre><code><%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Src="~/WebUserControl.ascx" TagPr... | <p>Place this in your code behind declarations </p>
<pre><code>protected <solutionName>.<controlName> myControl1; /*C#*/
</code></pre>
<p>here myControl1 is the id of your user control. Now you may call public functions of this control. </p>
| 47,090 |
<p>Has anyone successfully talked <a href="http://www.profibus.com/" rel="noreferrer">profibus</a> from a .NET application?</p>
<p>If you did, what device/card did you use to accomplish this, what was the application, and did you use any kind of preexisting or available code?</p>
| <p>We've not used Profibus, but have used <strong>DeviceNET</strong> (another CAN based protocol), <strong>Ethernet/IP</strong> and <strong>ControlNet</strong> which all have similar challenges.</p>
<p>We've been doing this since the late 1990's and therefore rely mainly on our own generated code using off-the-shelf h... | <p>Try this: <a href="http://libnodave.sourceforge.net" rel="nofollow noreferrer">http://libnodave.sourceforge.net</a></p>
| 9,220 |
<p>How do I check if a given object is nullable in other words how to implement the following method...</p>
<pre><code>bool IsNullableValueType(object o)
{
...
}
</code></pre>
<p>I am looking for nullable <em>value types.</em> I didn't have reference types in mind.</p>
<pre><code>//Note: This is just a sample. The ... | <p>There are two types of nullable - <code>Nullable<T></code> and reference-type.</p>
<p>Jon has corrected me that it is hard to get type if boxed, but you can with generics:
- so how about below. This is actually testing type <code>T</code>, but using the <code>obj</code> parameter purely for generic type infe... | <p>a simple way to do this:</p>
<pre><code> public static bool IsNullable(this Type type)
{
if (type.IsValueType) return Activator.CreateInstance(type) == null;
return true;
}
</code></pre>
<p>these are my unit tests and all passed</p>
<pre><code> IsNullable_String_ShouldReturn_True
... | 49,005 |
<p>I have a filename in a format like:</p>
<blockquote>
<p><code>system-source-yyyymmdd.dat</code></p>
</blockquote>
<p>I'd like to be able to parse out the different bits of the filename using the "-" as a delimiter.</p>
| <p>You can use the <a href="http://en.wikipedia.org/wiki/Cut_(Unix)" rel="noreferrer">cut command</a> to get at each of the 3 'fields', e.g.:</p>
<pre><code>$ echo "system-source-yyyymmdd.dat" | cut -d'-' -f2
source
</code></pre>
<p>"-d" specifies the delimiter, "-f" specifies the number of the field you require</p>
| <p>The simplest (and IMO best way) to do this is simply to use <code>read</code>:</p>
<pre><code>$ IFS=-. read system source date ext << EOF
> foo-bar-yyyymmdd.dat
> EOF
$ echo $system
foo
$ echo $source $date $ext
bar yyyymmdd dat
</code></pre>
<p>There are many variations on that theme, many of which ar... | 7,194 |
<p>I am having a problem getting a list of fields from a query defined at run time by the users of my program. I let my users enter a SQL query into a memo control and then I want to let them go through the fields that will return and do such things as format the output, sum column values and so forth. So, I have to ... | <p>Replied again 'coz I'm interested. My methods works (with my queries) because they have been pre-defined with the params' datatypes preset to the correct type:)</p>
<p>I'm not sure how you are expecting the query to know or derive the datatype of the param given that you are not even selecting the field that it ope... | <pre><code>TmpQuery.ParamByName('MyDateTimeParam').DataType := ftDate;
TmpQuery.ParamByName('MyDateTimeParam').Clear;
TmpQuery.ParamByName('MyDateTimeParam').Bound := True;
</code></pre>
| 32,570 |
<p>So basically we have lots of SharePoint usage log files generated by our SharePoint 2007 site and we would like to make sense of them. For that we're thinking of reading the log files and dumping into a database with the appropriate columns and all. Now I was going to make an SSIS package to read all the text files ... | <p>This is the script we use to load IIS log files in a SQL Server database:</p>
<pre><code>LogParser "SELECT * INTO <TABLENAME> FROM <LogFileName>" -o:SQL -server:<servername> -database:<databasename> -driver:"SQL Server" -username:sa -password:xxxxx -createTable:ON
</code></pre>
<p>The <code... | <p>Sorry I found out that Sharepoint Logs are not the same as IIS logs. They are different. How can we parse them?</p>
| 21,910 |
<p>I have a footer that is a 1 x 70px, which is set as the background and tiles horizonally.</p>
<p>In cases when the web page does not contain a lot of content on it, it will display the footer above where the footer should be. I want it to fill in with a solid color, so if they scroll down, it won't show the footer,... | <p>Please clarify - do you want solid green at the bottom? If so, just set a green background for body...</p>
<pre><code>body {
background-color:#060;
}
</code></pre>
<p>That should give you the result in your second screenshot. Change the color to match the bottom of your gradient image.</p>
<p>If you want th... | <p>You can use </p>
<pre><code>position:absolute;
bottom: 0;
</code></pre>
<p>to put the footer at the bottom always...</p>
| 25,728 |
<p>Sometimes I have to work on code that moves the computer clock forward. In this case some .cpp or .h files get their latest modification date set to the future time.</p>
<p>Later on, when my clock is fixed, and I compile my sources, system rebuilds most of the project because some of the latest modification dates a... | <p>I would recommend using a virtual machine where you can mess with the clock to your heart's content and it won't affect your development machine. Two free ones are <a href="http://www.microsoft.com/Windows/products/winfamily/virtualpc/default.mspx" rel="nofollow noreferrer">Virtual PC</a> from Microsoft and <a href=... | <p>I don't use windows - but surely there is something like awk or grep that you can use to find the "future" timestamped files, and then "touch" them so they have the right time - even a perl script.</p>
| 8,608 |
<p>I need to import a large CSV file into an SQL server. I'm using this :</p>
<pre><code>BULK
INSERT CSVTest
FROM 'c:\csvfile.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
</code></pre>
<p>problem is all my fields are surrounded by quotes ("... | <p>Try <code>FIELDTERMINATOR='","'</code></p>
<p>Here is a great link to help with the first and last quote...look how he used the substring the SP</p>
<p><a href="http://www.sqlteam.com/article/using-bulk-insert-to-load-a-text-file" rel="noreferrer">http://www.sqlteam.com/article/using-bulk-insert-to-load-a-text-fil... | <p>Yup, K Richard is right: <code>FIELDTERMINATOR = '","'</code></p>
<p>See <a href="http://www.sqlteam.com/article/using-bulk-insert-to-load-a-text-file" rel="nofollow noreferrer">http://www.sqlteam.com/article/using-bulk-insert-to-load-a-text-file</a> for more info.</p>
| 12,206 |
<p>OK, I have just been reading and trying for the last hour to import a CSV file from access into MySQL, but I can not get it to do it correctly, no matter what I try.</p>
<p>My table is like so:</p>
<pre><code>+-----------------+-------------
| Field | Type
+-----------------+-------------
| ARTICLE_NO ... | <p>Your fields are terminated by ";" not "\"". Change</p>
<pre><code> FIELDS TERMINATED BY '\"'
</code></pre>
<p>to</p>
<pre><code> FIELDS TERMINATED BY ';'
</code></pre>
<p>You could add this as well:</p>
<pre><code> OPTIONALLY ENCLOSED BY '"'
</code></pre>
<p>which I think is what you were trying to do with th... | <p>it commonly happens that what you're using as the "FIELDS TERMINATED BY" string actually occurs inside one of the fields, check this by writing a little program to .split() each line in the file and count the fields. Hopefully, you control how the input file is generated and can use somehting extremely unlikely, li... | 33,219 |
<p>I want to connect to a USB Webcam in .NET, specifically using C#. Being new to .NET I don't know what kind of support there is in the standard libraries for doing so. I found one example on the web that copies bitmaps through the clipboard, but that seems very hacky (and probably slow). Is there a better way?</p>
| <p>You will need to use <a href="https://learn.microsoft.com/en-gb/windows/win32/wia/-wia-startpage" rel="nofollow noreferrer">Windows Image Acquisition (WIA)</a> to integrate a webcam with your application. There are plenty examples of this readily available. Here is a <a href="https://learn.microsoft.com/en-gb/archi... | <p>On my computer, WIA was painstakingly sloooow... so i decided to give the <a href="http://windowssdk.msdn.microsoft.com/en-us/library/ms713477(VS.80).aspx" rel="nofollow noreferrer">Windows Multimedia Video Capture</a> a try.</p>
<p>You can find a demo <a href="http://www.timvw.be/wp-content/code/csharp/testavicap3... | 13,851 |
<pre><code>function Submit_click()
{
if (!bValidateFields())
return;
}
function bValidateFields() {
/// <summary>Validation rules</summary>
/// <returns>Boolean</returns>
...
}
</code></pre>
<p>So, when I type the call to my bValidateFields() function intellisence in Visual Studio doesn'... | <p>I recall an issue where having turned off the Navigation Bar in VS stopped a lot of the JS intellisense from working properly. If you have it turned off, try turning the Navigation Bar on again and see if it helps.</p>
<p>Edit: You may also have to do Ctrl+Shift+J to force the IDE to update the intellisense.</p>
... | <p>Did you try adding the <code>/// <reference></code> comment at the top of the external library? I've run into this in the past and it resolved my issue.</p>
| 26,981 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.