instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Is there a way in .NET 2.0 (C#) to serialize object like you do using XmlSerializer in a simple / customizable human readable format thats for instance looks like <a href="http://community.moertel.com/pxsl/" rel="noreferrer">PXLS</a> or JSON?
Also I know that XML is human readable, I'm looking for something with les... | <p>To Serialize into JSON in .NET you do as follows:</p>
<pre><code>public static string ToJson(IEnumerable collection)
{
DataContractJsonSerializer ser = new DataContractJsonSerializer(collection.GetType());
string json;
using (MemoryStream m = new MemoryStream())
... | <p>Apply a xsl to your xml to strip out what you don't want to see ?</p>
<p>something like</p>
<pre><code><?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="yes"/>
<xsl:template match="*">
<xsl:valu... | 32,308 |
<p>Ok, so I got my extender working on a default.aspx page on my website and it looks good. I basically copied and pasted the code for it into a user control control.ascx page. When I do this I completely loose the functionality (just shows the target control label and no dropdown, even upon hover). Is there any rea... | <p>I don't know if this helps, but I had the same problem with the autocomplete extender and determined that the server-side function could not be in the user control, but needed to be on the page (or in a webservice, I guess). Once I moved the function, it worked fine.</p>
| <p>Check the DocType. Here is what I have found useful</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
</code></pre>
<p>Place this in your user control (or the page that uses it) and all should be well. I had a similar problem with a collapsibl... | 8,186 |
<p>I have two separate mercurial repositories. At this point it makes sense that they "become one" because I want to work on the two projects simultaneously.</p>
<p>I'd really like the two projects to each be a subdirectory in the new repository.</p>
<ol>
<li>How do I merge the two projects?</li>
<li>Is this a good i... | <p>I was able to combine my two repositories in this way:</p>
<ol>
<li>Use <code>hg clone first_repository</code> to clone one of the repositories.</li>
<li>Use <code>hg pull -f other_repository</code> to pull the code in from the other repository.</li>
</ol>
<p>The <code>-f</code> (force) flag on the pull is the key... | <p>If you aren't using the same code across the projects, keep them separate. You can set <em>your</em> personal repository of each of those projects to be just a directory apart. Why mix all the branches, merges, and commit comments when you don't have to.</p>
<p><strong>About your edit:</strong> Pushing from One rep... | 3,391 |
<p>I'm looking for a current (1.2), well-formatted, printable version of the jQuery documentation. I've checked the alternative resources page and see the PDF versions from CF and Java, but both are out of date.</p>
<p>The jQuery site has the API browser with "Printable Version" in the toolbox, but it prints terribly... | <p>take a look at <a href="http://charupload.wordpress.com/2007/12/07/jquery-documentation-chm/" rel="nofollow noreferrer">this page</a>.</p>
<p>it has compiled html help file (CHM) for latest jQuery 1.3.</p>
<p>that guy also compiles another useful CHM manuals.</p>
| <p>Yeah i also disappointed with manning jquery in action book, learning jquery by packt is much better but still not covered most common needs, probably john resig need to write a book himself.</p>
| 24,878 |
<p>I have an xml file providing data for a datagrid in Flex 2 that includes an unformatted Price field (ie: it is just a number).
Can anyone tell me how I take that datafield and format it - add a currency symbol, put in thousand separators etc.
Thanks.
S.</p>
| <p>As stated above an easy way to do this would be to add a labelFunction to the specified column and format the data within there.</p>
<p>Frequently I find that its much easier to work with objects then straight XML so normally if I am receiving XML from a function I would create an object and parser for that XML and... | <p>How about the CurrencyFormatter class</p>
<p>See <a href="http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001087.html" rel="nofollow noreferrer">here</a> for docs from Flex 2. It's pretty easy to use.</p>
<p>You can use one of these in a labelFunction ... | 20,968 |
<p>I'm using Installshield 2008 express to create an installation package. My application relies on Sql Server 2005 express edition. I know I am able to check the "microsoft sql server 2005 express" prerequisite under the redistributables tab. However, this leaves the installation entirely in the hands of the end user,... | <p>If the express addition supports install script you can use the following bit of code. You need to include the Sql Express redist in your install somewhere</p>
<p>LaunchAppAndWait(SRCDIR+"\SQLEXPR32.EXE",
"INSTANCENAME="+ instName +
" SECURITYMODE=SQL " +
"DISABLENETWORKPROTOCOLS=0 SQLAUT... | <p>I have not used InstallShield Express. InstallShield Professional allows you to define the command line that is passed to the SQL Server installation. This allows you to define an instance name along with other parameters such as 'quiet' mode.</p>
| 25,935 |
<p>I am trying to get Haml to work with my Ruby on Rails project. I am new to Ruby on Rails and I really like it. However, when I attempt to add an <code>aplication.html.haml</code> or <code>index.html.haml</code> for a view, I just receive errors.</p>
<p>I am using NetBeans as my IDE.</p>
| <h2>Haml with Rails 3</h2>
<p>For Rails 3 all you need to do is add <code>gem "haml", '3.0.25'</code> to your <code>Gemfile</code>. No need to install plugin or run <code>haml --rails .</code>.</p>
<p>Just:</p>
<pre>
$ cd awesome-rails-3-app.git
$ echo 'gem "haml"' >> Gemfile
</pre>
<p>And you're done.</p>
| <p>If you are using <a href="http://pow.cx/" rel="nofollow">Pow</a> you will need to restart it also. Ideally you are using <a href="http://rubygems.org/gems/powder" rel="nofollow">powder</a> (gem install powder), because then you can just run this at the terminal</p>
<pre><code>$ powder restart
</code></pre>
| 12,444 |
<p>Each time a python file is imported that contains a large quantity of static regular expressions, cpu cycles are spent compiling the strings into their representative state machines in memory.</p>
<pre><code>a = re.compile("a.*b")
b = re.compile("c.*d")
...
</code></pre>
<p>Question: Is it possible to store these ... | <blockquote>
<p>Is it possible to store these regular expressions in a cache on disk in a pre-compiled manner to avoid having to execute the regex compilations on each import?</p>
</blockquote>
<p>Not easily. You'd have to write a custom serializer that hooks into the C <code>sre</code> implementation of the Python ... | <p>The <a href="http://docs.python.org/lib/module-shelve.html" rel="nofollow noreferrer">shelve</a> module appears to work just fine:</p>
<pre><code>
import re
import shelve
a_pattern = "a.*b"
b_pattern = "c.*d"
a = re.compile(a_pattern)
b = re.compile(b_pattern)
x = shelve.open('re_cache')
x[a_pattern] = a
x[b_patte... | 9,103 |
<p>If I develop a desktop app using C#, and later want to turn it into a webapp but don't want to use ASP.NET, what are my options? </p>
<p>I did a bit of searching and it looks like there doesn't appear to be a good solution to integrate C# code with any scripting language other than running it as a web service and m... | <p>Why would you make things so difficult for yourself? The best thing would be to put almost all of your code into an assembly, and just use the winforms app for display purposes. Then, later, you can just reimplement the display logic in asp.net.</p>
<p>So, I guess the answer is no.</p>
| <p>AJAX + WebService + plain HTML</p>
| 20,175 |
<p>Simple question, how do you list the primary key of a table with T-SQL? I know how to get indexes on a table, but can't remember how to get the PK.</p>
| <pre><code>SELECT Col.Column_Name from
INFORMATION_SCHEMA.TABLE_CONSTRAINTS Tab,
INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE Col
WHERE
Col.Constraint_Name = Tab.Constraint_Name
AND Col.Table_Name = Tab.Table_Name
AND Tab.Constraint_Type = 'PRIMARY KEY'
AND Col.Table_Name = '<your table nam... | <p>If you need it in Oracle it is so simple.</p>
<pre><code>SELECT `Constraint_Name`
FROM `All_Constraints`
WHERE `Constraint_Type` = `'P'`
AND `Owner` = `'your schema here';`
</code></pre>
| 12,153 |
<p>When using os.system() it's often necessary to escape filenames and other arguments passed as parameters to commands. How can I do this? Preferably something that would work on multiple operating systems/shells but in particular for bash.</p>
<p>I'm currently doing the following, but am sure there must be a libra... | <p>This is what I use:</p>
<pre><code>def shellquote(s):
return "'" + s.replace("'", "'\\''") + "'"
</code></pre>
<p>The shell will always accept a quoted filename and remove the surrounding quotes before passing it to the program in question. Notably, this avoids problems with filenames that contain spaces or an... | <p>On UNIX shells like Bash, you can use <code>shlex.quote</code> in Python 3 to escape special characters that the shell might interpret, like whitespace and the <code>*</code> character:</p>
<pre><code>import os
import shlex
os.system("rm " + shlex.quote(filename))
</code></pre>
<p>However, this is not eno... | 5,639 |
<p>I have a gridview and I need to sort its elements when the user clicks on the header.<br>
Its datasource is a List object.</p>
<p>The aspx is defined this way :</p>
<pre><code><asp:GridView ID="grdHeader" AllowSorting="true" AllowPaging="false"
AutoGenerateColumns="false" Width="780" runat="server" OnSort... | <p>You can use a session variable to store the latest Sort Expression and when you sort the grid next time compare the sort expression of the grid with the Session variable which stores last sort expression. If the columns are equal then check the direction of the previous sort and sort in the opposite direction. </p>... | <p>In vb.net but very simple!</p>
<pre><code>Protected Sub grTicketHistory_Sorting(sender As Object, e As GridViewSortEventArgs) Handles grTicketHistory.Sorting
Dim dt As DataTable = Session("historytable")
If Session("SortDirection" & e.SortExpression) = "ASC" Then
Session("SortDirection" & e... | 31,102 |
<p>I was hoping to implement a simple XMPP server in Java. </p>
<p>What I need is a library which can parse and understand xmpp requests from a client. I have looked at Smack (mentioned below) and JSO. Smack appears to be client only so while it might help parsing packets it doesn't know how to respond to clients. I... | <p><a href="http://xmpp.org/xmpp-software/libraries/" rel="noreferrer">http://xmpp.org/xmpp-software/libraries/</a> has a list of software libraries for XMPP. Here is an <em>outdated</em> snapshot of it:</p>
<p><h3>ActionScript</h3> </p>
<ul>
<li><a href="http://code.google.com/p/as3xmpp/" rel="noreferrer">as3xmpp</... | <p>I found a good xmpp server based on Java : <a href="http://www.tigase.org/" rel="nofollow">http://www.tigase.org/</a></p>
| 21,385 |
<p>I'm pretty new to HQL (well, nHibernate in general) and am currently building a simple app to learn more about it.</p>
<p>I've run into problems trying to express the following SQL as HQL though, and would be very grateful for any ideas.</p>
<p>Here's the query:</p>
<pre><code>select * from parent p
where p.id in... | <p>Sorry - the default is true in ASP.NET, so you should explicitly set AutoEventWireup to false in the @ Page directive, or remove it and set it to false in pages section of web.config for MVC. </p>
| <p>You can get rid of this attribute, or set it to false (which is the default). </p>
<p>AutoEventWireup means ASP.NET will use reflection at runtime to look for methods on your web form class in the form of Page_EventName (like Page_Load, Page_Init, etc), and automatically wire the methods to the corresponding page l... | 34,788 |
<p>In Python 2.6, a new "timeout" parameter was added to the httplib.HTTPConnection class:
<a href="http://docs.python.org/library/httplib.html#httplib.HTTPConnection" rel="nofollow noreferrer">http://docs.python.org/library/httplib.html#httplib.HTTPConnection</a></p>
<p>However, this is only a timeout for the connect... | <p>You can set a global socket timeout <sup>(*)</sup>:</p>
<pre><code>import socket
timeout = 10
socket.setdefaulttimeout(timeout)
</code></pre>
<hr>
<p><sup>(*)</sup> <strong>EDIT</strong>: As people in the comments correctly point out: This is technically true, but it only has predictable results for tasks that i... | <p>When you initiate the connection, it is posible to give as third argument the timout value.</p>
<pre><code>connection = HTTPConnection(<IP of URL>, <port or None>, <timeout>)
...
</code></pre>
<p> is a float in seconds.</p>
<pre><code>connection = HTTPConnection('slow.service.com', None, 20.0)
<... | 33,316 |
<p>I've seen a lot of discussion on URL Routing, and LOTS of great suggestions... but in the real world, one thing I haven't seen discussed are: </p>
<ol>
<li>Creating Friendly URLs <strong>with Spaces and illegal characters</strong> </li>
<li>Querying the DB</li>
</ol>
<p>Say you're building a Medical site, which ha... | <p>I myself prefer _ to - for readability reasons ( you put an underline on it and the <code>_</code>'s virtually go_away ) , if you're going to strip spaces. </p>
<p>You may want to try casting extended characters, ie, ü , to close-ascii equivelants where possible, ie:</p>
<p>ü -> u </p>
<p>However, in my experienc... | <p>As a follow-up. I do have some ideas. So feel free to comment on the ideas or give your own answer to the question:</p>
<p>Solution #1: Replace all illegal characters with dashes:</p>
<ul>
<li><strong>www.mysite.com/diseases---conditions/Auto-immune-disorders/the--1-killer-of-people-is-some-disease/</strong></li>... | 33,440 |
<p>How do I connect to an SQL Server remotely and administer my database objects? I need to connect to my database located on the web hosting company's server. I have the server name, IP address, my database username & password. I have an installation of SQL Server 2000 in my machine. </p>
<p>Can I use SQL Server ... | <p>Yes, you can use Enterprise Manager (or SQL Server Management Studio, even if it's an Express version) to connect to any SQL Server (of the same or lower version as the tool you're using) you have TCP/IP connectivity to. Just launch it, enter the DNS host name or IP address in the 'Server Name' box and hit Connect.<... | <p>It is possible, but a lot of things need to align for you to be able to connect.</p>
<p>Enterprise Manager and SQL Management Studio just use a standard client connection to SQL. The default TCP/IP port is 1433, but the host needs to allow that port through the firewall. If you are using a named instance, then I ... | 17,531 |
<p>There is a legacy CVS repository, which contains a large number of directories, sub-directories, and paths. There is also a large number of branches and tags that do not necessarilly cover all paths & files - usually a subset. How can I find out, which branch / tag covers, which files and paths?</p>
<p>CVS log ... | <p>To determine what tags apply to a particular file use:</p>
<pre><code>cvs log <filename>
</code></pre>
<p>This will output all the versions of the file and what tags have been applied to the version.</p>
<p>To determine what files are included in a single tag, the only thing I can think of is to check out u... | <p>I don't know of any tool that can help you, but if you are writing your own, I can save you from one headace: Directories in CVS cannot be tagget. Only the files within them have tags (and that is what determines what is checked out when you check out a directory on a specific tag).</p>
| 4,843 |
<p>There is a lot of buzz about <strong>Microsoft Silverlight</strong>, especially after the Olympics. Also <code>H264</code> will be supported in a future version. Where do you think Silverlight will be 1 year from now?</p>
| <p>They were saying they were getting 1.5 million downloads per day back in March 2008, and that was before the Olympics and the Democratic National Convention. So, unless my math is off, that's more than 4 people.</p>
<p>I'd expect to see it show up as a recommended Windows update, and possible included with IE8 or s... | <p>100% more.</p>
<p>(so about 4 people)</p>
| 7,776 |
<p>What are the main differences among them? And in which typical scenarios is it better to use each language?</p>
| <p>In order of appearance, the languages are <code>sed</code>, <code>awk</code>, <code>perl</code>, <code>python</code>.</p>
<p>The <code>sed</code> program is a stream editor and is designed to apply the actions from a script to each line (or, more generally, to specified ranges of lines) of the input file or files. ... | <p>First, there are two unrelated things in the list "Perl, Python awk and sed".</p>
<p>Thing 1 - simplistic text manipulation tools.</p>
<ul>
<li><p>sed. It has a fixed, relatively simple scope of work defined by the idea of reading and examining each line of a file. sed is not designed to be particularly readable... | 47,901 |
<p>I have implemented the WMD control that Stack Overflow uses into a project of mine, it <strong>almost</strong> works like a charm, but when I save the changes to the database it is saving the HTML version and not the Markdown version.</p>
<p>So where I have this in my text box:</p>
<pre><code>**boldtext**
</code><... | <p>Before you include <code>wmd.js</code>, or whatever you've named the WMD editor JavaScript code locally, add one line of JavaScript code:</p>
<pre><code>wmd_options = {"output": "Markdown"};
</code></pre>
<p>This will force the output of the editor to Markdown.</p>
| <p>If you're using the new WMD from <a href="http://code.google.com/p/wmd-new/" rel="nofollow">http://code.google.com/p/wmd-new/</a>, open <strong>wmd.js</strong> and add this line:</p>
<pre><code>wmd.wmd_env.output = 'markdown';
</code></pre>
<p>Excerpt:</p>
<pre><code>...
wmd.ieCachedRange = null; // cached textar... | 14,844 |
<p>I've got an <code>JComboBox</code> with a custom <code>inputVerifyer</code> set to limit MaxLength when it's set to editable.</p>
<p>The verify method never seems to get called.<br>
The same verifyer gets invoked on a <code>JTextField</code> fine.</p>
<p>What might I be doing wrong?</p>
| <p>I found a workaround. I thought I'd let the next person with this problem know about. </p>
<p>Basically. Instead of setting the inputVerifier on the ComboBox you set it to it's "Editor Component". </p>
<pre><code>JComboBox combo = new JComboBox();
JTextField tf = (JTextField)(combo.getEditor().getEditorComponent()... | <p>Show us a small section of your code.</p>
<pre><code>package inputverifier;
import javax.swing.*;
class Go {
public static void main(String[] args) {
java.awt.EventQueue.invokeLater(new Runnable() { public void run() {
runEDT();
}});
}
private static void runEDT() {
... | 7,818 |
<p>Is it possible to override the background color of the minimize and maximized buttons in WinForms?</p>
| <p>You cannot do it easily.</p>
<p>The best option is:
<a href="https://web.archive.org/web/20200718062913/http://geekswithblogs.net:80/kobush/articles/CustomBorderForms3.aspx" rel="nofollow noreferrer">http://geekswithblogs.net/kobush/articles/CustomBorderForms3.aspx</a></p>
<p>You can find more answers here:
<a href=... | <p>The short version is, out of the box, not that I'm aware of.</p>
<p>The longer version is that there's nothing stopping you from creating a borderless form, then creating your own [minimize|restore]/maximize/close buttons on it. You'll have to draw your own form title bar, and basically take on all the magic of mov... | 40,739 |
<p>I'm working with Analysis Services and I have run into a compatibility issue. Here is my situation. I have 3 machines:</p>
<ul>
<li>Server2005: This machine has SQL Server, Analysis Services and Visual Studio, all in 2005 versions.</li>
<li>Client2008: This machine has Visual Studio 2008.</li>
<li>Client2005: This... | <p>The impersonation settings have changed slightly. The best solution is to ensure that your SQL Server database gives the Analysis Services service account read permissions.</p>
<p>You may also need to change the data source connection impersonation information:</p>
<p><img src="https://farm4.static.flickr.com/3055... | <p>The same problem here... it looks like projects have benn build in VS2008 cann't be deployed to SQL Server Analysis Services 2005... </p>
| 38,643 |
<p>I need to have a <code>staticText</code> to float below another element with variable height. I'm taking a sample from the book <code>JasperReports for Java Programmers</code>. It says that it's possible to do it. The difference with my sample is that I use a hard coded string in <code>textFieldExpression</code>, th... | <p><a href="https://stackoverflow.com/questions/353928/jasperreports-subreports-not-working-with-positiontypefloat#359092">This answer</a> applies (different elements, same situation).</p>
<p>One thing I didn't take right from the book's sample is that the textField's declared height (24) is less than the actual heigh... | <p><a href="https://stackoverflow.com/questions/353928/jasperreports-subreports-not-working-with-positiontypefloat#359092">This answer</a> applies (different elements, same situation).</p>
<p>One thing I didn't take right from the book's sample is that the textField's declared height (24) is less than the actual heigh... | 44,879 |
<p>I have a web service using .net c# and I want to write to a text file on the server, but I cannot get this to work. I believe it's a permission problem.</p>
<p>Specifically, I think the problem is I am using <code>System.IO.Directory.GetCurrentDirectory()</code>. </p>
<p>Is there a better alternative?</p>
| <p>Try granting the ASP.NET user (or whatever account IIS is running as) permission to write to the folder you are trying to write to. </p>
<p>If this is a network share, try to run IIS as a domain user that can write to the share. </p>
<p>Remember the principle of granting minimal permission (dont use Admin level ac... | <p>You should be able to write files from web services. This is most likely a permissions or trust issue. If you are in a limited trust (i.e., Medium trust) ensure that you are writing to a patch in or below your web root. If you are already doing that, or are in a full trust environment check to make sure that the dir... | 28,923 |
<p>I'm looking for books / articles / papers on Javascript engine internals along the lines of the many reference works about the JVM internals, CLR internals, etc. I could (and likely will) look at the source code for JavaScriptCore and V8/Chromium, but if there's a book out there or some other "guided tour" document... | <p>I was curious about this too, and here's what I found:</p>
<p>About Chrome's Javascript engine (v8):</p>
<ul>
<li><a href="http://ajaxian.com/archives/garbage-collection-in-v8-for-mobile-and-beyond" rel="noreferrer">Garbage Collection in V8; For mobile and beyond</a></li>
<li><a href="http://www.scribd.com/doc/169... | <p>Google have documented a lot about V8. <a href="http://code.google.com/p/v8/" rel="noreferrer">http://code.google.com/p/v8/</a> There are some interesting videos on the main page ( although you've probably already seen those ) </p>
| 45,778 |
<p>I swear there used to be a way in X to start capturing all terminal traffic to a file on your host. It may have been a HummingBird extension, but I thought it was standard. Now, I can't find the trick. Am I hallucinating (happens when you get old), or is it possible?<br><br>I'm not talking about 'tee'. I want to be ... | <p>This feature is called logging and exists in the source code but is disabled by default for security reasons. Do you really want everyone with the ability to write control sequences to your terminal (<em>e.g.</em>, the author of any file you might one day <code>cat</code>) to be able to write arbitrary data to arbit... | <p>I am a little bit confused by the way you asked your question. First you mention Xterm then X and then terminal, are you simply looking for the "tee" (<code>man tee</code>) command? </p>
| 22,354 |
<p>I have problem in some JavaScript that I am writing where the Switch statement does not seem to be working as expected.</p>
<pre><code>switch (msg.ResultType) {
case 0:
$('#txtConsole').val("Some Val 0");
break;
case 1:
$('#txtConsole').val("Some Val 1");
break;
case 2:
$('#txtConsole').te... | <p>I'm sure that a switch uses === for comparison in Actionscript and since JS and AS both follow the ECMAScript standard, I guess the same applies to JS. My guess is that the value is not actually a Number, but perhaps a String.</p>
<p>You could try to use parseInt(msg.ResultType) in the switch or use strings in the ... | <p>Are you sure the ResultType is an integer (e.g. 0) and not a string (e.g. "0")?</p>
<p>This could easily explain the difference in behaviour</p>
| 31,133 |
<p>There are a number of <a href="https://stackoverflow.com/questions/156430/regexp-recognition-of-email-address-hard">email</a> regexp <a href="https://stackoverflow.com/questions/210945/what-would-be-a-globally-accepted-regular-expression-to-match-e-mail-addresses">questions</a> popping <a href="https://stackoverflow... | <p>They do it because they see "I want to test whether this text matches the spec" and immediately think "I know, I'll use a regex!" without fully understanding the complexity of the spec or the limitations of regexes. Regexes are a wonderful, powerful tool for handling a wide variety of text-matching tasks, but they ... | <p>Regexps are much faster to use, of course, and they only validate what's specified in the RFC. Write a custom parser? What? It takes 10 seconds to use a regexp.</p>
| 26,042 |
<p>What is the best method to determine if a user has viewed a piece of data, ie like an update to a comment. The two solutions I have thought about are these....</p>
<ol>
<li><p>Use a separate table that has a row for each user and the data id that is being viewed and inserting into when the item was last viewed.</p>... | <p>It's got to be option 1:</p>
<p><strong>Table 1 (comment)</strong></p>
<ul>
<li>comment_id</li>
<li>comment</li>
</ul>
<p><strong>Table 2 (comment_view)</strong></p>
<ul>
<li>comment_id</li>
<li>user_id</li>
</ul>
<p>Option 2 will not work because every <strong>new</strong> user will have every existing comment... | <p>Option 2 is an <em>unusual</em> way of doing things, which in the database world is a way of saying it <em>might</em> work but it's probably best to go with a more traditional approach like Option 1.</p>
| 37,995 |
<p>Given a string <code>"filename.conf"</code>, how to I verify the extension part?</p>
<p>I need a cross platform solution.</p>
| <p>Is this too simple of a solution?</p>
<pre><code>#include <iostream>
#include <string>
int main()
{
std::string fn = "filename.conf";
if(fn.substr(fn.find_last_of(".") + 1) == "conf") {
std::cout << "Yes..." << std::endl;
} else {
std::cout << "No..." << std::endl;... | <p>If you happen to use <a href="http://pocoproject.org/" rel="nofollow">Poco</a> libraries you can do:</p>
<pre><code>#include <Poco/Path.h>
...
std::string fileExt = Poco::Path("/home/user/myFile.abc").getExtension(); // == "abc"
</code></pre>
| 7,518 |
<p>As far as I know, foreign keys (FK) are used to aid the programmer to manipulate data in the correct way. Suppose a programmer is actually doing this in the right manner already, then do we really need the concept of foreign keys?</p>
<p>Are there any other uses for foreign keys? Am I missing something here?</p>
| <p>Foreign keys help enforce referential integrity at the data level. They also improve performance because they're normally indexed by default.</p>
| <p>Yes. The ON DELETE [RESTRICT|CASCADE] keeps developers from stranding data, keeping the data clean. I recently joined a team of Rails developers who did not focus on database constraints such as foreign keys.</p>
<p>Luckily, I found these: <a href="http://www.redhillonrails.org/foreign_key_associations.html" rel="n... | 3,926 |
<p>I've encountered multiple third party .Net component-vendors that use a licensing scheme. On an evaluation copy, the components show up with a nag-screen or watermark or some such indicator. On a licensed machine, a <strong>Licenses.licx</strong> is created - with what appears to be <em>just</em> the assembly full n... | <p>Almost everything about .Net licensing is explained <a href="http://www.developer.com/net/csharp/article.php/3074001" rel="noreferrer">here</a>. No need to rewrite, I think.</p>
<p>It is better to exclude license files from project in source control, if you can. Otherwise, editing visual components may be pain in t... | <p>This was a good article on the topic: <a href="http://www.textcontrol.com/en_US/blog/archive/20091015/">Click Here</a></p>
<p>In order to deploy an application with licensed components like TX Text Control, the EXE file must be licensed properly.</p>
<p>The .NET licensing mechanism recommends to add the licenses t... | 7,442 |
<p>The published code for Palm OS applications doesn't include standard headers, but instead uses Palm OS APIs for things like StrCopy and MemMove. Can I use standard headers and functions or do I need to convert my code to use the Palm OS versions?</p>
| <p>From a program size point of view its better to use the Palm OS API whenever possible, since that means you don't have to include the code from the library in the generated 'executable'. If you use functions from the compiler provided libraries the code of that functions will be added to each of your programs increa... | <p>It depends on the compiler and what version of the tools you're using. In general, if you can use Palm OS APIs, you'll probably work better on the platform, but both CodeWarrior and prc-tools had some library functions implemented.</p>
<p>In CW for Palm OS V9, there's a pretty full version of the Metrowerks Standa... | 25,936 |
<p>How do I setup a Python environment on windows computer so I can start writing and running Python scripts, is there an install bundle? Also which database should i use?</p>
<hr>
<p>I should of mentioned that I am using this for web based applications. Does it require apache? or does it use another http server? Wh... | <p>Download the Python 2.6 Windows installer from <a href="http://python.org/" rel="nofollow noreferrer">python.org</a> (<a href="http://python.org/ftp/python/2.6/python-2.6.msi" rel="nofollow noreferrer">direct link</a>). If you're just learning, use the included SQLite library so you don't have to fiddle with databas... | <p>Django tutorial <a href="http://docs.djangoproject.com/en/dev/topics/install/" rel="nofollow noreferrer">How to install Django</a> provides a good example how a web-development Python environment may look.</p>
| 21,998 |
<p>I want to display the TIME field from my mysql table on my website, but rather than showing 21:00:00 etc I want to show 8:00 PM. I need a function/code to do this or even any pointers in the right direction. Will mark the first reply with some code as the correct reply.</p>
| <p>Check this out: <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html</a></p>
<p>I'd imagine you'd want date_format().</p>
<p>Example: DATE_FORMAT($date, "%r")</p>
| <p>Use <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format" rel="nofollow noreferrer">DATE_FORMAT()</a></p>
<p>DATE_FORMAT(<Fieled>,'%h:%i:%s %p')</p>
<p>or</p>
<p>DATE_FORMAT(<Fieled>,'%r')</p>
| 20,844 |
<p>I am writing a perl script to parse a mysql database schema and create C++ classes when necessary. My question is a pretty easy one, but us something I haven't really done before and don't know common practice. Any object of any of classes created will need to have "get" methods to populate this information. So m... | <p>Ususally, the most costly part of an application is round trips to the database, so it would me much more efficient to populate all your data members from a single query than to do them one at a time, either on an as needed basis or from your constructor. Once you've paid for the round trip, you may as well get you... | <p>there are existing tools that reverse db's into java (and probably other languages). consider using one of them and converting that to c++.</p>
| 10,914 |
<p>I've been trying to find a 3D printer filament which would not release any chemicals if in contact with heated water for a substantial amount of time. So far, I've easily ruled out both PLA and ABS, as they're not considered food safe from what I can find. I have found PETG filament, which seems to be food safe. </p... | <p>Many manufactures list their filaments as being food safe, but I would not treat this as "gospel truth". Apparently, the FDA considers PETG to be safe for food contact, but they are probably thinking about injection-moulded and vacuum-formed parts. Unfortunately, an initial search of the FDA's website did not yield ... | <p>As far as PET-based filaments go, most of them are FDA approved. So yes, "food safe". It's the process of 3D printing that ruins that. all the little layers trap just about everything and are hard to clean. If you wanted to boil your part, that might work, but you'd be better off buying a food-safe coating spray for... | 1,213 |
<p>We're running a lightweight web app on a single EC2 server instance, which is fine for our needs, but we're wondering about monitoring and restarting it if it goes down.</p>
<p>We have a separate non-Amazon server we'd like to use to monitor the EC2 and start a fresh instance if necessary and shut down the old one.... | <p>You should have a look at <a href="http://reductivelabs.com/trac/puppet/wiki/PuppetIntroduction" rel="noreferrer">puppet</a> and its support for <a href="http://reductivelabs.com/trac/puppet/wiki/Recipes/AmazonWebService" rel="noreferrer">AWS</a>. I would also look at the <a href="http://rightaws.rubyforge.org/" rel... | <p>You can use an autoscale group with a min/max/desired quantity of 1. Place the instance behind an ELB and have the autoscale group be triggered by the ELB healthy node count. This allows you to have built in monitoring by cloudwatch and the ELB health check. Anytime there is an issue the instance be replaced by the ... | 31,164 |
<p>I have the following div layout:</p>
<img src="https://i.stack.imgur.com/bZSnA.jpg">
<p>Everything is fine when I put normal txt elements in both the blue and the orange div. However, when I place an image in the orange div (which is 31px), the elements in the blue div get pushed down by about half the height of... | <p>You might want to try floating the image to the left of the text. This way the text will sit next to the image without the need for positioning. For example: </p>
<pre><code><style>
div {
position: absolute;
border: 1px solid blue;
}
div img {
height: 31px;
width: 50px;
float: left;
}
</style>
<div&... | <p>I'm not so good with CSS boxes, but could adding: display:inline; to the image style fix the porblem? And/Or adding margin:0px;<br>
Oh and is the brwoser rendering in Quirks mode, since not making it render in Quirks mode could fix some problems too. </p>
<p><b>Edit</b><br>
By quirks mode I mean, does your page ha... | 37,872 |
<p><strong>Scenario:</strong> Several people go on holiday together, armed with digital cameras, and snap away. Some people remembered to adjust their camera clocks to local time, some left them at their home time, some left them at local time of the country they were born in, and some left their cameras on factory ti... | <p>Windows Live Photo Gallery Wave 3 Beta includes this feature. From the help:</p>
<blockquote>
<p>If you change the date and time
settings for more than one photo at
the same time, each photo's time stamp
is changed by the same amount, so that
the time stamps of all the selected
photos remain in their or... | <p>I'd dare to advice my software for this purpose: <a href="https://github.com/Fr0sT-Brutal/App_EXIFTimeEdit" rel="nofollow">EXIFTimeEdit</a>. Open-source and simple, it supports all the possible variants I could imagine:</p>
<ul>
<li>Shifting date part (year/month/day/hour/minute) by any value</li>
<li>Setting date ... | 10,252 |
<p>I found this link <a href="http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/" rel="noreferrer">http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/</a>, but there isn't a lot of description around it, aside that it's "simple".</p>
<p>Ideally, I'd like an extension to CcMode that can do it, or at least ... | <p>Add the following code to your ~/.emacs file.</p>
<pre><code>(autoload 'glsl-mode "glsl-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode))
</code></pre>
<p>Put the file <a href="http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/... | <p>Based on GLSL mode, I wrote a similar one for HLSL which is used in Direct3D effect.
Here it is. <a href="http://sourceforge.net/projects/hlslmode/files/hlsl-mode.el" rel="nofollow">http://sourceforge.net/projects/hlslmode/files/hlsl-mode.el</a></p>
| 12,085 |
<p>I'm doing some simple tests (in preparation for a larger project) to call an ASP.NET WebMethod using JQuery AJAX. In my example, my WebMethod returns a simple string. However, when I attempt to call it using JQuery, I get the entire HTML page content returned instead of just my string. What am I missing?</p>
<p>Cli... | <p>Check out this link. I used some of his other posts to calll WCF service with success. Be sure to check out the related articles:</p>
<p><a href="http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/" rel="noreferrer">http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet... | <p>I had the exactly the same problem: WebMethod returned the entire HTML page instead the intended data. For me, the solution came from changing inside <strong>~/App_Start/RouteConfig.cs</strong> the following line:</p>
<pre><code>settings.AutoRedirectMode = RedirectMode.Permanent;
</code></pre>
<p>to</p>
<pre><co... | 45,367 |
<p>Working on a project that parses a log of events, and then updates a model based on properties of those events. I've been pretty lazy about "getting it done" and more concerned about upfront optimization, lean code, and proper design patterns. Mostly a self-teaching experiment. I am interested in what patterns more ... | <p>Well... for one thing rather than a single event class with a union of all the properties, or 61 event classes (1 base, 60 subs), in a scenario with that much variation, I'd be tempted to have a single event class that uses a property bag (dictionary, hashtable, w/e floats your boat) to store event information. The... | <p>I'm not sure I understand the problem correctly. I assume there is a complex 'model updating logic'. Don't distribute this through 60 classes, keep it in one place, move it out from the event classes (Mediator pattern, sort of).</p>
<p>Your Mediator will work with event classes (I don't see how could you use the Fl... | 11,979 |
<p>I am creating a site in which different pages can look very different depending upon certain conditions (ie logged in or not, form filled out or not, etc). This makes it necessary to output diferent blocks of html at different times.</p>
<p>Doing that, however, makes my php code look horrific... it really messes w... | <p>Don't panic, every fresh Web programmer face this problem.</p>
<p>You HAVE TO separate your program logic from your display. First, try to make your own solution using two files for each Web page :</p>
<ul>
<li>one with only PHP code (no HTML) that fills variables</li>
<li>another with HTML and very few PHP : this... | <p>In cases like that I write everything incrementally into a variable or sometimes an array and then echo the variable/array. It has the added advantage that the page always renders in one go, rather than progressively.</p>
| 13,815 |
<p>Here's the code I want to speed up. It's getting a value from an ADO recordset and converting it to a char*. But this is slow. Can I skip the creation of the _bstr_t?</p>
<pre><code> _variant_t var = pRs->Fields->GetItem(i)->GetValue();
if (V_VT(&var) == VT_BSTR)
... | <p>The first 4 bytes of the BSTR contain the length. You can loop through and get every other character if unicode or every character if multibyte. Some sort of memcpy or other method would work too. IIRC, this can be faster than <code>W2A</code> or casting <code>(LPCSTR)(_bstr_t)</code></p>
| <p>Ok, my C++ is getting a little rusty... but I don't think the conversion is your problem. That conversion doesn't really do anything except tell the compiler to consider _bstr_t a char*. Then you're just assigning the address of that pointer to p. Nothing's actually being "done."</p>
<p>Are you sure it's not jus... | 14,336 |
<p>I know how to use the DrawImage() method of the Graphics object to copy from a rectangular source region to a rectangular destination region, and how to copy to a paralellogram region defined by a three-element Point[] array.</p>
<p>Is there any way in .NET to copy from a rectangular source region to a 4-sided non-... | <p>As far as I can tell, there isn't a straightforward (built-in) way to do this kind of image transform in .NET.</p>
<p>If you look at <a href="http://www.codeproject.com/KB/graphics/Aaform.aspx" rel="nofollow noreferrer">Anti Aliased Image Transformation (Aaform)</a> over on codeproject, you can download his sample ... | <p>As far as I can tell, there isn't a straightforward (built-in) way to do this kind of image transform in .NET.</p>
<p>If you look at <a href="http://www.codeproject.com/KB/graphics/Aaform.aspx" rel="nofollow noreferrer">Anti Aliased Image Transformation (Aaform)</a> over on codeproject, you can download his sample ... | 42,686 |
<p>I need to build something that starts serving a H.264 encoded video to a flash player halfway through the file (to support skipping to a point in the video that has not been buffered yet). </p>
<p>Currently, the videos are in the FLV container format, but transcoding is an option. I managed to re-write the file hea... | <p>The flash player can only start playing H.264 video once it's downloaded the MOOV atom. Existing pseudo-streaming providers just give you an FLV header - either the first 13 bytes of the file or a hardcoded one - and then serve the file from the given offset. If you want to make an H.264 pseudo-streamer, you'll ne... | <p>two things you can do:</p>
<p>1) use lighttpd and it's mp4 streaming plug-in that'll generate the required streaming container on the fly</p>
<p>2) create a keyframed FLV and use a psuedo-streaming script (like XMOOV) to stream your file.</p>
<p>if you need mp4/aac you can just put them inside the FLV container, ... | 8,740 |
<p>How can I comment a JSP expression like: <code><%= map.size() %></code></p>
<p>Is there something like <code><%= // map.size() %>?</code></p>
| <p>Pure JSP comments look like this:</p>
<pre><code><%-- Comment --%>
</code></pre>
<p>So if you want to retain the "<code>=</code>".you could do something like:</p>
<pre><code><%--= map.size() --%>
</code></pre>
<p>The key thing is that <code><%=</code> defines the beginning of an expression, in whi... | <p>One of:</p>
<p>In html</p>
<pre><code><!-- map.size here because -->
<%= map.size() %>
</code></pre>
<p>theoretically the following should work, but i never used it this way.</p>
<pre><code><%= map.size() // map.size here because %>
</code></pre>
| 27,119 |
<p>Say for instance I was writing a function that was designed to accept multiple argument types:</p>
<pre><code>var overloaded = function (arg) {
if (is_dom_element(arg)) {
// Code for DOM Element argument...
}
};
</code></pre>
<p>What's the best way to implement <strong><code>is_dom_element</code></... | <p>jQuery checks the nodeType property. So you would have:</p>
<pre><code>var overloaded = function (arg) {
if (arg.nodeType) {
// Code for DOM Element argument...
}
};
</code></pre>
<p>Although this would detect all DOM objects, not just elements. If you want elements alone, that would be:</p>
<pr... | <p>What about</p>
<pre><code>obj instanceof HTMLElement
</code></pre>
| 14,628 |
<p>Is it possible for a python script to open its own source file and overwrite it?</p>
<p>The idea was to have a very simple and very dirty way for a python script to download an update of itself so that the next time it is run it would be an updated version.</p>
| <p>That's certainly possible. After the script is loaded/imported, the Python interpreter won't access it anymore, except when printing source line in a exception stack trace. Any pyc file will be regenerated the next time as the source file is newer than the pyc.</p>
| <p>You might also want to check out this module ( which is in 2.5 & 3 as well )</p>
<p><a href="http://www.python.org/doc/2.1.3/lib/os-process.html" rel="nofollow noreferrer">http://www.python.org/doc/2.1.3/lib/os-process.html</a></p>
<p>Specifically the execv method will overwrite the current process with whatev... | 37,170 |
<p>Can somebody show me how to calculate the inverse of a matrix? I'm using VC++ 6.0</p>
| <p>MFC is not a tool for numerical methods.</p>
<hr>
<p>Calculating the inverse of an nxn matrix is simple. I'll give you the algorithm:</p>
<pre><code>/* I took this from my implementation of CMatrix
* It works, but I'm not sure if it's the most efficient algorithm.
*
* 1. Start with Q = Identity, whose inver... | <p>Another good source is <a href="http://www.nr.com/" rel="nofollow noreferrer">Numerical Recipes</a>, although that might be a little overkill.</p>
| 49,820 |
<p>I'm reviewing some Spring code, and I see a few bean defs that do not have an id or a name.
The person who did it is not around to ask.
The application is working fine.
I am not familiar what this necessarily means.
Anybody know if this means anything in particular?</p>
| <p>Some beans are not required to be accessed by other beans in the context file or programmatically. So as mentioned by JacobM, they don't require an id or name as they're not referenced.</p>
<p>Such an example would be a <a href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/beans/facto... | <p>its not a mandatory to provide java Bean Id..If we are not providing Bean Id,our Container Provides the Default Been Id.Default Bean Id look like as
"(Package Name).(Bean Class Name)#N"where N=0,1,2,......etc.</p>
| 41,709 |
<p>I believe the question says it all ... (I'll update if needed)</p>
| <p>You're not going to be able to do what you're talking about simply, because the postback (which is what the login control uses) is going to be whatever the page's security is (SSL or non-SSL).</p>
<p>Your best bet in this scenario is to use an IFRAME which contains an HTTPS (SSL) page that just contains thelogin co... | <p>You aren't going to be able to have your site as non-SSL, with a login box on every page, and then submit the username and password via SSL. </p>
<p>The only way to really accomplish this is to use frames of some sort. This way your entire page could be non-SSL, but the login frame would have to be SSL.</p>
<p>The... | 12,177 |
<p>I'm running a long process stored procedure.</p>
<p>I'm wondering if in case of a timeout or any case of disconnection with the database after initiating the call to the stored procedure. Is it still working and implementing the changes on the server?
</p>
| <blockquote>
<p>Anyway if the client is not there to commit at the end of the job the changes should be rolled back by the server.</p>
</blockquote>
<p>In other words, if you have a stored procedure making changes to the database and there is a possibility that the connection might disconnect in the middle, be sure ... | <p>I would suggest running your profiler on the database and watching the activity, and also create a basic test case so that you know for sure what happens. The outcome is dependent on your database and what you are using to connect to it.</p>
| 4,476 |
<p>2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.</p>
<p>What is the sum of the digits of the number 2 power of 1000 (2^1000)?</p>
<p>Can anyone provide the solution or algorithm for this problem in java?</p>
| <p>I won't provide code, but <code>java.math.BigInteger</code> should make this trivial.</p>
| <pre><code>In[1162] := Plus @@ IntegerDigits[2^1000]
Out[1162] = 1366
</code></pre>
| 49,413 |
<p>On Stackers' recommendation, I have been reading Crockford's excellent <em>Javascript: The Good Parts</em>.</p>
<p>It's a great book, but since so much of it is devoted to describing the best way to use Javascript's basic functionality, I'm not sure how I can put his advice into practice without duplicating the eff... | <p><a href="http://prototypejs.org/" rel="nofollow noreferrer">Prototype</a> has many great features, including a <a href="http://prototypejs.org/api/class" rel="nofollow noreferrer">Class helper</a> that handles the details of JS "inheritance" via the object prototype.</p>
<p>Edit: damn, I keep forgetting that jQuery... | <p>I think YUI is the closest to what Crockford teaches in his book. (He's the Yahoo architect also and it makes sense)</p>
| 47,885 |
<p>I accidentally committed an unwanted file (<code>filename.orig</code> while resolving a merge) to my repository several commits ago, without me noticing it until now. I want to completely delete the file from the repository history. </p>
<p>Is it possible to rewrite the change history such that <code>filename.orig<... | <p><strong>Please don't use this recipe if your situation is not the one described in the question. This recipe is for fixing a bad merge, and replaying your good commits onto a fixed merge.</strong></p>
<p>Although <code>filter-branch</code> will do what you want, it is quite a complex command and I would probably ch... | <p>You can also use:</p>
<p><code>git reset HEAD file/path</code></p>
| 39,633 |
<p>How can I detect keyboard event in C language without using third party libraries? Should I use signal handling?</p>
| <p>There's not a standard way, but these should get you started.</p>
<p>Windows:</p>
<pre><code>getch();
</code></pre>
<p>Unix:</p>
<p>Use this code from W. Richard Stevens' Unix Programming book to set your terminal in raw mode, and then use read().</p>
<pre><code>static struct termios save_termios;
static int ... | <p>Standard C does not have any facilities for detecting keyboard events, unfortunately. You have to rely on platform-specific extensions. Signal handling wont help you.</p>
| 27,197 |
<p>I've got an executable file, and I would like to know which version(s) of the Microsoft .NET Framework this file needs to be started.</p>
<p>Is there an easy way to find this information somewhere?</p>
<p>(So far I tried <a href="https://en.wikipedia.org/wiki/ILDASM#Metadata_storage" rel="noreferrer">ILDASM</a> and ... | <p>I think the closest you can reliably get is to determine what version of the <strong>CLR</strong> is required. You can do this by using ILDASM and looking at the "MANIFEST" node or Reflector and looking at the dissasembly view of the "Application.exe" node as IL. In both cases there is a comment that indicates the C... | <p>For newer .NET 6.0 applications the notepad method did not work for me, but if there is a *.deps.json file next to the exes that's a big clue - often contains the version in form of the following section</p>
<pre><code>"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0/win-x86"
</... | 42,222 |
<p>I am interested to know what strategies people have to keep their code AND work versioned across multiple machines. For example I have a desktop PC running XP, a macbook running OSX and VMWare running XP as well as a sales laptop for running product demos. I want to know how I can always have these in sync. Subve... | <p>Like others have said, subversion is your best bet for code. For binary files/non-code, I find <a href="http://www.getdropbox.com" rel="nofollow noreferrer">DropBox</a> to be very convenient. It stores revisions, has undelete, easy sharing, etc. basically an automagic, web-friendly SVN. Not having to think about it... | <p>I put important builds in Source Control -- it's fine for binary files.</p>
| 13,683 |
<p>I have a text file where I want to change only the first line of the file. The file could be millions of rows long, so I'd rather not have to loop over everything, so I'm wondering if there is another way to do this.</p>
<p>I'd also like to apply some rules to the first line so that I replace instances of certain ... | <p>A <code><a href="http://java.sun.com/javase/6/docs/api/java/io/RandomAccessFile.html" rel="noreferrer">RandomAccessFile</a></code> will do the trick, unless the length of the resulting line is different from the length of the original line.</p>
<p>If it turns out you are forced to perform a copy (where the first li... | <pre><code>public void main() throws IOException {
String newString = "The New String";
File myFile = new File("PathToFile");
// An array to store each line in the file
ArrayList<String> fileContent = new ArrayList<String>();
Scanner myReader = new Scanner(myFile);
... | 24,708 |
<p>I'm using Eclipse 3.4 and Tomcat 5.5 and I have a Dynamic Web Project set up. I can access it from <a href="http://127.0.0.1:8080/project/" rel="noreferrer">http://127.0.0.1:8080/project/</a> but by default it serves files from WebContent folder. The real files, that I want to serve, can be found under folder named ... | <p>In the project folder, there should be a file under the <code>.settings</code> folder named <code>org.eclipse.wst.common.component</code> that contains an XML fragment like this:</p>
<pre><code><wb-module deploy-name="WebProjectName">
<wb-resource deploy-path="/" source-path="/WebContent"/>
<... | <p>On STS 2.5.1 </p>
<ol>
<li>right click on your project</li>
<li>click on properties</li>
<li>Click on 'Java Build path'</li>
<li>Click "Source" tab</li>
<li>Navigate to default out put folder</li>
<li>Browse and add your path</li>
<li>Finish</li>
</ol>
| 24,724 |
<p>I am looking for a Visual Studio add-in that would analyze the text around the cursor position and navigate to the corresponding class definition.</p>
<p>For example I have this XML file that is currently open:</p>
<pre><code><object id="abc" type="MyProject.Foo.Bar, MyProject"/>
</code></pre>
<p>If I put t... | <p>Well you could use the '<strong><a href="http://msdn.microsoft.com/en-us/library/f5yx24a6(VS.80).aspx" rel="nofollow noreferrer">Code Definition Window</a></strong>' that comes with the VS2008 IDE. When you place your cursor, the Code Def window dynamically updates with the source code for that type. <em>Works with ... | <p>Use the Alt+G command in <a href="http://www.wholetomato.com/" rel="nofollow noreferrer">Visual Assist</a>.</p>
| 41,570 |
<p>I am considering purchasing a code signing certificate from VeriSign or Thawte to sign an XBAP with. My question is this: What happens when that certificate expires? $299 and $599 are pretty hefty prices for 1-year/2-year cerificates, and if I have to deliver a newly signed build to my customers whenever my certific... | <p>If you <strong>timestamp your code while the certificate is valid</strong> the effect is that your expired certificates are good.</p>
<p>From <a href="https://search.thawte.com/support/ssl-digital-certificates/index?page=content&id=AR1119" rel="noreferrer">Thawte Code Signing Certificate FAQs</a>:</p>
<p>How ... | <p>Code signing certs are not "managed" meaning they do not update themselves... chances are you have to purchase a new one once it expires.<br /><br />
You can set up a Certification Authority (CA) - stick with a windows-based CA if you're a windows-only shop but otherwise I'd recommend Linux with something like <a hr... | 42,678 |
<p>Are there any tools available to log the page load time for a php site?</p>
<p>Mainly looking for something that I can see trends of load times over time, I was considering dumping them into a file using error_log(), but I don't know what I could use to parse it and display graphs</p>
| <p>You can record the microtime at the start of execution, hold that variable until the end, check the time, subtract them, and there you have your execution time. Output buffering will be required to make this work in most cases, unless it's a situation in which a particular thing always runs last (like <code>footer()... | <p>See <a href="http://pear.php.net/package/Benchmark/" rel="nofollow noreferrer">PEAR Benchmark</a>. It allows you to add benchmarks into your code. You can have it dump an HTML table on your pages, or you can loop through the data and write to a log file.</p>
| 16,273 |
<p>If you create a class library that uses things from other assemblies, is it possible to embed those other assemblies inside the class library as some kind of resource?</p>
<p>I.e. instead of having <em>MyAssembly.dll</em>, <em>SomeAssembly1.dll</em> and <em>SomeAssembly2.dll</em> sitting on the file system, those o... | <p>Take a look at <strong><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=22914587-b4ad-4eae-87cf-b14ae6a939b0&displaylang=en" rel="nofollow noreferrer">ILMerge</a></strong> for merging assemblies.</p>
<blockquote>
<p>I'm also a little confused about why .NET assemblies are .dll files. Didn't t... | <p>With respect to Cheeso's answer of embedding the assemblies as resources and loading them dynamically using the Load(byte[]) overload using an AssemblyResolve event handler, you need to modify the resolver to check the AppDomain for an existing instance of the Assembly to load and return the existing assembly instan... | 27,473 |
<p>I have some program settings that are currently stored in HKEY_LOCAL_MACHINE. Due to Vista and locked down users, some users don't have permission to HKEY_LOCAL_MACHINE, and those values don't really belong to HKEY_LOCAL_USER either (it has to be the same for all users), what's the best alternative location for stor... | <p>You should put:</p>
<ul>
<li>personal settings (like window position and minor preferences) under <code>HKEY_CURRENT_USER</code> in the registry or in the <code>CSIDL_APPDATA</code> or <code>CSIDL_LOCAL_APPDATA</code> folder;</li>
<li>important application settings (like a fixed path that should not be modified by... | <p>Can you make a .msi file that can be used to push the registry settings out through group policy?</p>
| 36,211 |
<p>When printing a single character in a C program, must I use "%1s" in the format string? Can I use something like "%c"?</p>
| <p>yes, <code>%c</code> will print a single char:</p>
<pre><code>printf("%c", 'h');
</code></pre>
<p>also, <code>putchar</code>/<code>putc</code> will work too. From "man putchar":</p>
<pre><code>#include <stdio.h>
int fputc(int c, FILE *stream);
int putc(int c, FILE *stream);
int putchar(int c);
* fputc() w... | <pre><code>char variable = 'x'; // the variable is a char whose value is lowercase x
printf("<%c>", variable); // print it with angle brackets around the character
</code></pre>
| 39,947 |
<p>I know how to lighten the colors for certain commands, however I'd like to lighten the standard ansi colors across all commands.</p>
| <p>I found instructions for doing it for Xterm and aterm here:</p>
<p><a href="http://gentoo-wiki.com/TIP_Linux_Colors_in_Aterm/rxvt" rel="noreferrer">http://gentoo-wiki.com/TIP_Linux_Colors_in_Aterm/rxvt</a></p>
<p>From those I was able to get brighter colors by adding:</p>
<pre><code>rxvt*background: #000000
rxvt... | <p>A simple solution would be to turn up your monitor brightness :)</p>
<p>More seriously, see the RESOURCES section of the <a href="http://seth.positivism.org/man.cgi/rxvt" rel="nofollow noreferrer">manual</a>.</p>
| 17,524 |
<p>Is there a free third-party or .NET class that will convert HTML to RTF (for use in a rich-text enabled Windows Forms control)?</p>
<p>The "free" requirement comes from the fact that I'm only working on a prototype and can just load the BrowserControl and just render HTML if need be (even if it is slow) and that De... | <p>Actually there is a simple and <strong>free</strong> solution: use your browser, ok this is the trick I used:</p>
<pre><code>var webBrowser = new WebBrowser();
webBrowser.CreateControl(); // only if needed
webBrowser.DocumentText = *yourhtmlstring*;
while (_webBrowser.DocumentText != *yourhtmlstring*)
Applicati... | <p>Maybe what you need is <a href="http://www.codeplex.com/WinformHtmlTextbox" rel="nofollow noreferrer">a control to edit the HTML</a>? </p>
| 18,104 |
<p>Currently I'm writing it in clear text <em>oops!</em>, it's an in house program so it's not that bad but I'd like to do it right. How should I go about encrypting this when writing to the registry and how do I decrypt it?</p>
<pre><code>OurKey.SetValue("Password", textBoxPassword.Text);
</code></pre>
| <h1>You don't decrypt authentication passwords!</h1>
<p>Hash them using something like the SHA256 provider and when you have to challenge, hash the input from the user and see if the two hashes match.</p>
<pre><code>byte[] data = System.Text.Encoding.ASCII.GetBytes(inputString);
data = new System.Security.Cryptography.... | <p>Rather than encrypt/decrypt, you should be passing the password through a hashing algorithm, md5/sha512, or similar. What you would ideally do is hash the password and store the hash, then when the password is needed, you hash the entry and compare the entries. A password will then never be "decrypted", simply hash... | 26,118 |
<p>We are using Visual Studio 2008 as our primary development IDE. Our security team has set up McAfee to scan files in our \Local Settings\Temp folder. Unfortunately VS uses this directory during code builds which is slowing the developers down. We've reached an impasse with the security team on this, and wonder if... | <p>You can write a batch file which overwrites the %TEMP% and %TMP% variables and then launches visual studio. When the batch file overwrites an enviorment variables it is applicable only for that session, it does not modify the %TEMP% for applications launched from other batch files / system directly. </p>
| <p>Maybe complain a lot that you need faster computers since the added security slows you down so much? Have hard facts ready (like "slower compile time costs me 60 minutes every day")<br>
Usually when it comes around to spending money most businesses find other ways around a problem.</p>
| 22,142 |
<p>I'm searching a C# component or code snipped that does something like that:</p>
<p>I want to inform new users about the most important program functions if he opens a new window for example.
It should be a box showing text (formated if possible) that is of course not modal and has some mechanism to 'go out of the w... | <p>I use a "bar" at the top of every window to display some information about the current window/dialog.</p>
| <p>Use tooltips. They can be programmatically controlled, and you can have them appear at will. You'll need to add the functionality to your app to keep track of what tooltips have been shown to the user already. </p>
<p>You can add a "balloon" style by setting the IsBalloon property to true.</p>
<p>You can also repl... | 19,521 |
<p>I need to profile a java application for a customer. It's an eclipse/maven project, so I decided on using eclipse TPTP ( <a href="http://www.eclipse.org/tptp" rel="noreferrer">http://www.eclipse.org/tptp</a> ).</p>
<p>I tried to install eclipse TPTP through the update manager from a standard eclipse installation, b... | <p>An alternative is to use Netbeans to profile an Eclipse Application.</p>
<p>I have a blog post on the link below that explains how to configure both applications:</p>
<p><a href="http://www.jroller.com/ortegon/entry/on_profiling_eclipse_rcp_applications" rel="nofollow noreferrer">http://www.jroller.com/ortegon/ent... | <p>Maybe try downloading the "Java 1.5+ (JVMTI) Profiler SDK" (runtime) from
<a href="http://www.eclipse.org/tptp/home/downloads/?ver=4.5.1" rel="nofollow noreferrer">http://www.eclipse.org/tptp/home/downloads/?ver=4.5.1</a></p>
<p>I also think IBM's latest Rational Developer integrates this technology (there is 60 da... | 22,583 |
<p>Is there some rare language construct I haven't encountered (like the few I've learned recently, some on Stack Overflow) in C# to get a value representing the current iteration of a foreach loop?</p>
<p>For instance, I currently do something like this depending on the circumstances:</p>
<pre><code>int i = 0;
forea... | <p>The <code>foreach</code> is for iterating over collections that implement <a href="http://msdn.microsoft.com/en-us/library/9eekhta0%28v=vs.110%29.aspx" rel="noreferrer"><code>IEnumerable</code></a>. It does this by calling <a href="http://msdn.microsoft.com/en-us/library/s793z9y2(v=vs.110).aspx" rel="noreferrer"><co... | <p>i want to discuss this question more theoretically (since it has already enough practical answers)</p>
<p>.net has a very nice abstraction model for groups of data (a.k.a. collections) </p>
<ul>
<li>At the very top, and the most abstract, you have an <code>IEnumerable</code> it's just a group of data that you can ... | 6,466 |
<p>At what point does a MySQL database start to lose performance?</p>
<ul>
<li>Does physical database size matter?</li>
<li>Do number of records matter?</li>
<li>Is any performance degradation linear or exponential?</li>
</ul>
<p>I have what I believe to be a large database, with roughly 15M records which take up alm... | <p>The physical database size doesn't matter. The number of records don't matter.</p>
<p>In my experience the biggest problem that you are going to run in to is not size, but the number of queries you can handle at a time. Most likely you are going to have to move to a master/slave configuration so that the read que... | <p>No it doesnt really matter. The MySQL speed is about 7 Million rows per second. So you can scale it quite a bit</p>
| 2,366 |
<p>I make a lot of web applications and from time to time I need a color picker. What's one that I can use like an API and doesn't require a lot of code to plug in? I also need it to work in all browsers.</p>
| <p><a href="http://acko.net/dev/farbtastic" rel="noreferrer">Farbtastic</a> is a nice jQuery color picker </p>
<p>But apparently doesn't work in IE6</p>
<p><a href="http://www.eyecon.ro/colorpicker/#about" rel="noreferrer">Here</a> is another jQuery color picker that looks nice, not sure about it compatibility though... | <p>If your using prototype and script.aculo.us this one is great:</p>
<p><a href="http://code.google.com/p/colorpickerjs/" rel="nofollow noreferrer">http://code.google.com/p/colorpickerjs/</a></p>
| 10,293 |
<p>There are some cool and exciting features in .NET 3.5/C# 3.0, and with those features comes some darn interesting ways to write the exact same line of code.</p>
<p>Using the above stated tool set (and by extension .NET 2.0 stuff), what are the different ways the below code snippet could reasonably be rewritten? </p... | <p>Lambda:</p>
<pre><code>if (Directory.Exists(uploadDirectory))
Directory.GetFiles(uploadDirectory)
.Where(f => File.GetLastWriteTime(file) < DateTime.Now.AddHours(-12))
.Each(f => File.Delete(f));
</code></pre>
<p>Edit: On 2nd thought, you can avoid the security lookups on each File access by us... | <p>Well, the first bit maps quite neatly to a LINQ query... but there is (deliberately) no ForEach in regular LINQ. We can annoy Eric and add one, though ;-p</p>
<p>So the following uses LINQ and a custom extension method - but we could re-write the <em>exact</em> same code (i.e. the same IL) as:</p>
<ul>
<li>query s... | 26,655 |
<p>I have multiple selects:</p>
<pre><code><select id="one">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>
<select id="two">
<option value="1">one</option>
<option value="2">two&... | <p>I am not (currently) a user of jQuery, but I can tell you that you need to temporarily disconnect your event handler while you repopulate the items or, at the least, set a flag that you then test for and based on its value, handle the change.</p>
| <p>Or you can just hide the option you don't want to show...</p>
<pre><code>function hideSelected($one, $two)
{
$one.bind('change', function()
{
var val = $one.val();
$two.find('option:not(:visible)').show().end()
.find('option[value='+val+']').hide().end();
})
}
hideSelected($o... | 6,665 |
<p>I have 6 classes, which are all document types. All the document types have the same 8 fields. There is one class which consists of only these 8 fields. The rest of the classes have more fields. Some of these classes have the same fields (beside the 8 fields).</p>
<p>Example:</p>
<p>class Document: fields 1 to 8</... | <p>Either make Document the base type of Form etc, or make a form have the extra fields and a reference to a separate Document (i.e. use composition instead of inheritance). In this case it sounds like inheritance would quite possibly be the best option, but it really depends on what you want to do with it. Do you have... | <p>The old school answer would be creating a class with the shared fields and inherit.</p>
<p>The trendy answer would be to create a class that has those fiends and have it as a member.</p>
<p>Inheriting creates more dependency between the classes, if you will every change the base, which is considered bad practice.<... | 47,283 |
<p>There are a lot of procedures and functions in the master database of SQL Server that provide handy tools for the database developer. For instance, <code>sp_help [database object]</code> will provide several results sets with useful attributes of the specified object; <code>sp_helptext [procedure or function name]... | <p>They are all on the MS Site: <a href="http://msdn.microsoft.com/en-us/library/ms187961.aspx" rel="nofollow noreferrer">System Stored Procedures (Transact-SQL)</a></p>
| <p>two that come to my mind</p>
<p>Locks: <a href="http://support.microsoft.com/kb/q255596/" rel="nofollow noreferrer">sp_lock2</a></p>
<p>Orphans: <a href="http://technet.microsoft.com/en-us/library/ms174378(SQL.90).aspx" rel="nofollow noreferrer">sp_change_users_login</a></p>
| 35,604 |
<p>Currently i have a NotInheritable class in App_Code that hold some variables that need to be access thur-out the application but i don't think it's a good way to manage global variables. </p>
| <p>Usually, this kind of thing calls for a <a href="http://en.wikipedia.org/wiki/Singleton_pattern" rel="nofollow noreferrer">Singleton</a>. However, I'd recommend never coding a singleton yourself, and using a Dependency Injection/IoC framework to handle the life-cycle of services.</p>
<p>The other thing you have to ... | <p>You should use the Application Settings. Just go to the Application property window, choose the settings tab and add your variables. Than on the code just use the strong typed class. For instance, if I've created a Global variable named <em>PortalName</em> I just use: <code>Settings.Default.PortalName</code></p>
| 39,372 |
<p>I am trying to implement position-sensitive zooming inside a <code>JScrollPane</code>. The <code>JScrollPane</code> contains a component with a customized <code>paint</code> that will draw itself inside whatever space it is allocated - so zooming is as easy as using a <code>MouseWheelListener</code> that resizes the... | <p>Tested this, seems to work...</p>
<pre><code>private void updatePreferredSize(int n, Point p) {
double d = (double) n * 1.08;
d = (n > 0) ? 1 / d : -d;
int w = (int) (getWidth() * d);
int h = (int) (getHeight() * d);
preferredSize.setSize(w, h);
int offX = (int)(p.x * d) - p.x;
int ... | <p>Your MouseWheelListener also has to locate the cursor, move it to the center of the JScrollPane and adjust the xmin/ymin and xmax/ymax of the content to be viewed.</p>
| 14,038 |
<p>What is your best practical user-friendly user-interface design or principle? </p>
<p>Please submit those practices that you find actually makes things really useful - no matter what - if it works for your users, share it!</p>
<hr>
<p>Summary/Collation</p>
<p>Principles</p>
<ol>
<li>KISS.</li>
<li>Be clear and... | <p>Try to use verbs in your dialog boxes. </p>
<p>It means use </p>
<p><img src="https://i.stack.imgur.com/R8Jmu.png" alt="alt text"></p>
<p>instead of </p>
<p><img src="https://i.stack.imgur.com/Yrxwz.png" alt="alt text"></p>
| <p><a href="http://msdn.microsoft.com/en-us/library/aa511332.aspx" rel="nofollow noreferrer">Be Powerful and Simple</a></p>
<p>Oh, and hire a designer / learn design skills. :)</p>
| 11,613 |
<p>How to tag images in the image itself in a web page? </p>
<p>I know <a href="http://www.taggify.net/" rel="nofollow noreferrer">Taggify</a>, but... is there other options?</p>
<p><a href="http://en.blog.orkut.com/2008/06/tag-thats-me.html" rel="nofollow noreferrer">Orkut</a> also does it to tag people faces... How... | <p>I know this isn't javascript but C# 3.0 has an API for doing this. The <strong>System.Windows.Media.Imaging</strong> namespace has a class called <strong>BitmapMetadata</strong> which can be used to read and write image metadata (which is stored in the image itself). Here is a method for retrieving the metadata for ... | <p>You can check out Image.InfoCards (IIC) at <a href="http://www.imageinfocards.com" rel="nofollow noreferrer">http://www.imageinfocards.com</a> . With the IIC meta-data utilities you can add meta-data in very user-friendly groups called "cards".</p>
<p>The supplied utilities (including a Java applet) allow you to ta... | 15,610 |
<p>What are some guidelines for displaying information to a user in a web-browser?</p>
<p>I am trying to determine some guidelines and best practices for displaying information to a user. </p>
<p>The exact case is a confirmation button: once it’s been pressed and the subject is confirmed the button is disabled (to pr... | <p>Regarding UI clues, you can find some good ideas related to <a href="http://www.websemantics.co.uk/tutorials/accessible_forms/" rel="nofollow noreferrer"><strong>form validation</strong></a>.</p>
<p>For instance, you can display explicitly the list those prerequisite with a symbol (red *) before each of them, stati... | <p>I would first show the information in some way other than a tool tip since this is somewhat critical information. Also, for the button, I would have two different UI clues. Obviously, the button should be disabled until it is ready to be clicked. Then when the button is clicked, you could have some image or somethin... | 43,262 |
<p>Im building a web application which is a process management app. Several different employee types will be shown a list of Tasks to do and as each one completes a task then it is moved on to the next employee to work on.</p>
<p>The Task hierarchy is Batch > Load > Assembly > Part > Task. There are currently 8 rules... | <p>It is difficult to determine from the details in the question. However, putting your logic in a business logic (middle) layer will mean that your business rules can continue to use the same code no matter what the back-end database may be. At the moment you specify T-SQL but is it possible that in the future you wil... | <p>What platform? .NET 3.5 introduces LinqToSQL that may make this a moot point. You could use a strategy pattern to select from/build an appropriate query based on the task type, then let LINQ do the translation to SQL for you. That way you can build the query in code, but still have it actually executed on the DB.<... | 16,416 |
<p>Just as the title says. I feel like I have tried everything. I am compiling the firmware for Marlin on a Megatronics board from RepRap. That shouldn't be relevant, because I have validated that it is a firmware issue (and not a pin assignment/hardware issue).</p>
<p>When I turn it on, the Y-axis is active and just c... | <p>I did a simple search at <a href="http://www.huski.ai" rel="nofollow noreferrer">www.huski.ai</a>, and found 11 trademarks with the mark word "FabLab".</p>
<p><a href="https://i.stack.imgur.com/PXPXU.png" rel="nofollow noreferrer" title="Screenshot of search"><img src="https://i.stack.imgur.com/PXPXU.png" ... | <p>Sorry, I needed to learn to use the site. This site shows Fablab as a word mark, the same way it shows Apple: <a href="https://www.trademarkengine.com/free-trademark-search/trademark-search" rel="nofollow noreferrer">https://www.trademarkengine.com/free-trademark-search/trademark-search</a></p>
| 1,868 |
<p>I have ListView with Grouping Items. Grouping uses custom GroupStyle (Expander). I would like to have check box which will Expand and collapse all groups when. It works fine untill I click manually on the group header and expand or collapse that group. After clicking that particular group stops to respond on che... | <p>I found solution for the problem. What needs to be done is specify Mode=TwoWay and UpdateSourceTrigger=Explicit, so this way it is not breaking Binding and everything works fine. Bellow is an example of working code.</p>
<pre><code><Window xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
... | <p>It looks like the binding is broken since it's set to be OneWay with the checkbox, then if you click any of the expanders it will then break the binding. Setting it to be TwoWay will cause it to always work but expanding one item will cause them all to expand, which isn't very useful.</p>
<p>I believe the solution ... | 28,096 |
<p>What are the best JVM settings you have found for running Eclipse?</p>
| <p><sub>It is that time of year again: "eclipse.ini take 3" the settings strike back!</sub> </p>
<h1>Eclipse Helios 3.6 and 3.6.x settings</h1>
<p><a href="http://www.eclipse.org/home/promotions/friends-helios/helios.png" rel="nofollow noreferrer">alt text http://www.eclipse.org/home/promotions/friends-helios/helios... | <p>Here's what I use (though I have them in the shortcut instead of the settings file):</p>
<p>eclipse.exe -showlocation -vm "C:\Java\jdk1.6.0_07\bin\javaw.exe" -vmargs -Xms256M -Xmx768M -XX:+UseParallelGC -XX:MaxPermSize=128M</p>
| 17,208 |
<p>I've worked with <strong>Cruise Control</strong> as the CI framework in my last project.
Any recommendations on some other tools?</p>
<p>(Not that i found CruiseControl lacking, just wanted to know if someone did some comparisons)</p>
| <p>We have had great success with <a href="http://hudson-ci.org/" rel="nofollow noreferrer">Hudson</a>. It is easy to install and configure, has a great range of plugins and a good web user interface. The checkstyle and cobertura code coverage plugins are two that we use. </p>
| <p>TFS 2008 is pretty good. It has continuous integration built in to TFS build.</p>
| 13,590 |
<p>Suppose that two tables exist: <code>users</code> and <code>groups</code>.</p>
<p><strong>How does one provide "simple search" in which a user enters text and results contain both users and groups whose names contain the text?</strong></p>
<p>The result of the search must distinguish between the two types.</p>
| <p>The trick is to combine a <code>UNION</code> with a literal string to determine the type of 'object' returned. In most (?) cases, UNION ALL will be more efficient, and should be used unless duplicates are required in the sub-queries. The following pattern should suffice:</p>
<pre><code> SELECT "group" type, name
... | <p>If you use "UNION ALL" then the db doesn't try to remove duplicates - you won't have duplicates between the two queries anyway (since the first column is different), so UNION ALL will be faster.<br>
(I assume that you don't have duplicates inside each query that you want to remove)</p>
| 8,023 |
<p>I have a function that is effectively a replacement for print, and I want to call it without parentheses, just like calling print.</p>
<pre><code># Replace
print $foo, $bar, "\n";
# with
myprint $foo, $bar, "\n";
</code></pre>
<p>In Perl, you can create subroutines with parameter templates and it allows exactly t... | <p>print is not a <a href="http://ca.php.net/manual/en/functions.variable-functions.php" rel="noreferrer">variable functions</a></p>
<blockquote>
<p>Because this is a language construct
and not a function, it cannot be
called using variable functions</p>
</blockquote>
<p>And :</p>
<blockquote>
<p>Variable fu... | <p>That can't be done with PHP. Functions you declare must be called with brackets.</p>
| 26,130 |
<p>This XML file contained archived news stories for all of last year. I was asked to sort these stories by story categor[y|ies] into new XML files.</p>
<pre><code>big_story_export.xml
</code></pre>
<p>turns into</p>
<pre><code>lifestyles.xml
food.xml
nascar.xml
</code></pre>
<p>...and so on.</p>
<p>I got the job ... | <p>This sounds like a bug in the large XML file or the XSLT processor. There are two things you should check on your file.</p>
<ol>
<li>Is the file well-formed XML? That is, are all tags and attributes properly terminated and matched? An XML processor, like <a href="http://xmlstar.sourceforge.net/" rel="nofollow no... | <p>Check out Apache's <a href="http://xml.apache.org/xalan-c/index.html" rel="nofollow noreferrer">Xalan C++</a>. In my experience, where others (including Saxon) have failed on "large" XML files (>600 MB), this was able to run with memory to spare. </p>
| 18,010 |
<p>In <code>java.util.Calendar</code>, January is defined as month 0, not month 1. Is there any specific reason to that ?</p>
<p>I have seen many people getting confused about that...</p>
| <p>It's just part of the horrendous mess which is the Java date/time API. Listing what's wrong with it would take a very long time (and I'm sure I don't know half of the problems). Admittedly working with dates and times is tricky, but aaargh anyway.</p>
<p>Do yourself a favour and use <a href="http://joda-time.source... | <p>In addition to DannySmurf's answer of laziness, I'll add that it's to encourage you to use the constants, such as <code>Calendar.JANUARY</code>.</p>
| 44,795 |
<p>I'm developing a web application that is targeted at IE and during testing would like to log in as a number of different users and test their interactions with each other.</p>
<p>At present I have to log in and out to switch users; Opening another window just overrides the cookies/session.</p>
<p>Is there any way ... | <p>How about running it as a different user?</p>
<p>For instance,</p>
<pre><code>runas /user:domain\account iexplore.exe
</code></pre>
| <p>This might not be the final solution to your problem, but what I have observed is, that for example <a href="http://rssbandit.org/" rel="nofollow noreferrer">RSS Bandit</a> - an RSS reader that uses IE as rendering engine - seems to have a different Cookie base than the "real Internet Explorer". That way you can ha... | 44,649 |
<p>I ordered an <a href="http://rads.stackoverflow.com/amzn/click/B007KG0ZYI" rel="nofollow">OEM Power Supply</a> and I intend to hook up with <a href="http://rads.stackoverflow.com/amzn/click/B00511QVVK" rel="nofollow">this rocker switch</a> I believe it's like the one specified in the <a href="http://reprap.org/wiki/... | <p>According to the RepRap.org <a href="http://reprap.org/wiki/G-code" rel="nofollow noreferrer">list of G-Code commands</a>, see <strong><a href="http://reprap.org/wiki/G-code#G0_.26_G1:_Move" rel="nofollow noreferrer">G0 & G1: Move</a></strong>:</p>
<blockquote>
<p>The <code>Ennn</code> command is <em>The amou... | <p>Is the hotend temperature set correctly? If you only preheat the hotend but then turn it off, it will behave exactly as you described (while you're above <code>EXTRUDE_MINTEMP</code> it will behave normally, but once the temperature drops too low it will continue doing the XYZ-moves, but stop extruding). Perhaps you... | 233 |
<p>I am looking for best practices for detecting and preventing DOS in the service implementation (not external network monitoring). The service handles queries for user, group and attribute information. </p>
<p>What is your favorite source of information on dealing with DOS?</p>
| <p>This is a technique I found very useful..</p>
<p><a href="http://weblogs.asp.net/omarzabir/archive/2007/10/16/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx" rel="noreferrer">Prevent Denial of Service (DOS) attacks in your web application</a></p>
| <p>My first attempt to solve the DoS vulnerability used the approach suggested by Gulzar, which is basically to limit the number of calls allowed from the same IP address. I think it's a good approach, but, unfortunately, it caused my code to fail a performance test. </p>
<p>Since I was unable to get the performance ... | 13,348 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.