instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>For example, if I have an echo statement, there's no guarantee that the browser might display it right away, might display a few dozen echo statements at once, and might wait until the entire page is done before displaying anything.</p>
<p>Is there a way to have each echo appear in a browser as it is executed?</p>
| <p>You can use <a href="http://php.net/flush" rel="noreferrer"><code>flush()</code></a> to force sending the buffer contents to the browser.</p>
<p>You can enable implicit flushing with "<a href="http://php.net/ob_implicit_flush" rel="noreferrer"><code>ob_implicit_flush(true)</code></a>".</p>
| <p>Start your investigation here:</p>
<p><a href="http://httpd.apache.org/docs/1.3/misc/FAQ-F.html#nph-scripts" rel="nofollow noreferrer">http://httpd.apache.org/docs/1.3/misc/FAQ-F.html#nph-scripts</a></p>
| 16,207 |
<p>I am running a java program that sets up a database connection to an SQL database. It works fine on Mac OS X, but when I try to run the same code on Linux, I get a Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException.</p>
<p>I am using jdk-1.6.0_02 - if I unzip src.zip, it turn... | <p>SQLClientInfoException is new in Java 1.6 and should be present in the src.zip. I have a <code>jdk1.6.0_03</code> in Windows and a <code>jdk1.6.0_06</code> in Linux and the class is included in both. Try to upgrade to the latest version.</p>
| <p>NoClassDefFoundError: "The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found." (from the API docs). </p>
<p>That class seems to be part of the standard jdk distribution. Likely there is an error in your path, or something in the program ... | 40,540 |
<p>What is the best way to design a user login mechanism using Java? What are the best practices to be followed to architect a secure and robust login mechanism? </p>
<p>What is the difference between JAAS, JNDI and GSSAPI? How do you decide which one to choose?</p>
| <p>Single sign on (SSO) is one of hte best practices. Using one set of credentials for authentication (not necessarily authorization) for a group of applications.
Sun's java based open source -- OpenSSO solution is available at <a href="https://opensso.dev.java.net/" rel="nofollow noreferrer">https://opensso.dev.java.... | <p>It depends on your user referential.</p>
<p>You need to be able to connect your login java module with that base. it is is LDAP, you might consider framework like <a href="http://www.openldap.org/jldap/" rel="nofollow noreferrer">OpenLDAP</a>.</p>
<p>Plus you have to consider what is include in your "login" perime... | 28,783 |
<p>Has anyone had any experience scaling out SQL Server in a multi reader single writer fashion. If not can anyone suggest a suitable alternative for a read intensive web application, that they have experience with</p>
| <p>It depends on probably 2 things:</p>
<ol>
<li>How big each single write is?</li>
<li>Do readers need real time data?</li>
</ol>
<p>A write will block readers when writing, but if each write is small and fast then readers won't notice.</p>
<p>If you offload, say, end of day reporting then you batch your load onto ... | <p>I don't have any experience with scaling out SQL Server for your scenario.
However for a Read-Intensive application, I would be looking at reducing the load on the database and employ a Cache Strategy using something like <a href="http://www.danga.com/memcached/" rel="nofollow noreferrer">Memcache</a> or <a href="h... | 48,783 |
<p>When I first setup the SVN structure for my different projects, I decided to place each different project in a separate repository.</p>
<p>This has worked well for a while, but I'm staring to think that I would like to merge all of those repositories into one overall "company-wide" repository so when I have employe... | <p>I recently had to do something similar and what I did was, in essence:</p>
<pre><code>* svnadmin create X:\Repositories\RepositoryC
* svn mkdir http://localhost:8080/svn/RepositoryC/branches --message "Added the branches folder."
* svn mkdir http://localhost:8080/svn/RepositoryC/tags --message "Added the tags folde... | <p>You can use <a href="http://www.coelho.net/svn-merge-repos.html" rel="nofollow noreferrer">svn-merge-repos.pl</a>, or you can merge several repository dumps with <a href="http://svn.borg.ch/svndumptool/" rel="nofollow noreferrer">SvnDumpTool</a> merge, and then load the resulting dump with <code>svnadmin load --igno... | 49,184 |
<p>What are some general tips to make sure I don't leak memory in C++ programs? How do I figure out who should free memory that has been dynamically allocated?</p>
| <p>I thoroughly endorse all the advice about RAII and smart pointers, but I'd also like to add a slightly higher-level tip: the easiest memory to manage is the memory you never allocated. Unlike languages like C# and Java, where pretty much everything is a reference, in C++ you should put objects on the stack whenever ... | <p>Exactly one return from any function. That way you can do deallocation there and never miss it.</p>
<p>It's too easy to make a mistake otherwise:</p>
<pre><code>new a()
if (Bad()) {delete a; return;}
new b()
if (Bad()) {delete a; delete b; return;}
... // etc.
</code></pre>
| 10,240 |
<p>What are the specifications of the three wires inside a PC cable that is used to connect the switching power supply to a US AC outlet.</p>
<p>The positive, negative and ground appear to be the same gauge stranded cable, and I've heard that it can handle 10A, but beyond that I don't really know what the rest of the ... | <p><em>Very</em> basically speaking, electricity works like this:</p>
<ol>
<li>There's some source that delivers a certain <strong>voltage</strong>.</li>
<li>You have a device that operates at a certain voltage. <strong>The device voltage and supply voltage should always match.</strong> No, don't put that 120V US devi... | <p>It's somewhat unclear what you mean by "standard PC cable", but virtually all desktop computers use <a href="https://en.wikipedia.org/wiki/IEC_60320#C13.2FC14_coupler" rel="nofollow">IEC C14 sockets/IEC C13 plugs</a>. Such connectors/sockets are rated for 10A 250V and thus you can safely assume that the cord itself ... | 168 |
<p>I'm going to be writing a chess server and one or more clients for chess and I want to describe the rules of chess (e.g. allowable moves based on game state, rules for when a game is complete) in a programming language independant way. This is a bit tricky since some of the chess rules (e.g. King Castling, en passen... | <p>Let's think. We're describing objects (locations and pieces) with states and behaviors. We need to note a current state and an ever-changing set of allowed state changes from a current state.</p>
<p>This is programming. You don't want some "meta-language" that you can then parse in a regular programming language... | <p>Drools has a modern human readable rules implementation -- <a href="https://www.jboss.org/drools/" rel="nofollow noreferrer">https://www.jboss.org/drools/</a>.
They have a way users can enter their rules in Excel. A lot more users can understand what is in Excel than in other tools.</p>
| 23,604 |
<p>I just started using SVN, and I have a cache directory that I don't need under source control. How can I ignore the whole directory/folder with SVN?</p>
<p>I am using <a href="https://en.wikipedia.org/wiki/Comparison_of_Subversion_clients#Standalone_Subversion_clients_comparison_table" rel="noreferrer">Versions</a>... | <p>Set the <code>svn:ignore</code> property of the parent directory:</p>
<pre><code>svn propset svn:ignore dirname .
</code></pre>
<p>If you have multiple things to ignore, separate by newlines in the property value. In that case it's easier to edit the property value using an external editor:</p>
<pre><code>svn pr... | <p>Since you're using Versions it's actually really easy:</p>
<ul>
<li>Browse your checked-out copy</li>
<li>Click the directory to ignore</li>
<li>In the "Ignore box on the right click Edit</li>
<li>Type *.* to ignore all files (or *.jpg for just jpg files, etc.)</li>
</ul>
| 14,148 |
<p>I'm working on a solution that contains multiple projects targeting Windows Mobile 5 and standard Windows applications.</p>
<p>Lately when opening up a form in designer the common UI controls (textbox, button, label, etc etc...) have vanished leaving only the controls defined within the project.</p>
<p>Resetting t... | <p>I just had a similiar problem. In a managed C++ project all the default toolbox items disappeared form the winforms designer. After playing around for a while I found that there was a problem in the .vcproj file.</p>
<pre><code><VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="COLLAD... | <p>Actually you may be able to <a href="http://msdn.microsoft.com/en-us/library/9yxtkx75(VS.80).aspx" rel="nofollow noreferrer">add a registry key</a> to get this to work also.</p>
| 24,211 |
<p>I would like to get a pretty accurate method to do finite element analysis (FEA) on my 3d designs considering the infill. I use <em>Autodesk Inventor</em> to design parts but the FEA can only be applied to a solid body (100% infill). Does anyone know software that can convert a 3d design to another but considering t... | <p>This is the throat block for direct drive extrusion, Anet8 is a cheap clone of Prusa printers, so it's easy to find parts for Anet printers. </p>
<p>This is one extruder kit that may help your needs, <a href="https://es.aliexpress.com/store/product/1Set-3D-Printer-makerbot-MK8-Extruder-Aluminum-extrusion-Frame-Bloc... | <p>Like @ZuOverture said the name of this component is the filament drive. Most of the manufactures sell the whole extrusion device already assembled, to avoid mismatches between the components of the extrusion device. If your device is somehow damaged, and without possibilities to be used in the printer the easiest so... | 742 |
<p>What conventions do you use for log categories in log4j or similar libraries ?
Usually you see class names as categories, but have you used other systems ?</p>
<p>What about log levels ? What levels do you use and in which case ?</p>
<p>Update: as some of you replied, there is no 'right' answer. I'm just looking f... | <p>I have 3 levels: errors, warnings and verbose log telling whatever the program is doing at a time.</p>
<p>I use class+function as a context.</p>
| <p>We have had extensive debates about this over the years and the only thing we all agree on is that there is no perfect answer!</p>
<p>What we have settled on is using a top level category name to differentiate between broad categories: e.g. 'Operation' relates to anything the user might care about, 'Internal' relat... | 19,749 |
<p>I have an application the will load usercontrols dynamically depending on the user. You will see in the example below that I am casting each user control via switch/case statements. Is there a better way to do this? Reflection? (I must be able to add an event handler Bind in each control.)</p>
<pre><code>override... | <p>I do not see anything control-class-specific in your code. You perform exactly the same operations, and looks like all user controls inherit from Control.</p>
<p>If the only specific thing is the event binding (i.e. Control class does not have Bind event), then better think about refactoring your code, so you make ... | <p>You could try TypeOf (in c#) Or would uc.GetType() work.</p>
| 45,762 |
<p>how can I debug a dll that is not loaded by the java application.</p>
<p>The scenario is this: my java app is loading the jni.dll that is using another dll and that dll is using another dll.</p>
<p>java<->jni.dll<->dll<->dll </p>
<p>I have the source code for all modules</p>
<p>I am using visual studio ... | <p>but this is the same.</p>
<p>I do the same, so let me explain my working set.</p>
<p>I am using eclipse 3.1 and Visual C++ 2003 7.1.3088 (German... sorry ;) ) and Windows XP.
I load some_jni.dll and some.dll in java and using the jni classes.
some.dll loads internaly other.dll.
I can debug some.dll and other.dll ... | <p>It's been a long while since I last did this, and even then it was on Linux & Solaris. An incomplete solution is to embed 'hard coded breakpoints' in your DLL with "<code>_asm int 3;</code>"</p>
<p>Whenever Windows executes this instruction it gives the desktop user the chance to attach a suitably configured de... | 46,952 |
<p>Am working with django Publisher example, I want to list all the publishers in the db via my list_publisher.html template, my template looks like;</p>
<pre><code>{% extends "admin/base_site.html" %}
{% block title %}List of books by publisher{% endblock %}
{% block content %}
<div id="content-main">
<h1&g... | <p>A few suggestions:</p>
<ul>
<li>check that your base_site.html does define a <code>{% block content %}{% endblock %}</code> section to be refine by your my list_publisher.html</li>
<li>check the cardinality of your list: <code>{%regroup publisher by name as pub_list %}{{ pub_list|length }}</code>. That should at l... | <p>Good answer by VonC.</p>
<p>A quick and dirty way to look at pub_list is to stick <code>[{{pub_list}}]</code> in your template. I put it in square brackets in case it's empty. BTW, you may get something that looks like <code>[,,,,,]</code>. This is because object references are wrapped in <> and your browser is... | 34,585 |
<p>Is there a tool out there that can automatically convert Python to Java?
Can Jython do this?</p>
| <p>It may not be an easy problem.
Determining how to map classes defined in Python into types in Java will be a big challange because of differences in each of type binding time. (duck typing vs. compile time binding). </p>
| <p>to clarify your question:</p>
<p>From Python Source code to Java source code? (I don't think so)<br></p>
<p>.. or from Python source code to Java Bytecode? (Jython does this under the hood)</p>
| 18,531 |
<p>Sometimes my c++ program crashes in debug mode, and what I got is a message box saying that an assertion failed in some of the internal memory management routines (accessing unallocated memory etc.). But I don't know where that was called from, because I didn't get any stack trace. How do I get a stack trace or at l... | <p>If you have a crash, you can get information about where the crash happened whether you have a debug or a release build. And you can see the call stack even if you are on a computer that does not have the source code.</p>
<p>To do this you need to use the PDB file that was built with your EXE. Put the PDB file i... | <p>You can use <a href="https://github.com/orling/Poppy" rel="nofollow">Poppy</a> for this. You just sprinkle some macros across your code and it will gather the stack trace, together with the actual parameter values, local variables, loop counters, etc. It is very lightweight so it can be left in the release build to ... | 13,791 |
<p>I have heard of desktop applications whose code has been open-sourced, but are there any websites whose code has been open-sourced? I don't think I have heard of any. If there are aren't any, are there any reasons why?</p>
<p>This will have the advantage of not having to wait for the web development team to include... | <p>Pastebin: <a href="http://pastebin.com/" rel="noreferrer">http://pastebin.com/</a></p>
<p>The wiki behind Wikipedia et al: <a href="http://www.mediawiki.org/wiki/MediaWiki" rel="noreferrer">http://www.mediawiki.org/wiki/MediaWiki</a></p>
<p>GrailsCrowd: <a href="http://grailscrowd.com/" rel="noreferrer">http://gra... | <p>phpbb.org
django
joomla
dotnetnuke</p>
| 23,773 |
<p>I've been trying to optimize the Windows program I am developing, trying to find the best data structures that will minimize memory use. It loads large blocks of data, so with huge files, it can use a large amount of RAM.</p>
<p>For memory measurement, I have been using GlobalMemoryStatusEx. See: <a href="http://ms... | <p>See the addenum in my question.</p>
| <p>I use <a href="http://valgrind.org/" rel="nofollow noreferrer">valgrind</a> to track memory usage, as well as to profile code and detect memory leaks. The massif tool, I believe, tracks memory usage on the stack and heap.</p>
| 40,357 |
<p>For my IIS website, I'd like to redirect ALL requests to ONE page. The purpose of this is that I want to do some maintenance on the database (take it off-line) that all my web applications use. I have about 50 web apps running under this website, so I'd like to avoid visiting each of them to change something. I'm t... | <p>If you are using ASP.NET 2.0 (or higher), you can drop an app_offline.htm page on the root.</p>
<p><a href="http://www.codeguru.com/csharp/.net/net_asp/article.php/c19653" rel="noreferrer">More info here</a>.</p>
| <p>Could you create a new site in IIS with a binding to port 80 with a blank host-header (much like the Default site) and then stop the other site(s)? That way all requests would be handled by the new site, which could simply be a static HTML page notifying users that the site is down for maintenance.</p>
| 38,507 |
<p>I made a view to abstract columns of different tables and pre-filter and pre-sort them. There is one column whose content I don't care about but I need to know whether the content is null or not. So my view should pass an alias as "<em>true</em>" in case the value of this specified column <strong>isn't null</strong>... | <p>You have to use a <strong>CASE</strong> statement for this:</p>
<pre><code>SELECT CASE WHEN columnName IS NULL THEN 'false' ELSE 'true' END FROM tableName;
</code></pre>
| <p>Since SQL server 2012 you can use <code>IIF</code></p>
<pre><code>IIF(columnName IS NULL, 'false', 'true')
</code></pre>
| 19,011 |
<p>I have a string from an email header, like <code>Date: Mon, 27 Oct 2008 08:33:29 -0700</code>. What I need is an instance of GregorianCalendar, that will represent the same moment. As easy as that -- how do I do it?</p>
<p>And for the fastest ones -- this is <strong>not</strong> going to work properly:</p>
<pre><c... | <p>I'd recommend looking into the Joda Time library, if that's an option. I'm normally against using a third-party library when the core platform provides similar functionality, but I made this an exception because the author of Joda Time is also behind JSR310, and Joda Time is basically going to be rolled into Java 7 ... | <h1><em>java.time</em></h1>
<p><strong>Solution using <code>java.time</code>, the <a href="https://www.oracle.com/technical-resources/articles/java/jf14-date-time.html" rel="nofollow noreferrer">modern date-time API</a>:</strong></p>
<p>The modern date-time API offers <a href="https://docs.oracle.com/javase/8/docs/api/... | 29,773 |
<p>I'm writing an application in PHP 5. I want to delete some rows in a SQLite v2 database file. I'm doing something like this:</p>
<pre><code>$sqliteConnection = new SQLiteDatabase('path/to/db');
$queryString = "DELETE FROM myTable WHERE status='not good'";
$result = $sqliteConnection->query($queryString);
</code>... | <p>The PHP function <a href="http://de2.php.net/sqlite_changes" rel="noreferrer"><code>sqlite_changes()</code></a> does this for you. </p>
<blockquote>
<p>Returns the numbers of rows that were changed by the most recent SQL statement executed against the <code>dbhandle</code> database handle. </p>
</blockquote>
<p>... | <p>I'd recommend using <a href="http://www.php.net/manual/en/book.pdo.php" rel="nofollow noreferrer">PDO</a> and <a href="http://www.php.net/manual/en/pdo.exec.php" rel="nofollow noreferrer">PDO:exec</a>, which returns the number of affected rows. (Or <a href="http://www.php.net/manual/en/pdostatement.rowcount.php" rel... | 40,427 |
<p>I'm having a problem with my compiler telling me there is an 'undefined reference to' a function I want to use in a library. Let me share some info on the problem:</p>
<ul>
<li>I'm cross compiling with gcc for C.</li>
<li>I am calling a library function which is accessed through an included header which includes an... | <p>It sounds like you are not compiling the .c file in the library to produce a .o file. The linker would look for the prototype's implementation in the .o file produced by compiling the library </p>
<p>Does your build process compile the library .c file?</p>
<p>Why do you call it a "library" if it's actually just s... | <p>I guess you have to add the path where the linker can find the libraray. In gcc/ld you can do this with -L and libraray with -l.</p>
<blockquote>
<p>-Ldir, --library-path=dir </p>
<p>Search directory dir before standard
search directories (this option must
precede the -l option that searches
that direc... | 17,327 |
<p>When in release it crashes with an unhandled exception: std::length error.</p>
<p>The call stack looks like this:</p>
<pre><code>msvcr90.dll!__set_flsgetvalue() Line 256 + 0xc bytes C
msvcr90.dll!__set_flsgetvalue() Line 256 + 0xc bytes C
msvcr90.dll!_getptd_noexit() Line 616 + 0x7 bytes C
msvcr90.dll!_get... | <p>Examining the stack dump:</p>
<p>InitTerm is simply a function that walks a list of other functions and executes each in step - this is used for, amongst other things, global constructors (on startup), global destructors (on shutdown) and atexit lists (also on shutdown).</p>
<p>You are linking with CGAL, since tha... | <p>Crashes before main() are usually caused by a bad constructor in a global or static variable.</p>
<p>Looks like the constructor for <strong>class Random</strong>.</p>
| 43,141 |
<p>I have a Form being launched from another form on a different thread. Most of the time it works perfectly, but I get the below error from time to time. Can anyone help?</p>
<pre><code>at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 heig... | <p>The user has to be able to see multiple open accounts simultaneously, right? So you need multiple instances of a form?</p>
<p>Unless I'm misreading something, I don't think you need threads for this scenario, and I think you are just introducing yourself to a world of hurt (like these exceptions) as a result.</p>
... | <p>Can you elaborate what you are trying to do here?
If you are trying to show a Form from a different thread than the UI thread then refer to this question:
<a href="https://stackoverflow.com/questions/160555/my-form-doesnt-properly-display-when-it-is-launched-from-another-thread">My form doesn't properly display ... | 19,798 |
<p>I am new to Cocoa and need to capture input using scanf to run a program that requires input of four variables one at a time.</p>
<p>Is there any console, window class, canvas, memo class (as in delphi) that will llow me to do this.</p>
<p>Earl Cenac</p>
| <p>You can use stdio with Objective C, which is a complete superset of C.</p>
<p>If your program runs from a command line, you can just write it in C.</p>
| <p>You can use <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSScanner_Class/Reference/Reference.html" rel="nofollow noreferrer">NSScanner</a> to parse the input, but as has already been said you use the C standard library to interact with stdin/stdout. I'd use -[NSString initWith... | 32,258 |
<p>Here is the question:<br>
<strong>Can TortoiseSvn work on Windows 2008 without turning off User Account Control?</strong> </p>
<p>Here is the story:
I just moved my test server to Windows 2008 and I am having problems with TortoiseSvn. I am logged on as an administrator, but when I go to update some code from the... | <p>right-click on your working copy c:\dev folder, select "properties" from the context menu.
In the properties dialog, go to the security tab. You will notice that the Admin user doesn't have full access (the user is not listed there).
Add the Admin user and give it full access rights.</p>
<p>Yes, the Admin user usua... | <p>Did you try navigating to Program Files\TortoiseSVN\bin in Windows Explorer and setting "run ad administrator" on TortoiseProc.exe > Properties > Compatibility?</p>
| 31,259 |
<p>There is a div that has inner content, a div with a border that's inside a div. Somehow, this div is expanded to encompass the next div. It blows my mind.</p>
<pre><code><div style="background: yellow;">
<div>
<div style="border: 1px solid black; background: green">green background</div... | <p>Sounds like you're in transitional quirksmode which is EVIL.</p>
<p>Strict solves this.</p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
</code></pre>
| <p>One solution is to put "position: relative" everywhere, but this breaks other things in my page.</p>
| 48,013 |
<p>I want to get at the item that is being data bound, during the ItemDataBound event of an asp:repeater.</p>
<p>I tried the following (which was an unaccepted answer in a <a href="https://stackoverflow.com/questions/284420/datagridview-bindinghow-to-color-line-depending-of-the-object-binded#284470">stackoverflow ques... | <p>Right off the bat I would have to guess you need this:</p>
<pre><code>if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
//Put stuff here
}
</code></pre>
<p>After all, the item itself could be representing a header or footer row.</p>
| <p>If you're dealing with an asp:ListView, you can do something like this:</p>
<pre><code> protected void myLV_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType != ListViewItemType.DataItem)
return;
object dataItem = ((ListViewDataItem)e.Item).DataItem;
}
</code></pre>
<... | 44,745 |
<p>Right now I'm doing something like this:</p>
<pre><code>RewriteRule ^/?logout(/)?$ logout.php
RewriteRule ^/?config(/)?$ config.php
</code></pre>
<p>I would much rather have one rules that would do the same thing for each url, so I don't have to keep adding them every time I add a new file.</p>
<p>Also, I like to... | <p>Try:</p>
<p>RewriteRule ^/?(\w+)/?$ $1.php</p>
<p>the $1 is the content of the first captured string in brackets. The brackets around the 2nd slash are not needed.</p>
<p>edit: For the other match, try this:</p>
<p>RewriteRule ^/?(\w+)/(\w+)/?$ $1_$2.php</p>
| <p>Mod rewrite can't do (potentially) boundless replaces like you want to do in the second part of your question. But check out the External Rewriting Engine at the bottom of the <a href="http://httpd.apache.org/docs/2.2/misc/rewriteguide.html" rel="nofollow noreferrer">Apache URL Rewriting Guide</a>:</p>
<blockquote>... | 13,008 |
<p>An app I'm writing always crashes on a clients computer, but I don't get an exception description, or a stack trace.<br>
The only thing I get is a crash report that windows wants to send to Microsoft.<br>
I would like to get that dump file and investigate it myself, but I cannot find it.</p>
<p>When I "View the con... | <p>You can use the <a href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx" rel="noreferrer">Windows debugging tools</a> to view the crash dump. To get the most use out of it, you'll need an exact copy of the symbols for that application (i.e. same version).</p>
<p>Have a look at <a href="http://blogs.m... | <p>Tess' blog was a great resource. Eventually I managed to figure out how to do remote debugging which means I didn't have to look at the crash dump.</p>
<p>For the general community, here are some links I found useful:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/8x6by8d2.aspx" rel="noreferrer">Rem... | 4,739 |
<p>Is there a manual for cross-compiling a C++ application from Linux to Windows?</p>
<p>Just that. I would like some information (links, reference, examples...) to guide me to do that.</p>
<p>I don't even know if it's possible. </p>
<p>My objective is to compile a program in Linux and get a .exe file that I can run... | <p>The basics are not too difficult:</p>
<pre><code>sudo apt-get install mingw32
cat > main.c <<EOF
int main()
{
printf("Hello, World!");
}
EOF
i586-mingw32msvc-cc main.c -o hello.exe
</code></pre>
<p>Replace <code>apt-get</code> with <code>yum</code>, or whatever your Linux distro uses. That will gene... | <p>I suggest you give the following, <a href="http://lilypond.org/gub/" rel="nofollow noreferrer">GUB</a> (Grand Unified Builder) a try as it cross-compiles several packages with their dependencies and assembles them into a single installation package for currently 11 architectures. You can download a prebuilt iso for ... | 22,043 |
<p>I have a ListBox whose ItemSource is an ObjectDataProvider that is an instance of an ObservableCollection. The ObservableCollection is a collection of ObservableCollections. The ItemTemplate of the ListBox is a DataTemplate that creates a ListBox for each item of the listbox. To illustrate this better I'm trying to ... | <p>With Card like the following:</p>
<pre><code> public class Card
{
private string _name;
public Card(string name)
{
_name = name;
}
public string Name
{
get { return _name; }
set { _name = value; }
}
}
</code></pre>
<p>and Book like the following:</p>
<pre><c... | <p>Thank you for the responses. While I do agree with both responses, and always appreciate being notified of bad coding practices, the first answer did the trick. I was having an issue with the ItemsSource of the ListBox within my DataTemplate. Somewhere along the lines of learning WPF, I became hooked on using Object... | 45,579 |
<p>I have a web server on port 80 and port 81. IE can connect to the server on either port. This worked fine until I installed an application with a file type (.TPJ) that had a MIME type of text/xml on the client PC. At that point IE no longer opened the web site, but offered to download a file <em>serverName.TPJ</em>.... | <p>I found the answer. There is a left-over entry in the registry for the text/xml MIME type. It can be restored to the default value by re-registering the MSXML3.DLL.</p>
<pre><code>regsvr32 msxml3.dll
</code></pre>
| <p>Windows Registry Editor Version 5.00</p>
<p>[HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/xml]
"CLSID"="{48123BC4-99D9-11D1-A6B3-00C04FD91555}"
"Extension"=".xml"
"Encoding"=hex:08,00,00,00</p>
| 37,004 |
<p>I'm familiar with SQL Server Indexed Views (or Oracle Materialized Views), we use them in our OLAP applications. They have the really cool feature of being able to usurp an execution plan and remap it to the indexed view w/out having to change existing code.</p>
<p>IE. Let's say I had a SPROC that was a really expe... | <p>Materialized views can be useful for reporting against OLTP, especially is large numbers of rows are aggregated to get the results. The space requirements are completely dependent on how much data you are saving. Think of it as a cache.</p>
<p>The tricky balance is between how recent the data needs to be for th... | <p>We use materialized views to speed up things where I work. Most often for reports against the OLTP system. Many of our reports run from a data warehouse, but since we refresh the warehouse overnight, up to the moment data has to come from the OLTP tables.</p>
| 8,162 |
<p>I use Eclipse, Maven, and Java in my development. I use Maven to download dependencies (jar files and javadoc when available) and Maven's eclipse plug-in to generate the .project and .classpath files for Eclipse. When the dependency downloaded does not have attached javadoc I manually add a link for the javadoc in t... | <p>From the Maven Eclipse Plugin <a href="http://maven.apache.org/plugins/maven-eclipse-plugin/examples/attach-library-sources.html" rel="noreferrer">FAQ</a></p>
<blockquote>
<p>The following example shows how to do
this in the command-line:</p>
<pre><code>mvn eclipse:eclipse -DdownloadSources=true -DdownloadJav... | <p>Would having the sources for the dependency help? You can tell the eclipse plugin to download those (and refer to them in the .classpath) with <code>-DdownloadSources=true</code></p>
| 6,617 |
<p>I am building a PHP application in CodeIgniter. CodeIgniter sends all requests to the main controller: <code>index.php</code>. However, I don't like to see <code>index.php</code> in the URI. For example, <code>http://www.example.com/faq/whatever</code> will route to <code>http://www.example.com/index.php/faq/whateve... | <p>Some practical examples of the differences between these variables:<br>
Example 1.
PHP_SELF is different from SCRIPT_NAME <em>only</em> when requested url is in form:<br>
<a href="http://example.com/test.php/foo/bar" rel="noreferrer">http://example.com/test.php/foo/bar</a></p>
<pre><code>[PHP_SELF] => /test.php/... | <p>Backup a second, you've taken the wrong approach to begin with. Why not just do this</p>
<pre><code>RewriteEngine on
RewriteCond $1 !^(images|inc|favicon\.ico|index\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php?url=$1 [L]
</code></pre>
<p>instead? Then grab it with <code>$_GET['url'];</code></p>
| 35,390 |
<p>I'm trying to replace each <code>,</code> in the current file by a new line:</p>
<pre><code>:%s/,/\n/g
</code></pre>
<p>But it inserts what looks like a <code>^@</code> instead of an actual newline. The file is not in DOS mode or anything.</p>
<p>What should I do?</p>
<p>If you are curious, like me, check the q... | <h2>Use <code>\r</code> instead of <code>\n</code>.</h2>
<p>Substituting by <code>\n</code> inserts a null character into the text. To get a newline, use <code>\r</code>. When <em>searching</em> for a newline, you’d still use <code>\n</code>, however. This asymmetry is due to the fact that <code>\n</code> and <code>\r<... | <p>in vim editor the following command successfully replaced \n with new line</p>
<pre><code>:%s/\\n/\r/g
</code></pre>
| 9,681 |
<p>I'd like to use a Regex parser to aid in some string processing in a C application. I'm ideally looking for something lightweight and open-source. The target platform is an embedded system so we're looking to save as much as possible with memory consumption in particular. I've found a number of options online but wa... | <p><a href="http://www.scintilla.org/" rel="noreferrer" title="Scintilla and SciTE">Scintilla</a>, an open source text editor component, uses <a href="http://www.cs.yorku.ca/~oz/" rel="noreferrer">Ozan S. Yigit's RE engine</a></p>
<p>It was chosen because it is in the public domain (so no encumbering license) and very... | <p>Given your lightweight requirements, I'd recommend <a href="https://garyhouston.github.io/regex/" rel="nofollow noreferrer">Henry Spencer's regex library</a> which implements the <a href="http://www.regular-expressions.info/posix.html" rel="nofollow noreferrer">POSIX BRE and ERE regex flavors</a>. These are standar... | 39,486 |
<p>I'm writing an error handling module for a fairly complex system architected into layers. Sometimes our data layer throws obscure exceptions.</p>
<p>It would be really handy to log out the <i>values</i> of the parameters of the method that threw the exception. </p>
<p>I can reflect on the TargetSite property of th... | <p>In short ... no. See this question on <a href="https://stackoverflow.com/questions/168396/capturing-method-state-using-reflection#168421">capturing method state</a> for some reasons.</p>
| <p>The built in framework ArgumentOutOfRangeException (which you should throw in a method if the incoming parameters are... out of range... has private field and public property for the method parameter that caused the error... When you create this exception, you pass the parameter value in the ctor... </p>
<pre><co... | 39,845 |
<p>I have the following Query and i need the query to fetch data from SomeTable based on the filter criteria present in the Someothertable. If there is nothing present in SomeOtherTable Query should return me all the data present in SomeTable</p>
<p>SQL SERVER 2005</p>
<p>SomeOtherTable does not have any indexes or ... | <p>Try:</p>
<pre><code>SELECT
*
FROM
SomeTable
LEFT JOIN SomeOtherTable ON SomeTable.ID=SomeOtherTable.ID AND Name = 'ABC'
WHERE
1=1
AND
(
SomeOtherTable.ID IS NOT NULL
OR
0=(SELECT Count(1) FROM SomeOtherTable WHERE spName = 'ABC')
)
</code></pre>
| <p>Aloha</p>
<p>Try</p>
<pre><code>select t.* from SomeTable t
left outer join SomeOtherTable o
on t.id = o.id
where (not exists (select id from SomeOtherTable where spname = 'adbc')
OR spname = 'adbc')
</code></pre>
<p>-Edoode</p>
| 48,930 |
<p>How can I remove duplicate values from an array in PHP?</p>
| <p>Use <a href="http://php.net/array_unique" rel="noreferrer">array_unique()</a>.</p>
<p>Example:</p>
<pre><code>$array = array(1, 2, 2, 3);
$array = array_unique($array); // Array is now (1, 2, 3)
</code></pre>
| <p>I have done this without using any function.</p>
<pre><code>$arr = array("1", "2", "3", "4", "5", "4", "2", "1");
$len = count($arr);
for ($i = 0; $i < $len; $i++) {
$temp = $arr[$i];
$j = $i;
for ($k = 0; $k < $len; $k++) {
if ($k != $j) {
if ($temp == $arr[$k]) {
echo $temp."<br&... | 39,597 |
<p>Here's the situation: we have an Oracle database we need to connect to to pull some data. Since getting access to said Oracle database is a real pain (mainly a bureaucratic obstacle more than anything else), we're just planning on linking it to our SQL Server and using the link to access data as we need it.</p>... | <p>If the inner join significantly reduces the total number of rows, then option 1 will result in much less network traffic (since you won't have all the rows from table1 having to go across the db link</p>
| <p>I'd go with your first option especially if your query contains a where clause to select a sub-set of the data in the tables.</p>
<p>It will require less work on both servers, assuming there are indices on the tables in the Oracle server that support the join operation.</p>
| 49,505 |
<p>Using the <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow noreferrer">jQuery Validation</a> plugin and AJAX, how can I validate the contents of say an input (textbox) but pass more than one parameter to a controller action?</p>
<p>A brilliant example of passing a single value ... | <p>Looking at the code for jQuery Validation it looks like the post data can not be customized. So you'll have to stick with query parameters:</p>
<pre><code> <script type="text/javascript">
$(document).ready(function(){
$("#form-sign-up").validate(
{
var param1 = $('#mytextbox').val();
rules:
{... | <p>Something like this?</p>
<pre><code>$(document).ready(function(){
$("#form-sign-up").validate( {
rules: {
email: {
required: true,
email: true
},
surname: {
required: true,
surname: true
}
},
messages: {
email: {
required: "Please p... | 43,386 |
<p>I am writing a client for a backup server.
My client schedules some folders for backup. (ex: every friday at hour X).
I am using for scheduling <strong>cron4j</strong> (a port of Linux cron to java).</p>
<p>Everything works nice until i schedule at the same time multiple upload jobs, then due to the multiple thread... | <p>Can you explain what you mean when you say it gets a bit "messy"? Any particular symptoms?</p>
<p>Anyway looking at this from a clean sheet I'd say you want to throttle the number of concurrent uploads you're performing at one time otherwise you're likely to hit some kind of limit in terms of the number of connecti... | <p>ipworks FTP class is thread safe. And you <strong>must</strong> read Java Concurrency in Practice by Brian Goetz ... </p>
<pre><code>public class ServerConnection extends Thread {
// the connection to the ftp server
private final Ftp connection;
</code></pre>
<p>or you can implement Runnable and use an <a href=... | 49,080 |
<p>I'm producing a hex file to run on an ARM processor which I want to keep below 32K. It's currently a lot larger than that and I wondered if someone might have some advice on what's the best approach to slim it down?</p>
<p>Here's what I've done so far</p>
<ol>
<li>So I've run 'size' on it to determine how big the ... | <p>General list:</p>
<ul>
<li>Make sure that you have the compiler and linker debug options disabled</li>
<li>Compile and link with all size options turned on (-Os in gcc)</li>
<li>Run <code>strip</code> on the executable</li>
<li>Generate a map file and check your function sizes. You can either get your linker to gen... | <p>You could look at something like <a href="http://en.wikipedia.org/wiki/Executable_compression" rel="nofollow noreferrer">executable compression</a>.</p>
| 24,426 |
<p>I would like to do both of the following things:</p>
<ol>
<li>use audit triggers on my database tables to identify which user updated what;</li>
<li>use connection pooling to improve performance</li>
</ol>
<p>For #1, I use 'system_user' in the database trigger to identify the user making the change, but this preve... | <p>Look up something called WebServices, SOAP and XML-RPC. Should get you well on your way.</p>
| <p>Use web services to wrap common code / libraries that you want to share across the interfaces. All the listed platforms have decent support for webservices.</p>
| 11,949 |
<p>I'm working on a JSP where I need to call methods on object that come from a Bean. The previous version of the page does not use JSTL and it works properly. My new version has a set up like this:</p>
<pre><code><jsp:useBean id="pageBean" scope="request" type="com.epicentric.page.website.PageBean" />
<c:set... | <p>When using the dot operator for property access in JSTL, <code>${pageDividers.size}</code> (no <strong>()</strong> needed) results in a call to a method named <code>getSize()</code>.<br>
Since java.util.List offers a method called <code>size()</code> (rather than <code>getSize()</code>) you won't be able to access t... | <p>To access the property of a bean using EL you simply name the property (not invoke the method). So lets say you have a method called getSize() in the bean then</p>
<pre><code>${pageDividers.size}
</code></pre>
<p>Notice no ().</p>
<p>EDIT:Sorry...made an error in the original post.</p>
| 28,154 |
<p>I'm using Hibernate for ORM of my Java app to an Oracle database (not that the database vendor matters, we may switch to another database one day), and I want to retrieve objects from the database according to user-provided strings. For example, when searching for people, if the user is looking for people who live i... | <p>For the simple case you describe, look at Restrictions.ilike(), which does a case-insensitive search.</p>
<pre><code>Criteria crit = session.createCriteria(Person.class);
crit.add(Restrictions.ilike('town', '%fran%');
List results = crit.list();
</code></pre>
| <p>Most default database collations are not case-sensitive, but in the SQL Server world it can be set at the instance, the database, and the column level.</p>
| 14,662 |
<p>In Enterprise Manager you could script all SPs in a database through the right click menu, is there a way to do it in Management Studio?</p>
| <p>You can right click on the database and to go Tasks -> Generate Scripts...</p>
<p>This will allow you to script all or selected objects (schema, stored procedures, tables, users and views) with specific options.</p>
| <p>If you right click on the database name, the bottom option is "Generate Scripts" which will then launch a wizard to generate scripts for the whole DB or specific objects inside.</p>
| 21,168 |
<p>I'm using the jquery library to load the content of an html file. Something like this:</p>
<p>$("#Main").load("login.html")</p>
<p>If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas how I can detect if the file t... | <p>You can use the ajaxComplete event, whis gives you access to the xhr object which you can query the status of the request e.g a status of 404 will mean the file does not exist.</p>
<p>More Info in the docs <a href="http://docs.jquery.com/Ajax/ajaxComplete#callback" rel="noreferrer">http://docs.jquery.com/Ajax/ajaxC... | <p>@PConroy's solution works, but it does the same thing for all failed ajax requests.</p>
<p>If you need this on a per request basis - i.e. if the first request fails it goes to X page and if the second fails go to Y, then you need to do this using the error handle in the $.ajax function:</p>
<p><a href="http://jsbi... | 23,990 |
<p>looking for the standard bug-proofed way to convert "long names" such as "C:\Documents and settings" to their equivalent "short names" "C:\DOCUME~1"</p>
<p>I need this to run an external process from withing my C# app. It fails if I feed it with paths in the "long name".</p>
| <p>If you are prepared to start calling out to Windows API functions, then GetShortPathName() and GetLongPathName() provide this functionality.</p>
<p>See <a href="http://csharparticles.blogspot.com/2005/07/long-and-short-file-name-conversion-in.html" rel="noreferrer">http://csharparticles.blogspot.com/2005/07/long-an... | <p>The trick with GetShortPathName from WinAPI works fine, but be careful when using very long paths there. </p>
<p>We just had an issue when calling 7zip with paths longer than MAX_PATH. GetShortPathName wasn't working if the path was too long. Just prefix it with "\?\" and then it will do the job and return correctl... | 32,253 |
<p>I'm trying to create an unusual associative array implementation that is very space-efficient, and I need a sorting algorithm that meets all of the following:</p>
<ol>
<li>Stable (Does not change the relative ordering of elements with equal keys.)</li>
<li>In-place or almost in-place (O(log n) stack is fine, but no... | <p>Merge sort can be written to be in-place I believe. That may be the best route.</p>
| <p>Perhaps <a href="http://en.wikipedia.org/wiki/Shell_sort" rel="nofollow noreferrer">shell sort</a>? If I recall my data structures course correctly, it tended to be stable, but it's worse case time is O(n log^2 n), although it performs O(n) on almost sorted data. It's based on insertion sort, so it sorts in place.</... | 13,811 |
<p>How do you compress Script Resources of ASP.Net? I saw a file there reached up to 255 KB! I tried finding solutions, but so far it only talks about scripting dynamic and static files. I checked the compression temp folder of IIS and found no compressed scripted resource there. That led me to the conclusion that thes... | <p>If you're running IIS6 the guys at OrcsWeb have a nice wee article -</p>
<blockquote>
<p><a href="http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx</a></p>
</blockquote>
<p>We have customers running the port80 soft... | <p>Check out the JSCompress task in the MSBuild Community Tasks (<a href="http://msbuildtasks.tigris.org/" rel="nofollow noreferrer">http://msbuildtasks.tigris.org/</a>). It'll strip out the whitespace from a JS file for you.</p>
| 16,783 |
<p>I have a proxy object generated by Visual Studio (client side) named ServerClient. I am attempting to set ClientCredentials.UserName.UserName/Password before opening up a new connection using this code:</p>
<pre><code>InstanceContext context = new InstanceContext(this);
m_client = new ServerClient(context);
m_clie... | <p>It appears that you can only access these properties pretty early in the instanciation cycle. If I override the constructor in the proxy class (ServerClient), I'm able to set these properties:</p>
<pre><code>base.ClientCredentials.UserName.UserName = "Sample";
</code></pre>
<p>I'm beginning to appreciate the peopl... | <p>I think your problem might be related to the use of the InstanceContext. I thought that was only needed for duplex communication channels from the server side. </p>
<p>I admit I'm not sure about this, but I think in this case you are telling the client to use an existing instance context so it thinks there is alrea... | 24,255 |
<p>I've got a strange problem with SQL Server 2000, and I just can't think of a reason for this to happen.</p>
<p>There are two tables, both having a combined primary key with a clustered index on it, both keys have the same structure:</p>
<pre><code>(VARCHAR(11), INT, DATETIME) /* can't change this, so don't sugge... | <blockquote>
<p>Why does it switch from an Index Seek
to an Index Scan?</p>
</blockquote>
<p>This is largely a guess, but here goes:</p>
<p>In the first case ('Foo'), MSSQL recognize that the value being search for is a perfect match for the first part of the index on t1, and therefore uses the index to find a re... | <p><a href="http://www.sqlservercentral.com/Forums/Topic464285-146-2.aspx" rel="nofollow noreferrer">From SqlServerCentral</a>:</p>
<p>the queries can have what looks like a perfectly formed join condition. But when you examine the query plan you will see a warning indicating 'No Join Predicate' indicating that 2 of ... | 37,091 |
<p>I have a form in HTML where our users fill in the data and then print it. The data isn't saved anywhere. These forms come from outside our company and are built as html pages to resemble the original as closely as possible and then stuffed away and forgotten in a folder on the intranet. Normally another developer... | <p>Add a separate CSS file for printing by doing something like this:</p>
<pre><code><link rel="stylsheet" type="text/css" media="print" href="print.css">
</code></pre>
<p>add it to the <code><head></code> section of the page.</p>
<p>In this(print.css) file include styling relevant to what you want to se... | <pre><code><input type="text" style="border: 0; background-color: #fff;" />
</code></pre>
<p>Where #fff is your background color..</p>
| 18,140 |
<p>When I use this code to output some XML I parsed (and modified) with <code>XmlParser</code></p>
<pre><code>XmlParser parser = new XmlParser()
def root = parser.parseText(feedUrl.toURL().text)
def writer = new StringWriter()
new XmlNodePrinter(new PrintWriter(writer)).print(root)
println writer.toString()
</code></p... | <p>It looks like it's denormalizing the output and including the namespace context along with the nodes that actually need the namespace context.</p>
<p>For example, the webpage for this question comes in with creativeCommons namespace embedded:</p>
<pre><code><feed xmlns="http://www.w3.org/2005/Atom" xmlns:creati... | <p>It looks like it's denormalizing the output and including the namespace context along with the nodes that actually need the namespace context.</p>
<p>For example, the webpage for this question comes in with creativeCommons namespace embedded:</p>
<pre><code><feed xmlns="http://www.w3.org/2005/Atom" xmlns:creati... | 28,144 |
<p>A python script need to spawn multiple sub-processes via fork(). All of those child processes should run simultaneously and the parent process should be waiting for all of them to finish. Having an ability to set some timeout on a "slow" child would be nice.
The parent process goes on processing the rest of the scr... | <p>Simple example:</p>
<pre><code>import os
chidren = []
for job in jobs:
child = os.fork()
if child:
children.append(child)
else:
pass # really should exec the job
for child in children:
os.waitpid(child, 0)
</code></pre>
<p>Timing out a slow child is a little more work; you can use ... | <p>I have done this in perl a time or two. Learning python and wanted to replicate the function. A scheduler for an unknown number of forked tasks must keep track of running tasks, ended tasks, and return codes. This code includes the code for the SIGCHLD handler, the parent task, and a simple child task.</p>
<pre... | 21,081 |
<p>Environment: </p>
<blockquote>
<p>win2003 running IIS6 serving asp pages that call delphi code.</p>
</blockquote>
<p>Delphi code contacts a <strong>c# webservice</strong> for which it needs to login (<code>login.asmx</code>). Webservice logs show login is successful. Debug results show that <code>Context.User.Id... | <p>I did this using git svn, with my development done in a git repository. The remote development is done in subversion. I made a git svn clone of the subversion repository, which I push to a real git repository. A cronjob runs "git svn rebase && git push" every now and again to create a git mirror of the subve... | <p>You can have your local repository where you commit your changes, as you already have done. Further you would do a periodic merge from the base repository in order to merge the changes done in the base trunk into your local repository.</p>
<p>The only difficult thing is that you need to keep track of the revisions ... | 41,497 |
<p><a href="https://stackoverflow.com/questions/205887/postback-security">Related Article</a></p>
<p>On a similar topic to the above article, but of a more specific note. How exactly do you handle items that are in the viewstate (so they are included on submit), but can also be changed via AJAX. For instance, say we h... | <p>You're not validating the dropdown list are you? You're validating the value a user selected. It's pretty much the same advice as the other post, since javascript or other tools can alter the html or create their own POST's, you <em>must always</em> validate on the server side. Assume all client requests can be tamp... | <p>why not validating onChange even in the dropdownlist?</p>
<p>just add the script manager and add that property to the onchange in the Page_Load event</p>
<pre>
' Creating the javascript function to validate
Dim js As String
js = "function validateDDL1(ddl) { alert(ddl.value); }"
' Adding onChange javascript metho... | 25,236 |
<p>Killing the processs while obtaining this information would be fine.</p>
| <p>A quick-and-dirty way would be <code>ObjectSpace.each_object{|e| p e}</code>. You could do some tests to determine what you wanted to keep, or Marshal the objects.</p>
| <p>For the more hardcore there is also <a href="http://blog.evanweaver.com/files/doc/fauna/bleak_house/files/README.html" rel="nofollow noreferrer">BleakHouse</a> which gives you a special custom-compiled copy of ruby with better memory leak tracking powarz</p>
| 14,193 |
<p>I'm investigating using hosted subversion for a new project at work and was wondering if anyone had any experiences they would share.</p>
<p>I've personally used <a href="http://www.beanstalkapp.com/" rel="nofollow noreferrer">Beanstalk</a> for small projects at home, but not with mulitple users or a large reposito... | <p>wush.net has been awesome - great support
I use it for personal projects as well as two freelance projects (one with a few hundred thousand lines of code)
None have large number of developers, but that should not be a problem</p>
<p>svnrepository is also good - but a lot less hand holding.
I switched to wush only b... | <p>If your project is open-source, you might want consider Google Code.</p>
<p>I've found it to be excellent!</p>
| 38,451 |
<p>A quick search for currency regex brings up <a href="https://regexlib.com/Search.aspx?k=currency&c=-1&m=-1&ps=20" rel="noreferrer">a lot of results</a>.</p>
<p>The problem I have in choosing one is that regex is difficult to verify without testing all the edge cases. Does anyone have a regex for U.S. cur... | <p>here's some stuff from the makers of Regex Buddy. These came from the library so i'm confident they have been thoroughly tested.</p>
<p>Number: Currency amount (cents mandatory)
Optional thousands separators; mandatory two-digit fraction</p>
<pre><code>Match; JGsoft:
^[+-]?[0-9]{1,3}(?:,?[0-9]{3})*\.[0-9]{2}$
</c... | <p>What about this one? Shorter and elegant</p>
<pre><code>(?:\,|\.?\d)*
</code></pre>
| 46,116 |
<p>I am looking for a C# library for getting files or directory from a directory using a complex pattern like the one used in Ant:</p>
<ul>
<li><code>dir1/dir2/**/SVN/*</code> --> Matches all files in SVN directories that are located anywhere in the directory tree under dir1/dir2</li>
<li><code>**/test/**</code> --> M... | <p>Coding it yourself wouldnt be that hard.</p>
<p>Just use a correctly formulated regular expression with System.IO methods to build the full path</p>
| <p>Are you comfortable with defining "*" as "anything but slash" and "**" as "anything at all"? If so, the regex conversion seems straightforward. </p>
<pre><code>* -> [^\/]*
** -> .*
</code></pre>
<p>Then it's a matter of recursively enumerating all files, and checking if their paths match the regex.</p>
| 19,163 |
<p>I am using the following generic code to save entities.</p>
<pre><code>using (ITransaction tx = session.BeginTransaction())
{
try
{
entity.DateModified = DateTime.Now;
session.SaveOrUpdate(entity);
session.Flush();
tx.Commit();
return entity;
}
catch (Exception)
... | <p>I'll suggest the obvious: make sure Profiler is set to display transaction information.</p>
<p>In the Trace Properties dialog -> Events selection tab, there's an expando for Transactions. Open it up and check the appropriate boxes (or just check 'em all on).</p>
<p>Also, FYI: I checked our application that uses NH... | <p>Try committing the transaction, then flushing the session.</p>
| 40,589 |
<p>Given the following JSON Date representation:</p>
<pre><code>"\/Date(1221644506800-0700)\/"
</code></pre>
<p>How do you deserialize this into it's JavaScript Date-type form?</p>
<p>I've tried using MS AJAX JavaScrioptSerializer as shown below:</p>
<pre><code>Sys.Serialization.JavaScriptSerializer.deserialize("\/... | <p>Provided you know the string is definitely a date I prefer to do this :</p>
<pre><code> new Date(parseInt(value.replace("/Date(", "").replace(")/",""), 10))
</code></pre>
| <p>The big number is the standard JS time</p>
<pre><code>new Date(1221644506800)
</code></pre>
<p>Wed Sep 17 2008 19:41:46 GMT+1000 (EST)</p>
| 10,776 |
<p>Traditional logfile analytics tools (awstats, statcounter) or general web analytics (google analytics, yahoo web analytics) are not suitable for analyzing traffic on servlets. Is there a good alternative to log messages using a logging framework (log4j for example) and to write a custom analytics software for these?... | <p>I guess you're referring to the fact that by default SQL Server installs allow Windows and SQL Server Authentication. If you remove the Windows Authentication mode then users will have to connect via SQL Server authentication.</p>
<p>This from <a href="http://support.microsoft.com/kb/247931" rel="nofollow noreferre... | <p>I suppose this is not the answer you hoped for but it is unavoidable that anyone with administrative rights will be able to browse and edit information in the database. </p>
<p>You cannot change this.</p>
<p>Perhaps you could consider WHY you want to prevent this kind of access?</p>
<p>I expect you want to preve... | 33,165 |
<p>For example, to make a DIY cartesian 3d printer you <strong>could</strong> use/do the following:</p>
<ul>
<li><p>Create G-code using a program of your choice.</p></li>
<li><p>Load it into Universal G-code Sender (GRBL).</p></li>
<li><p>Pass it into an Arduino with GRBL.</p></li>
<li><p>The arduino can pass the inst... | <p>The short answer is that the handling of the non-cartesian design is done by the motion-control firmware running on the Arduino.</p>
<p>The long answer:</p>
<p>I don't believe GRBL supports non-cartesian designs, and it is not commonly used for printers. It is more often used for mills, routers, or laser machines.... | <p>Every 3D printer or machine tool that is commanded through G-code must interpret the G-code in terms of the particular mechanism. Even a Cartesian machine in which there is a clear X, Y, and Z axis, each with independent actuators, interprets the G-code and adjusts for the scale factors, considers the current kinet... | 867 |
<p>Try to commit my first iPhone application to Subversion found that there's "code signing identity" section in my xcode project.pbxproj file.</p>
<pre><code>CODE_SIGN_IDENTITY = "iPhone Developer: my username here...;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: above...";
</code></pre>
<p>The issue is,... | <p>You can base a project or target configuration on the contents of an <code>xcconfig</code> file that is not checked in to Subversion or is otherwise customized per developer. Add an appropriate <code>xcconfig</code> file to your project and then choose the file from the "Based On" pop-up at the bottom of the Build ... | <p>The obvious choice would be to create other build configurations.</p>
| 42,917 |
<p>I'm looking to build some functionality for a content management system for the editing of files stored on the server.</p>
<p>I'd like to provide users the ability to easily download files locally to their computer, open the file for editing, and save it back to the server. The process should be as seamless as pos... | <p>Windows client OS has a WebDAV redirector and has had for a long time, so
a) you shouldnt need a client piece and b) it's not specific to Office files.</p>
<p>The fun bit is the server end, implementing a WebDAV server.</p>
<p>WebDAV isnt supported on client OSs like Vista (IIS5.1 has support, 6.0 doesnt), only o... | <p>The site <a href="http://www.webdav.org/" rel="nofollow noreferrer">WebDAV Resources</a> includes a link to at least <a href="http://milton.ettrema.com/index.html" rel="nofollow noreferrer">one open-source server implementation</a>. I haven't used this software, I'm just citing the reference.</p>
<p>It appears that... | 39,133 |
<p>I am using following PHP code to connect to MS Access database:</p>
<pre><code>$odb_conn = new COM("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". $db_path.";";
$odb_conn->open($connstr);
</code></pre>
<p>How can I retrieve database catalog/metadata from the mdb file?</p>
<p><... | <p>You will find information on ADO here : </p>
<ul>
<li><p><a href="http://msdn.microsoft.com/en-us/library/ms675532(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms675532(VS.85).aspx</a></p></li>
<li><p><a href="http://www.w3schools.com/ado/default.asp" rel="nofollow noreferrer">htt... | <p>The <code>MSysObjects</code> table can be used to query metadata in Access:</p>
<pre><code>SELECT NAME
FROM MSysObjects
WHERE Type In (1,4,6) AND Left([Name],4)<>"MSYS"
</code></pre>
| 14,611 |
<p>I use an anonymous object to pass my Html Attributes to some helper methods.
If the consumer didn't add an ID attribute, I want to add it in my helper method.</p>
<p>How can I add an attribute to this anonymous object?</p>
| <p>I assume you mean anonymous types here, e.g. <code>new { Name1=value1, Name2=value2}</code> etc. If so, you're out of luck - anonymous types are normal types in that they're fixed, compiled code. They just happen to be autogenerated.</p>
<p>What you <em>could</em> do is write <code>new { old.Name1, old.Name2, ID=my... | <pre><code>public static string TextBox(this HtmlHelper html, string value, string labelText, string textBoxId, object textBoxHtmlAttributes, object labelHtmlAttributes){}
</code></pre>
<p>This would accept the id value the textbox should have and the label should refer to.
If the consumer now doesn't include the "id"... | 28,927 |
<p>I have to create something similiar to Google Calendar, so I created an events table that contains all the events for a user.</p>
<p>The hard part is handling re-occurring events, the row in the events table has an event_type field that tells you what kind of event it is, since an event can be for a single date onl... | <p>As previously stated, <strong><em>don't reinvent the wheel</em></strong>, just enhance it.</p>
<p>Checkout <a href="http://www.ultraapps.com/app_overview.php?app_id=19" rel="nofollow noreferrer">VCalendar</a>, it is open source, and comes in PHP, ASP, and ASP.Net (C#)!</p>
<p>Also you could check out <a href="http... | <p>I think I understand your second paragraph to mean you are considering a second events table that has a row for each occurrence of an event. I would avoid that.</p>
<p>Re-occurring events should have a start date and a stop date (which could be Null for events that continue every X days "forever") You'll have to de... | 3,367 |
<p><code>std::auto_ptr</code> is broken in VC++ 8 (which is what we use at work). My main gripe with it is that it allows <code>auto_ptr<T> x = new T();</code>, which of course leads to horrible crashes, while being simple to do by mistake.</p>
<p>From an <a href="https://stackoverflow.com/questions/106508/what-... | <p>Move to boost smart pointers.</p>
<p>In the meantime, you may want to extract a working auto_ptr implementation from an old / another STL, so you have working code.</p>
<p>I believe that auto_ptr semantics are fundamentally broken - it saves typing, but the interface actually is not simpler: you still have to trac... | <p>Use boost::shared_ptr/boost::scoped_ptr. It will be the preferred smart pointer in upcoming C++ standards (is in TR1 already).</p>
<p>Edit:
Please find a related discussion here: <a href="https://stackoverflow.com/questions/197048/idiomatic-use-of-stdautoptr-or-only-use-sharedptr">Idiomatic use of std::auto_ptr or ... | 33,972 |
<p>I've gone to <a href="http://sourceforge.net/project/showfiles.php?group_id=2435" rel="noreferrer">http://sourceforge.net/project/showfiles.php?group_id=2435</a>, downloaded the Automated MinGW Installer for MinGW 5.1.4 and at the same time the GNU Source-Level Debugger Release Candidate: GDB 6.8-3. I've then instal... | <p>In a command prompt I browsed to C:\MinGW\bin and ran:</p>
<pre><code>mingw-get.exe install gdb
</code></pre>
<p>That fixed it for me. Not sure if it matters but I have C:\MinGW\bin in my path (guess I probably didn't need to browse to C:\MinGW\bin).</p>
| <p>The <a href="http://www.tdragon.net/recentgcc/" rel="nofollow noreferrer">TDM GCC/MinGW32 builds</a> installer includes gdb. It's gcc 4.4.x with all the core binary packages required for basic Windows development, and is widely used without any unusual problems.</p>
| 20,530 |
<p>I have a version resource in my resources in a C++ project which contains version number, copyright and build details. Is there an easy way to access this at run-time to populate my <em>help/about</em> dialog as I am currently maintaining seperate const values of this information. Ideally, the solution should work... | <p>This is an edited version of my original answer.</p>
<pre><code>bool GetProductAndVersion(CStringA & strProductName, CStringA & strProductVersion)
{
// get the filename of the executable containing the version resource
TCHAR szFilename[MAX_PATH + 1] = {0};
if (GetModuleFileName(NULL, szFilename,... | <p>Ok, a bit more googleing found the <a href="http://www.codeguru.com/cpp/w-p/files/fileinformation/article.php/c4481" rel="nofollow noreferrer">following</a> on CodeGuru. Basically this approach uses the <strong>CFileVersionInfo</strong> object to get on any given file. It should be interesting to see if it works o... | 40,885 |
<p>can someone give a scons config file which allows the following structure</p>
<pre><code>toplevel/
/src - .cc files
/include .h files
</code></pre>
<p>at top level I want the o and final exe.</p>
| <p>This question: <a href="https://stackoverflow.com/questions/279860/how-do-i-get-projects-to-place-their-build-output-into-the-same-directory-with">https://stackoverflow.com/questions/279860/...</a>
gives a pretty flexible scons skeleton which should serve your needs with a few tweaks to the path variables.</p>
| <p>This question: <a href="https://stackoverflow.com/questions/279860/how-do-i-get-projects-to-place-their-build-output-into-the-same-directory-with">https://stackoverflow.com/questions/279860/...</a>
gives a pretty flexible scons skeleton which should serve your needs with a few tweaks to the path variables.</p>
| 38,904 |
<p>I think Cacti is great except for the fact that it takes hours to configure it. There is a lot that you can do with it but I find it a little overly complicated. A script collecting disk utilization recently broke on me (for no apparent reason), I spent 3 hours and got no where.</p>
<p>I would like a tool like Cact... | <p>I think this is what I want:</p>
<p><a href="http://collectd.org" rel="nofollow noreferrer">http://collectd.org</a></p>
<p>Collectd in combination with drraw looks like it will fit my needs.</p>
| <p>Unfortunately they are all very time-consuming to learn and configure. You have to spend time to understand all the principles used and read sample configurations.</p>
<p>No short-cuts on this chore :-D</p>
| 34,850 |
<p>What would you recommend for class that needs to keep a list of unique integers?</p>
<p>I'm going to want to Add() integers to the collection and also check for existence e.g. Contains().</p>
<p>Would be nice to also get them in a list as a string for display, ie. "1, 5, 10, 21".</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/bb359438.aspx" rel="nofollow noreferrer">HashSet</a>:</p>
<blockquote>
<p>The <code>HashSet<T></code> class provides high-performance set operations. A set is a collection that contains no duplicate elements, and whose elements are in no particular order...</... | <p>you could inherit a class from KeyedCollection. This way your key can be the value itself, you can override the ToString so that you get your desired output. This could give you the behaviour you want/need.</p>
<p>Note, this answer was for the framework 2.0 part of the Q</p>
| 19,793 |
<p>Is there an effective tool to convert C# code to Java code?</p>
| <p>I have never encountered a C#->Java conversion tool. The syntax would be easy enough, but the frameworks are dramatically different. Even if there were a tool, I would strongly advise against it. I have worked on several "migration" projects, and can't say emphatically enough that while conversion seems like a go... | <p>Why not write it in Haxe (<a href="http://haxe.org/" rel="nofollow noreferrer">http://haxe.org/</a>) and convert it to whatever you want it to be?</p>
| 10,421 |
<p>I need to create a PRIVATE message queue on a remote machine and I have resolved to fact that I can't do this with the .NET Framework in a straight forward manner. I can create a public message queue on a remote machine, but not a PRIVATE one. I can create a message queue (public or private) locally.</p>
<p>I am w... | <p>Yes, queue creation is simple in .NET, however you cannot create a private queue on a remote machine this way.
I have been thinking about adding queue creation to the MSMQ WMI provider for some time... If you need it for a real product / customer, you can contact me and I will consider giving this feature a priority... | <p>A blog post about MSMQ and WMI is here: <a href="http://msmq.spaces.live.com/blog/cns!393534E869CE55B7!210.entry" rel="nofollow noreferrer"><a href="http://msmq.spaces.live.com/blog/cns!393534E869CE55B7!210.entry" rel="nofollow noreferrer">http://msmq.spaces.live.com/blog/cns!393534E869CE55B7!210.entry</a></a></p>
... | 12,847 |
<p>As a second interview I get people to sit down and write code...I try to make the problem really technology independent.</p>
<p>My programming problems that I have don't really exercise peoples OO abilities. I tend to try and keep the coding problem solvable within 2 hours ish. So, I've struggled to find a proble... | <p>This is a problem that I use with some trainings, looks simple but is tricky OOP-wise:</p>
<p>Create model classes that will properly represent the following constructs:</p>
<ol>
<li>Define a Shape object, where the object is any two dimensional figure, and has the following characteristics: a name, a perimeter, a... | <p>I've got a super simple set. The idea is mainly to use them to filter <em>out</em> people who really don't know their stuff rather than filtering <em>in</em> the rock stars.</p>
<p>These are all 5 minute white-board type questions, so they are really not that hard. But the act of writing up code, and talking throug... | 30,495 |
<p>When generating XML from XmlDocument in .NET, a blank <code>xmlns</code> attribute appears the first time an element <em>without</em> an associated namespace is inserted; how can this be prevented?</p>
<p>Example:</p>
<pre><code>XmlDocument xml = new XmlDocument();
xml.AppendChild(xml.CreateElement("root",
"wh... | <p>Thanks to Jeremy Lew's answer and a bit more playing around, I figured out how to remove blank <code>xmlns</code> attributes: pass in the root node's namespace when creating any child node you want <em>not</em> to have a prefix on. Using a namespace without a prefix at the root means that you need to use that same ... | <p>If possible, create a serialization class then do:</p>
<pre><code>XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");
XmlSerializer serializer = new XmlSerializer(yourType);
serializer.Serialize(xmlTextWriter, someObject, ns);
</code></pre>
<p>It's safer, and you can control the namespaces ... | 16,353 |
<p>Seems so basic, I can't believe I don't know this! I just need a scratch folder to dump some temporary files to. I don't care if it gets wiped out between usages or not, and I don't think I should have to go through the hassle of creating one and maintaining it myself from within my application. Is that too much to ... | <p>Use <a href="http://msdn.microsoft.com/en-us/library/system.io.path.gettemppath.aspx" rel="nofollow noreferrer"><code>System.IO.Path.GetTempPath()</code></a>.</p>
| <p>This is for VB.NET</p>
<pre><code>My.Computer.FileSystem.SpecialDirectories.Temp
</code></pre>
<p>not sure if there's similar in C#</p>
| 15,650 |
<p>I have an abstract class defining a pure virtual method in c++:</p>
<pre><code>class Base
{
Base();
~Base();
virtual bool Test() = 0;
};
</code></pre>
<p>I have subclassed this with a number of other classes (which provide an implementation for Test()), which I'll refer to as A, B, C, etc. I now want to create an... | <p>There is only a slight misunderstanding in that code. Instead of allocating Base objects, you have to allocate pointers. A pointer can exist at any time. A pointer to a abstract class, to an incomplete type, and even to void is valid:</p>
<pre><code>int main(int argc, char* argv[])
{
int size = 0;
Base** ba... | <p>First, make sure that your destructor is also declared as virtual:</p>
<pre><code>virtual ~Base();
</code></pre>
<p>You're better off storing a an array of pointers to instances:</p>
<pre><code>Base** bases = new Base *[10];
</code></pre>
| 48,181 |
<p>I've googled the hell out of it, and it seems like there is no way to install gcc on OS X without installing Xcode (which takes at leats 1.5GB of space). All I need is gcc and none of the other junk that comes with Xcode. And at this point, I'll take any other kind of C compiler.</p>
<p>I know I could simply instal... | <p>Try <a href="https://github.com/kennethreitz/osx-gcc-installer" rel="noreferrer">the osx-gcc-installer</a> on github.</p>
| <p>Install the GCC package from the Packages directory in Xcode's disk image and you'll have just GCC. Note that of course you won't have autotools or other standard build tools, for which you will have to install more packages from that folder.</p>
| 14,020 |
<p>Is it possible to look back through the history of a Subversion repository for files of a certain name (even better would be for them to have a wildcard search)?</p>
<p>I want to see if a <code>.bat</code> file has been committed to the repository at some point in the past but has since been removed in later update... | <p>TortoiseSVN can search the logs very easily, and on my system I can enter ".plg" in the search box and find all adds, modifies, and deletes for those files.</p>
<p>Without Tortoise, the only way I can think of doing that would be to grep the full logs or parse the logs and do your own searching for 'A' and 'D' indi... | <p>Personally I'd use</p>
<pre><code>svnadmin dump -r1:HEAD /path/to/repo/
</code></pre>
<p>Pipe it into less and search or grep with some context.</p>
| 4,018 |
<p>I run a small browser MMO, and I have a problem where a couple users are embedding scripts into their profile images, and using them to make attacks against said users, and my game in general. Is there a way to protect against this, or do I need to start blocking people from being able to use their own custom image... | <p>Most likely what is hapening is they are giving you a link to a script that is building the image and returning it on the fly, there is nothing aside from no allowing users to use external images, that you can do about it, one option to prevent it is to download and store the image on your server as opposed to linki... | <p>Some of the most common practices for validating image integrity include checking the <a href="http://en.wikipedia.org/wiki/MIME" rel="nofollow noreferrer">MIME</a> type, or binary reading the first few bytes of an image. Although these are not the best, it's worth a try to fend some of them off.</p>
| 41,755 |
<p>If you throw an exception from inside an MFC dialog, the app hangs, even if you have a catch block in your code. It refuses to respond to the mouse or keyboard, and the only way to shut it down is to use Task Manager.</p>
<h3>Why I'm posting this question</h3>
<p>To my shame, there is a popular shrink-wrapped appl... | <p>The code for CDialog::DoModal makes the dialog modal by disabling the parent window. When the dialog code returns, the window is reenabled. There is an explicit catch for CException* errors, but not for any other kind of thrown exception; thus the parent window never gets reenabled.</p>
<p>Change your code to thr... | <p>Mark's answer is correct. For a much more rigorous analysis of this problem and a detailed suggestion for dealing with it in your own code, see this <a href="https://web.archive.org/web/20110902181726/http://members.cox.net/doug_web/eh.htm" rel="nofollow noreferrer">FAQ by Doug Harrison</a> (section Q6 in particula... | 17,274 |
<p>If I were to want to create a nice looking widget to stay running in the background with a small memory footprint, where would I start building the windows application. It's goal is to keep an updated list of items off of a web service. Similar to an RSS reader.</p>
<p>note: The data layer will be connecting throu... | <p>re:</p>
<blockquote>
<p>Update: Clarification The above sizes,
are the memory being used as the
process is ran, not the executable.</p>
</blockquote>
<p>Okay, when you run a tiny C# Win Forms app, the smallest amount of RAM that is reserved for it is around 2 meg, maybe 4 meg. This is just a working set tha... | <p>If you "already have a C# dll" you're intending to use then there must be .net already installed on the target machine.</p>
<p>In that case, a C# win forms app need not be anywhere near 20 meg. The smallest hello world type win form would be 7 kilobytes.</p>
| 10,470 |
<p>So I have some files I want to ignore in a subversion repository, but I don't want my ignore patterns for this to be propagated to the repository.</p>
<p>In other words, I added some private files in my checkout that I want to keep, but they only exist for me and wouldn't make sense to be ignored for everyone, so i... | <p>Subversion <strong>does</strong> have a <a href="http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.advanced.props.special.ignore" rel="nofollow noreferrer">per-user, global ignore setting</a>, which sounds like what you want. Look in your <code>.subversion</code> directory (found in your <em>home</em> directory) ... | <p>I'm confused about 2 things:</p>
<ul>
<li>why do you have files that you don't want to check in that other people <em>might</em> want to check in? seems like you'd get a conflict if that happened anyway</li>
<li>does just "ignoring" in the human sense not work for you?</li>
</ul>
<p>I'm just having trouble seeing... | 7,565 |
<p>In vi[m] there is the <a href="http://www.softpanorama.org/Editors/Vimorama/vim_piping.shtml" rel="noreferrer"><code>!</code> command which lets me pipe text</a> through a shell command -- like sort or indent -- and get the filtered text back into the buffer. Is there an equivalent in emacs?</p>
| <p>You can select a region and type `C-u M-| command RET', and it replaces the region with the command output in the same buffer due to the interactive prefix argument of shell-command-on-region. </p>
| <p><strong>Late edit</strong>: As much as I appreciate the upvotes, Jurta's answer is the way to go. And Greg's hack is neater than mine.</p>
<p>I'll leave the rest of this here because it might be worth something, but...</p>
<hr>
<p><strong><code>M-x shell-command-on-region</code></strong>, which appears to be boun... | 25,343 |
<p>I have a C# app which uses a System.Diagnostics.Process to run another exe. I ran into some example code where the process is started in a try block and closed in a finally block. I also saw example code where the process is not closed.</p>
<p>What happens when the process is not closed? </p>
<p>Are the resourc... | <p>When the other process <em>exits</em>, all of <em>its</em> resources are freed up, but you will still be holding onto a process handle (which is a pointer to a block of information about the process) unless you call <code>Close()</code> on your <code>Process</code> reference. I doubt there would be much of an issue,... | <p>They will continue to run as if you started them yourself.</p>
| 22,411 |
<p>I am writing a software synthesizer and need to generate bandlimited, alias free waveforms in real time at 44.1 kHz samplerate. Sawtooth waveform would do for now, since I can generate a pulse wave by mixing two sawtooths together, one inverted and phase shifted.</p>
<p>So far I've tried the following approaches:</... | <p>There are a lot of ways to approach the bandlimited waveform generation. You will end up trading computational cost against quality as usual.</p>
<p>I suggest that you take a look at this site here:</p>
<p><a href="http://www.musicdsp.org/" rel="noreferrer">http://www.musicdsp.org/</a></p>
<p>Check out the archiv... | <p>The DC offset from a blit - can be reduced with a simple High Pass Filter! - much like a real analogue circuit where they use a DC blocking cap!</p>
| 21,138 |
<p>When over freeing a pointer you may see an error such as</p>
<p>"pointer being freed was not allocated"</p>
<p>When debugging with the simulator, I add a build argument MallocStackLogging = YES - this allows me to use malloc_history in the terminal to track down where I have over freed a pointer.</p>
<p>If I debu... | <p>Another way to do this. Make sure to turn NSZombie on so it reports the memory address of the object that is getting the extra release. Then Run with Performance Tool->Object Allocations. This will bring up instruments. Look at the Console log as provided by Xcode organizer. Once you get the crash lookup the memory ... | <p>You need to set the MallocStackLogging env variables on the target executable...</p>
<p>To access these settings, select your executable from the Groups & Files pane in XCode, then Get Info.</p>
<p>Go to the Arguments tab and add the following entries into the “Variables to be set in the environment” box:</p>
| 37,817 |
<p>I'm using JMX to save some diagnostic information from a remote process. Looking at the interface in jconsole shows that the return type is <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/openmbean/CompositeData.html" rel="noreferrer">CompositeData</a> (the data actually comes back as <a href="http... | <p>If I'm not mistaken you could do</p>
<pre><code>Set< String > keys = cData.getCompositeType().keySet();
</code></pre>
<p>(given that cData is a CompositeData object)</p>
<p><a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/openmbean/CompositeType.html#keySet()" rel="noreferrer">http://java.s... | <p>You can find a more complete example with this <a href="http://blogs.oracle.com/jmxetc/entry/a_small_program_that_prints" rel="nofollow noreferrer">small program that prints the attributes of all JVM MBeans</a></p>
<p>In particular:</p>
<pre><code>StringBuffer writeCompositeData(StringBuffer buffer,
S... | 34,109 |
<p>I've been using Git on Windows (msysgit) to track changes for some design work I've been doing.</p>
<p>Today I've been working on a different PC (with remote repo <code>brian</code>) and I'm now trying to merge the edits done today back into my regular local version on my laptop.</p>
<p>On my laptop, I've used <co... | <p><code>git checkout</code> accepts an <code>--ours</code> or <code>--theirs</code> option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging in, you can do:</p>
<pre><code>$ git checkout --theirs -- path/to/conflicted-file.txt
</code></pre>
<p>t... | <p>I use Git Workflow for Excel - <a href="https://www.xltrail.com/blog/git-workflow-for-excel" rel="nofollow noreferrer">https://www.xltrail.com/blog/git-workflow-for-excel</a> application to resolve most of my binary files related merge issues. This open-source app helps me to resolve issues productively without spen... | 35,107 |
<p>I have an existing web app that allows users to "rate" items based on their difficulty. (0 through 15). Currently, I'm simply taking the average of each user's opinion and presenting the average straight from MySQL. However, it's becoming clear to me (and my users) that weighting the numbers would be more appropr... | <p>This is a simple example about how to do it in MySQL directly. You of course would need to add a condition on the subquery to get only the votes for the relevant item instead of all the votes.</p>
<pre>
mysql> create table votes( vote int);
Query OK, 0 rows affected (0.01 sec)
mysql> insert into votes values (5),... | <p>What made it clear that weighting would be more appropriate? What are you seeing in an arithmetic mean that isn't helpful to you? I'm curious because it seems like the answer you are seeking might not necessarily meet your needs the best. (Also, a 16-point scale is typically much larger than what most people need; p... | 35,605 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.