instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>After reading <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c">Hidden Features of C#</a> I wondered, What are some of the hidden features of Java?</p>
| <p><a href="http://www.c2.com/cgi/wiki?DoubleBraceInitialization" rel="nofollow noreferrer">Double Brace Initialization</a> took me by surprise a few months ago when I first discovered it, never heard of it before.</p>
<p><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html" rel="nofollow noref... | <p>Surprises me that an interface can extend multiple interfaces but class can extend only one class.</p>
| 3,631 |
<p>lsof is an increadibly powerful command-line utility for unix systems. It lists open files, displaying information about them. And since most everything is a file on unix systems, lsof can give sysadmins a ton of useful diagnostic data.</p>
<p>What are some of the most common and useful ways of using lsof, and whic... | <p>To show all networking related to a given <code>port</code>:</p>
<pre><code>lsof -iTCP -i :port
lsof -i :22
</code></pre>
<p>To show connections to a specific host, use <code>@host</code></p>
<pre><code>lsof -i@192.168.1.5
</code></pre>
<p>Show connections based on the host and the port using <code>@host:port</c... | <pre><code>lsof +f -- /mountpoint
</code></pre>
<p>lists the processes using files on the mount mounted at /mountpoint. Particularly useful for finding which process(es) are using a mounted USB stick or CD/DVD.</p>
| 13,170 |
<p>Is there a fast algorithm for finding the Largest Common Substring in two <code>strings</code> or is it an NPComplete problem?</p>
<p>In PHP I can find a needle in a haystack:</p>
<pre><code><?php
if (strstr("there is a needle in a haystack", "needle")) {
echo "found<br>\n";
}
?>
</code></pre>
<p... | <p>I have since found <a href="http://en.wikipedia.org/wiki/Longest_common_substring_problem" rel="nofollow noreferrer">a relevant wikipedia article</a>. It is not a NP complete problem, it can be done in O(mn) time using a dynamic programming algorithm.</p>
<p>In PHP I found the <a href="http://us3.php.net/manual/en/... | <p>Please have a look at <a href="http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_substring#PHP" rel="nofollow noreferrer">Algorithm implementation/Strings/Longest common substring</a> on Wikibooks. I haven't tested the PHP implementation but it seems to match the general algorithm on the W... | 43,661 |
<p>I've written a little web site in my effort to learn vb.net and asp.net, fairly happy with it so rented some space and uploaded it, it was written using asp.net express edition 2008 and sql server express .... I've uploaded it and I've found that it was written in .NET 3.5 and my host only deals with 2.01 ... I've s... | <p>Are you using the SqlMembershipProvider to store your users in your database? Check your config file's section and make sure the connectionStringName refers to the name of your connection string.</p>
| <p>Cheers for your help people, changed my web.config to</p>
<pre><code><?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings>
<add name="DatebaseConnectionString" connectionString="ohh wouldn't you like to know" />
</connectionStrings>
<system.w... | 32,653 |
<p>I am using bash in os X Terminal app, and my custom $PS1 breaks when I scroll through my history.</p>
<pre><code>PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\n\[${red}\$${NC}\]"
</code></pre>
<p>also tried
PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\r\n[${red}\$${NC}]" </p>
<p>The problem seems to be in the newline. ... | <p>You need the [ and ] arond every escape sequence; do $BLUE and the like include these? If not, they need to be bracketed with these calls.</p>
| <p>If the problem seems to be with the newline, try putting \r\n instead of just \n and see if it makes a difference.</p>
| 13,086 |
<pre><code>url = "http://example.com/file.xml"
data = urllib2.urlopen(url)
data.read()
</code></pre>
<p>The question is, when exactly will the file be downloaded from the internet? When i do urlopen or .read()? On my network interface I see high traffic both times. </p>
| <p><strong><em>svn:external</em></strong> will cause Subversion to combine different repository paths on check-out, but ultimately those paths are still 'disjoint', so you have to do two commits to get the changes applied.</p>
<p>Here's the relevant quote from <a href="http://svnbook.red-bean.com/en/1.5/svn-book.html#... | <p>I think I remember reading about a bug relating to this in TortoiseSVN that's been fixed in the latest release. Check the latest <a href="http://tortoisesvn.tigris.org/tsvn_1.5_releasenotes.html" rel="nofollow noreferrer">release notes</a>.</p>
| 27,580 |
<p>So the ADO.NET Entity Framework has gotten a little bit of bad press (in the form of blog entries and a petition) but I don't want to rush to judgement. I'm limited in time for experimentation but I was wondering has anyone worked with it yet with more empirical feedback? </p>
<p>Finally, what are thoughts on using... | <p>NHibernate may be more mature. That does not necessarily mean it is a "better" solution. Having used it at my job for some time, I would personally prefer to use almost anything than NHibernate (even straight SQL, if migration were remotely feasible). The number of error messages thrown by NHibernate that don't mean... | <p>I do have a problem with SubSonic. SubSonic choked to death on tables with same name but different schema. I don't want to discuss the best practices of building a database, because I did not make the call to do so.( When it comes to raise voice make a point and keep the job, I'd rather keep my job. :) )</p>
| 3,875 |
<p>Are there official MIME types for the .cs (C# source), .resx, .aspx, etc. files in a .NET project? </p>
<p>If no official types are defined, any recommendations on good MIME types? This will be exposed via Apache and the <code>mod_dav_svn</code> module when viewing a Subversion repository from a web browser, so any... | <p>Use the information on this <a href="https://stackoverflow.com/questions/58510/in-c-how-can-you-find-the-mime-type-of-a-file-based-on-the-file-signature-not-t#58514">answer</a> to easily determine the MIME types.</p>
<p>For example (running on Windows XP SP2) I got the following results:</p>
<ul>
<li><strong>cs</s... | <p>Apparently Gnome uses text/x-csharp for C# source files, but I'd personally expect .cs and .aspx files to be text/plain and .resx to be text/xml.</p>
| 25,517 |
<p>I have a rich client application that uses Castle Windsor. At the moment all the assemblies including the application exe are in the one folder but it all looks rather untidy. I would like to put my dlls inside a subfolder such as "bin" but this prevents Castle from locating types etc when called upon. In fact the a... | <p>That depends on how you are configuring the Windsor.</p>
<p>In case you use Castle.MicroKernel.Registration interface, you should load assemblies manually and then register loaded types in the container.</p>
| <p>You can use a custom XmlInterpreter to initialize your container with.
Create a class that inherits XmlInterpreter and put the following override in that class:
This one processes all *.dll.config in the directory of the current executing assembly, which easily could be rewritten to use a recursive file lookup of so... | 41,083 |
<p>I have a .net winforms app which has a few animation effects, fade ins and scroll animations etc. These work fine however if I'm in a Remote Desktop Protocol session the animations start to grate.</p>
<p>Can someone suggest a way of determining whether or not an app is running across an RDP session so I can turn t... | <p>Assuming you're at least on .NET Framework 2.0, there's no need to use P/Invoke: just check the value of <code>System.Windows.Forms.SystemInformation.TerminalServerSession</code> (<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.terminalserversession(VS.80).aspx" rel="noreferre... | <p>Use the <a href="http://msdn.microsoft.com/en-us/magazine/cc164123.aspx" rel="nofollow noreferrer">GetSystemMetrics()</a> function in the user32.dll. Use <a href="http://ttp://msdn.microsoft.com/en-us/library/ms724385.aspx" rel="nofollow noreferrer">PInvoke</a> to call it. The following is sample code provided by ... | 37,753 |
<p>I have a line of Fortran code, which includes some text. I'm changing the text, which makes the code line too long for Fortran, so I split it over two lines using 'a'. </p>
<p>Was:</p>
<pre><code> IF (MYVAR .EQ. 1) THEN
WRITE(iott,'(A) (A)') 'ABC=', SOMEVAR
</code></pre>
<p>Changed to:</p>
<pre><code> IF (... | <p>If you're worried about exceeding a 72 column limit, then I assume you're using Fortran 77. The syntax for Fortran 77 requires that you start with column 7, except for continued lines, which need a continuation character in column 6. I use the following method to tell me how many lines are continued for one statem... | <p>It's been too long for me to remember the old column requirements of FORTRAN (and they may not even be as strict as they were way back when).</p>
<p>But - isn't this something that a quick test run will tell you straight off? </p>
| 48,825 |
<p>Is there a way to test an application where you simulate a hundred different clients connecting to a IIS server and asking the same data? At the customer where our project is running they have 400 computers and they often do stress tests with all computers. I on the other hand have only got my laptop... (and a devel... | <p>ab is a tool that was designed for Apache, <a href="http://www.cyberciti.biz/tips/howto-performance-benchmarks-a-web-server.html" rel="noreferrer">but you can use it with IIS</a>.</p>
| <p>Trty this tool , i've tested my website seems to work well > <a href="http://www.softpedia.com/get/Internet/Servers/Server-Tools/x0Bench.shtml#download" rel="nofollow noreferrer">x0Bench</a></p>
| 38,377 |
<p>Currently, I'm in the process of hiring a web developer who will be working on a site that processes credit cards. While he won't have the credentials to log into the payment gateway's UI he will have access to the API login and transaction key since it's embedded in the application's code.</p>
<p>I'd like to be aw... | <p>Do they really need access to your production sites?</p>
<p>Don't store the key in your code, store it in your production database, or on a file on the production server.</p>
| <p>From your description it seems that this developer will have access to the customer cards detail in which case the customers privacy may be compromised. You might consider wording the contract appropriately to make sure that this angle is covered.</p>
<p>However the main point is that if you're working on a sensiti... | 20,128 |
<p>I have two arrays containing the same elements, but in different orders, and I want to know the extent to which their orders differ.</p>
<p>The method I tried, didn't work. it was as follows:</p>
<p>For each list I built a matrix which recorded for each pair of elements whether they were above or below each other ... | <p>Mean square of differences of indices of each element.</p>
<pre><code>List 1: A B C D E
List 2: A D C B E
</code></pre>
<p>Indices of each element of List 1 in List 2 (zero based)</p>
<pre><code>A B C D E
0 3 2 1 4
</code></pre>
<p>Indices of each element of List 1 in List 1 (zero based)</p>
<pre><code>A B C D ... | <p>There is a branch-and-bound algorithm that should work for any set of operators you like. It may not be real fast. The pseudocode goes something like this:</p>
<pre><code>bool bounded_recursive_compare_routine(int* a, int* b, int level, int bound){
if (level > bound) return false;
// if at end of a and b... | 49,533 |
<p>In my company, I am implementing a java based html browser. I found a lot of tools to generate complete browsers only in Swing which are looking like Mozilla. But I was not able to find a browser which supports JavaScript. The browser I will implement should execute JavaScript inside the HTML sides.</p>
<p>Do you k... | <p>I'd look at <a href="https://github.com/lobobrowser/LoboBrowser" rel="nofollow noreferrer">Lobo</a>. It sounds like just want you want. It has a HTML Renderer and parser, and some support for Javascript. If it's missing a feature of Javascript that you need, it seems like it would easier to contribute to Lobo, in... | <p><em>In my company, I am implementing a java based html browser.</em></p>
<p>Good God, why?</p>
<p>That said, <a href="http://today.java.net/pub/a/today/2004/05/24/html-pt1.html" rel="nofollow noreferrer">this page at java.net</a> discusses some options; you could search it more extensively.</p>
| 46,623 |
<p>the object of the game in this case is to use a Treeview with a sitemap provider - and implement using CSS. I'm guessing the way to do this is with the CSS adapter kit. </p>
<p>I've plugged in the adapters using the DLL implementation and there i get my basic treeview but it seems to pull in all sorts of js that le... | <p>I would use a repeater as in this example taken from the asp.net data access tutorials:</p>
<pre><code><asp:Repeater runat="server" ID="menu" DataSourceID="SiteMapDataSource1">
<ItemTemplate>
<li>
<asp:HyperLink runat="server"
NavigateUrl='<%# Eval("Url")... | <p>The CSS adapters are provided as SAMPLE code. That's why they come in their own namespace and not in a System or Microsoft namespace. The idea is that you can customise them to suit your own needs.</p>
<p>If you don't need the Js, edit the code and remove it. Alternatively, use your own code instead.</p>
| 46,626 |
<p>The following VBA code works great in Excel 2003, but results in a <em>Stack Overflow Error</em> in Excel 2007. The code is required to either unlock or lock certain cells based on a drop-down menu selection. I need to be able to run the code in both Excel 2003 and 2007. Please help.</p>
<pre><code>Private Sub Wor... | <p>The stack overflow almost certainly comes from recursion. Not sure why you aren't getting a stack overflow in Excel 2003 - perhaps an error is being raised before the stack overflows. </p>
<p>You can protect against infinite recursion something like the following:</p>
<pre><code>Private m_bInChange As Boolean
P... | <p>Your method gets called whenever ANY cell in the worksheet changes. Your "NO" block changes the contents of the target cells, which causes the method to be called again.</p>
<p>Options:</p>
<ol>
<li>Use a flag variable as Joe suggested, to see if you're already executing</li>
<li><p>Test the "Target" value to see... | 45,577 |
<p>I am mulling over a web-app in Perl that will allow users to create bug monitors. So essentially each "bug watch" will be a bug ID that will be passed to a sub routine along with the "sleep" time, and once the "sleep time" is over it must recur without blocking the parent process or th... | <p>What's wrong with Schedule::Cron? You can make any subroutine reference that you like, so you can make closures that refer to the extra or specific data you need. You don't have to rely on the argument list. Was there something else about the module that didn't work for you?</p>
| <p>@(brian d foy): The reasons why i think Schedule::Cron is good for me
1: $cron->add_entry doesn't seem to provide me an option to pass @arrays/$vars to the subs.</p>
<p>$cron->add_entry("$temp",{'subroutine' => \&test1,'arguments' => \@array}); is not allowed.</p>
<p>2: I am not sure if there is a way to ad... | 40,450 |
<p>What is the best way to create a clone of a DTO? There is not an ICloneable interface or a BinaryFormatter class in Silverlight. Is reflection the only way?</p>
| <p>Here is the code we came up with for cloning. This works in Silverlight 2 & 3.</p>
<pre><code>Public Shared Function Clone(Of T)(ByVal source As T) As T
Dim serializer As New DataContractSerializer(GetType(T))
Using ms As New MemoryStream
serializer.WriteObject(ms, source)
ms.Seek(0, Se... | <p>I believe the standard cloning functionality was left out to keep it simple and lightweight. I believe you could use either JSON or XML serialization to achieve the same thing though. Not sure about the performance costs though. </p>
| 24,791 |
<p>I have this regex I built and tested in regex buddy.</p>
<pre><code>"_ [ 0-9]{10}+ {1}+[ 0-9]{10}+ {2}+[ 0-9]{6}+ {2}[ 0-9]{2}"
</code></pre>
<p>When I use this in .Net C# </p>
<p>I receive the exception</p>
<pre><code>"parsing \"_ [ 0-9]{10}+ +[ 0-9]{10}+ +[ 0-9]{6}+ [ 0-9]{2}\" - Nested quantifier +."
</code... | <p>.NET is complaining about the <code>+</code> after the <code>{n}</code> style quantifier as it doesn't make any sense. <code>{n}</code> means match exactly n of a given group. <code>+</code> means match one or more of a given group. Remove the <code>+</code>'s and it'll compile fine.</p>
<pre><code>"_ [ 0-9]{10}... | <p>They're right. This version of your regex doesn't fail:</p>
<p><code>(_ [ 0-9]{10})+(\s{1})+([ 0-9]{10})+(\s{2})+([ 0-9]{6})+\s{2}[ 0-9]{2}</code></p>
<p>Notice the use of parens to create groups that then can repeat one or more times. Also, you should be more specific and use \s instead of a space, as pattern w... | 25,798 |
<p>I read <a href="https://stackoverflow.com/questions/218123/what-was-the-strangest-coding-standard-rule-that-you-were-forced-to-follow#220591">this answer</a> and its comments and I'm curious: Are there any reasons for not using <code>this</code> / <code>Self</code> / <code>Me</code> ?</p>
<p>BTW: I'm sorry if this ... | <p>Warning: Purely subjective answer below.</p>
<p>I think the best "reason" for not using this/self/me is brevity. If it's already a member variable/function then why redundantly add the prefix? </p>
<p>Personally I avoid the use of this/self/me unless it's necessary to disambiguate a particular expression for the... | <p>as for me i use <code>this</code> to call methods of an instantiated object whereas <code>self</code> is for a static method</p>
| 43,200 |
<p>I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser.</p>
<p>How do I use jQuery to get the set of images, filter it to broken images then replace the src?</p>
<hr/>
<p>--I thought it would be easier to do this with jQuery, ... | <p>Handle the <code>onError</code> event for the image to reassign its source using JavaScript:</p>
<pre><code>function imgError(image) {
image.onerror = "";
image.src = "/images/noimage.gif";
return true;
}
</code></pre>
<pre><code><img src="image.png" onerror="imgError(this);"/>
</code></pre>
<... | <p>I found this to work best, if any image fails to load the first time, it is completely removed from the DOM. Executing <code>console.clear()</code> keeps the console window clean, since the 404 errors cannot be omitted with try/catch blocks. </p>
<pre><code>$('img').one('error', function(err) {
// console.log... | 11,818 |
<p>My friend was given this free google website optimizer tshirt and came to me to try and figure out what the front logo meant.</p>
<p><a href="http://2.bp.blogspot.com/_iQVgmEEAit4/SPkKHA3e8fI/AAAAAAAAAB8/ugUerJjuBw8/s1600-h/GWO-tshirt.jpg" rel="nofollow noreferrer">t-shirt</a></p>
<p>So, I have a couple of guesses... | <p>I emailed the Website Optimizer Team, and they said "There's no secret code, unless you find one. :)"</p>
| <p>Well, I can't see an immediate pattern. But if you are testing IP, why not take two blocks of 4 as a single binary number.</p>
| 31,422 |
<p>As part of our product release we ship Apache HTTP Server binaries that we have compiled on our (UNIX) development machine.</p>
<p>We tell our clients to install the binaries (on their UNIX servers) under the same directory structure that we compiled it under. For some clients this is not appropriate, e.g. where th... | <p>I think the way to do(get around) this problem is to develop a "./configure && make" script that your client uses to install, specify and compile the binaries. That would offcourse require that the client has all the source-code installed on his server or you can make it available on an NFS share.</p>
| <blockquote>
<p>I think the way to do(get around) this problem is to develop a "./configure && make" script that your client uses to install, specify and compile the binaries. That would offcourse require that the client has all the source-code installed on his server or you can make it available on an NFS sh... | 4,213 |
<p>I am struggling to make a decision regarding the correct organisation for a web service. Should I have multiple ASMX's representing the different functionality in the web service, or should I have a single ASMX?</p>
<p>If I have multiple ASMX's, does this not constitute multiple web services?</p>
<p>If I have a si... | <p>I would recommend multiple .asmx's mapping to different functional aspects of your app, otherwise you're going to end up with a whopper of an end point. Far too often I see a single endpoint with about 50 web service methods, it's nasty on the end user's dev to have to work with that.</p>
<p>Kev</p>
| <p>A way solve the problem of multiple asmx described in the original question.</p>
<p>Read this <a href="http://www.freddes.se/2009/02/16/multiple-web-service-references-sharing-types/" rel="nofollow noreferrer">http://www.freddes.se/2009/02/16/multiple-web-service-references-sharing-types/</a></p>
<p>and get to kno... | 39,674 |
<p>I've been hearing conflicting facts about this topic. What is correct?</p>
| <p>You've been hearing conflicting views because it's a topic of great confusion, even among senior engineers. In short, simply placing an assembly in the GAC does implicitly give it full trust, but this can be overriden via security policy.</p>
<p>EDIT1: Let me add that a common thought is if you don't trust an assem... | <p>I'll try to give an example that may help clear things up. Let's say you have a web app that runs medium trust. It needs to do something that requires full trust, so you create a class library project (assembly) to do that task and install it to the GAC. In testing, the new assembly performs it's function flawles... | 16,241 |
<p>I am using fscanf to read a file which has lines like<br>
Number <-whitespace-> string <-whitespace-> optional_3rd_column </p>
<p>I wish to extract the number and string out of each column, but ignore the 3rd_column if it exists</p>
<p>Example Data:<br>
12 foo something<br>
03 bar<br>
24 something #rand... | <p>The problem is that the <code>%*s</code> is eating the number on the next line when there's no third column, and then the next <code>%d</code> is failing because the next token is not a number. To fix it without using <code>gets()</code> followed by <code>sscanf()</code>, you can use the character class specified:<... | <p>I often use gets() followed by an sscanf() on the string you just, er, gots.</p>
<p>Bonus: you can separate the test for end-of-input from the parsing.</p>
| 30,496 |
<p>I'm running SqlServer 2005 express edition on my laptop for development purposes. It seems that when I open a connection to the database, the setup time is REALLY slow. It can take up to 10 seconds to get a connection. I usually have multiple connections open at the same time (Profiler, Development environment, Quer... | <p>I figured it out. The problem was I had multiple databases with AutoClose set to true. I shut it off in all my databases and the problem went away.</p>
<p>see <a href="http://www.sqlservercentral.com/articles/Administering/autoclosefordatabases/891/" rel="nofollow noreferrer">this article</a> for more info.</p>
| <p>Are you sure the connection is the bottleneck? Is it your conn.Open() line that is taking 10 seconds? </p>
| 19,878 |
<p>Does anyone know which property sets the text color for disabled control?
I have to display some text in a disabled <code>TextBox</code> and I want to set its color to black.</p>
| <p><strong>NOTE:</strong> see Cheetah's answer below as it identifies a prerequisite to get this solution to work. Setting the <code>BackColor</code> of the <code>TextBox</code>.</p>
<hr>
<p>I think what you really want to do is enable the <code>TextBox</code> and set the <code>ReadOnly</code> property to <code>true... | <p>If you want to display text that cannot be edited or selected you can simply use a label</p>
| 34,821 |
<p>I know there are at least 10 different ways to structure project in version control. I'm curious what some methods being used are and which ones work for you. I've worked with SVN, TFS, and currently/unfortunately VSS. I've seen version control implemented very poorly and just OK, but never great.</p>
<p>Just to ... | <p>Example for SVN: </p>
<p>trunk/</p>
<p>branch/</p>
<p>tags/</p>
<p>The trunk should be kept at a point where you can always push a release from it. There should be no huge gaping bugs that you know about(of course there will be eventually but that is what you should strive for). </p>
<p>Every time you need to m... | <p>We migrated from the bad world of VSS with one giant repository (over 4G) before switching to SVN. I really struggled with how to set up the new repository for our company. Our company is very "old" school. It's difficult to get change I'm one of the younger developers and I'm 45! I am part of a corporate develo... | 3,752 |
<p>While running a batch file in Windows XP I have found randomly occurring error message:</p>
<blockquote>
<p>The system cannot find the batch label specified name_of_label</p>
</blockquote>
<p>Of course label existed. What causes this error?</p>
| <p>Actually, you need 2 conditions for this to happen:</p>
<ul>
<li>the batch file must not use CRLF line endings</li>
<li>the label you jump to must span a block boundary (as opposed to and :end label wich is just a shortcut to the end of your script)</li>
</ul>
<p>See. <a href="https://web.archive.org/web/20160305063... | <p>Little different use case ...</p>
<p>I was calling a bat script during <strong>packer</strong> build of Windows Server 2012 Server, using the <em>shell</em> provisioner (OpenSSH).
Now, the script was working fine through cmd in the provisioned Virtual Machine (put breakpoint in packer build to stop and confirmed th... | 28,790 |
<p>I have a WiFi module that only needs two wires connection to work. These are RX and TX pins connected to Arduino or the CR-10S printer board but I don't know if there is any physical or software UARTs TX and RX pins. My goal is to add a Wifi support to the CR-10S printer. Since this is not Arduino and the pins are n... | <p>You are looking for a capacitor that must be connected to Pin 4 of the LM2596.</p>
<p>Maybe you could provide a better picture of that area so we could see the different tracks on the board.</p>
<p>The LM2596 is in the center of the right side of the board (it is also labeled with LM2596D). The pins should be cou... | <h1>You are looking at the wrong board</h1>
<p>Your board might on the surface look like a Creality v 2.0 board, and is indeed from the same family of boards. After trying to discern the parts and finally resorting to google image search, I almost had to maniacally laugh:</p>
<p>The currently latest version is the <a h... | 1,099 |
<p>Most of the time, the errors you get from your model properties will happen when you're saving data. For instance, if you try saving a string as an IntegerProperty, that will result in an error.</p>
<p>The one exception (no pun intended) is ReferenceProperty. If you have lots of references and you're not completely... | <p>I'm having similar difficulties for my project. As I code the beta version of my application, I do create a lot of dead link and its trully a pain to untangle things afterward. Ideally, this tool would have to also report of the offending reference so that you could pin-point problems in the code.</p>
| <p>You could extend and customize ReferenceProperty to not throw this exception, but then it'll need to return something - presumably None - in which case your template will simply throw an exception when it attempts to access properties on the returned object.</p>
<p>A better approach is to fetch the referencepropert... | 47,907 |
<p>I am making an web based appliaction in java (using jsp). When the appliaction is invoked login page will come, when the user enter the valid credientials, he will be taken to the index page. But the problem is, when the login is success, the index page is coming but it is opening behind the login page. (means login... | <p>I had the exact same problem this week! I fixed it by creating an action in the ActionManager on the mainform. This action opens the help file and has the F1-key set as shortcut. It also works for all MDI child screens.</p>
| <p>F1 help processing is built into Delphi, so all you have to do is handle the help messages properly. This may be as little as setting the helpfile property for the application. You can set particular pages using the form's help??? properties.</p>
<p>Basically, just use the help system supplied and forget keydown. T... | 27,817 |
<p>What commands in Emacs can I use to insert into the text buffer of a file the current date and time?</p>
<p><em>(For example, the equivalent in Notepad is simply pressing F5 which is about the only useful feature for Notepad!)</em></p>
| <pre><code>C-u M-! date
</code></pre>
| <p>Here's my take on it. </p>
<pre class="lang-el prettyprint-override"><code>(defun modi/insert-time-stamp (option)
"Insert date, time, user name - DWIM.
If the point is NOT in a comment/string, the time stamp is inserted prefixed
with `comment-start' characters.
If the point is IN a comment/string, the time stam... | 31,386 |
<p>I've been curious in the past few months in trying my hand at doing some assembly for the SPARC processor (either V8 or V9). My question is this, I have no access to a SPARC machine, is there a way I can run SPARC binaries on my x86 machine? I've looked at QEMU but I am not too sure how to set it up.</p>
| <p><A HREF="https://www.simics.net/" rel="nofollow noreferrer">SimICS</A> emulates a Sparc platform. Academic and personal licenses are free.</p>
<p><B>Edit:</B> I didn't do SimICS justice in my initial response, it is a very useful tool for Sparc-based development. You can instrument, profile, and explore the behavio... | <p>Please have a look at <a href="http://www.stromasys.com" rel="nofollow">http://www.stromasys.com</a>, CHARON-SPK meets your requirements.
Also <a href="http://www.stromasys.ch/virtualization-solutions/virtual-sparcstation/" rel="nofollow">http://www.stromasys.ch/virtualization-solutions/virtual-sparcstation/</a> cou... | 19,433 |
<p>Is there an FTP browser hiding away in NetBeans 6.1? The help manual doesn't even suggest FTP exists. </p>
<p>All I've been able to find so far is a tree viewer in the Services panel (no edit controls) and the ability to upload projects, folders and specific files from the Projects/Files views. Is there anywhere to... | <p>It looks like something was recently added to netbeans for php... </p>
<p><a href="http://blogs.oracle.com/netbeansphp/entry/ftp_support_added" rel="nofollow noreferrer">http://blogs.oracle.com/netbeansphp/entry/ftp_support_added</a></p>
<p>don't know if you can make use of that...</p>
| <p>The remotefs addin works for 6.5:
<a href="http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=13195" rel="nofollow noreferrer">remotefs</a></p>
<p><a href="https://i.stack.imgur.com/VoQbL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VoQbL.png" alt="alt text"></a><br>
... | 4,093 |
<p>I have a strange issue with my heated bed. It has been working well for a long time, but recently it has developed an issue where the temperature reported by the thermistor will occasionally jump by around 10 degrees.</p>
<p><a href="https://i.stack.imgur.com/aMRF7.png" rel="noreferrer"><img src="https://i.stack.im... | <p>It really looks like either a bad thermistor or bad electrical joints. Are the connections to the thermistor itself crimped, or soldered? Are there connectors near the thermistor that can get heated up by the bed?</p>
<p>Electrical connections that are mechanical in nature (such as crimped, or using a connector) ca... | <p>It really looks like either a bad thermistor or bad electrical joints. Are the connections to the thermistor itself crimped, or soldered? Are there connectors near the thermistor that can get heated up by the bed?</p>
<p>Electrical connections that are mechanical in nature (such as crimped, or using a connector) ca... | 138 |
<p>My users are presented a basically a stripped down version of a spreadsheet. There are textboxes in each row in the grid. When they change a value in a textbox, I'm performing validation on their input, updating the collection that's driving the grid, and redrawing the subtotals on the page. This is all handled by ... | <p>Use the semaphore (let's call it StillNeedsValidating). if the SaveForm function sees the StillNeedsValidating semaphore is up, have it activate a second semaphore of its own (which I'll call FormNeedsSaving here) and return. When the validation function finishes, if the FormNeedsSaving semaphore is up, it calls the... | <p>You don't have a race condition, race conditions can not happen in javascript since javascript is single threaded, so 2 threads can not be interfering with each other.</p>
<p>The example that you give is not a very good example. The setTimeout call will put the called function in a queue in the javascript engine, a... | 43,884 |
<p>Searching for a string within a string is extremely well supported in .NET but what do you do when the data you need to search isn't a string?</p>
<p>I have binary data arriving in regular chunks via a NetworkStream. Packets are binary but they all start with a signature sequence of bytes. I accumulate the chunks i... | <p>You can use Array.IndexOf to find a single byte.</p>
<p>However, I would caution you that some valid data might accidentally be your signature and completely throw off your application. A better solution in my opinion would be to always send a four byte integer that contains the size of the packet. Then read that m... | <p>Can you use unmanaged/unsafe code? If so I would probably suggest looking into using pointer arithmetic for searching your byte array. That is how strings are effective. You can do similar.</p>
<p>another solution could be to use a dictionary to store your packet data. Have the key be your signature. Then its rathe... | 23,090 |
<p>I'm looking at doing some work (for fun) in a compiled language to run some simple tests and benchmarks against php.</p>
<p>Basically I'd like to see what other people use for C++ CGI programming. (Including backend database, like mysql++ or something else)</p>
| <p>I'm not sure exactly what you're looking for, but there is a C++ web framework called wt (pronounced "witty"). It's been kept pretty much up to date and if you want robust C++ server-side code, this is probably what you're looking for.</p>
<p>You can check it out and read more at the <a href="http://www.webtoolkit.... | <p>I've found very pleasant to use <a href="http://cppcms.com/wikipp/en/page/main" rel="nofollow">CppCMS</a> to develop a <em>Fast CGI</em> app to deploy in a <a href="http://nginx.org/" rel="nofollow">nginx</a> server - although it never went in production =( . The CppCMS project also includes some libraries for SQL c... | 40,827 |
<p>The age old question. Where should you put your business logic, in the database as stored procedures ( or packages ), or in the application/middle tier? And more importantly, Why?</p>
<p>Assume database independence is not a goal.</p>
| <p>Put enough of the business logic in the database to ensure that the data is consistent and correct.</p>
<p>But don't fear having to duplicate some of this logic at another level to enhance the user experience.</p>
| <p>Business logic is usually embodied by objects, and the various language constructs of encapsulation, inheritance, and and polymorphism. For example, if a banking application is passing around money, there may be a Money type that defines the business elements of what "money" is. This, opposed to using a primitive de... | 14,535 |
<p>How exactly do DLL files work? There seems to be an awful lot of them, but I don't know what they are or how they work.</p>
<p>So, what's the deal with them?</p>
| <p><strong>What is a DLL?</strong></p>
<p>Dynamic Link Libraries (DLL)s are like EXEs but they are not directly executable. They are similar to .so files in Linux/Unix. That is to say, DLLs are MS's implementation of shared libraries. </p>
<p>DLLs are so much like an EXE that the file format itself is the same. B... | <p>DLLs (Dynamic Link Libraries) contain resources used by one or more applications or services. They can contain classes, icons, strings, objects, interfaces, and pretty much anything a developer would need to store except a UI.</p>
| 15,152 |
<p>Similar to <a href="https://stackoverflow.com/questions/188141/c-list-orderby-alphabetical-order">List<> OrderBy Alphabetical Order</a>, we want to sort by one element, then another. we want to achieve the functional equivalent of </p>
<pre><code>SELECT * from Table ORDER BY x, y
</code></pre>
<p>We have ... | <p>Do keep in mind that you don't need a stable sort if you compare all members. The 2.0 solution, as requested, can look like this:</p>
<pre><code> public void SortList() {
MyList.Sort(delegate(MyClass a, MyClass b)
{
int xdiff = a.x.CompareTo(b.x);
if (xdiff != 0) return xdiff;
... | <p>I had an issue where OrderBy and ThenBy did not give me the desired result (or I just didn't know how to use them correctly). </p>
<p>I went with a list.Sort solution something like this.</p>
<pre><code> var data = (from o in database.Orders Where o.ClientId.Equals(clientId) select new {
OrderId = o.id,
... | 36,796 |
<p>I am trying to use the <code>System.Net.Mail.MailMessage</code> class in C# to create an email that is sent to a list of email addresses all via <code>BCC</code>. I do not want to include a <code>TO</code> address, but it seems that I must because I get an exception if I use an empty string for the <code>TO</code> a... | <p>I think if you comment out the whole <code>emailMessage.To.Add(sendTo);</code> line , it will send the email with <code>To</code> field empty.</p>
| <p>Must have a to address. It has been this way since the original sendmail an implementations in the 80s and all SMTP mailers, I know of, have the same requirement. You can just use a dummy address for to. </p>
| 38,809 |
<p>I have the following two fields on my web page: <code>BookAuthor</code> and <code>BookDescription</code>. On submit, the page searches against Lucene index using the given search criteria.</p>
<p>If the user does not type in anything in the two fields and submits the page, how do I make Lucene.Net return all the b... | <p>Like a NumericUpDown?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.numericupdown.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.numericupdown.aspx</a></p>
| <p><a href="http://devexpress.com" rel="nofollow noreferrer">DevExpress</a> have such a <a href="http://devexpress.com/Products/NET/Controls/WinForms/Editors/editors/SpinEdit.xml" rel="nofollow noreferrer">SpinEdit</a> component in their suite</p>
| 44,598 |
<p>What design pattern should I use to handle both forms authentication and active directory? (Administrative setting will allow you to chose either one of them).</p>
<p>From what I know, .NET membership provider only has forms right?</p>
| <p>.Net Membership lets you use Windows or Passport as well as forms authentication.</p>
<p>There is an ActiveDirectoryMembershipProvider. Click on "How to use forms authentication with Active Directory" in the links at the top of <a href="http://msdn.microsoft.com/en-us/library/ms998372.aspx#pagpractices0001_authhowt... | <p>To answer your design pattern question. On a project that had a similar situation (using two different systems for authentication), we used the <a href="http://en.wikipedia.org/wiki/Facade_pattern" rel="nofollow noreferrer">Facade pattern</a> to abstract away which system was actually doing the authentication (one o... | 31,801 |
<p>I have some event handler on a boundary class that manages a persistence mechanism for a given generic transaction:</p>
<pre><code>void MyBoundaryClass::MyEventHandler(...)
{
//retrieve stuff from the UI
//...
//declare and initialize trasaction to persist
SimpleTransaction myTransaction(.../*pass down stuf... | <p>Considering that:</p>
<ul>
<li>the <a href="https://stackoverflow.com/questions/99688/private-vs-public-members-in-practice-how-important-is-encapsulation#100035">concept of encapsulation</a> is about defining a container, and </li>
<li>object-oriented design is based on the concept of message passing (invocation o... | <p>The level of encapsulating should be <strong>directly linked to the cohesion</strong> of your object. Your object must do a single task or must be divided in multiple class and encapsulate all its behaviors and properties.</p>
<p><strong>A rule of thumb</strong> is when it's time to test your object. If you are doi... | 31,922 |
<p>In Java you can give the number zero as a single parameter for the Socket or DatagramSocket constructor. Java binds that Socket to a free port then. Is it possible to limit the port lookup to a specific range?</p>
| <p>Hrm, after reading the docs, I don't think you can. You can either bind to any port, then rebind if it is not acceptable, or repeatedly bind to a port in your range until you succeed. The second method is going to be most "efficient".</p>
<p>I am uneasy about this answer, because it is... inelegant, yet I really ca... | <p>You might glance at the java code that implements the function you are using. Most of the java libraries are written in Java, so you might just see what you need in there.</p>
<p>Assuming @Kenster was right and it's a system operation, you may have to simply iterate over ports trying to bind to each one or test it... | 14,083 |
<p>I'm trying to get the <a href="http://go.microsoft.com/fwlink/?LinkID=106001&clcid=0x409" rel="nofollow noreferrer">MVCToolkit</a> working with an ASP.NET MVC Beta application and ran into an unresolved reference to System.Web.Extensions version 3.6 (ASP.NET MVC Beta comes with System.Web.Extensions version 3.5)... | <p>One thing you might want to consider is Google's 404 script for doing just what you mentioned. It probably wouldn't be as good as a custom solution, but it may be worth trying out to be sure.</p>
<p><a href="http://googlewebmastercentral.blogspot.com/2008/08/make-your-404-pages-more-useful.html" rel="nofollow nore... | <p>One thing you might want to consider is Google's 404 script for doing just what you mentioned. It probably wouldn't be as good as a custom solution, but it may be worth trying out to be sure.</p>
<p><a href="http://googlewebmastercentral.blogspot.com/2008/08/make-your-404-pages-more-useful.html" rel="nofollow nore... | 42,721 |
<p>I have a c# struct where I need to forbid calling the no args constructor on it.</p>
<pre><code>MyStruct a;
/// init a by members // OK
MyStruct b = MyStruct.Fact(args); // OK, inits by memebers
MyStruct s = new MyStruct(); // can't have that
</code></pre>
<p>I'm doing this mostly to force explicet values for a... | <p>You can't. All structs have a public parameterless constructor by definition in C#. (In the CLR almost none of them do, but they can always act as if they have.) See <a href="https://stackoverflow.com/questions/333829">this question</a> for why you can't define your own parameterless constructors on structs (in C#, ... | <p>Put it in its own assembly and have the MyStruct() without the args as a Internal (Friend in VB). Have the Factory in the same assembly as MyStruct() but with a Public accessor.</p>
<p>Now the factory can access the no args MyStruct, but anything calling from outside the assembly must use the Factory.</p>
<p>Edit... | 44,446 |
<p>I'm not sure I'm using all the correct terminology here so be forgiving.</p>
<p>I just put up a site with a contact form that sends an email using the PHP mail() function. Simple enough. However the live site doesn't actually send the email, the test site does. So it's not my code. </p>
<p>It's a shared host and w... | <p>Hey guys thanks for the answers, it is really appreciated.</p>
<p>After ignoring the issue for a few months it has come up again, I did however find the answer to my problems.</p>
<p>Firstly, as you answers suggested, PHP and the mail() function were working as expected. The mail was getting sent.</p>
<p>The prob... | <p>Yes, you could put in what ever you want in the 'from' field and it would still work.</p>
| 5,960 |
<p>What's the easiest way to print a stacktrace from a debugging printout? Often during testing you would like to know the callstack leading up to the situation provoking a debug message.</p>
| <p><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#dumpStack()" rel="noreferrer">Thread.dumpStack();</a></p>
| <p>Just because I needed it myself:</p>
<p>As inspired by answer <a href="https://stackoverflow.com/questions/421280/in-java-how-do-i-find-the-caller-of-a-method-using-stacktrace-or-reflection">How do I find the caller of a method using stacktrace or reflection?</a> , you can retrieve the call stack using </p>
<pre><... | 7,854 |
<p>I've been working on database-driven web applications for a few years now and recently took on a project involving a CMS that is XML-capable. This has led me to think about the usage of XML/XSLT in general and in what situations it would be more useful than the approach I've always used, which is storing all of my d... | <p>To quote <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0321150406/102-0503816-7711357" rel="noreferrer">This Book</a> (Effective XML: 50 Specific Ways to Improve Your XML):</p>
<blockquote>
<p>“XML is not a database. It was never
meant to be a database. It is never
going to be a database. Relational
... | <p>Some applications use XML files to store configuration, I prefer to use <a href="http://www.sqlite.org/" rel="nofollow noreferrer">SQLite</a> to do so.</p>
| 24,614 |
<p>If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table?</p>
| <p><a href="https://web.archive.org/web/20180330233216/http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/" rel="noreferrer">Here is one hack</a> that may work. It isn't clean, but it looks like it might work:</p>
<p>Essentially, you just try to update ... | <pre><code>DELIMITER @@
DROP TRIGGER IF EXISTS trigger_name @@
CREATE TRIGGER trigger_name
BEFORE UPDATE ON table_name
FOR EACH ROW
BEGIN
--the condition of error is:
--if NEW update value of the attribute age = 1 and OLD value was 0
--key word OLD and NEW let you distinguish between the old and new value of a... | 2,239 |
<p>I know I could write scripts and create jobs to run them, but at least some of what I'm wanting it to do is beyond my programming abilities for that to be an option.</p>
<p>What I'm imagining is something that can run on a regular schedule that will examine all the databases on a server and automatically shrink dat... | <p>If you are using SQL Server 2005. Fire up the Management Studio and look at the Maintenance Plan section.</p>
<p>See <a href="http://msdn.microsoft.com/en-us/library/ms189036.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms187658.aspx</a> for an overview and <a href="http://msdn.microsoft... | <p>yeah everything you described (except maybe perf monitoring) can be done with database maintenance plans, back ups, shrinking log files etc.</p>
| 4,300 |
<p>I'd like to keep a "compile-counter" for one of my projects. I figured a quick and dirty way to do this would be to keep a text file with a plain number in it, and then simply call upon a small script to increment this each time I compile.</p>
<p>How would I go about doing this using the regular Windows command lin... | <p>You can try a plain old batchfile.</p>
<pre><code>@echo off
for /f " delims==" %%i in (counter.txt) do set /A temp_counter= %%i+1
echo %temp_counter% > counter.txt
</code></pre>
<p>assuming the count.bat and counter.txt are located in the same directory.</p>
| <p>If you don't mind running a Microscoft Windows Based Script then this jscript will work OK. just save it as a .js file and run it from dos with "wscript c:/script.js".</p>
<pre><code>var fso, f, fileCount;
var ForReading = 1, ForWriting = 2;
var filename = "c:\\testfile.txt";
fso = new ActiveXObject("Scripting.F... | 6,207 |
<p>This is an issue I've run into with a website I'm designing. I'm using a template based design for the site, so the information on the page is thrown inside the template when the page is accessed. The information shown changes based on the page attribute passed in as a GET request.</p>
<p>So, to actually load the i... | <p>in short no. if you're using a program that is able to use a different template engine though, it can possibly at least produce valid HTML which won't cause dreamweaver to freak out. it sounds like you might not be the developer of the application generating the templates, but if you're interested, <a href="http://w... | <p>I did a very similar thing and I ended up just setting up a web based visual editor. the client could edit the main body of some pages online. That may be your best solution. unfortunetly I don't remember the name of the editor that I could set to edit only certain parts of the page. I will respond again when i ... | 15,245 |
<p>I have written a few MSBuild custom tasks that work well and are use in our CruiseControl.NET build process.</p>
<p>I am modifying one, and wish to unit test it by calling the Task's Execute() method. </p>
<p>However, if it encounters a line containing </p>
<pre><code>Log.LogMessage("some message here");
</code><... | <p>You need to set the .BuildEngine property of the custom task you are calling. </p>
<p>You can set it to the same BuildEngine your current task is using to include the output seamlessly.</p>
<pre><code>Task myCustomTask = new CustomTask();
myCustomTask.BuildEngine = this.BuildEngine;
myCustomTask.Execute();
</code... | <p>In assembly <code>System.Web</code> in <code>namespace</code> <code>System.Web.Compilation</code> is a class <code>MockEngine</code> which implements <code>IBuildEngine</code> <code>interface</code> in a way which describes Tim Murphy. </p>
| 32,615 |
<p>I have a little demonstration below of a peculiar problem.</p>
<pre><code>using System;
using System.Windows.Forms;
namespace WindowsApplication1
{
public class TestForm : Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
priv... | <p>Firstly, thanks for the complete program - it made it <em>much</em> easier to work out what was going on!</p>
<p>While the textbox isn't visible, it isn't resized. When you select tabPage1, the Selected event fires <em>before</em> the controls become visible and the textbox gets laid out again.</p>
<p>Now, that's ... | <p>Not sure if I understand the problem.
But, you might use textbox's resize event to capture the width change OR form's resize.</p>
<p>In your example, does the select event of tabPage1 fire when you do step 3?</p>
| 28,152 |
<p>My project is based on spring framework 2.5.4. And I try to add aspects for some controllers (I use aspectj 1.5.3).</p>
<p>I've enabled auto-proxy in application-servlet.xml, just pasted these lines to the end of the xml file:</p>
<pre><code><aop:aspectj-autoproxy />
<bean id="auditLogProcessor" class="co... | <p>Your breakpoints aren't being hit because you are using Spring's AOP Proxies. See <a href="http://static.springframework.org/spring/docs/2.5.x/reference/aop.html#aop-understanding-aop-proxies" rel="nofollow noreferrer">understanding-aop-proxies</a> for a description of how AOP Proxies are special. </p>
<p>Basically... | <p>Is this as simple as spelling? or are there just typos in the question?
Sometimes you write <code>rebuildThumbnail</code> and sometimes you write <code>rebildThumbnail</code></p>
<p>The methods you are trying to override with advice are not final methods in the MVC framework, so whilst bpapas answer is useful, my u... | 6,073 |
<p>I have a website in which I provide tool-tips for certain things using a hidden <code><span></code> tag and JavaScript to track various mouse events. It works excellently. This site somewhat caters towards people with vision issues, so I try to make things degrade as well as possible if there is no JavaScript ... | <p>Perhaps you need to re-think the way you are providing tooltips. Could the content be contained in the title attribute of a semantically appropriate element?</p>
<p>EDIT: If you provide more info, someone might be able to suggest more of a solution. What sorts of elements are the tooltips popping up on? Images? ... | <p>CSS is also used by screenreaders to help define which page elements are read or not.
Screen readers will almost always <strong>ignore</strong> elements with <em>display:none</em> applied to them, so not using CSS is not a valid indicator of a screenreader's presence.</p>
<p>I would go with <strong>Chris</strong>' ... | 18,121 |
<p>I'm trying to get a class memeber variable list at run time. I know this probably using typeof and reflections. but can't find an example. Please someone shed light for me.</p>
<p>Here is pseudo code example:</p>
<pre><code>Class Test01
{
public string str01;
public string str02;
public int myint01;
}
</code><... | <p>If you're after public <em>fields</em> just use <a href="http://msdn.microsoft.com/en-us/library/system.type.getfields.aspx" rel="noreferrer"><code>tt.GetType().GetFields()</code></a></p>
<p>If you need other members, use <a href="http://msdn.microsoft.com/en-us/library/system.type.getproperties.aspx" rel="noreferr... | <pre><code>foreach (MemberInfo mi in tt.GetType().GetMembers()) ...
</code></pre>
| 44,132 |
<p>This might be too opinionated a question, but looking for help!</p>
<p>I have been trying to refine my ASP.NET MVC program structure. I just started using it at preview 5 and it is my first foray into business application development -- so everyting is new!</p>
<p>At the controller level, I have a service object ... | <p>I typically do basic validation (required fields, email format, etc.) in the controller action when the form is submitted. I then let the business layer handle validation that requires business knowledge. I usually double check the basic stuff in the business layer as well, so if I expose that logic through web serv... | <p>I have come across this same issue in a recent project. First, to restate the problem, I am trying to follow the domain-centric approach of DDD. I have entities composed into aggregates that can validate themselves, and the repositories verify validity on save. The UI can also get validity information from an aggre... | 37,649 |
<p>Which reporting technology would fit for the best situation/type of product? I am now thinking of <strong>3</strong> technologies:</p>
<ol>
<li>Embedded Reports (Crystal Reports;MS Reporting services) </li>
<li>Server reports (MS Reporting Services) </li>
<li>OLAP Databases (MS Analysis Services)</li>
</ol>
<p>Whi... | <p>OLAP isn't a reporting platform, it's in the database layer. </p>
<p>If you're going to have a collection of pre-planned, canned reports, then Crystal or RS are the best ideas. Personally I prefer Crystal but it can be quite a pain to develop reports - but when they're approved, Crystal is a rock steady platform. (... | <p>We are using XtraReports from DevExpress. The ratio price/productivity is very high and you can get source codes.</p>
<p>You can use it for desktop or web applications ( or export to pdf, doc, html, etc...) and end-user designer is delivered natively by DevExpress. I believe, this is one of the best reporting suite... | 14,057 |
<p>While working between a Windows MySQL server and a Debian MySQL server, I noticed that warnings were fatal on Windows, but silently ignored on Debian. I'd like to make the warnings fatal on both servers while I'm doing development, but I wasn't able to find a setting that effected this behavior. Anyone have any idea... | <p>I think what you're looking for is the sql_mode parameter in my.conf. STRICT_ALL_TABLES is the value. I guess it depends what you mean by "fatal".</p>
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html</a><... | <p>Look at enabling strict mode in the /etc/my.ini file.</p>
| 8,975 |
<p>How many rows should be in the (main) buffer of a virtual Listview control?</p>
<p>I am witting an application in pure 'c' to the Win32 API. There is an ODBC connection to a database which will retrieve the items (actually rows). </p>
<p>The MSDN sample code implies a fixed size buffer of 30 for the end cache (W... | <p>Use the ListView_ApproximateViewRect (or the LVM_APPROXIMATEVIEWRECT message) to get the view rect height.</p>
<p>Use the ListView_GetItemRect (or the LVM_GETITEMRECT message) to get the height of an item.</p>
<p>Divide the view rect height by the height of an item to get the number of items that can fit in your v... | <p>@Brian R. Bondy Thanks for the explicit help for how to do get the number of items. In fact I was all ready working my way to understanding that it could be done (for list or report view) with ListView_GetCountPerPage, and I would use you way to get it for for the others, though I don't need the ListView_Approxima... | 6,940 |
<p>What are the lesser-known but useful features of the Python programming language?</p>
<ul>
<li>Try to limit answers to Python core.</li>
<li>One feature per answer.</li>
<li>Give an example and short description of the feature, not just a link to documentation.</li>
<li>Label the feature using a title as the first l... | <h2>Chaining comparison operators:</h2>
<pre><code>>>> x = 5
>>> 1 < x < 10
True
>>> 10 < x < 20
False
>>> x < 10 < x*10 < 100
True
>>> 10 > x <= 9
True
>>> 5 == x > 4
True
</code></pre>
<p>In case you're thinking it's doing <code>1 ... | <pre><code>is_ok() and "Yes" or "No"
</code></pre>
| 12,670 |
<p>I have a JEdit (BeanShell) macro which opens a specific file then immediately saves the file to my c:\temp folder (so that I don't accidentally update the real file).</p>
<p>Here is the bean shell code:</p>
<pre><code>logFilePath = "c:\\temp\\aj.txt";
jEdit.openFile( view , logFilePath );
_buffer = jEdit.g... | <p>You can try <a href="http://community.jedit.org/?q=node/view/4026" rel="nofollow noreferrer">this solution</a>, calling <code>VFSManager.waitForRequests();</code>.</p>
| <p>You can also do it less bold.</p>
<ol>
<li>use the return value of jEdit.openFile(), this is already the Buffer, no need for getBuffer()</li>
<li>Do not call VFSManager.waitForRequests() which waits for ALL requests to be done, but simply add a BufferListener to the Buffer you got from jEdit.openFile() and do your ... | 37,846 |
<p>I have a client that's been struggling with slow loading pdf files on the web.
My client has some very large pdf files that are almost 10 Mb. They take upwards of 3-4 minutes to download. The files will not display until the whole file is loaded.
We and they have seen other's sites where the pdfs load one page at ... | <p>That's just another stupidness of distutils. I personally remove this annoying check in my distutils installation on every windows machine I have to use.</p>
<p>Installing another mingw version would work as long as it passes the version check - but really, the whole idea of checking version of the tools does not m... | <p>You could try <a href="http://www.develer.com/oss/GccWinBinaries" rel="nofollow noreferrer">this</a> unofficial MinGW distribution, it has a simple install process that sets up distutils to use it for compiling extensions.</p>
| 38,270 |
<p>If I am evaluating two variables and not two method calls does it matter weather I use "&&" or "&"</p>
<pre><code>//some logic that sets bool values
boolean X = true;
boolean Y = true;
if (X & Y){
// perform some operation
}
if (X && Y){
// perform some operation
}
</code></pre>
<p... | <p>Always use && if you are performing a true/false logic test. A single & performs a bit-wise 'and'. It make work like a logic test in some cases but it is not guaranteed to work for all logic cases. The most common use of a single & is when applying a bit-mask.</p>
<p>Examples (&&):</p>
<p... | <p>& is a bitwise operator while && is the AND operator. Two completely different operations.</p>
<pre><code>int a = 1;
int b = 2;
assert (a & b == 0)
assert (a && b == true)
</code></pre>
<p>EDIT: Ooops...this example doesn't work in C#. It should in C++. Hopefully it illustrates the intent... | 36,371 |
<p>I am planning to use this to poll a database which can take close to 10-15 minutes or more, so should I be using timers for this.</p>
| <p>If you want the task to complete quickly but what you need to do actually takes longer, you could split it up into two pieces. Have one that runs when the Timer fires, so you get things happening at the right time, but then defer the serious processing to another function (say, in a different thread) that can take a... | <p>The answer is, it depends. If you are only going to have this one polling task run, and the interval is more than sufficient for each run to finish before the next one begins, then this solutions will work fine.</p>
<p>The problem is when there is more than one TimeTask on the same Timer, since they execute sequen... | 44,577 |
<p>I'm developing a library for use in other apps and this library has lots of debugging and logging statements thanks to NLog.</p>
<p>Is it possible to exclude the reference to NLog.dll when I switch to release mode?</p>
<p>Cheers,</p>
| <p>You can manually edit the csproj file, and do something like this:</p>
<pre><code><Reference Include="NLog" Condition="'$(Configuration)' == 'Debug'" />
</code></pre>
<p>This only makes it reference that assembly in Debug. I wouldn't recommend doing this often though, because this behavior isn't reflected in... | <p>There is no reason for removing a reference in case you are sure that no code will be in use from that DLL. In that case you can simply remove DLL.</p>
| 32,563 |
<p>I'm looking to improve my PHP coding and am wondering what PHP-specific techniques other programmers use to improve productivity or workaround PHP limitations.</p>
<p>Some examples:</p>
<ol>
<li><p>Class naming convention to handle namespaces: <code>Part1_Part2_ClassName</code> maps to file <code>Part1/Part2/Class... | <p>Ultimately, you'll get the most out of PHP first by learning generally good programming practices, before focusing on anything PHP-specific. Having said that...</p>
<hr>
<h2>Apply liberally for fun and profit:</h2>
<ol>
<li><p>Iterators in foreach loops. There's almost never a wrong time.</p></li>
<li><p>Design... | <p>I've been developing with PHP (and MySQL) for the last 5 years. Most recently I started using a framework (<a href="http://framework.zend.com" rel="nofollow noreferrer">Zend</a>) with a solid javascript library (<a href="http://www.dojotoolkit.org" rel="nofollow noreferrer">Dojo</a>) and it's changed the way I work ... | 30,123 |
<p>Any useful metrics will be fine</p>
| <p>One of the things that I look for in a code is unit test. This will give the freedom to refactor it. So if the code does not have tests I consider it a legacy code.</p>
| <p>I don't know of any real metrics that can be used to determine if something is "legacy code" or not, but anything older than just written could be considered legacy. Legacy code means different things to different people/organizations, so it really is somewhat subjective.</p>
| 14,481 |
<p>I'm using the Telerik RAD Controls RADEditor/WYSIWYG control as part of a Dynamic Data solution.</p>
<p>I would like to be able to upload files using the Document Manager of this control.</p>
<p>However, these files are larger than whatever the default setting is for maximum upload file size.</p>
<p>Can anyone po... | <p>The Telerik website has instructions <a href="http://www.telerik.com/help/aspnet-ajax/upload_uploadinglargefiles.html" rel="nofollow noreferrer">here</a>.</p>
<p>Short version: in Web.config set the maxRequestLength</p>
<pre><code><system.web>
<httpRuntime maxRequestLength="102400" executionTimeout= "36... | <p><a href="http://www.telerik.com/community/forums/thread/b311D-ekgdc.aspx" rel="nofollow noreferrer">This thread</a> in combination with <a href="https://stackoverflow.com/questions/131728/how-do-i-change-the-maximum-upload-file-size-for-the-document-manager-in-a-tele#131737">Yaakov Ellis's answer</a> may help others... | 15,982 |
<p>Does anyone have a list of email addresses that I can use to test my JS address validation script? I'm looking for as complete of a list as is reasonable to test the most common edge cases, if not all cases.</p>
| <p>Examples valid according to RFC2822</p>
<ul>
<li>me@example.com</li>
<li>a.nonymous@example.com</li>
<li>name+tag@example.com</li>
<li>name\@tag@example.com – this is a valid email address containing two @ symbols.</li>
<li>spaces\ are\ allowed@example.com</li>
<li>"spaces may be quoted"@example.com</li>
<li>!#$%&a... | <p>The domain part (after the last @), is a series of string labels divided by a dot.</p>
<p>Each label is a string of 1 to 63 octets consisting of A-Z, a-z 0-9 or hyphen (-)</p>
<p>The maximum size of the domain is 255 octets.</p>
<p>To be compatible with arpanet, each label must start with a letter and end with a ... | 38,053 |
<p>In an ASP.NET 2.0 website, I have a string representing some well-formed XML. I am currently creating an XmlDocument object with it and running an XSL transformation for display in a Web form. Everything was operating fine until the XML input started to contain namespaces.</p>
<p>How can I read in this string and... | <p>Your code looks right.</p>
<p>The problem is probably in the xml document you're trying to load.
It must have elements with a "w" prefix, without having that prefix declared in the XML document</p>
<p>For example, you should have:</p>
<pre><code><test xmlns:w="http://...">
<w:elementInWNamespace />
... | <p>Your code looks right.</p>
<p>The problem is probably in the xml document you're trying to load.
It must have elements with a "w" prefix, without having that prefix declared in the XML document</p>
<p>For example, you should have:</p>
<pre><code><test xmlns:w="http://...">
<w:elementInWNamespace />
... | 14,757 |
<p>Should I be using this method of throwing errors:</p>
<pre><code>if (isset($this->dbfields[$var])) {
return $this->dbfields[$var];
} else {
throw new FieldNotFoundException($var);
}
</code></pre>
<p>or this style:</p>
<pre><code>try {
return $this->dbfields[$var];
} catch (Exception $e) {
... | <p>The second example is bad. You're taking a lot of overhead to catch an exception when, as you demonstrate, it's just as easy to prevent the exception in the first place. Plus you also assume you know why that exception was thrown - if there was some other exception, like say an out of memory or something, you're r... | <p>Just re-read your explanation.</p>
<p>I guess your method there in #1 is going to catch any exceptions that might be thrown and simply return a bool. I definitely don't like the catching of the generic exception most of the time, so #2 wouldn't be my choice.</p>
| 23,863 |
<p>I have a single spool mbox file that was created with evolution, containing a selection of emails that I wish to print. My problem is that the emails are not placed into the mbox file chronologically. I would like to know the best way to place order the files from first to last using bash, perl or python. I would li... | <p>This is how you could do it in python:</p>
<pre><code>#!/usr/bin/python2.5
from email.utils import parsedate
import mailbox
def extract_date(email):
date = email.get('Date')
return parsedate(date)
the_mailbox = mailbox.mbox('/path/to/mbox')
sorted_mails = sorted(the_mailbox, key=extract_date)
the_mailbox.... | <p>What's the point in rewriting the mbox whereas you can reorder the mails in memory when loading up the mailbox? Which time is the one you want to order on? Receive date? Sent date? Anyway, all the Ruby/Python/Perl modules for playing with mboxes can do that.</p>
| 48,039 |
<p>I need to store some simple properties in a file and access them from Ruby.</p>
<p>I absolutely love the .properties file format that is the standard for such things in Java (using the java.util.Properties class)... it is simple, easy to use and easy to read.</p>
<p>So, is there a Ruby class somewhere that will le... | <p>Is this for a Rails application or a Ruby one?</p>
<p>Really with either you may be able to stick your properties in a yaml file and then <code>YAML::Load(File.open("file"))</code> it.</p>
<hr>
<p><strong>NOTE from Mike Stone:</strong> It would actually be better to do:</p>
<pre><code>File.open("file") { |yf| YA... | <p>Instead of the .properties style of config file, you might consider using YAML. YAML used in Ruby on Rails for database configuration, and has gained in popularity in other languages (Python, Java, Perl, and others).</p>
<p>An overview of the Ruby YAML module is here: <a href="http://www.ruby-doc.org/core/classes/Y... | 12,379 |
<p>There are a few questions on SO already regarding LINQ pivots and while a couple of them outline my exact problem, I can't successfully translate them to a working solution. I feel that this is mostly due to a join in my tables.</p>
<p>So for the benefit of all the LINQ junkies out there who love a problem, here's... | <p>Make the design whatever you want to be, but in ASP.NET side implement your own MembershipProvider. This will translate your DB design into users/roles that .NET can use. After that you can use it as usually - with <code>user.isInRole("Admin")</code> :)</p>
| <p>Assuming you're using .NET, one way to do this is to implement your own Role and Membership Providers. Then, you could add functionality by implementing an interface that contained the items you wanted (I've just knocked this sample up off the top of my head, so I apologize if it seems a bit rough):</p>
<pre><code>... | 45,396 |
<p>We are a group of students doing our Master degree in field of computer science.</p>
<p>This semester we should do a Software engineering project according to the following bottom explanation.</p>
<p>we should exactly act and report as a real Software engineering Team.</p>
<p>I have been chosen as a project manager ... | <p>Your description is somewhat different from your initial question so it's a little confusing. I'll try my best to answer and give you a few tips ...</p>
<p>As a <strong>project manager or leader</strong>, you should be trying to <strong>get the best out of everyone</strong> in your team. Each one of them will be go... | <p>"I will be pleased if some one guide me how to do this project and how to manage this group, and where to start? how to encourage the members, and how to do my plans in practice?"</p>
<p>That's the core problem in all group endeavors. The question is so vague that there is no specific answer. Here's a list of boo... | 30,909 |
<p>What is the best way to format a decimal if I only want decimal displayed if it is not an integer.</p>
<p>Eg:</p>
<pre><code>decimal amount = 1000M
decimal vat = 12.50M
</code></pre>
<p>When formatted I want:</p>
<pre><code>Amount: 1000 (not 1000.0000)
Vat: 12.5 (not 12.50)
</code></pre>
| <pre><code> decimal one = 1000M;
decimal two = 12.5M;
Console.WriteLine(one.ToString("0.##"));
Console.WriteLine(two.ToString("0.##"));
</code></pre>
| <p><strong>Updated following comment by user1676558</strong></p>
<p>Try this:</p>
<pre><code>decimal one = 1000M;
decimal two = 12.5M;
decimal three = 12.567M;
Console.WriteLine(one.ToString("G"));
Console.WriteLine(two.ToString("G"));
Console.WriteLine(three.ToString("G"));
</code></pre>
<p>For a d... | 26,621 |
<p>I am using Oracle 9 and JDBC and would like to encyrpt a clob as it is inserted into the DB. Ideally I'd like to be able to just insert the plaintext and have it encrypted by a stored procedure:</p>
<pre><code>String SQL = "INSERT INTO table (ID, VALUE) values (?, encrypt(?))";
PreparedStatement ps = connection.pr... | <p>There is an example in Oracle Documentation:</p>
<p><a href="http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_obtoo2.htm" rel="nofollow noreferrer">http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_obtoo2.htm</a></p>
<p>You do not need to close it</p>
<pre><code>DECLARE
input_str... | <p>Slightly off-topic: What's the point of the encryption/obfuscation in the first place? An attacker having access to your database will be able to obtain the plaintext -- finding the above stored procedure will enable the attacker to perform the decryption.</p>
| 12,244 |
<p>I've inherited a VB.net project that generates 2 DLLS: one for the web app, and another for the "business layer". This is for a sub-app of a larger web site. (Using VS2005).</p>
<p>The problem is that that something doesn't smell right with the DLL & namespace structure, and I'd like to know if there are any p... | <p>When your program is compiled the full type name is included along with "evidence". This evidence includes the name of the assembly and versioning information. Otherwise it wouldn't know if you wanted the 1.0 or the 1.1 or the 2.0 version of the class. This same system allows it to find different classes in the same... | <p>No there is nothing wrong with overlayed namespaces. Take a look at the .net framework itself where many namespaces are overlayed.</p>
| 17,923 |
<p>I can do an <code>eval("something()");</code> to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#?</p>
<p>An example of what I am trying to do is: I have an integer variable (say <code>i</code>) and I have multiple properties by the names: "Property1", "Property2", "Prope... | <p><strong>DISCLAIMER:</strong> This answer was written back in 2008. The landscape has changed drastically since then.</p>
<p>Look at the other answers on this page, especially the one detailing <code>Microsoft.CodeAnalysis.CSharp.Scripting</code>.</p>
<p>Rest of answer will be left as it was originally posted but is ... | <p>Unfortunately, C# doesn't have any native facilities for doing exactly what you are asking. </p>
<p>However, my C# eval program does allow for evaluating C# code. It provides for evaluating C# code at runtime and supports many C# statements. In fact, this code is usable within any .NET project, however, it is limit... | 2,663 |
<p>I have an Asset object that has a property AssignedSoftware, which is a collection. </p>
<p>I want to make sure that the same piece of Software is not assigned to an Asset more than once. In Add method I check to see if the Software already exist, and if it does, I want to throw an exception. </p>
<p>Is there a ... | <p>From the Class Library design guidelines for errors (<a href="http://msdn.microsoft.com/en-us/library/8ey5ey87(VS.71).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/8ey5ey87(VS.71).aspx</a>):</p>
<blockquote>
<p>In most cases, use the predefined exception types. Only define new exception types for pr... | <p>Well, if you really want an collection with unique items, you might want to take a look at the <a href="http://msdn.microsoft.com/en-us/library/bb359438.aspx" rel="nofollow noreferrer">HashSet object</a> (available in C# 3.0).</p>
<p>Otherwise, there are two approaches that you can take:</p>
<ul>
<li>Create a cust... | 7,840 |
<p>I use Firebug and the Mozilla JS console heavily, but every now and then I run into an IE-only JavaScript bug, which is really hard to locate (ex: <em>error on line 724</em>, when the source HTML only has 200 lines).</p>
<p>I would love to have a lightweight JS tool (<em>a la</em> firebug) for Internet Explorer, so... | <p>You might find <a href="http://getfirebug.com/lite.html" rel="noreferrer">Firebug Lite</a> useful for that. </p>
<p>Its bookmarklet should be especially useful when debugging on a user's machine.</p>
| <ol>
<li>Go to Tools->Internet Options…->Advanced->Enable Script Debugging (Internet Explorer)</li>
</ol>
<p>then attach Visual Studio Debugger when an error occurs.</p>
<p>If you're using IE 8, install the developer toolbar because it has a built in debugger.</p>
| 2,553 |
<p>While simple, interface-driven event notification frameworks in Java have been around since pre-Cambrian times (e.g. java.beans.PropertyChangeSupport), it is becoming increasingly popular for frameworks to use annotation-driven event notification instead. </p>
<p>For an example, see <a href="http://www.jboss.org/f... | <p>You can already do this today with <a href="http://eventbus.org" rel="noreferrer" title="EventBus">EventBus</a>.</p>
<p>Following example is from <a href="http://eventbus.org/confluence/display/EventBus/Getting+Started" rel="noreferrer">EventBus Getting Started guide</a>. Statusbar that updates based on published e... | <p>You can also check out <a href="https://github.com/bennidi/mbassador" rel="nofollow">MBassador</a> It is annotation driven, very light-weight and uses weak references (thus easy to integrate in environments where objects lifecycle management is done by a framework like spring or guice or somethign). </p>
<p>It prov... | 21,541 |
<p>What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of <a href="http://en.cppreference.com/w/cpp/string/byte/atoi" rel="noreferrer">returning zero</a>).</p>
| <p>In the new C++11 there are functions for that: stoi, stol, stoll, stoul and so on.</p>
<pre><code>int myNr = std::stoi(myString);
</code></pre>
<p>It will throw an exception on conversion error.</p>
<p>Even these new functions still have the <strong>same issue</strong> as noted by Dan: they will happily convert t... | <p>In C, you can use <code>int atoi (const char * str)</code>,</p>
<p>Parses the C-string str interpreting its content as an integral number, which is returned as a value of type int.</p>
| 23,630 |
<p>Anybody have a slicker way to do this? Seems like it should be easier than this, but I'm having a mental block. Basically I need to remove items from an dictionary and recurse into the values of the items that are also dictionaries.</p>
<pre><code>private void RemoveNotPermittedItems(ActionDictionary menu)
{
... | <p>You don't really need to collect the keys and iterate them again if you iterate the dictionary in reverse (from 'menu.Count - 1' to zero). Iterating in forward order will, of course, yield mutated collection exceptions if you start removing things.</p>
<p>I don't know what an ActionDictionary is, so I couldn't tes... | <p>Option 1: A Dictionary is still a Collection. Iterate over menu.Values.</p>
<p>You can iterate over menu.Values and remove them as you iterate. The values won't come in any sorted order (which should be fine for your case). You may need to use a for loop and adjust the index rather than using foreach - the enume... | 29,149 |
<p>We have several jobs that run concurrently that have to use the same config info for log4j. They are all dumping the logs into one file using the same appender. Is there a way to have each job dynamically name its log file so they stay seperate?</p>
<p>Thanks<BR>
Tom</p>
| <p>Can you pass a Java system property for each job? If so, you can parameterize like this:</p>
<pre><code>java -Dmy_var=somevalue my.job.Classname
</code></pre>
<p>And then in your log4j.properties:</p>
<pre><code>log4j.appender.A.File=${my_var}/A.log
</code></pre>
<p>You could populate the Java system property w... | <p>You could programmatically configure log4j when you initialize the job.</p>
<p>You can also set the log4j.properties file at runtime via a system property. From the <a href="http://logging.apache.org/log4j/1.2/manual" rel="nofollow noreferrer">manual</a>:</p>
<blockquote>
<p>Set the resource string variable to t... | 10,946 |
<p>Is there a way to use Enum values inside a JSP without using scriptlets.</p>
<p>e.g. </p>
<pre><code>package com.example;
public enum Direction {
ASC,
DESC
}
</code></pre>
<p>so in the JSP I want to do something like this</p>
<pre><code><c:if test="${foo.direction ==<% com.example.Direction.ASC %&... | <p>You could implement the web-friendly text for a direction within the enum as a field:</p>
<pre>
<code>
<%@ page import="com.example.Direction" %>
...
<p>Direction is <%=foo.direction.getFriendlyName()%></p>
<% if (foo.direction == Direction.ASC) { %>
<p>That means you're going to heaven!</p>
&l... | <p>You can simply check against the enum value as a string:</p>
<pre><code><c:if test="${foo.direction == 'ASC'}">...
</code></pre>
| 19,753 |
<p>Is it possible to select from <code>show tables</code> in MySQL?</p>
<pre><code>SELECT * FROM (SHOW TABLES) AS `my_tables`
</code></pre>
<p>Something along these lines, though the above does not work (on 5.0.51a, at least).</p>
| <p>I think you want <code>SELECT * FROM INFORMATION_SCHEMA.TABLES</code></p>
<p>See <a href="http://dev.mysql.com/doc/refman/5.0/en/tables-table.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/tables-table.html</a></p>
| <p>I don't understand why you want to use <code>SELECT * FROM</code> as part of the statement.</p>
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/show-tables.html" rel="nofollow noreferrer">12.5.5.30. SHOW TABLES Syntax</a></p>
| 9,056 |
<p>I'd like to write a functional test of a RESTful web service I'm working on in a Ruby on Rails app. </p>
<p>The test is of a POST request where the body of the request is a plain XML doc and not a form. Any pointers on how to do this? The problem I'm encountering is how to specify the body XML in the call to the po... | <p>The following worked for me:</p>
<pre><code>@request.env['RAW_POST_DATA'] = MY_XML_STRING
post :create
</code></pre>
| <p>Check out <a href="http://github.com/thoughtbot/shoulda/tree/master" rel="nofollow noreferrer">shoulda</a>'s "should_be_restful" macro. This macro will soon be <a href="http://thoughtbot.lighthouseapp.com/projects/5807/tickets/78-deprecate-should_be_restful" rel="nofollow noreferrer">deprecated</a> from shoulda and ... | 43,644 |
<p>I am running a Qt 4.5 commercial snapshot and want to use a plugin that I downloaded (it's a .so file) in my <code>QWebView</code>. Is there a specific location where I need to place this file? Can I grab it using the <code>QWebPluginFactory</code>?</p>
| <p>I am assuming the plugin here is the NPAPI plugin (e.g. Flash). Under X11, QtWebKit search several common directories for the plugin. For the complete list, see <a href="http://doc.qt.digia.com/4.5/qtwebkit.html#netscape-plugin-support" rel="nofollow noreferrer">the documentation on Netscape plugin support</a>.</p>
... | <p>Have you tried putting in the <em>standard library directories</em>? It should be picked up by the <strong>linker</strong> if it's in one of those directories.</p>
<p>For example:</p>
<pre><code>/lib/
/usr/lib/
/usr/share/lib/
/usr/local/lib/
</code></pre>
| 3,939 |
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered... | <pre><code>python -m pdb -c continue myscript.py
</code></pre>
<p>If you don't provide the <code>-c continue</code> flag then you'll need to enter 'c' (for Continue) when execution begins. Then it will run to the error point and give you control there. As <a href="https://stackoverflow.com/questions/242485/starting-py... | <p>Put a breakpoint inside the constructor of topmost exception class in the hierarchy, and most of the times you will see where the error was raised.</p>
<p>Putting a breakpoint means whatever you want it to mean : you can use an IDE, or <code>pdb.set_trace</code>, or whatever</p>
| 30,016 |
<p>I want to enhance my browser-based web application with functionality that enables management of local files and folders. E.g. folder tree structures should be synchronized between local workstation and server via HTTP(S).</p>
<p>I am aware of security-related limitations in browser-based applications. However, the... | <p>Google Gears.</p>
<p>it lets you write Javascript applications with a much bigger platform support than the usual browser, and go 'unconnected' with local file access, cache and DB. and if/when connected it syncs to the central server.</p>
<p>available for several browsers on all platforms; but still under heavy ... | <p>Your best bet might be to write a custom application that interacts with your web application. For example, <a href="https://www.getdropbox.com" rel="nofollow noreferrer">Dropbox</a> lets you synchronize files across computers by use of a background application that watches a Dropbox-enabled folder. It also lets you... | 37,332 |
<p>I currently have some code that will produce a crash dump when my application crashes however I can't work out what are the best flags to use for it are.</p>
<p>At the moment I have it using Full Memory (MiniDumpWithFullMemory) but this produces 32mg crash files. What flags should I use as to not make the crash fil... | <p>This is not always such a general answer. The flags desired will depend somewhat on what you are trying to accomplish or for what you may be searching.</p>
<p>Perhaps you are having threading issues, MiniDumpWithThreadInfo or MiniDumpWithProcessThreadData would be appropriate. If your program is corrupting its in... | <p>Minidumps are highly compressible - I'd recommend zipping it to help out with the size</p>
| 45,173 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.