instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>What is MySQL equivalent of the <code>Nz</code> Function in Microsoft Access? Is <code>Nz</code> a SQL standard?</p>
<p>In Access, the <code>Nz</code> function lets you return a value when a variant is null. <a href="http://www.techonthenet.com/access/functions/advanced/nz.php" rel="nofollow noreferrer">Source</a><... | <p>The <a href="https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html#function_coalesce" rel="nofollow noreferrer"><code>COALESCE()</code></a> function does what you describe. It's standard SQL and it should be supported in all SQL databases.</p>
<p>The <a href="https://dev.mysql.com/doc/refman/8.0/en/flow... | <p>Perhaps Knowing what MS Access NZ() Function actually does would be helpful (prior to answering with completely invalid suggestions). The NZ() Function test for Null and Replaces the Null with an empty string, a Zero or optionally a value that the user enters.</p>
<p>COALESCE doesn't even come close, in fact it ret... | 27,566 |
<p>If I had 20 directories under trunk/ with lots of files in each and only needed 3 of those directories, would it be possible to do a Subversion checkout with only those 3 directories under trunk?</p>
| <p>Indeed, thanks to the comments to my post here, it looks like <a href="http://svnbook.red-bean.com/en/1.8/svn.advanced.sparsedirs.html" rel="noreferrer">sparse directories</a> are the way to go. I believe the following should do it:</p>
<pre><code>svn checkout --depth empty http://svnserver/trunk/proj
svn update --... | <p>Not in any especially useful way, no. You can check out subtrees (as in Bobby Jack's suggestion), but then you lose the ability to update/commit them atomically; to do that, they need to be placed under their common parent, and as soon as you check out the common parent, you'll download everything under that parent... | 7,375 |
<p>I'm trying to create a simple Java application that displays a frame containing a JButton. I'm using JNI to add transparency to the window. The window is transparent but the button is not. Also, when I move the window the button doesn't move with the window. The same thing happens with a JLabel. If I use a Button in... | <p>6u10 supports <a href="http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/" rel="nofollow noreferrer">transparent windows</a> through an unofficial API. 6u10 is available for download through java.com and previous JDK versions will update to it or a later update soon.</p>
| <p>You may have more success with <a href="https://github.com/twall/jna/" rel="nofollow noreferrer">JNA</a>, and in particular their <a href="https://github.com/twall/jna/javadoc/com/sun/jna/examples/WindowUtils.html" rel="nofollow noreferrer">Window utils</a>.</p>
| 33,298 |
<p>I would like to make a child class that has a method of the parent class where the method is a 'classmethod' in the child class but <strong>not</strong> in the parent class.</p>
<p>Essentially, I am trying to accomplish the following:</p>
<pre><code>class foo(Object):
def meth1(self, val):
self.value =... | <p>I'm also not entirely sure what the exact behaviour you want is, but assuming its that you want bar.meth1(42) to be equivalent to foo.meth1 being a classmethod of bar (with "self" being the class), then you can acheive this with:</p>
<pre><code>def convert_to_classmethod(method):
return classmethod(method.im_fu... | <p>The question, as posed, seems quite odd to me: I can't see why anyone would want to do that. It is possible that you are misunderstanding just what a "classmethod" is in Python (it's a bit different from, say, a static method in Java).</p>
<p>A normal method is more-or-less just a function which takes as its first ... | 9,214 |
<p>If an object has a property that is a collection, should the object create the collection object or make a consumer check for null? I know the consumer should not assume, just wondering if most people create the collection object if it is never added to.</p>
| <p>You can also use the "Lazy initailizer" pattern where the collection is not initialized until (and unless) someone accesses the property getter for it... This avoids the overhead of creating it in those cases where the parent object is instantiated for some other purpose that does not require the collection... </p>
... | <p>As a general rule, I think the object should create the collection and provide methods for manipulating it; add/get/remove. When following this rule, you should not provide methods for setting the collection directly. If you want a method like setSomeCollection(Collection someCollection) for convenience, the impleme... | 45,623 |
<p>I'm trying to use the <code>Microsoft.Sdc.Tasks.ServiceProcess.Exists</code> to check whether or not a service exists. There is no example of using it in the documentation though. Anyone have one?</p>
| <p>I've not actually used this in production myself, and I'm not sure which version you have (I have a copy of Release 2.1.3155.0) and according to the accompanying .chm help file the Task has the following properties:</p>
<ul>
<li>DoesExist Returns TRUE if the service specified exists </li>
<li>IsDisabled Retur... | <p>I've not actually used this in production myself, and I'm not sure which version you have (I have a copy of Release 2.1.3155.0) and according to the accompanying .chm help file the Task has the following properties:</p>
<ul>
<li>DoesExist Returns TRUE if the service specified exists </li>
<li>IsDisabled Retur... | 20,894 |
<p>We are an organisation who have purchased a system which is used by doctors to view test results of patients (quite sensitive information).
Being a programmer, I have poked and prodded with the system and found that it submits the username and password via a HTTP GET request.
On the domain it is run on, all computer... | <p>If it's medical data and you live in the United States, there is an excellent chance that access to it is subject to HIPAA regulations, including security requirements. You should review <a href="http://www.cms.hhs.gov/SecurityStandard/Downloads/SecurityGuidanceforRemoteUseFinal122806.pdf" rel="nofollow noreferrer">... | <p>Was this custom software or something used by others? If the latter, consider joining or starting a user group representing all those who use the software.</p>
| 29,530 |
<ul>
<li>What are the stack and heap?</li>
<li>Where are they located physically in a computer's memory?</li>
<li>To what extent are they controlled by the OS or language run-time?</li>
<li>What is their scope?</li>
<li>What determines their sizes?</li>
<li>What makes one faster?</li>
</ul>
| <p>The stack is the memory set aside as scratch space for a thread of execution. When a function is called, a block is reserved on the top of the stack for local variables and some bookkeeping data. When that function returns, the block becomes unused and can be used the next time a function is called. The stack is ... | <p>Thank you for a really good discussion but as a real noob I wonder where instructions are kept? In the BEGINNING scientists were deciding between two architectures (von NEUMANN where everything is considered DATA and HARVARD where an area of memory was reserved for instructions and another for data). Ultimately, we ... | 10,533 |
<p>I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the <a href="http://msdn.microsoft.com/en-us/library/cc267206.aspx" rel="noreferrer">Gdikdx.dll extension</a> to look at Gdi information... | <p>There was a <a href="http://msdn.microsoft.com/en-us/magazine/cc188782.aspx" rel="nofollow noreferrer">MSDN Magazine article from several years ago</a> that talked about GDI leaks. This points to several different places with good information.</p>
<p>In WinDbg, you may also try the <code>!poolused</code> command f... | <p>I have created a Windbg script for that. Look at the answer of </p>
<p><a href="https://stackoverflow.com/questions/1626941/windbg-command-to-get-all-gdi-handle-count-from-a-crash-dump">Command to get GDI handle count from a crash dump</a></p>
<p>To track the allocation stack you could set a ba (Break on Access) b... | 12,970 |
<p>The C++ standard imposes an ordering on class member variables in memory. It says that the addresses of member variables have to increase in the order of declaration, but only inside one access section. Very specifically, this does not seem to prevent compilers from laying out access sections in an interleaved way... | <p>I checked out the C++ standard. In section 9.2, paragraph (or clause or whatever) 12, it says "The order of allocation of nonstatic data members separated by an access-specifier is unspecified." "Unspecified" means implementation-dependent behavior that need not be documented.</p>
<p>Therefore, the standard is ex... | <p>The way I interpret the standard, it sees the code example as follows: since there is no access specifier between i and j, the address of i must come before the address of j. The proposed ordering satisfies this. Idem for k and n. So in my interpretation, compilers <em>are</em> allowed to use this ordering.</p>
| 36,881 |
<p>How do I use JUnit to test a class that has internal private methods, fields or nested classes?</p>
<p>It seems bad to change the access modifier for a method just to be able to run a test.</p>
| <p>If you have somewhat of a legacy <strong>Java</strong> application, and you're not allowed to change the visibility of your methods, the best way to test private methods is to use <a href="http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29" rel="noreferrer">reflection</a>.</p>
<p>Internally we're usi... | <p>In your class:</p>
<pre><code>namespace my_namespace {
#ifdef UNIT_TEST
class test_class;
#endif
class my_class {
public:
#ifdef UNIT_TEST
friend class test_class;
#endif
private:
void fun() { cout << "I am private&qu... | 5,487 |
<p>We have a client that has Oracle <em>Standard</em>, and a project that would be ten times easier addressed using OLAP. However, Oracle only supports OLAP in the <em>Enterprise</em> version.</p>
<p>Migration to enterprise is <strong>not</strong> possible</p>
<p>I'm thinking of doing some manual simulation of OLAP, ... | <p>You can simulate OLAP functionality using client side tools pointed at a relational database.</p>
<p>Personally I think the best tool for the job is probably <a href="http://www.tableausoftware.com/" rel="noreferrer">Tableau Desktop</a>. This is an amazingly sophisticated front end analytics tool that will make you... | <p>Whilst MS SQL Server offers OLAP, you'll need an Enterprise licence to use a cube in a live environment that is web-facing.</p>
| 6,398 |
<p>I have a 3-leveled hierarchy of entities: Customer-Order-Line, which I would like to retrieve in entirety for a given customer, using ISession.Get(id). I have the following XML fragments:</p>
<p>customer.hbm.xml:</p>
<pre><code><bag name="Orders" cascade="all-delete-orphan" inverse="false" fetch="join">
&... | <p>You're getting 4XOrder and 4XLines because the join with lines doubles the results . You can set a Transformer on the ICriteria like :</p>
<pre><code>.SetResultTransformer(new DistinctRootEntityResultTransformer())
</code></pre>
| <p>@Tigraine: your query only returns Post with Comments. This brings All posts with all Comments (2 levels). What Ben asking is Customer to Order To LineItem (3 level).
@Ben: to my knowledge nHibernate doesn't support eager loading upto 3 level yet. Hibernate does support it thou. </p>
| 43,107 |
<p>How can I set the protected <code>DoubleBuffered</code> property of the controls on a form that are suffering from flicker?</p>
| <p>Here's a more generic version of <a href="https://stackoverflow.com/questions/76993/how-to-double-buffer-net-controls-on-a-form#77041">Dummy's solution</a>. </p>
<p>We can use reflection to get at the protected <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doublebuffered.aspx" rel="... | <h2>FWIW</h2>
<p>building on the work of those who've come before me:<br>
<a href="https://stackoverflow.com/a/77041/4496560">Dummy's Solution</a>, <a href="https://stackoverflow.com/a/77233/4496560">Ian Boyd's Solution</a>, <a href="https://stackoverflow.com/a/77023/4496560">Amo's Solution</a></p>
<p>here is a version... | 10,262 |
<p>Is there an easy way to display a messagebox in VB.NET with custom button captions? I came across <em><a href="https://stackoverflow.com/questions/77293/what-is-an-easy-way-to-create-a-messagebox-with-custom-button-text-in-managed-c">What is an easy way to create a MessageBox with custom button text in Managed C++?... | <p>MessageBox uses a plain window that can be messed with like any other window. This has been possible in Windows for a very long time, well over 20 years already. The techniques are getting obscure though, too many friendly class wrappers that hide the native winapi and don't expose everything you can do with it. ... | <p>Here is a C# snippet that uses a Win32 hook to alter the button captions (sourced from <a href="http://icodesnip.com/snippet/csharp/custom-messagebox-buttons" rel="nofollow">http://icodesnip.com/snippet/csharp/custom-messagebox-buttons</a>):</p>
<pre><code> [DllImport("kernel32.dll")]
static extern u... | 29,057 |
<p>Does anyone know of a really good editor to debug JavaScript (other then Visual Studio 2008 and FireBug)?
</p>
| <p>Here is an article, <a href="http://www.sitepen.com/blog/2008/04/03/advanced-javascript-debugging-techniques/" rel="noreferrer">Advanced JavaScript Debugging Techniques</a>, that describes the use of several tools. One new tool I learned about that I hadn't heard of before is <a href="http://www.jslint.com/" rel="n... | <p>For Internet Explorer debugging (and when you don't have VS 2008), you can use MS Script Editor. This is a good writeup on how to get it configured correctly: </p>
<p><a href="http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html" rel="nofollow noreferrer">http://www.jonathanboutelle.com/mt/archi... | 12,870 |
<p>In SQL Server you can use the <code>IsNull()</code> function to check if a value is null, and if it is, return another value. Now I am wondering if there is anything similar in C#.</p>
<p>For example, I want to do something like:</p>
<pre><code>myNewValue = IsNull(myValue, new MyValue());
</code></pre>
<p>instead... | <p>It's called the null coalescing (<code>??</code>) operator:</p>
<pre><code>myNewValue = myValue ?? new MyValue();
</code></pre>
| <p>This is meant half as a joke, since the question is kinda silly.</p>
<pre><code>public static bool IsNull (this System.Object o)
{
return (o == null);
}
</code></pre>
<p>This is an extension method, however it extends System.Object, so every object you use now has an IsNull() method.</p>
<p>Then you can save t... | 20,425 |
<p>When I get exceptions, it is often from deep within the call stack. When this happens, more often than not, the actual offending line of code is hidden from me:</p>
<pre class="lang-none prettyprint-override"><code>tmp.rb:7:in `t': undefined method `bar' for nil:NilClass (NoMethodError)
from tmp.rb:10:in `... | <p>Exception#backtrace has the entire stack in it:</p>
<pre><code>def do_division_by_zero; 5 / 0; end
begin
do_division_by_zero
rescue => exception
puts exception.backtrace
raise # always reraise
end
</code></pre>
<p>(Inspired by Peter Cooper's <a href="http://www.rubyinside.com/21-ruby-tricks-902.html" rel=... | <p>You can also use <a href="https://github.com/yegor256/backtrace" rel="nofollow noreferrer">backtrace</a> Ruby gem (I'm the author):</p>
<pre><code>require 'backtrace'
begin
# do something dangerous
rescue StandardError => e
puts Backtrace.new(e)
end
</code></pre>
| 49,286 |
<p>I am writing a test program to copy some file in Application data folder on device to release directory on desktop.</p>
<p>I am not sure how to access release dir on desktop?</p>
<p>Is there any shell command to do that?</p>
<p>Basically I want to write c++ program that will run on device to accomplish this task.... | <p>W3C did create another technology, sort of.</p>
<p>SVG is a pretty nice vector graphics standard that, combined with scripting, can do a bunch of things Flash can do, but all in plain XML and JavaScript instead of a lump of binary gunge. It's tricky to call this a Flash replacement as it works so very differently, ... | <p>The W3C has no real authority to "take a role" in the development of a proprietary technology. They can only be <strong>given</strong> such a role if the company that owns the technology decides to give it to them, and so far neither Adobe nor Microsoft has done so.</p>
| 40,182 |
<p>In a script, when a command-let or other executable statement errors out, is there a try/catch type of mechanism to recover from these errors? I haven't run across one in the documentation.</p>
| <p>You use a <code>Trap [exception-type] {}</code> block before the code you want to handle exceptions for.</p>
| <p>Here's someone (Adam Weigert) who implemented try/catch/finally using powershell. I use this in place of the built-in trap staement. Seems more natural.</p>
<p><a href="http://weblogs.asp.net/adweigert/archive/2007/10/10/powershell-try-catch-finally-comes-to-life.aspx" rel="nofollow noreferrer">http://weblogs.asp... | 24,759 |
<p>When you are working on a new website, what combinations of browsers and operating systems do you target, and at what priorities? Do you find targeting a few specific combinations (and ignoring the rest) better than trying to strive to make them all work as intended?</p>
<p>Common browsers:</p>
<ul>
<li>Firefox (... | <p>Mainly I just target browsers as the sites I've built don't really depend on anything OS specific. As mentioned above, YAHOO's graded browser support guide is a good starting point on determining which browsers yous should/could support. And Yahoo's User Interface library (CSS+JavaScript) helps massively in achievin... | <p>Where I work, we target</p>
<ul>
<li>Firefox 2 and 3 on Windows</li>
<li>Firefox 2 and 3 on Mac</li>
<li>Safari on Windows and Mac</li>
<li>IE 6 and 7</li>
</ul>
<p>We are not specifically targeting any Linux browsers, but if they work in the list above, there's a good chance they work everywhere. We are also tes... | 15,958 |
<p>What's the best way to create recurring tasks?</p>
<p>Should I create some special syntax and parse it, kind of similar to Cronjobs on Linux or should I much rather just use a cronjob that runs every hour to create more of those recurring tasks with no end?</p>
<p>Keep in mind, that you can have endless recurring ... | <p>Try to get away without serializing javascript code. That way lies a world of pain. Debugging will be much easier if code can only come from static files, not from a database. Instead, walk your JSON responses after you receive them and pass the appropriate data to the appropriate object constructors.</p>
<p>If you... | <p>If you use WCF framework to develop RESTful web service, that is very easy to achieve.
Simply create your data structure classes with your desired collection with DataContract, DataMember attributes.</p>
<pre><code>[DataContract]
public class Foo
{
[DataMember]
public string FooName {get;set;}
[DataMem... | 13,500 |
<p>I'm working on an AJAXy project (Dojo and Rails, if the particulars matter). There are several places where the user should be able to sort, group, and filter results. There are also places where a user fills out a short form and the resulting item gets added to a list on the same page.</p>
<p>The non-AJAXy imple... | <p>Well, every time you generate HTML snippets on the client and on the server you may end up with duplicated code. There is no good way around it generally. But you can do two things:</p>
<ol>
<li>Generate everything on the server. Use <a href="http://en.wikipedia.org/wiki/Ahah" rel="nofollow noreferrer">AHAH</a> whe... | <p>I don't have a complete answer for you; I too have struggled with this on a recent project. But, here is a thought:</p>
<ul>
<li>Ajax call to Rails</li>
<li>Rails composes the entire grid again, with the new row.</li>
<li>Rails serializes HTML, which is returned to the browser.</li>
<li>Javascript replaces the enti... | 45,311 |
<p>I would like to hear opinions or peoples experiences regarding <a href="http://dbappbuilder.sourceforge.net/Rel.php" rel="nofollow noreferrer">Rel</a>. Is it destined for the dustbin, or is it the next big thing in programming? I haven't tried doing anything with it yet (and it looks like you really can't at this ... | <p>I think it is intended as an aid to <strong>teaching</strong> the pure relational model, not as a competitor to SQL DBMSs for "real work" in the short or medium term. However, Date and Darwen make a compelling case for the proper implementation of the relational model in their book <a href="http://www.thethirdmanif... | <p>Nearly four years on from the OP. I came across Rel recently, and it does have potential for what I am doing. It is more clearly established as a teaching language, but the implementation is now quite solid, though still a little fragile in syntax. It does have potential and I hope that this potential will be realis... | 35,086 |
<p>We have to connect to a third party SOAP service and we are using WCF to do so. The service was developed using Apache AXIS, and we have no control over it, and have no influence to change how it works.
The problem we are seeing is that it expects the requests to be formatted using Web Services Security, so we are ... | <p>Funny you should ask this question. I asked Microsoft how to do this about a year ago. At the time, using .NET 3.0, it was not possible. Not sure if that changed in the 3.5 world. But, no, there was no physical way of adding security to the request and leaving the response empty.</p>
<p>At my previous employer we u... | <p>Funny you should ask this question. I asked Microsoft how to do this about a year ago. At the time, using .NET 3.0, it was not possible. Not sure if that changed in the 3.5 world. But, no, there was no physical way of adding security to the request and leaving the response empty.</p>
<p>At my previous employer we u... | 8,860 |
<p>Consider the Oracle <code>emp</code> table. I'd like to get the employees with the top salary with <code>department = 20</code> and <code>job = clerk</code>. Also assume that there is no "empno" column, and that the primary key involves a number of columns. You can do this with:</p>
<pre><code>select * from scott.e... | <p>The following is slightly over-engineered, but is a good SQL pattern for "top x" queries.</p>
<pre><code>SELECT
*
FROM
scott.emp
WHERE
(deptno,job,sal) IN
(SELECT
deptno,
job,
max(sal)
FROM
scott.emp
WHERE
deptno = 20
and job = 'CLERK'
GROUP BY
deptno,
job
)
</code></pr... | <p>That's great! I didn't know you could do a comparison of (x, y, z) with the result of a SELECT statement. This works great with Oracle.</p>
<p>As a side-note for other readers, the above query is missing a "=" after "(deptno,job,sal)". Maybe the Stack Overflow formatter ate it (?).</p>
<p>Again, thanks Mark.</p>
| 7,395 |
<p>I'm using CVS on Windows (with the WinCVS front end), and would like to add details of the last check in to the email from our automated build process, whenever a build fails, in order to make it easier to fix.</p>
<p>I need to know the files that have changed, the user that changed them, and the comment.</p>
<p>I... | <p>CVS doesn't group change sets like other version control systems do; each file has its own, independent version number and history. This is one of the deficiencies in CVS that prompts people to move to a newer VC.</p>
<p>That said, there are ways you could accomplish your goal. The easiest might be to add a post-co... | <p>Will "cvs history -a -l" get you close? Shows for all users last event per project...</p>
| 11,200 |
<p>In Oracle, I can re-create a view with a single statement, as shown here:</p>
<pre><code>CREATE OR REPLACE VIEW MY_VIEW AS
SELECT SOME_FIELD
FROM SOME_TABLE
WHERE SOME_CONDITIONS
</code></pre>
<p>As the syntax implies, this will drop the old view and re-create it with whatever definition I've given.</p>
<p>Is the... | <p>The solutions above though they will get the job done do so at the risk of dropping user permissions. I prefer to do my create or replace views or stored procedures as follows.</p>
<pre><code>IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_myView]'))
EXEC sp_executesql N'CREATE VI... | <p>You can use ALTER to update a view, but this is different than the Oracle command since it only works if the view already exists. Probably better off with DaveK's answer since that will always work.</p>
| 19,733 |
<p>Are there any utilities out there which can draw pictures of the merge history of a subversion repo - we always commit merges with a (fairly) consistent log message, and it would be handy to be able to automatically extract this info into a single picture that shows what branches occurred when, and what the state of... | <p>I use <a href="https://www.smartsvn.com/features/" rel="nofollow noreferrer">SmartSVN</a> for this; I has a very quick and easy to use revision graph, which can show svm:mergeinfo as colour coded links and arrows between branches. It's pretty hard to beat when looking at a good-size source tree</p>
| <p>I think Tortoise svn does <a href="http://svn.haxx.se/tsvnusers/archive-2008-05/0149.shtml" rel="nofollow noreferrer"><strong>not yet</strong></a> support version tree.</p>
<p>So far, Clearcase explorer is the best i've come across.</p>
| 7,997 |
<p>I'm adding repeating events to a Cocoa app I'm working on. I have repeat every day and week fine because I can define these mathematically (3600*24*7 = 1 week). I use the following code to modify the date:</p>
<pre><code>[NSDate dateWithTimeIntervalSinceNow:(3600*24*7*(weeks))]
</code></pre>
<p>I know how many mon... | <p>(Almost the same as <a href="https://stackoverflow.com/questions/181459/is-there-a-better-way-to-find-midnight-tomorrow/181495#181495">this question</a>.)</p>
<p>From the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendarDate_Class/Reference/Reference.html" rel="nofollow... | <p>I'll probably use NSCalendarDate.</p>
<p>Get current date's dayOfMonth, monthOfYear and yearOfCommonEra, as three numbers.</p>
<p>Add the required number of months (1/3/6/9), taking care of 1) whether that date exist (e.g. 31 April, 29 Feb on a non-leap year), and 2) roll-over of year.</p>
<p>Create that new date... | 22,474 |
<p>I am just wondering what are the steps followed by you guys when starting a new project? Do you used to create UML diagrams, SRS or any design documents? I am starting a new project and like to get some expert advice on all these practices. I know to code, but I never tried UML and other stuffs. </p>
<p>Any help wo... | <p>Typically, my process runs something like this:</p>
<ul>
<li>I usually start with a logical model - a bastardised UML if you like - so I can visualise the key entities and relationships in my system. </li>
<li>Then I think about a the underlying datamodel (thinking through potential issues around data consumption p... | <p>I never really bothered about UML (not "real" UML anyway). When I start a project, I'm interested in a few things:</p>
<ol>
<li>How will my software be used (and by whom)</li>
<li>What does the software need to do</li>
<li>How do the different features/components fit together</li>
</ol>
<p>For 1, you can use UML U... | 41,472 |
<p>Strange performance outcome, I have a LINQ to SQL query which uses several let statements to get various info it looks like this</p>
<pre><code> public IQueryable<SystemNews> GetSystemNews()
{
using (var t = new TransactionScope(TransactionScopeOption.Required,
new TransactionOptions { Is... | <p>In general, LINQ-to-SQL will be "about the same", and I'd agree that caching is porbably an issue here. Really you need to look at the generated SQL; the easiest way being:</p>
<pre><code>_datacontext.Log = Console.Out;
</code></pre>
<p>Then try running the TSQL directly in Query Analyzer. SPROCs have some advanta... | <p>You're probably seeing a caching effect; it's not real.</p>
<p>One of the tenets of benchmarking is that you can skew your benchmark either way by running the benchmark once, getting the results in cache, then run it again and report amazing results, or, do the reverse...</p>
| 27,198 |
<p>If I try to use a closure on an event handler the compiler complains with :</p>
<p>Incompatible types: "method pointer and regular procedure"</p>
<p>which I understand.. but is there a way to use a clouser on method pointers? and how to define if can?</p>
<p>eg : </p>
<pre><code>Button1.Onclick = procedure( send... | <pre><code>@Button1.OnClick := pPointer(Cardinal(pPointer( procedure (sender: tObject)
begin
((sender as TButton).Owner as TForm).Caption := 'Freedom to anonymous methods!'
end )^ ) + $0C)^;
</code></pre>
<p><a href="http://codenoid.blogspot.com/2011/04/anonymous-methods-as-events-in-delphi.html" rel="noreferrer... | <p>In previous Delphi versions you could use a regular procedure as event handler by adding the hidden self pointer to the parameters and hard typecast it:</p>
<pre><code>procedure MyFakeMethod(_self: pointer; _Sender: TObject);
begin
// do not access _self here! It is not valid
...
end;
...
var
Meth: TMethod;... | 47,014 |
<p>How is it that tools like this one can make an ajax style call back to a central site? basically they give you a " tag to put on your site where ever it is. So in this widget you have the ability to ask for an email to be sent to you for the page you're currently on. I assume this makes an ajax style call back to sh... | <p>They give you a script to include in your site. This script has full access to the DOM and your cookies. In order for it to call back to their site, they use a technique called JSONP. The script that you included, adds another script with parameters in the querystring. The server then returns JSON (which is just... | <p>The answer is that browsers, by some reason, only block XmlHttpRequests to servers other than the originating one. You are free to use <SCRIPT>-tags that has SRC pointing to wherever, and such script tags can of course be dynamically inserted into your DOM.</p>
| 44,447 |
<p>Even though I have a robust and fast computer (Pentium Dual Core 2.0 with 2Gb RAM), I'm always searching for lightweight software to have on it, so it runs fast even when many apps are up and running simultaneously.</p>
<p>On the last few weeks I've been migrating gradually to Linux and want to install a free light... | <p><a href="http://projects.gnome.org/gedit/" rel="nofollow noreferrer">gedit</a></p>
<ul>
<li>Syntax highlighting</li>
<li>Fast, lightweight</li>
<li>Tabs</li>
<li>GUI</li>
</ul>
| <p>any of the popular editors can be turned into an ide.</p>
<p>I use Vi on the console and have used various gui editors over the years. This doesn't just go for linux I use Crimson Editor on windows as a C/python/z80asm ide.</p>
| 2,486 |
<p>I have the following classes</p>
<pre><code>public interface InterfaceBase
{
}
public class ImplementA:InterfaceBase
{
}
public class ImplementB:InterfaceBase
{
}
public void TestImplementType<T>(T obj) where T: InterfaceBase
{
}
</code></pre>
<p>How to infer what the T is whether ImplementA or ImplementB... | <p><code>obj is ImplementA</code></p>
| <p>How about:</p>
<pre><code> if(obj.GetType().Equals(typeof(ImplementA)))
{
// ...
}
</code></pre>
| 30,003 |
<p>How do I go about programmatically creating audio streams using Cocoa on the Mac. To make, say a white-noise generator using core frameworks on Mac OSX in Cocoa apps?</p>
| <p>One way is using the <a href="http://developer.apple.com/documentation/MusicAudio/Reference/CoreAudio/book_intro/chapter_1_section_1.html#//apple_ref/doc/uid/TP30001108-CH201-DontLinkElementID_85" rel="nofollow noreferrer">CoreAudio</a> DefaultOutputUnit.</p>
<p>You can configure it with parameters such as output s... | <p>Look at <a href="http://developer.apple.com/documentation/MusicAudio/Conceptual/AudioQueueProgrammingGuide/Introduction/chapter_1_section_1.html" rel="nofollow noreferrer">Audio Queue Services</a>.</p>
| 11,326 |
<p>Is it possible to develop plugins for Microsoft Office Communicator? If so, where does one start -- is there an SDK?</p>
| <p>A good place to start would be the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ed1cce45-cc22-46e1-bd50-660fe6d2c98c&displaylang=en" rel="nofollow noreferrer">SDK</a>. I'm not sure if you can create plugins for it, but since it has a API, you can definitely hook into it from external apps or... | <p>The <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=621C675C-46B7-4F68-ADDC-9F44E5594BFB&displaylang=en" rel="nofollow noreferrer">Custom Tabs</a> sample app may be just what you are looking for.</p>
| 36,537 |
<p>How universally is the C99 standard supported in today's compilers? I understand that not even GCC fully supports it. Is this right?</p>
<p>Which features of C99 are supported more than others, i.e. which can I use to be quite sure that most compilers will understand me?</p>
| <p>If you want to write portable C code, then I'd suggest you to write in C89 (old ANSI C standard). This standard is supported by most compilers.</p>
<p>The Intel C Compiler has <a href="http://software.intel.com/en-us/articles/c99-support-in-intelr-c-compiler/" rel="noreferrer">very good C99 support</a> and it produ... | <p>Look at <a href="http://gcc.gnu.org/c99status.html" rel="nofollow noreferrer">C99 suport status for GNU</a> for details on which features are supported currently.</p>
<p><a href="http://developers.sun.com/sunstudio/documentation/ss12/mr/READMEs/c.html#about" rel="nofollow noreferrer">Sun Studio</a> is purported to ... | 16,871 |
<p>Thanks for a <a href="https://stackoverflow.com/questions/327893/how-to-write-a-compare-function-for-qsort-from-stdlib">solution in C</a>,
now I would like to achieve this in C++ using std::sort and vector:</p>
<pre><code>typedef struct
{
double x;
double y;
double alfa;
} pkt;
</code></pre>
<p><code>vector&... | <p><code>std::sort</code> takes a different compare function from that used in <code>qsort</code>. Instead of returning –1, 0 or 1, this function is expected to return a <code>bool</code> value indicating whether the first element is less than the second.</p>
<p>You have two possibilites: implement <code>operator <... | <p>In C++, you can use functors like <code>boost::bind</code> which do this job nicely:</p>
<pre><code>#include <vector>
#include <algorithm>
struct pkt {
double x;
double y;
double alfa;
pkt(double x, double y, double alfa)
:x(x), y(y), alfa(alfa) { }
};
int main() {
std::vec... | 42,624 |
<p>I have a receive port with two FILE receive locations polling the same network share. The only difference between the receive locations is that they use a different file mask. They both use a custom pipeline with single Flat file disassembler component. I have a send port subscribing to the receive port. (this is ju... | <p>Interesting - I recall seeing similar things in BizTalk 2004 but haven't seen anything like that with BT2006.</p>
<p>It sounds like the pipeline may be running into threading issues - perhaps due to receiving the files from the same file location.</p>
<p>Have you tried any of the advanced file receive location pro... | <p>I have to say I find this very strange, I would find it very hard to believe that 5 years into BizTalk (counting from 2004 :-)), the FILE adapter and the standard disassemblers have threading issues.,</p>
<p>Are the files coming into the pick up location over the network? what file masks are you using? is there a c... | 41,422 |
<p>I know that Internet Explorer has some proprietary extensions so that you can do things like create divs with a gradient background. I can't remember the element name or it's usage. Does anyone have some examples or links?</p>
| <p>Look at the custom CSS filters IE can handle
<a href="http://msdn.microsoft.com/en-us/library/ms532847.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms532847.aspx</a></p>
| <p>Two things I discovered while struggling with IE 9 gradient.</p>
<ol>
<li>The <code>-ms-filter</code> did not work for me. I had to use simply <code>filter</code>.</li>
<li>I had to add <code>height: 100%</code> to my class for IE to use the gradient.</li>
</ol>
| 26,276 |
<p>StackOverflow, you're my only hope!</p>
<p>I am unfortunate enough to have inherited an ASP.NET 3.5 application roughly 3/4 in development. This project uses Crystal Reports Basic for VS 2008 to generate a PDF file from a data source. Pretty straightforward.</p>
<p>Anyway, this project compiles and runs fine on my... | <p>Have you tried installing the runtime for Crystal Reports Basic for VS 2008?
Check my post on runtime locations at <a href="http://blog.aggregatedintelligence.com/2008/12/crystal-reports-basic-2008-runtime.html" rel="nofollow noreferrer">http://blog.aggregatedintelligence.com/2008/12/crystal-reports-basic-2008-runti... | <p>My 'solution' (if you can call it that) was to <strong>not</strong> use <strong>Crystal Reports Basic for VS 2008</strong>. I switched to using <strong>Crystal Reports for .NET Framework 2.0</strong>, which comes bundled with VS 2005. I then installed this runtime on the server, and it worked fine.</p>
<p><img sr... | 40,394 |
<p>Is it possible to play video from data that has been embedded in a swf at compile time (with the <code>[Embed]</code> metatag)?</p>
<p>The "Import Video->Embed" feature provided by Flash CS3 etc. is not acceptable because it has many severe limitations (including sound synchronization issues, a maximum number of fr... | <p>As long as your video is an FLV, then the answer is yes - you can use <code>NetStream.appendBytes()</code> to play the embedded <code>ByteArray</code>:</p>
<pre><code>public class Main extends MovieClip
{
[Embed(source="sample.flv", mimeType="application/octet-stream")]
private var SampleVideo:Class;
p... | <p>Oh yeah, so apparently you can embed binary data in a swf using the <code>Embed</code> meta tag. </p>
<pre><code>[Embed(
source="local_data_file.flv",
mimeType="application/octet-stream") ]
private static var __FlvClass123:Class;
protected static var flvData:ByteArray = new __FlvClass123();
</code></pre>
<... | 24,264 |
<p>This code involves a recursive Stored Procedure call and a "not so great" method of avoiding cursor name collision. In the end I don't care if it uses cursors or not. Just looking for the most elegant approach. I'm mainly going to use it as a simple method to track down Stored Proc hierarchies (without buying a prod... | <p>for ms sql server you can use CURSOR LOCAL, then the cursor is local to the sproc call and your code becomes much simpler:</p>
<pre><code>CREATE PROCEDURE uspPrintDependencies
(
@obj_name varchar(300),
@level int
)
AS
SET NOCOUNT ON
DECLARE @sub_obj_name varchar(300)
if @level > 0 begin
PRINT Replic... | <p>See <a href="https://stackoverflow.com/questions/352176/sqlserver-how-to-sort-table-names-ordered-by-their-foreign-key-dependency#352294">this Stackoverflow question</a> for a discussion of sorting querying table foreign key dependencies by depth - which is a similar problem to the one you're discussing. There are ... | 49,743 |
<p>I am designing an <strong>Automatic text summarizer</strong>. One of the major modules in this project requires <strong>TRAINING CORPUS</strong>. Can someone please help me out by providing <strong>TRAINING CORPUS</strong> or <strong>referring some link to download</strong> it. Thanks in anticipation</p>
| <p>See <a href="http://norvig.com/spell-correct.html" rel="noreferrer">How to Write a Spelling Corrector</a> by Norvig. He mentions <a href="http://www.gutenberg.org/wiki/Main_Page" rel="noreferrer">Project Gutenberg</a>, <a href="http://en.wiktionary.org/wiki/Wiktionary:Frequency_lists" rel="noreferrer">Wiktionary</a>... | <p>See also the <a href="http://gandalf.aksis.uib.no/corpora/" rel="nofollow noreferrer">Corpora mailing list</a>, they're a good starting point, and you could also look through their mailing archives for more resources. </p>
| 35,910 |
<p>I'm looking for software to create PNG8 format transparent images as per <a href="http://www.sitepoint.com/blogs/2007/09/18/png8-the-clear-winner/" rel="nofollow noreferrer">this article</a>.</p>
<p><strong>NOTE:</strong> I need a Linux solution myself, but please submit answers for other OSes.</p>
| <p><a href="http://pngquant.org" rel="nofollow noreferrer">pngquant</a> does a good job of converting to PNG8 while preserving full transparency.</p>
<p>If you're size-conscious, you may also be interested in <a href="http://pmt.sourceforge.net/pngcrush/" rel="nofollow noreferrer">pngcrush</a>, which can usually (lossl... | <p>I recommend "The GIMP" as it is <a href="http://docs.gimp.org/en/gimp-images-out.html" rel="nofollow noreferrer">possible to output in PNG8</a> and supports Linux/Windows. If you want a quick Windows-only solution, I also recommend <a href="http://www.irfanview.com/" rel="nofollow noreferrer">IrfanView</a>.</p>
| 19,438 |
<p>I would like to code a little program which visually illustrates the behavior of the <code>volatile</code> keyword. Ideally, it should be a program which performs concurrent access to a non volatile static field and which gets incorrect behavior because of that. </p>
<p>Adding the volatile keyword in the same progr... | <p>I've achieved a working example!</p>
<p>The main idea received from wiki, but with some changes for C#. The wiki article demonstrates this for static field of C++, it is looks like C# always carefully compile requests to static fields... and i make example with non static one:</p>
<p>If you run this example in <st... | <p>It's hard to demonstrate in C#, as the code is abstracted by a virtual machine, thus on one implementation of this machine it work right without volatile, while it might fail on another one.</p>
<p><a href="http://en.wikipedia.org/wiki/Volatile_variable" rel="nofollow noreferrer">The Wikipedia has a good example ho... | 16,132 |
<p>I find that white filaments are quite translucent and printing 5 layers of white filament onto 2 layers of black filament (at 0.2 mm layers, the white layers being 100% infilled and the underlying black layer covering about 85% of the whole area) produces a slightly grey color on the top.</p>
<p>Is that a limitatio... | <p>This could be caused by under extrusion, often caused by the bed being too close to the hot end / extruder nozzle. You could try to relevel the bed, or change the screws so that the bed moves down slightly. Often when levelling, you want to feel slight resistance when sliding a piece of paper between the bed an the ... | <p>This could be caused by under extrusion, often caused by the bed being too close to the hot end / extruder nozzle. You could try to relevel the bed, or change the screws so that the bed moves down slightly. Often when levelling, you want to feel slight resistance when sliding a piece of paper between the bed an the ... | 1,684 |
<p>So I'm reading The Art & Science of Javascript, which is a good book, and it has a good section on JSONP. I've been reading all I can about it today, and even looking through every question here on StackOverflow. JSONP is a great idea, but it only seems to resolve the "Same Origin Problem" for <i>getting</i> dat... | <p>JSONP results in a SCRIPT tag being generated to another server with any parameters that might be required as a GET request. e.g.</p>
<pre><code><script src="http://myserver.com/getjson?customer=232&callback=jsonp543354" type="text/javascript">
</script>
</code></pre>
<p>There is technically nothin... | <p>Yes, and honestly I would like to stick to that paradigm. However, I might bend the rule and say that, requests which do not alter/deal with CRUCIAL data will be accessible via GET calls... hm...</p>
<p>For instance, I am building a shopping cart system, and I think that allowing the adding/removing/etc of items to... | 30,921 |
<p>I know that there are issues with the VFP OLEDB provider on 64 bit machines. ... but what issues do you encounter while actually running a VFP application - on a 64 bit machine? Has anyone had any experience in this area?</p>
<p>My first thought was that it would just run as a 32bit app, without making use of the 6... | <p>This is somewhat of a specialized scenario, and it may not be related to 64 bitness, but since you asked...</p>
<p>My organization recently hosted a legacy VFP 7 app on a Windows Server 2008 Enterprise 64 bit server for access over Terminal Services. The app runs fine, but there is some kind of bug with the TS Eas... | <p>We've seen zero problems with our VFP9 apps on 64-bit XP, Server 2003, Vista, or Server 2008.</p>
<p>Our print engine is a VB DLL though, so we wouldn't run into any VFP-specific printing issues.</p>
| 12,500 |
<p>Alright. I have a query that looks like this:</p>
<pre><code>SELECT
SUM(`order_items`.`quantity`) as `count`,
`menu_items`.`name`
FROM
`orders`,
`menu_items`,
`order_items`
WHERE
`orders`.`id` = `order_items`.`order_id` AND
`menu_items`.`id` = `order_items`.`menu_item_id` AND
`o... | <p>This can be done without any subqueries, if one puts the date conditions in the <code>JOIN</code> clause. </p>
<p>Below is code I tested on MySQL 5.0.</p>
<pre><code>SELECT m.name, COALESCE(SUM(oi.quantity), 0) AS count
FROM menu_items AS m
LEFT OUTER JOIN (
order_items AS oi JOIN orders AS o
ON (o.id... | <p>Randy's answer is close, but the where statement removes any mention of those items not part of any orders in that date range.</p>
<p>Note that "left join" is different to linking tables in the where clause in the manner you have done (i.e. inner joins). I suggest you read up on the different types of SQL joins (in... | 33,035 |
<p>I have a potential client that build something with Flash Remoting Services. It looks there was some sort of server product offered back in 2002-2003, but I've been unable to see if it did anything so complex that it could not be replaced with a simple webservice. Does any one know what happened to this product?</... | <p>You can find support information at Adobe's <a href="http://www.adobe.com/support/flash_remoting/" rel="nofollow noreferrer">Flash Remoting Support</a> site. So, it is not so wholly dead that if you already have a licence for it, you cannot get support. That said, I've no idea how much it is really used these days... | <p>You can find support information at Adobe's <a href="http://www.adobe.com/support/flash_remoting/" rel="nofollow noreferrer">Flash Remoting Support</a> site. So, it is not so wholly dead that if you already have a licence for it, you cannot get support. That said, I've no idea how much it is really used these days... | 28,268 |
<p>I've joined a team that works on a product. This product has been around for ~5 years or so, and uses ASP.NET WebForms. Its original architecture has faded over time, and things have become relatively disorganized throughout the solution. It's by no means terrible, but definitely can use some work; you all know what... | <p>Your PM's concerns are valid - make sure you get your system under test before making any major refactorings.</p>
<p>I would strongly recommend getting a copy of Michael Feather's book <a href="https://rads.stackoverflow.com/amzn/click/com/0131177052" rel="noreferrer" rel="nofollow noreferrer">Working Effectively W... | <p>Just tossing out a second recommendation for Working Effectively with Legacy Code, an excellent book that really opened my eyes to the fact that almost any old / crappy / untestable code can be wrangled!</p>
| 4,061 |
<p>I'm going to be starting a project soon that requires support for large-ish binary files. I'd like to use Ruby on Rails for the webapp, but I'm concerned with the BLOB support. In my experience with other languages, frameworks, and databases, BLOBs are often overlooked and thus have poor, difficult, and/or buggy fun... | <p>+1 for attachment_fu</p>
<p>I use attachment_fu in one of my apps and MUST store files in the DB (for annoying reasons which are outside the scope of this convo).</p>
<p>The (one?) tricky thing dealing w/BLOB's I've found is that you need a separate code path to send the data to the user -- you can't simply in-lin... | <p>Look into the plugin, <a href="http://john.guen.in/rdoc/x_send_file/" rel="nofollow noreferrer">x_send_file</a> too. </p>
<p>"The XSendFile plugin provides a simple interface for sending files via the X-Sendfile HTTP header. This enables your web server to serve the file directly from disk, instead of streaming it ... | 8,130 |
<p>We (apparently) had poorly executed of our Solaris MySQL database engine last night. At least some of the InnoDB tables are corrupted, with timestamp out of order errors in the transaction log, and a specific error about the index being corrupted.</p>
<p>We know about the tools available for MyISAM table repairs, b... | <p>First of all <i>stop the server and image the disc</i>. There's no point only having one shot at this. Then take a look <a href="http://www.mysqlperformanceblog.com/2008/07/04/recovering-innodb-table-corruption/" rel="noreferrer">here</a>.</p>
| <p>Step 1. </p>
<p><strong>Stop MySQL server</strong></p>
<p>Step 2. </p>
<p>add this line to my.cnf ( In windows it is called my.ini )</p>
<pre><code>set-variable=innodb_force_recovery=6
</code></pre>
<p>Step 3. </p>
<p>delete <strong>ib_logfile0</strong> and <strong>ib_logfile1</strong></p>
<p>Step 4. </p>
<p... | 27,961 |
<p>In C++, how can I establish an SQL connection to store data in an SQL database?</p>
| <p>You should have a look at C preprocessors that exists traditionaly with databases (<a href="http://www.postgresql.org/docs/8.3/interactive/ecpg.html" rel="nofollow noreferrer">ecpg</a> for postgres, <a href="http://www.cs.umbc.edu/help/oracle8/server.815/a68022/toc.htm" rel="nofollow noreferrer">Pro*C</a> for oracle... | <p>Use SQLAPI++ - it's cross platform and supports MS SQL Server, Oracle, Postgres and others. Very easy to use.</p>
<p><a href="http://www.sqlapi.com/" rel="nofollow noreferrer">http://www.sqlapi.com/</a></p>
| 38,614 |
<p>I'm working on an ASP.NET website which targets desktop browsers. We want to enable an optional mobile view (e.g. <a href="http://m.sample.com" rel="nofollow noreferrer">http://m.sample.com</a>) which will offer a few simple pages which will be mostly text. There will be not need for AJAX or even Javascript, and the... | <p>I have done this in the past and the way I did it is by separating the pages by creating a directory for Desktop and creating a directory for Mobile. This gives you better separation of the views, since in reality they are a lot different. In ASP.NET Forms I used the <a href="http://msdn.microsoft.com/en-us/magazi... | <p>I know from personal experience there really isn't much you need to do for the iPhone. I usually rather just browse your regular site with my iPhone. </p>
<p>Just my two cents though.</p>
| 8,400 |
<p>Whats this syntax useful for : </p>
<pre><code> function(String... args)
</code></pre>
<p>Is this same as writing </p>
<pre><code> function(String[] args)
</code></pre>
<p>with difference only while invoking this method or is there any other feature involved with it ?</p>
| <p>The only difference between the two is the way you call the function. With String var args you can omit the array creation.</p>
<pre><code>public static void main(String[] args) {
callMe1(new String[] {"a", "b", "c"});
callMe2("a", "b", "c");
// You can also do this
// callMe2(new String[] {"a", "b"... | <pre><code>class StringArray1
{
public static void main(String[] args) {
callMe1(new String[] {"a", "b", "c"});
callMe2(1,"a", "b", "c");
callMe2(2);
// You can also do this
// callMe2(3, new String[] {"a", "b", "c"});
}
public static void callMe1(String[] args) {
System... | 38,700 |
<p>In a program to find whether the given number is an <a href="http://en.wikipedia.org/wiki/Narcissistic_number" rel="nofollow noreferrer">Armstrong</a> number, I stored the input no (3 digit) as string as follows.</p>
<pre><code>char input[10];
scanf("%s",&input);
</code></pre>
<p>Now I have to calculate cube o... | <p>You are performing your calculation on the ASCII value of the digit. You'll need to convert it to a numeric value like so:</p>
<pre><code>int digit = input[0] - '0';
int a; a = pow(digit, 3);
</code></pre>
| <p>On the other hand, you may need to replace the power with a more generic one like power = strlen(input)</p>
<p>so the code should look like this.</p>
<pre><code>char input[10];
int power, sum = 0;
scanf("%s", input);
power = strlen(input);
sum += pow(input[0] - '0', power);
/* you need to compare in here */
</co... | 41,361 |
<p>We are setting up a <a href="http://selenium.openqa.org/" rel="nofollow noreferrer">Selenium</a> test campaign on a big web application.
The first thing we've done was to build a framework which initialize SQL data in database before the test, launch the test, archive results and then clear data.</p>
<p>We've integ... | <p>Testability helps a lot. The biggest win for testability in web apps is if all of the HTML elements you need to interact with on the page have <strong>unique and consistent attributes</strong>. If the attributes you are using to identify the HTML elements (Selenium uses xpath) are not consistent/reliable from buil... | <p>I use http-unit which has the added benefit of working before any styling has been added to the page.</p>
<p><a href="http://httpunit.sourceforge.net/" rel="nofollow noreferrer">http://httpunit.sourceforge.net/</a>
You can attach the tests to run in the integration test phase for maven2.</p>
<p>From the site </p>
... | 17,794 |
<p>At my work everyone has sql snippets that they use to answer questions. Some are specific to a customer, while some are generic for a given database. I want to consolidate those queries into a library/repository that can be accessed by anyone on the team. The requirements would be:</p>
<ol>
<li>Accessible</li>
<li>... | <p>You could use a wiki.</p>
<p>You could get started with something as simple as <a href="http://www.tiddlywiki.com/" rel="nofollow noreferrer">Tiddly wiki</a>.</p>
| <p>Rather than pasting SQL snippets, I would consider graduating to an ORM (Object-Relational Mapper) or some other library to make representing and manipulating the data easier. It provides a layer of encapsulation to guard against schema changes and a layer of abstraction so you can think of the data in terms of bus... | 25,113 |
<p>It's a bit difficult to implement a deep object copy function. What steps you take to ensure the original object and the cloned one share no reference? </p>
| <p>A safe way is to serialize the object, then deserialize. This ensures everything is a brand new reference.</p>
<p><a href="http://javatechniques.com/blog/low-memory-deep-copy-technique-for-java-objects/" rel="noreferrer">Here's an article</a> about how to do this efficiently.</p>
<p>Caveats: It's possible for class... | <p>Here is an easy example on how to deep clone any object:
Implement serializable first</p>
<pre><code>public class CSVTable implements Serializable{
Table<Integer, Integer, String> table;
public CSVTable() {
this.table = HashBasedTable.create();
}
public CSVTable deepClone() {
... | 8,952 |
<p>When constructing an ArgumentException, a couple of the overloads take a string that is the invalid argument's parameter name. I figure it would be nice to not have to remember to update this ctor param whenever I change the method's param name. Is there a simple way to do this using reflection?</p>
<p><strong>Upda... | <p>You can use either Modules or RSL.</p>
<p>RSLs have the advantage of getting cached by flash rather than the browser so they stick around longer.</p>
<p>Modules are easier to create and use. I have used modules and had issues with modules failing to load (code needs to handle that case). I haven't tried RSLs yet.<... | <p>Note that, currently, loaded RSLs must be compiled against the very same version of the Flex framework.. if you plan for a "binary" plugin system, probably you want to wait for the <a href="http://opensource.adobe.com/wiki/display/flexsdk/Marshall+Plan" rel="nofollow noreferrer">Marshall plan</a> feature to be imple... | 11,992 |
<p>I have an application - more like a utility - that sits in a corner and updates two different databases periodically. </p>
<p>It is a little standalone app that has been built with a Spring Application Context. The context has two Hibernate Session Factories configured in it, in turn using Commons DBCP data sources... | <p>The best way to distribute transactions over more than one database is: Don't.</p>
<p>Some people will point you to XA but XA (or Two Phase Commit) is a lie (or marketese). </p>
<p>Imagine: After the first phase have told the XA manager that it can send the final commit, the network connection to one of the databa... | <p>In this case you would need a Transaction Monitor (server supporting XA protocol) and make sure your databases supports XA also. Most (all?) J2EE servers comes with Transaction Monitor built in. If your code is running not in J2EE server then there are bunch of standalone alternatives - Atomicos, Bitronix, etc.</p>
| 15,620 |
<p>What are your favorite C++ coding style idioms? I'm asking about style or coding typography such as where you put curly braces, are there spaces after keywords, the size of indents, etc. This is opposed to best-practices or requirements such as always deleting arrays with <code>delete[]</code>. </p>
<p>Here is a... | <p>When creating enumerations, put them in a namespace so that you can access them with a meaningful name:</p>
<pre><code>namespace EntityType {
enum Enum {
Ground = 0,
Human,
Aerial,
Total
};
}
void foo(EntityType::Enum entityType)
{
if (entityType == EntityType::Ground) {... | <p>I tend to put an else on all of my ifs.</p>
<pre><code>if (condition)
{
complicated code goes here
}
else
{
/* This is a comment as to why the else path isn't significant */
}
</code></pre>
<p>Even though it annoys my coworkers.
You can tell at a glance, that I considered the else case during coding.</p>
| 34,819 |
<p>I want to parse an Apache <strong>access.log</strong> file with a python program in a certain way, and though I am completely new to object-oriented programming, I want to start doing it now.</p>
<p>I am going to create a class <strong>ApacheAccessLog</strong>, and the only thing I can imagine now, it will be doing... | <p>In this case I would use <em>delegation</em> rather than <em>inheritance</em>. It means that your class should contain the file object as an attribute and invoke a <code>readline</code> method on it. You could pass a file object in the constructor of the logger class.</p>
<p>There are at least two reasons for this:... | <p>You seem to have found your answer that in this case delegation is the better strategy. Nevertheless, I would like to add that, excepting delegation, there is nothing wrong with extending a built-in class, particularly if your alternative, depending on the language, is "monkey patching" (see <a href="http://en.wiki... | 36,754 |
<p>We have a large application in Ruby on Rails with many filters. Some of these filters can be complex. I am looking for a way to individually test these filters with a unit test. Right now I test them by testing them through an action that uses them with a functional test. This just doesn't feel like the right wa... | <p>Remember a filter is just a method.<br>
Given this:</p>
<pre><code>class SomeController
before_filter :ensure_awesomeness
...
end
</code></pre>
<p>There's no reason you can't just do this:</p>
<pre><code>SomeController.new.ensure_awesomeness
</code></pre>
<p>and then check that it calls redirect_to or whate... | <p>It depends on what your filters are doing.</p>
<p>This: <a href="http://movesonrails.com/journal/2008/1/23/testing-your-application-controller-with-rspec.html" rel="nofollow noreferrer">http://movesonrails.com/journal/2008/1/23/testing-your-application-controller-with-rspec.html</a></p>
<p>And also learning how to... | 31,276 |
<p>tried searching but couldn't find anything.
I do not have a 3d printer so can't really experiment on my own, which means that when I am going to order a 3d print I want to get it as good as possible. So, my question:</p>
<p>Do quality of geometry matters when 3d printing? Will 3d printer only print quads, or ngons ... | <p>There are a lot of factors to 3D printing parts that work and fit together. </p>
<p>A lot of it will be discovered by trial and error, but let's try to put you on the right path. </p>
<p>First your material is what matters the most. Specifically their coefficient of thermal expansion, i.e. how much can the plastic... | <p>I can't attest to the empirical data laid out in the first answer, but I've had to deal with a lot of components printed in two parts to be connected via design-incorporated channels. I always found that, as a reference, a box of width and length 0.98" will slide securely, but freely, into a square channel of width ... | 463 |
<p>I'm thinking this might be a quick and easy way to lower the form spam on our site just a little bit. The idea being that (I have read) spammers aren't running with javascript enabled. (Or at least they are accessing your website without running javascript. I.e., they aren't browsing up to it in IE or FF.</p>
<p>I ... | <p>The simplest way is to set a cookie via javascript and check for it on postback.However, if you're looking to minimize spam you should actually have the browser perform a simple task which requires javascript execution. See Phil Haack's "Invisibile Captcha Validator" control, which has since been included in his Sub... | <p>I see you've accepted the <code>noscript</code> answer, but how will you use this to fight spam? <code>noscript</code> will allow you to add special content for users without JS, but unless you're generating the rest of your site in JS, it will still be available to user agents without JS.</p>
<p>A captcha of some ... | 7,559 |
<p>I'm just getting dirty in WinForms, and I've discovered, through a lovely tutorial, the magic of dragging a database table onto the design view of my main form. So, all is lovely, I've got my DataGridView with all of the columns represented beautifully.</p>
<p>BUT...</p>
<p>When I run my application against this b... | <p>Since it is an Identity column and you haven't saved it to the database yet it is -1. I am assuming here that this is before you save the table back to the database, correct? You need to perform the insert before that value will be set correctly.</p>
| <p>Since it is an Identity column and you haven't saved it to the database yet it is -1. I am assuming here that this is before you save the table back to the database, correct? You need to perform the insert before that value will be set correctly.</p>
| 5,942 |
<p>There seems to be no good way to localize a WPF application. MSDN seems to think that littering my XAML with <code>x:Uid</code>'s, generating CSV files, and then generating new assemblies (using their sample code!) is the answer. Worse, this process doesn't address how to localize images, binary blobs (say, PDF fi... | <p>Not an expert here, but "littering" your xaml with x:Uids is not worse than "littering" your Windows Forms code with all the string table nonsense you have to do for localizing them.</p>
<p>As far as I understand, WPF apps still support "all the Framework CLR resources including string tables, images, and so forth.... | <p>You can use the old "ResX" files which support all of your mentioned scenarios. How this can be accomplished in a WPF application is explained here:</p>
<p><a href="http://waf.codeplex.com" rel="nofollow noreferrer">WPF Application Framework (WAF)</a> => See Localization Sample</p>
| 11,267 |
<p>I am running a mysql server. I would like to somehow make sure that the whole DB is loaded into the ram as I heard it would be alot faster.</p>
<p>Is this true? and how do I vertify it?</p>
| <p>If you are using InnoDB, then you can set innodb_buffer_pool_size to be at least as large as your data and indexes. Then as you access data, it will be cached into memory and all subsequent accesses will occur via memory.</p>
<p>If you wanted to pre-cache the data, you could do some of your common queries, or full... | <p>(Just for completeness,) You could use <a href="http://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html" rel="nofollow noreferrer">HEAP</a> as table engine. But keep in mind that whatever data you put in a HEAP table is gone when you reboot the server.</p>
| 17,393 |
<p>I'm using the jQuery slideToggle function on a site to reveal 'more information' about something. When I trigger the slide, the content is gradually revealed, but is located to the right by about 100 pixels until the end of the animation when it suddenly jumps to the correct position. Going the other way, the cont... | <p>I have found a workaround, but I'm still not sure of the details. It seemed that when the 'overflow: hidden' style was added by jQuery, the effect that a nearby floated element had changed. The workaround was to place a permanent 'overflow: hidden' on the slideToggle'd div, and also a negative margin-left to count... | <p>This is an old one but similar problems still exist, below a working solution with a couple more requirements.</p>
<p><a href="http://jsfiddle.net/bfnGu/7/" rel="nofollow">http://jsfiddle.net/bfnGu/7/</a></p>
| 20,082 |
<p>I'm getting a warning from ReSharper about a call to a virtual member from my objects constructor. </p>
<p>Why would this be something not to do?</p>
| <p>When an object written in C# is constructed, what happens is that the initializers run in order from the most derived class to the base class, and then constructors run in order from the base class to the most derived class (<a href="https://learn.microsoft.com/en-us/archive/blogs/ericlippert/why-do-initializers-run... | <p>Another interesting thing I found is that the ReSharper error can be 'satisfied' by doing something like below which is dumb to me. However, as mentioned by many earlier, it still is not a good idea to call virtual properties/methods in constructor.</p>
<pre><code>public class ConfigManager
{
public virtual int M... | 14,533 |
<p>Is there any way to create C# 3.0 anonymous object via Reflection at runtime in .NET 3.5? I'd like to support them in my serialization scheme, so I need a way to manipulate them programmatically.</p>
<p><em>edited later to clarify the use case</em></p>
<p>An extra constraint is that I will be running all of it ins... | <p>Here is another way, seems more direct.</p>
<pre><code>object anon = Activator.CreateInstance(existingObject.GetType());
</code></pre>
| <p>Use reflection to get the Type, use GetConstructor on the type, use Invoke on the constructor.</p>
<p>Edit: Thanks to Sklivvz for pointing out that I answered a question that wasn't asked ;)</p>
<p>The answer to the actual question: I've found that generating C# code and then using CodeDomProvider (but not CodeDO... | 13,921 |
<p>What is the fastest way to load data from flatfiles into a MySQL database, and then create the relations between the tables via foreign keys? </p>
<p>For example... I have a flat file in the format: </p>
<pre><code>[INDIVIDUAL] [POP] [MARKER] [GENOTYPE]
"INDIVIDUAL1", "CEU", "rs55555","AA"
"INDIVIDUAL1", "C... | <p>I would take a multiple step approach to do this.</p>
<ol>
<li>Load the data into a temporary table, that is matching the file format that you have</li>
<li>Write queries to do the other inserts, starting the the general tables, then doing joins to get the FK values.</li>
</ol>
| <p>You could to start with the base tables without foreign keys. You would then lookup the IDs as you insert data in the other tables.</p>
<p>Another idea is that you could replace the IDs in the flat file(INDIVIDUAL1,CEU, ...etc.) by GUIDs . and then use them directly as IDs and foreign keys (i noticed this is tagge... | 28,579 |
<p>My FDM printer bed moves on the Y-axis and the print head moves on the X-axis and raises on the Z-axis. When printing rectangular objects (a model of Notre Dame in this case), are there print detail quality advantages to aligning the model perpendicular to the X or Y axis, or at 45 degrees? Part strength is not an i... | <p>In short: Not really.</p>
<p>longer version: It depends.</p>
<p>The main culprit of losing details in this case would be the weight and speed of the thing moving. So if you have a heavy X-axis carriage, acceleration and decelerating the carriage won't be instant. Same with the bed (Y-axis).</p>
<p>Another culprit... | <p>I'm under the impression that your question hints on rectilinear motion by aligning the print part to the axes motion of the printer. So, placing it under 45° would suggest movement of both steppers to make a straight line opposed to one stepper movement for a straight line.</p>
<p>Basically, the weight of the ... | 1,301 |
<p>When reading my RSS feed with the Thunderbird feed reader, some entries are duplicated. <a href="https://en.wikipedia.org/wiki/Google_Reader" rel="nofollow noreferrer">Google Reader</a> does not have the same problem.</p>
<p>Here is the faulty feed:
<a href="http://plcoder.net/rss.php?rss=Blog" rel="nofollow norefer... | <p>Try adding a <code><guid></code> tag to each item, giving it a permalink. i.e.:</p>
<pre><code><item rdf:about="http://plcoder.net/?doc=2134&amp;amp;titre=mon-pc-se-la-pete">
<link>http://plcoder.net/?doc=2134&amp;amp;titre=mon-pc-se-la-pete</link>
<guid>http://plcoder.net... | <p>I have experienced these issues with some of my own feeds. I started off with a list of entries like this:</p>
<pre><code>Item A
Item B
Item C
</code></pre>
<p>The client downloads them and everything is fine. Then I add a new item, so the feed reads as:</p>
<pre><code>Item D
Item A
Item B
</code></pre>
<p>D shows u... | 22,070 |
<p>What are the most common things to test in a new site?</p>
<p>For instance to prevent exploits by bots, malicious users, massive load, etc.?</p>
<p>And just as importantly, what tools and approaches should you use?</p>
<p>(some stress test tools are really expensive/had to use, do you write your own? etc)</p>
<p... | <p>Try and break your own site before someone else does. Your web site is basically a publicly accessible API that allows access to a database and other backend systems. Test the URLs as if they were any other API. I like to start by cataloging all URLs that have some sort of permenant affect on the state of the syste... | <p>There's seperate stages for this one.</p>
<p>Firstly there's the technical testing, where you check all technical functionality:</p>
<ul>
<li>SQL injections</li>
<li>Cross-site Scripting (XSS)</li>
<li>load times</li>
<li>stress levels</li>
</ul>
<p>Then there's the phase where you have someone completely compute... | 4,301 |
<p>I am having problem that even though I specify the level to ERROR in the root tag, the specified appender logs all levels (debug, info, warn) to the file regardless the settings. I am not a Log4j expert so any help is appreciated.</p>
<p>I have checked the classpath for log4j.properties (there is none) except the lo... | <p>The root logger resides at the top of the logger hierarchy. It is exceptional in three ways:</p>
<ul>
<li>it always exists,</li>
<li>its level cannot be set to null</li>
<li>it cannot be retrieved by name.</li>
</ul>
<p><strong>The rootLogger is the father of all appenders. Each enabled logging request for a given... | <p>This is correct behavior. The root logger is like the default behavior. So if you don't specify any logger it will take root logger level as the default level but this does not mean that root logger level is the level for all your logs.</p>
<p>Any of your code which logs using 'TraceLogger'logger or 'org.springfram... | 11,237 |
<p>After reading Practical Common Lisp I finally understood what the big deal about macros was, and I have been looking for a language for the .NET platform that supports this. There are a few lisp dialects for .NET but from what I have been able to gather all are either very beta or abandoned. Recently my interest has... | <p>Well, F# is based on OCaml and OCaml has a rather <a href="http://www.ocaml-tutorial.org/camlp4_3.10" rel="noreferrer">extensive macro system</a>. Given the syntactic and semantic similarities of F# and OCaml you may be able to port over the Ocaml macro system to F#.</p>
<p>Other than stealing Ocaml's macro system... | <p>That may be the other way around than what you want, but do you know about <a href="http://www.weitz.de/rdnzl/" rel="nofollow noreferrer">RDNZL</a>? It's a foerign-function interface (FFI) that lets you call .NET libraries from your Lisp code.</p>
<p>They are most probably much less mature than any Common Lisp or S... | 11,389 |
<p>Let's say you want to save a bunch of files somewhere, for instance in BLOBs. Let's say you want to dish these files out via a web page and have the client automatically open the correct application/viewer.</p>
<p>Assumption: The browser figures out which application/viewer to use by the mime-type (content-type?) h... | <p>The python-magic method suggested by <a href="https://stackoverflow.com/a/2133843/5337834">toivotuo</a> is outdated. <a href="http://github.com/ahupp/python-magic" rel="noreferrer">Python-magic's</a> current trunk is at Github and based on the readme there, finding the MIME-type, is done like this.</p>
<pre><code># ... | <p>I 've tried a lot of examples but with Django <a href="http://mutagen.readthedocs.io" rel="nofollow noreferrer">mutagen</a> plays nicely. </p>
<p>Example checking if files is <code>mp3</code> </p>
<pre><code>from mutagen.mp3 import MP3, HeaderNotFoundError
try:
audio = MP3(file)
except HeaderNotFoundError... | 6,518 |
<p>I'm need to find a method to programmatically determine which disk drive Windows is using to boot. In other words, I need a way from Windows to determine which drive the BIOS is using to boot the whole system. </p>
<p>Does Windows expose an interface to discover this? With how big the Windows API is, I'm hoping the... | <ol>
<li>Go into <code>Control Panel</code></li>
<li><code>System and Security</code></li>
<li><code>Administrative Tools</code></li>
<li>Launch the <code>System Configuration</code> tool</li>
</ol>
<p>If you have multiple copies of Windows installed, the one you are booted with will be named such as:</p>
<pre><code>... | <p>You can try use simple command line. <a href="https://technet.microsoft.com/en-us/library/cc709667%28v=ws.10%29.aspx" rel="nofollow">bcdedit</a> is what you need, just run cmd as administrator and type <code>bcdedit</code> or <code>bcdedit \v</code>, this doesn't work on XP, but hope it is not an issue.</p>
<p>Anyw... | 6,155 |
<p>In one of the stackoverflow podcasts (#18 I think) Jeff and Joel were talking about multi vs single tenant databases. Joel mentioned that "FogBugz on Demand" used a database per customer architecture and I was wondering if there is a point beyond which you'll need to have multiple database servers to distribute the ... | <p>Technically the limit of databases per instance in SQL Server is 32,767, but I doubt that you could use a SQL Server instance that has more than 2,000 databases, at that point the server would probably be not responsive.</p>
<p>You may be able to have close to 30,000 databases if they were all auto-closed and not b... | <p>I think it is more a question of the load on the databases. As was said above, if there is no load then 32,767. With a high load then it comes down, eventually to 1 or less than 1.</p>
| 27,141 |
<p>I've been using <a href="https://web.archive.org/web/20200229173754/http://tortoisesvn.tigris.org/" rel="noreferrer">TortoiseSVN </a> in a Windows environment for quite some time. It seems very feature-complete and nicely integrated into the Windows shell, and more importantly, it's fairly painless to teach to coll... | <p>I have been using the 64Bit version of TortoiseSVN for ages and I have never had issues with it on Windows 64Bit or Vista 64Bit. I am currently not aware of any other similiar SVN clients that do work on Vista. Is it possible the problem could lie within the configuration of TortoiseSVN or even the installation of V... | <p>I'll second Diago's answer. I use TortoiseSVN on Vista x64 pretty heavily.</p>
<p>I did upgrade directly from an older version to 1.5.2 though, and never used 1.5.1. Have you tried 1.5.2?</p>
| 2,255 |
<p>I know there are already a few questions regarding recommendations for C++ unit test frameworks, but all the answers did not help as they just recommend one of the frameworks but do not provide any information about a (feature) comparison.</p>
<p>I think the most interesting frameworks are CppUnit, Boost and the ne... | <p><a href="https://stackoverflow.com/questions/91683/how-do-you-implement-unit-testing-in-large-scale-c-projects">See this question</a> for some discussion.</p>
<p>They recommend the articles:
<a href="http://gamesfromwithin.com/?p=29" rel="noreferrer">Exploring the C++ Unit Testing Framework Jungle</a>, By Noel Llo... | <p><a href="http://lvc.github.io/api-sanity-checker/" rel="nofollow noreferrer">API Sanity Checker</a> — test framework for C/C++ libraries:</p>
<blockquote>
<p>An automatic generator of basic unit tests for a shared C/C++ library. It is able to generate reasonable (in most, but unfortunately not all, cases) input data... | 30,085 |
<p>We're currently building an application that executes a number of external tools. We often have to pass information entered into our system by users to these tools.</p>
<p>Obviously, this is a big security nightmare waiting to happen.</p>
<p>Unfortunately, we've not yet found any classes in the .NET Framework tha... | <p>Are you executing the programs directly or going through the shell? If you always launch an external program by giving the full path name to the executable and leaving the shell out of the equation, then you aren't really susceptible to any kind of command line injection.</p>
<p>EDIT: DrFloyd, the shell is respons... | <p>Well, if you can invoke the tools programmatically without the command line, that would probably be your best option. Otherwise, you could potentially execute the command line tool via a user that has absolutely no access to do anything (except perhaps a single directory that they can't do any harm with)... though ... | 6,658 |
<p>In SQL Server 2005, is there a way for a trigger to find out what object is responsible for firing the trigger? I would like to use this to disable the trigger for one stored procedure.</p>
<p>Is there any other way to disable the trigger only for the current transaction? I could use the following code, but if I'm ... | <p>I just saw this article recently highlighted on the SQL Server Central newsletter and it appears to offer a way which you may find useful using the Context_Info on the connection:</p>
<p><a href="http://www.mssqltips.com/tip.asp?tip=1591" rel="noreferrer">http://www.mssqltips.com/tip.asp?tip=1591</a></p>
<hr>
<p>... | <p>I concur with some other answers. Do not disable the trigger.</p>
<p>This is pure opinion, but I avoid triggers like the plague. I have found very few cases where a trigger was used to enforce database rules. There are obvious edge cases in my experience, and I have only my experience on which to make this state... | 21,046 |
<p>I want to run a psychological study for which participants have to look at large images.</p>
<p>The experiment is done on the web and therefore in a browser window. Is it possible to tell the browser to go into fullscreen, for example on button press?</p>
<p>I know there is the possibility to open a fixed-size pop... | <p>I have found some code after searching.</p>
<pre><code>function fullscreen() {
var element = document.getElementById("content");
if (element.requestFullScreen) {
if (!document.fullScreen) {
element.requestFullscreen();
$(".fullscreen").attr('src',"img/icons/panel_resize_actua... | <p>forget java script! For app feeling put this this to your body tag or div tag or css, it will work with all browsers, except Opera:</p>
<p>´
:-webkit-full-screen
:-moz-full-screen
:-ms-fullscreen
:fullscreen ´</p>
| 28,262 |
<p>At the moment my code looks like this:</p>
<pre><code># Assign values for saving to the db
$data = array(
'table_of_contents' => $_POST['table_of_contents'],
'length' => $_POST['length']
);
# Check for fields that may not be set
if ( isset($_POST['lossless_copy']) )
{
$data = array(
'lossle... | <p>How about this:</p>
<pre><code>// this is an array of default values for the fields that could be in the POST
$defaultValues = array(
'table_of_contents' => '',
'length' => 25,
'lossless_copy' => false,
);
$data = array_merge($defaultValues, $_POST);
// $data is now the post with all the keys s... | <pre><code>$formfields = $_POST;
$data = array();
foreach(array_keys($formfields) as $fieldname){
$data[$fieldname] = $_POST[$fieldname];
}
</code></pre>
<p>This will add all fields that are returned including submit. If you need to know if a checkbox has not been checked, you're going to have to use code like you p... | 27,453 |
<p>I recently bought some SUNLU PLA black filament and was attempting a small print with it and it started to come out in strings and lumps and was incredibly inconsistent. Before this I'd been using some Eryone PLA and those prints were superb, been printing back to back successfully but after using the SUNLU all of m... | <p>This is under extrusion, not delamination. Delamination is the result of the under extrusion.</p>
<p>It typically happens when the wrong filament diameter has been set in the slicer (a larger diameter than used, e.g 2.85 mm instead of 1.75 mm). Another option is that you accidentally put the printer in volumetric pr... | <p>This is under extrusion, not delamination. Delamination is the result of the under extrusion.</p>
<p>It typically happens when the wrong filament diameter has been set in the slicer (a larger diameter than used, e.g 2.85 mm instead of 1.75 mm). Another option is that you accidentally put the printer in volumetric pr... | 1,699 |
<p>I'm trying to programmatically reject a call on a BlackBerry, with Java + JDE.
I'm intercepting the <code>callIncoming</code> event, and in there I need to do something to reject a call from a specific number.</p>
<p>Does anyone know how to do that?</p>
| <p>I couldn't find an API for directly rejecting the call in progress. However, you could explore a hack where you inject a keypress of the Hangup/Disconnect button (see <code>EventInjector</code>).</p>
<p>As to determining the phone number, you could use <code>Phone.getCall(callId).getDisplayPhoneNumber()</code> or <... | <p>There is no other way than the <code>EventInjector</code>. The "security" layout of the BlackBerry API does not allow to hang up / reject a call. We tried to find a solution for this issue for 2 years. </p>
| 39,228 |
<p>I'm sure there were several, but the one I was thinking of would display a nice text screen when you crashed the computer thoroughly. </p>
<p>The Text was "Well smoke me a kipper."</p>
| <p>The name of the assembler was Fantasm.</p>
| <p>There was another 68000 Macintosh debugger called TMON. I don't remember the kipper quote being in it, but it's been a while.</p>
| 10,535 |
<p>Can someone define what exactly 'POCO' means? I am encountering the term more and more often, and I'm wondering if it is only about plain classes or it means something more?</p>
| <p>"Plain Old C# Object"</p>
<p>Just a normal class, no attributes describing infrastructure concerns or other responsibilities that your domain objects shouldn't have.</p>
<p>EDIT - as other answers have stated, it is technically "Plain Old CLR Object" but I, like David Arno comments, prefer "Plain Old Class Object"... | <p>POCO is a plain old CLR object, which represent the state and behavior of the application in terms of its problem domain.
it is a pure class, without inheritance, without any attributes.
Example: </p>
<pre><code>public class Customer
{
public int Id { get; set; }
public string Name { get; set; }
}
</code><... | 31,100 |
<p>What's the most efficient way to select the last n number of rows in a table using mySQL? The table contains millions of rows, and at any given time I don't know how large the table is (it is constantly growing). The table does have a column that is automatically incremented and used as a unique identifier for each ... | <pre class="lang-sql prettyprint-override"><code>SELECT * FROM table_name ORDER BY auto_incremented_id DESC LIMIT n
</code></pre>
| <p>Here you can change table name and column name according your requirement . if you want to show last 10 row then put n=10,or n=20 ,or n=30 ...etc according your requirement.</p>
<p>select * from
(select * from employee
Order by emp_id desc limit n)
a Order by emp_id asc;</p>
| 14,383 |
<p>I would like to use something like CLR Profiles on .Net 2.0 to see what objects are taking more space in the heap at any given time (of an ASP.Net worker process).</p>
<p>However, the CLR Profiler only lets me START an app, not attach to an existing one. I assume this is because it tracks allocations and GC too, bu... | <p><a href="http://memprofiler.com/" rel="nofollow noreferrer">.Net Memory Profiler</a> is exactly what you need. It's not free but there's a trial version. Actually I used the trial to find leaks on our last project. One notable feature is:</p>
<blockquote>
<p>Easily identify memory leaks by
collecting and compar... | <p><a href="http://memprofiler.com/" rel="nofollow noreferrer">.Net Memory Profiler</a> is exactly what you need. It's not free but there's a trial version. Actually I used the trial to find leaks on our last project. One notable feature is:</p>
<blockquote>
<p>Easily identify memory leaks by
collecting and compar... | 5,379 |
<p>There used to be a great one at this blog: <a href="http://www.hanneyetc.co.uk/" rel="nofollow noreferrer">http://www.hanneyetc.co.uk/</a> but it is offline now.</p>
| <p>Ryan Lanciaux blog:
<a href="http://frickinsweet.com/ryanlanciaux.com/post/RhinoCommons2c-NHibernate-and-ASPNET-MVC.aspx" rel="nofollow noreferrer">RhinoCommons, NHibernate and ASP.NET MVC Part 1 - Setup</a></p>
| <p>Some more resources:</p>
<ul>
<li>Ayende's <a href="http://ayende.com/wiki/Rhino%20Commons.ashx" rel="nofollow noreferrer">wiki</a></li>
<li>Ayende's <a href="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/SampleApplications/Exesto/" rel="nofollow noreferrer">Exesto</a> (a sample app)</li>
<li><a... | 39,047 |
<p>Joel always said to be careful when using 3rd party libraries. From my initial impressions, jQuery is great. What should I beware of when using it? What are the limitations? What headaches will I run into later on as I use it more?</p>
| <p>One thing I've run into with jQuery is that you end up chaining a lot of items together, and it tends to quickly get unreadable if you are not careful.</p>
<p>an example I can think of that illustrates this is on <a href="http://www.johndavidanderson.net/blog/2007/10/19/firebug-where-am-i/" rel="noreferrer">John Da... | <p>You can always consider different frameworks if jQuery doesn't suit.
Here's an example of <a href="http://mootools.net/" rel="nofollow noreferrer">mootools</a>.</p>
<blockquote>
<p>MooTools is a compact, modular,
Object-Oriented JavaScript framework
designed for the intermediate to
advanced JavaScript devel... | 13,577 |
<p>I have a svn repo on my machine (Windows). Anyone have a script to back it up to a network share?</p>
<p>I'm using the repo locally since I'm disconnected a lot. The network share is on a server with a backup strategy. I'm a perfect candidate for git/hg but I don't want to give up my VS integration just yet.</p>
| <p>I wrote a batch file to do this for a bunch of repos, you could just hook that batch file up to windows scheduler and run it on a schedule.</p>
<pre><code>svnadmin hotcopy m:\Source\Q4Press\Repo m:\SvnOut\Q4Press
</code></pre>
<p>I use the hotcopy but the svn dump would work just as well.</p>
| <p>svnadmin dump C:\SVNRepositorio\Repositorio > \\Backups\BkTmpSubversion\subversiontemp.dump</p>
<p>Try this.</p>
| 4,077 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.