instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm a new one for this community.
This also not directly related with 3D printing.
I searched about this and I couldn't find good answer.</p>
<p>One of my friends told me CNC machining centers (Milling) mostly use servo motors and CNC laser cutter and plasma cutters use stepper motors mostly.</p>
<p>Position contr... | <p>Servos do have several advantages; but, they are more expensive and more difficult to control.</p>
<p>Generally, a servo motor is a DC motor but with an encoder to provide position feedback. A circuit (can be a computer) then compares the actual position (from the encoder) against the commanded position and uses t... | <p>Servo for spindle to control rotation speed of cutting bit.
Stepper to control movement and tool position.
All CNC machines.</p>
| 610 |
<p>I have set up a simple web page for a family member and now they want to be able to edit the page themselves.</p>
<p>My primary web authoring tool is gvim which is obviously out of the question for a non techie.</p>
<p>Does anyone have any recomendations for a simple effective WYSWYG html editor</p>
<p>There are ... | <p>KompoZer (<a href="http://kompozer.net/" rel="nofollow noreferrer">http://kompozer.net/</a>), free, useful and simple.</p>
| <p>Microsoft Word! Save as HTML ;)</p>
| 41,480 |
<p>I was given an .xml file that I needed to read into my code as a DataSet (as background, the file was created by creating a <code>DataSet</code> in C# and calling <code>dataSet.WriteXml(file, XmlWriteMode.IgnoreSchema)</code>, but this was done by someone else). </p>
<p>The .xml file was shaped like this:</p>
<pre... | <p>This appears to be correct for your <em>nested</em> Foo tags:</p>
<pre><code><NewDataSet>
<Foo> <!-- Foo-Id: 0 -->
<Bar>abcd</Bar>
<Foo>efg</Foo> <!-- Foo-Id: 1, Parent-Id: 0 -->
</Foo>
<Foo> <!-- Foo-Id: 2 --... | <p>These are my observations rather than a full answer:</p>
<p>My guess (without trying to re-produce it myself) is that a couple of things may be happening as the DataSet tries to 'flatten' a hierarchical structure to a relational data structure.</p>
<p>1) thinking about the data from a relational database perspecti... | 7,493 |
<p>I am using mssql and am having trouble using a subquery. The real query is quite complicated, but it has the same structure as this:</p>
<pre><code>select
customerName,
customerId,
(
select count(*)
from Purchases
where Purchases.customerId=customerData.customerId
) as numberTransactions
fro... | <p>use the field number, in this case:</p>
<pre><code>order by 3
</code></pre>
| <p>You need to duplicate your logic. SQL Server isn't very smart at columns that you've named but aren't part of the dataset in your FROM statement.</p>
<p>So use</p>
<pre><code>select
customerName,
customerId,
(
select count(*)
from Purchases p
where p.customerId = c.customerId
) as numberTran... | 11,528 |
<p>How do I enumerate the properties of a JavaScript object?</p>
<p>I actually want to list all the defined variables and their values, but I've learned that defining a variable actually creates a property of the window object.</p>
| <p>Simple enough:</p>
<pre><code>for(var propertyName in myObject) {
// propertyName is what you want
// you can get the value like this: myObject[propertyName]
}
</code></pre>
<p>Now, you will not get private variables this way because they are not available.</p>
<hr>
<p>EDIT: <a href="https://stackoverflow.... | <p>I'm still a beginner in JavaScript, but I wrote a small function to recursively print all the properties of an object and its children:</p>
<pre><code>getDescription(object, tabs) {
var str = "{\n";
for (var x in object) {
str += Array(tabs + 2).join("\t") + x + ": ";
if (typeof object[x] === 'objec... | 11,145 |
<p>I have been searching for a simple way to convert a dataset from a <a href="http://en.wikipedia.org/wiki/PostgreSQL" rel="nofollow noreferrer">PostgreSQL</a> database to JSON for use in a project that I am building.</p>
<p>This is my first time using JSON, and I have found it really tricky to find a simple way of d... | <p>Use Newtonsofts <a href="http://james.newtonking.com/pages/json-net.aspx" rel="nofollow noreferrer">Json.Net</a> and check out <em><a href="http://www.west-wind.com/Weblog/posts/471835.aspx" rel="nofollow noreferrer">DataTable JSON Serialization in JSON.NET and JavaScriptSerializer</a></em> where it's used to create... | <p>Maybe you've heard about the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.aspx" rel="nofollow noreferrer">system.runtime.serialization.json</a> namespace in the newly announced <a href="http://www.microsoft.com/net/dublin.aspx" rel="nofollow noreferrer"><em>.NET Framework 4.0</e... | 46,385 |
<p>How do i check in C++ if a file is a regular file (and is not a directory, a pipe, etc.)? I need a function isFile(). </p>
<pre><code>DIR *dp;
struct dirent *dirp;
while ((dirp = readdir(dp)) != NULL) {
if ( isFile(dirp)) {
cout << "IS A FILE!" << endl;
i++;
}
</code></pre>
<p>I've tried comparin... | <p>You can use the portable <a href="http://www.boost.org/doc/libs/1_31_0/libs/filesystem/doc/index.htm" rel="nofollow noreferrer"><code>boost::filesystem</code></a> (The standard C++ library could not have done this up until recent introduction of <a href="http://en.cppreference.com/w/cpp/filesystem/is_regular_file" r... | <p>Thank you all for the help, i've tried with </p>
<pre><code>while ((dirp = readdir(dp)) != NULL) {
if (!S_ISDIR(dirp->d_type)) {
...
i++;
}
}
</code></pre>
<p>And it works fine. =)</p>
| 42,621 |
<p>We upgraded our machines with a microsoft patch listed above and are now having issues with some winsock controls. While moving on to the new component library there were two issues that we faced: </p>
<ul>
<li>We are creating a Winsock control dynamically using Form.Controls.Add(...). With the new dlls it gave us... | <p>Take a look at "Description of the cumulative update rollup for the Visual Basic 6.0 Service Pack 6 Runtime Extended Files."</p>
<p><a href="http://support.microsoft.com/kb/957924/" rel="nofollow noreferrer">http://support.microsoft.com/kb/957924/</a></p>
<p>This December 30, 2008 update should remove and replace ... | <p>Since the interface signatures have changed, you will have to remove the component reference from the project, save and close VB6 completely, unregister the old control, register the new version from the patch, reopen your project and add the component back in. If you do this you'll most likely lose support for mac... | 49,285 |
<p>I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file permissions as the c... | <p>Kyle, in order for PDO/Sqlite to work you need write permission to directory where your database resides.</p>
<p>Also, I see you perform multiple selects in loop. This may be ok if you are building something small and not heavy loaded. Otherwise I'd suggest building single query that returns multiple rows and proce... | <p>@Tom
Depends on how the hosting is setup, If the server runs PHP as an Apache Module then its likely that it is 'nobody' (usually whatever user apache is setup as). But if PHP is setup as cgi (such as fast-cgi) and the server runs SuExec then php runs as the same user who owns the files. </p>
<p>Eitherway the folde... | 8,620 |
<p>While incremental linking addresses much of the time spent linking, even for very large projects, I find the incremental linker in MSVS to be pretty haphazard. (I'm currently using 2003 atm, would love to hear if 2005/8 addressed any of this.) My list of known triggers include:</p>
<ul>
<li>changing anything exte... | <p>Minimizing the number of projects in your solution makes the problem a little better. And of course all the normal build speed-ups will work, like reducing includes and shrinking obj files size.</p>
| <p>I'm using 2008; and while I have only used it for small->medium sized projects, so far I haven't experienced any unexpected full links. </p>
<p>I haven't used 03, but in my opinion 08 seems to be far better then 05.</p>
| 11,227 |
<p><a href="http://en.wikipedia.org/wiki/Project_Darkstar" rel="nofollow noreferrer">Project Darkstar</a> was the topic of the monthly <a href="http://www.javasig.com/meeting/home.xhtml" rel="nofollow noreferrer">JavaSIG</a> meeting down at the Google offices in NYC last night. For those that don't know (probably ever... | <p><strong>Edit: This was written before Oracle bought Sun and started a rampage to kill everything that does not make them a billion $ per day. See the comments for an OSS Fork.</strong> <em>I still stand by my opinion that stuff like that (MMO Middleware) is realistic, you just need a company that doesn't suck behind... | <p>I don't work in the games industry, but it sounds to me like this will do the same thing for video games as the Quake and Half-Life engines did. That is they will promote getting young developers interested in the industry and promote development of indie games. </p>
<p>From what I can tell, video game companies do... | 4,036 |
<p>What is the best way for converting phone numbers into international format (E.164) using Java?</p>
<p>Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number.</p>
<p>I am sure I can do it by hand quite easily - but... | <p>Google provides a library for working with phone numbers. The same one they use for Android</p>
<p><a href="http://code.google.com/p/libphonenumber/">http://code.google.com/p/libphonenumber/</a></p>
<pre><code>String swissNumberStr = "044 668 18 00"
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
try {... | <p>In some countries you can validate 112 as a valid phone number, but if you stick a country code in front of it it won't be valid any more. In other countries you can't validate 112 but you can validate 911 as a valid phone number.</p>
<p>I've seen some phones that put Q on the 7 key and Z on the 9 key. I've seen ... | 22,671 |
<p>I am testing against the following test document:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
... | <p>The problem is the namespaces. When parsed as XML, the img tag is in the <a href="http://www.w3.org/1999/xhtml" rel="noreferrer">http://www.w3.org/1999/xhtml</a> namespace since that is the default namespace for the element. You are asking for the img tag in no namespace.</p>
<p>Try this:</p>
<pre><code>>>... | <p>If you are going to use tags from a single namespace only, as I see it the case above, you are much better off using lxml.objectify.</p>
<p>In your case it would be like</p>
<pre><code>from lxml import objectify
root = objectify.parse(url) #also available: fromstring
</code></pre>
<p>You can access the nodes as</... | 38,025 |
<p>I know there is a <code>WeakHashMap</code> in <code>java.util</code>, but since it uses <code>WeakReference</code>s for everything, which is only referenced by this <code>Map</code>, referenced objects will get lost on the next GC cycle. So it's nearly useless if you want to cache random data, which is very likely t... | <p>Edit (Aug. 2012):</p>
<p>It turns out that currently the best solution are probably Guava 13.0's <code>Cache</code> classes, explained on <a href="https://github.com/google/guava/wiki/CachesExplained" rel="nofollow noreferrer">Guava's Wiki</a> - that's what I'm going to use.
It even supports building a <code>SoftHas... | <p>If you want to implement a cache softreferences are definetly a better idea than weak references, but it puts your entire cache removal policy in the hands of the garbage collector. which is probably not what you want.</p>
<p>If cache removal policy is important your are going to need to do it on your own most lik... | 33,146 |
<p>I am working on a project that requires a number of icons generated from a set of source images. I have a script that generates all the required images with judicious use of <a href="http://www.imagemagick.org/script/index.php" rel="nofollow noreferrer">ImageMagick</a>, although I have not found a suitable tool to ... | <p>Since GConvert won't work for you, perhaps this will be more useful:</p>
<h3><a href="http://www.heaventools.com/command-line_resource_editor.htm" rel="nofollow noreferrer">Resource Tuner Console</a></h3>
<blockquote>
<p>Resource Tuner Console is an efficient and highly customizable script driven
resource editor wit... | <p>Not sure if this will fit the bill, but the description says it supports "batch" operations so you should be able to automate the process.</p>
<h3><a href="http://www.gdgsoft.com/gconvert/" rel="nofollow noreferrer">GConvert</a></h3>
<blockquote>
<p>GConvert is a full-featured icon toolkit that lets you ex... | 21,269 |
<p>If I want to display an underlined value in a TextBlock, I have to use a Run element. (If there's a better/easier way, I'd love to hear about it.)</p>
<pre><code><TextBlock>
<Run TextDecorations="Underline" Text="MyText" />
</TextBlock>
</code></pre>
<p>Ideally, to implement this within a DataT... | <p>TextDecoration is an attached property so it can be applied to the TextBlock also. You create some pretty cool effects by templating the TextDecorations property.</p>
<p>See this <a href="http://msdn.microsoft.com/en-us/library/system.windows.textdecorations.underline.aspx" rel="nofollow noreferrer">MSDN article</... | <p>This works for me:</p>
<pre><code><TextBlock Text="MyText" TextDecorations="Underline" />
</code></pre>
| 46,937 |
<p>How to declare a static dictionary object inside a static class? I tried</p>
<pre><code>public static class ErrorCode
{
public const IDictionary<string, string> ErrorCodeDic = new Dictionary<string, string>()
{
{ "1", "User name or password problem" }
};
}
</code></pre>
<p>But ... | <p>If you want to declare the dictionary once and never change it then declare it as readonly:</p>
<pre><code>private static readonly Dictionary<string, string> ErrorCodes
= new Dictionary<string, string>
{
{ "1", "Error One" },
{ "2", "Error Two" }
};
</code></pre>
<p>If you want to dictionar... | <pre><code>public static class ErrorCode
{
public const IDictionary<string , string > m_ErrorCodeDic;
public static ErrorCode()
{
m_ErrorCodeDic = new Dictionary<string, string>()
{ {"1","User name or password problem"} };
}
}
</code></pre>
<p>Probably initi... | 40,390 |
<p>I need a way to allow each letter of a word to rotate through 3 different colors. I know of some not so clean ways I can do this with asp.NET, but I'm wondering if there might be a cleaner CSS/JavaScript solution that is more search engine friendly.</p>
<p>The designer is including <a href="http://stlartworks.effic... | <p>Here is some JavaScript.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var message = "The quick brown fox.";
var colors = new Array("#ff0000","#00ff00","#0000ff"); // ... | <blockquote>
<p>I'd rather not have to manually generate an image for every page </p>
</blockquote>
<p>Then generate the image automatically.</p>
<p>You don't specify which server-side technology you're using, but any good one will allow you to manipulate images (or at least call an external image utility)</p>
<p>... | 18,819 |
<p>Does anyone know of a web site where I can find a list of 32-bit MIPS instructions/opcodes, with the following features:</p>
<ul>
<li>Clearly distinguishes between real opcodes and assembly-language macros (pseudo-instructions)</li>
<li>Describes the instruction behavior including differences depending on privilege ... | <p>I can only partially answer the question: I'd recommend <A href="https://rads.stackoverflow.com/amzn/click/com/0120884216" rel="nofollow noreferrer" rel="nofollow noreferrer">See MIPS Run</A> by Dominic Sweetman, if you're not already referring to it. I have the first edition of the book, the second edition is now c... | <p>This <a href="https://web.archive.org/web/20201111203150/http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html" rel="nofollow noreferrer">web site (archive.org)</a> describes most of the MIPS instruction set and their encoding. It's not complete, though: missing at least <code>nor</code> and maybe other thin... | 16,452 |
<p>I am using Tomcat as a server and Internet Explorer 6 as a browser. A web page in our app has about 75 images. We are using SSL. It seems to be very slow at loading all the content. How can I configure Tomcat so that IE caches the images?</p>
| <p>If you are serving a page over https then you'll need to serve all the included static or dynamic resources over https (either from the same domain, or another domain, also over https) to avoid a security warning in the browser.</p>
<p>Content delivered over a secure channel will not be written to disk by default b... | <p>Content served over a HTTPS connection <strong>never gets cached</strong> in the browser. You cannot do much about it. </p>
<p>Usually, images in your web site are not very sensitive and are served over HTTP for this very reason.</p>
| 9,797 |
<p>The Mutex class is very misunderstood, and Global mutexes even more so.</p>
<p>What is good, safe pattern to use when creating Global mutexes?</p>
<p>One that will work</p>
<ul>
<li>Regardless of the locale my machine is in</li>
<li>Is guaranteed to release the mutex properly</li>
<li>Optionally does not hang for... | <p>I want to make sure this is out there, because it's so hard to get right:</p>
<pre><code>using System.Runtime.InteropServices; //GuidAttribute
using System.Reflection; //Assembly
using System.Threading; //Mutex
using System.Security.AccessControl; //MutexAccessRule
using System.S... | <p>A global Mutex is not only to ensure to have only one instance of an application. I personally prefer using Microsoft.VisualBasic to ensure single instance application like described in <a href="https://stackoverflow.com/questions/19147/what-is-the-correct-way-to-create-a-single-instance-wpf-application">What is the... | 28,415 |
<p>For my current C++ project I need to detect a unique string for every monitor that is connected and active on a large number of computers. </p>
<p>Research has pointed to 2 options</p>
<ol>
<li><p>Use WMI and query the Win32_DesktopMonitor for all active monitors. Use the PNPDeviceID for unique identification of m... | <p>This is my current work-in-progress code for detecting the monitor device id, reliably. </p>
<pre><code>CString DeviceID;
DISPLAY_DEVICE dd;
dd.cb = sizeof(dd);
DWORD dev = 0;
// device index
int id = 1;
// monitor number, as used by Display Properties > Settings
while (EnumDisplayDevices(0, dev, &dd, ... | <p>I've never tried doing it from a service, but <code>EnumDisplayDevices</code> generally works well when run as a user. I believe that services run in a separate (and headless) session, which could explain the problem you're seeing there.</p>
<p>Could you run a helper program from your service, impersonating a user ... | 21,848 |
<p>Recently I have been doing more complicated math in OpenSCAD and I have run into something that I find strange. Take a simple math expression: <code>2 / 2 / 2</code>. By any programming language this will equal 0.5 (1/2), and OpenSCAD agrees. Something like this: <code>2 / -2 / 2</code> should also be -0.5 for the s... | <p>I suspect the behavior you are seeing is an undocumented feature (aka, bug) of OpenSCAD. I've found in the latest stable release that if the - is placed on either end, the result is -0.5, but in the middle, my results are the same as yours. Surrounding the -2 with parentheses results in a correct answer, however.</p... | <p>I <a href="https://github.com/openscad/openscad/issues/2894" rel="nofollow noreferrer">filed this issue as a bug with the OpenSCAD project</a>, and there is now <a href="https://github.com/openscad/openscad/pull/2895" rel="nofollow noreferrer">a fix merged into master</a>, as well as a test case to prevent regressio... | 1,257 |
<p>I'm looking into clustering points on a map (latitude/longitude). Are there any recommendations as to a suitable algorithm that is fast and scalable?</p>
<p>More specifically, I have a series of latitude/longitude coordinates and a map viewport. I'm trying to cluster the points that are close together in order to r... | <p>For a virtual earth application I've used the clustering described
<a href="https://web.archive.org/web/20130410092213/http://www.soulsolutions.com.au/Articles/ClusteringVirtualEarthPart1.aspx" rel="nofollow noreferrer">here</a>. It's lightning fast and easily extensible.</p>
| <p>I looked at various libraries and found them so complex couldn't understand a word so I decided to make my own clustering algorithm</p>
<p>Here goes my code in Java</p>
<pre><code>static int OFFSET = 268435456;
static double RADIUS = 85445659.4471;
static double pi = 3.1444;
public static double lonToX(do... | 9,963 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/324311/symbolic-simplification-in-haskell-using-recursion">Symbolic simplification in Haskell (using recursion?)</a> </p>
</blockquote>
<p>The simplifications I have in mind are</p>
<pre><code>0*e = e*0 = 0
1*... | <p>Well, can't you apply pattern matching to the individual cases?</p>
<pre><code>simplify (Plus (Const 0) (Expr x)) = simplify (Expr x)
simplify (Plus (Expr x) (Const 0)) = simplify (Expr x)
simplify (Mult (Const 0) _) = Const 0
simplify (Mult _ (Const 0)) = Const 0
– … and so on
</code></pre>
<p>EDIT: Yes, of cours... | <p>I don't know much about haskell, but essentially your are going to want to do an expression tree traversal.</p>
<p>the tree is
EXP: (operator) (EXP) (EXP)
EXP: (const)
EXP: (var)</p>
<p>then your simplify becomes
heres the psuedo code</p>
<pre><code>simplify(Exp e)
if (e is const) return e
else if (e is var) ret... | 42,012 |
<p>I've recently come across a problem which requires at least a basic degree of image processing, can I do this in Python, and if so, with what?</p>
| <p>The best-known library is <a href="http://effbot.org/zone/pil-index.htm" rel="noreferrer">PIL</a>. However if you are simply doing basic manipulation, you are probably better off with the Python bindings for <a href="http://wiki.python.org/moin/ImageMagick" rel="noreferrer">ImageMagick</a>, which will be a good dea... | <p>If you are creating a custom image processing effect, you may find PythonPixels useful.
<a href="http://halfhourhacks.blogspot.com/2008/03/pythonpixels.html" rel="nofollow noreferrer">http://halfhourhacks.blogspot.com/2008/03/pythonpixels.html</a>
It is intended for writing and experimenting with image processing.</... | 12,046 |
<p>F# is derived from OCaml, but what major items are missing or added? Specifically I'm curious as to whether the resources available for learning OCaml are also useful to someone who wants to learn F#.</p>
| <p>The main differences are that F# does not support:</p>
<ul>
<li>functors</li>
<li>OCaml-style objects</li>
<li>polymorphic variants</li>
<li>the camlp4/5 preprocessor or extension points (ppx)</li>
</ul>
<p>In addition, F# has a different syntax for labeled and optional parameters.</p>
<p>In theory, OCaml program... | <p>F# supports OCaml syntax directly. It might not be 100% compatible, but I think it's pretty close.</p>
<p><a href="http://plus.kaist.ac.kr/~shoh/fsharp/html/index.html" rel="nofollow noreferrer">http://plus.kaist.ac.kr/~shoh/fsharp/html/index.html</a></p>
<p>Here is a list of differences (not sure how up-to-date ... | 21,648 |
<p>When designing business objects I have tried several different methods of writing the data access layer. Some have worked out better than others but I have always felt there must be a "better" way. </p>
<p>I would really just like to see the different ways people have handled the DAL in different situations and th... | <p>Unfortunately I don't think there is a "better way", it's too dependent on the specific situation as to what DAL approach you use.
A great discussion of the "state of the art" is <a href="https://rads.stackoverflow.com/amzn/click/com/0321127420" rel="nofollow noreferrer" rel="nofollow noreferrer">Patterns of Enterpr... | <p>There are several common patterns. <a href="https://rads.stackoverflow.com/amzn/click/com/0321127420" rel="nofollow noreferrer" rel="nofollow noreferrer">'The patterns of enterprise architecture'</a> book is a good reference for these:</p>
<ul>
<li>Table Data Gateway </li>
<li>Row Data Gateway</li>
<li>Active Recor... | 21,471 |
<p>Is it possible to pass a function/callback from javascript to a java applet?</p>
<p>For example i have an applet with a button that when pressed it will call the passed js callback</p>
<pre><code>function onCommand() {
alert('Button pressed from applet');
}
applet.onCommand(onCommand);
</code></pre>
| <p>I tend to use something I derived from the reflection example at the bottom of <a href="http://www.rgagnon.com/javadetails/java-0172.html" rel="nofollow noreferrer">this page</a>, as then you don't need to meddle with your classpath to get it to compile</p>
<p>Then I just pass JSON strings around between the applet... | <p>You can use <a href="http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/java_js.html" rel="nofollow noreferrer">JSObject</a> to call back into javascript from Java.</p>
<p>From that page:</p>
<pre><code>import netscape.javascript.*;
import java.applet.*;
import java.awt.*;
class MyApplet extends Appl... | 15,402 |
<p>I have an application which allows for multiple NSDocuments to be open. In this application is a single utility window that contains some functionality that I want to apply to the frontmost document.</p>
<p>I am trying to use bindings here, so the trick is how to cleanly bind the user interface of the utility wind... | <p>I’ve always bound through Shared Application, <code>mainWindow.document</code>, which works fine. if you have windows w/o documents, you may want to add a <code>mainYourKindOfWindow</code> key that is implemented by watching <code>mainWindow</code> and updating the value based on some filter criteria.</p>
| <blockquote>
<ul>
<li>put an object controller in my nib for the shared window. When a document window changes frontmost status, change the content of that binding.</li>
</ul>
</blockquote>
<p>That makes the most sense to me. You'd change the content to the document instance (<code>[NSDocumentController currentD... | 27,663 |
<p>Does anybody know if there is a color theme like the TextMate Dawn theme, for Emacs ? I simply don't like the way the fonts look on my dark emacs theme and I am not sure if it's emacs's fault or just the theme.</p>
<p>Here's a comparison:</p>
<p><a href="http://mixandgo.com/emacs_textmate.png" rel="nofollow norefe... | <p>Um, why do you have a dark Emacs?</p>
<p>Do <code>M-x color-theme-select</code> (maybe you'll need to install <code>color-theme</code> first: do <code>sudo apt-get install emacs-goodies-el</code> or see <a href="http://www.emacswiki.org/cgi-bin/wiki?ColorTheme" rel="noreferrer">Emacswiki page</a>), and pick a ligh... | <p>After installing color-theme for Emacs:</p>
<p><a href="http://www.emacswiki.org/emacs/ColorTheme" rel="nofollow noreferrer">http://www.emacswiki.org/emacs/ColorTheme</a></p>
<p>You can download this theme which is similar to the TextMate color scheme:</p>
<p><a href="http://blog.jdhuntington.com/2008/11/emacs-co... | 48,730 |
<p>Is there any free set of forms, icons, styles, images, etc for building web-based admin interfaces? If yes, which is the best?</p>
| <p>A particularly common choice is <a href="http://www.famfamfam.com/lab/icons/silk/" rel="noreferrer">Silk</a>. It's a very comprehensive free set. There's also the <a href="http://damieng.com/creative/icons/silk-companion-1-icons" rel="noreferrer">Silk Companion 1</a>.</p>
| <p><a href="http://www.iconspedia.com/" rel="nofollow noreferrer">http://www.iconspedia.com/</a></p>
| 17,550 |
<p>I want to use implicit linking in my project , and nmake really wants a .def file . The problem is , that this is a class , and I don't know what to write in the exports section .
Could anyone point me in the right direction ?</p>
<p>The error message is the following :</p>
<p><strong>NMAKE : U1073: don't know ho... | <p>If I recall correctly, you can use <code>__declspec(dllexport)</code> on the <em>class</em>, and VC++ will automatically create exports for all the symbols related to the class (constructors/destructor, methods, vtable, typeinfo, etc).</p>
<p>Microsoft has more information on this <a href="http://msdn.microsoft.com... | <p>The solution is the following :</p>
<ul>
<li><p>since a class is exported,you also need to add the exported methods in the .def file</p></li>
<li><p>I didn't find out how to export a constructor , so I went with using a factory method ( static ) , which will return new instances of an object</p></li>
<li><p>the oth... | 22,533 |
<p>I really like the interface for Yahoo Pipes (<a href="http://pipes.yahoo.com/pipes/" rel="noreferrer">http://pipes.yahoo.com/pipes/</a>) and would like to create a similar interface for a different problem. Are there any libraries that would allow me to create an interface with the same basic look and feel? </p>
<p... | <p>WireIt is an open-source javascript library to create web wirable interfaces like Yahoo! Pipes for dataflow applications, visual programming languages or graphical modeling. Wireit uses the YUI library (2.6.0) for DOM and events manipulation, and excanvas for IE support of the canvas tag. It currently supports Firef... | <p>You didn't mention the platform you're developing for, but if it's to be placed on an interactive website, you'd probably save time by doing it in Flash. Check out how to make draggable objects first (Google helps you here), then it's easy to connect them with lines or curves any way you like.</p>
| 11,185 |
<p>How can you beta test an iPhone app? I can get it on my own device, and anyone that gives me a device, I can run it on theirs, but is there a way to do a limited release via the app store for beta testing?</p>
<p>Related: Also, see <a href="https://stackoverflow.com/questions/37464/iphone-app-minus-app-store">this... | <h1>Creating ad-hoc distribution profiles</h1>
<p>The <a href="http://developer.apple.com/library/mac/#documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html" rel="noreferrer">instructions that Apple provides are here</a>, but here is how I created a general provisioning profile th... | <p><em>(As the official guide is still missing in this thread..)</em></p>
<p><a href="https://developer.apple.com/app-store/testflight/" rel="nofollow">TestFlight</a>, acquired by Apple and now (iOS8+) available for beta testing makes it easy to hand your app to beta testers without the need to collect device UUIDs be... | 6,138 |
<p>Is Oracle Application Express suitable for Intranet client/server application?
If so, what should I do to enable client access to application?</p>
<hr>
<p>Well, I am working as a PowerBuilder/Oracle developer, so I am familiar with client/server architecture. I have recently read an article about APEX so I would l... | <p><em>"since there would be nothing like http:/www.appdomain.com"</em>
Given you are familiar with client/server technology, I guess you know about TNSNAMES.ORA</p>
<p>Your Apex host would be defined in a similar manner to the way the database host is defined in tnsnames.ora
If your tnsnames.ora says that your databa... | <p>Application Express applications are accessed via a URL in a browser, with a URL something like:</p>
<pre><code>http://www.mydomain.com/pls/mydad/f?p=MYAPP
</code></pre>
<p>A client/server application would have to launch a browser window and pass in the appropriate URL.</p>
| 20,986 |
<p>Do I really have to learn Objective-C to develop solid Mac Apps?</p>
<p>As Mac users tend to use only applications that have a nice (native) GUI, i don't think that Mono and GTK+ or any Java GUI (Swing) will fit their needs.</p>
<p>There are projects like Cocoa#, PyObjC and RubyCocoa, but are they ready for primet... | <p>Objective-C <em>is</em> a dynamic language, as far as the Objective-C parts go. Here's a little summary article: <a href="http://www.macdevcenter.com/pub/a/mac/2003/04/28/objective-c.html" rel="noreferrer">http://www.macdevcenter.com/pub/a/mac/2003/04/28/objective-c.html</a></p>
<p>The syntax is scary at first, b... | <p>In general yes; but even if you (correctly IMHO) ruled out Mono, GTK and SWING because they don't fit well in the GUI, try Qt. it's <em>REALLY</em> respectful of Mac GUI standards (HIG: Human Interface Guidelines), and can be equally programmed on C++, Python and Java. the last version is cocoa-based and 64-bit ca... | 34,328 |
<p>By default (using the <code>plain</code> style) BibTeX orders citations alphabetically. </p>
<p>How to order the citations by order of appearance in the document?</p>
| <p>There are three good answers to this question.</p>
<ul>
<li>Use the <code>unsrt</code> bibliography style, if you're happy with its formatting otherwise</li>
<li>Use the <code>makebst</code> <a href="http://www.ctan.org/tex-archive/macros/latex/contrib/custom-bib/" rel="noreferrer">(link)</a> tool to design your own... | <p>The <a href="http://ctan.org/pkg/datatool" rel="nofollow">datatool</a> package offers a nice way to sort bibliography by an arbitrary criterion, by converting it first into some database format.</p>
<p>Short example, taken <a href="http://www.latex-community.org/forum/viewtopic.php?f=50&t=20461" rel="nofollow">... | 17,438 |
<p>What is the correct way of retrieving maximum values of all columns in a table with a single query? Thanks.</p>
<p>Clarification: the same query should work on any table, i.e. the column names are not to be hard-coded into it.</p>
| <pre><code>SELECT max(col1) as max_col1, max(col2) as max_col2 FROM `table`;
</code></pre>
| <p>I think (but would be happy to be shown wrong) that you have to know at least the number of columns in the table, but then you can do:</p>
<pre><code>select max(c1),max(c2),max(c3),max(c4),max(c5)
from (
select 1 c1, 1 c2, 1 c3, 1 c4, 1 c5 from dual where 0
union all
select * from arbitrary5columntable
... | 45,428 |
<p>I'm programming WCF using the ChannelFactory which expects a type in order to call the CreateChannel method. For example: </p>
<pre><code>IProxy proxy = ChannelFactory<IProxy>.CreateChannel(...);
</code></pre>
<p>In my case I'm doing routing so I don't know what type my channel factory will be using. I can p... | <p>What you are looking for is MakeGenericType</p>
<pre><code>string elementTypeName = Console.ReadLine();
Type elementType = Type.GetType(elementTypeName);
Type[] types = new Type[] { elementType };
Type listType = typeof(List<>);
Type genericType = listType.MakeGenericType(types);
IProxy proxy = (IProxy)Acti... | <p>Here's a question: Do you <i>really</i> need to create a channel with the exact contract type in your specific case?</p>
<p>Since you're doing routing, there's a very good chance you could simply deal with the generic channel shapes. For example, if you're routing a one-way only message, then you could create a cha... | 9,293 |
<p>I found a while ago (and I want to confirm again) that if you declare a class level variable, you should not call its constructor until the class constructor or load has been called. The reason was performance - but are there other reasons to do or not do this? Are there exceptions to this rule?</p>
<p><strong>ie... | <p>If you set your variable outside of the constructor then there is no error handling (handeling) available. While in your example it makes no difference, but there are many cases that you may want to have some sort of error handling. In that case using your first option would be correct.</p>
<p>Nescio talked about w... | <p>I prefer to initialize variables as soon as possible, since it avoids (some) null errors.</p>
<p>Edit: Obviously in this simplified example there is no difference, however in the general case I believe it is good practice to initialize class variables when they are declared, if possible. This makes it impossible to... | 30,789 |
<p>I'm wondering if it's possible to distribute a RoR app for production use without source code? I've seen <a href="https://stackoverflow.com/questions/55711/options-for-distribution-of-an-offline-ruby-on-rails-application">this post on SO</a>, but my situation is a little different. This would be an app administere... | <p>Your best option right now is to use JRuby. A little bit of background: My company (<a href="http://bitrock.com" rel="noreferrer" title="BitRock">BitRock</a>) works with many proprietary and commercial open source vendors. We help them package their server software, which is typically based on PHP, Java or Ruby toge... | <p>Take a look at <a href="http://www.jumpbox.com/" rel="nofollow noreferrer">JumpBox</a>.</p>
<p>I've had conversations with them on the topic, and they seem to have a solution that will work soon for Rails apps.</p>
| 12,479 |
<p>So I have a client who's current host does not allow me to use tar via exec()/passthru()/ect and I need to backup the site periodicly and programmaticly so is there a solution?</p>
<p>This is a linux server.</p>
| <p>At <a href="http://pear.php.net/package/Archive_Tar" rel="noreferrer">http://pear.php.net/package/Archive_Tar</a> you can donload the PEAR tar package and use it like this to create the archive:</p>
<pre><code><?php
require 'Archive/Tar.php';
$obj = new Archive_Tar('archive.tar');
$path = '/path/to/folder/';
$ha... | <p>I need a solution that would work on Azure websites (IIS) and had trouble with creating new files on the server using methods from other answers. The solution that worked for me was to use small <a href="http://freecode.com/projects/tbszip-a-zip-modifier-for-php" rel="nofollow">TbsZip</a> library for compression, wh... | 43,172 |
<p>Please feel free to correct me if I am wrong at any point...</p>
<p>I am trying to read a <a href="http://en.wikipedia.org/wiki/Comma-separated_values" rel="nofollow noreferrer">CSV</a> (comma separated values) file using .NET file I/O classes. Now the problem is, this CSV file may contain some fields with soft car... | <p>It probably is. In terms of order, it goes through each char once only, so it would be O(n) (where n is the length of the stream) so that's not a problem. To read a single character a BinaryReader is your best bet.</p>
<p>What I would do is make a class</p>
<pre><code>public class LineReader : IDisposable
{
pr... | <p>How about simply preprocessing the file?</p>
<p>Replace the soft carriage returns with something unique.</p>
<p>For the record, CSV files with linefeeds in the data, that's bad design.</p>
| 39,758 |
<p>The UPSERT operation either updates or inserts a row in a table, depending if the table already has a row that matches the data:</p>
<pre><code>if table t has a row exists that has key X:
update t set mystuff... where mykey=X
else
insert into t mystuff...
</code></pre>
<p>Since Oracle doesn't have a specif... | <p>The <a href="http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm#SQLRF01606" rel="noreferrer">MERGE statement</a> merges data between two tables. Using DUAL
allows us to use this command. Note that this is not protected against concurrent access.</p>
<pre><code>create or replace
procedure u... | <p>From <a href="http://www.praetoriate.com/oracle_tips_upserts.htm" rel="nofollow noreferrer">http://www.praetoriate.com/oracle_tips_upserts.htm</a>:</p>
<p>"In Oracle9i, an UPSERT can accomplish this task in a single statement:"</p>
<pre><code>INSERT
FIRST WHEN
credit_limit >=100000
THEN INTO
rich_customer... | 29,374 |
<p>I have a long print that keeps aborting. At some random point mid-print the printer says "Click to resume...". There is nothing in the G-code that asks for user confirmation. What could it be that triggers this? I noticed that sometimes (not every time) there is a blob of plastic in the way that should not be there.... | <p>To answer your question directly, this action (<code>Click to resume...</code>) is triggered by a buffer overflow of the Marlin firmware that is caused by the repetitive sending of <code>M105</code> command by Ultimaker Cura (without checking the result).</p>
<p>This problem is a <a href="https://github.com/Ultimak... | <p>Tonight I had faced the same problem.</p>
<p>I've read somewhere (can't find the source now) that this is a Cura bug that has been fixed in Cura 3.6 beta</p>
| 1,070 |
<p>It seems to be often said that Task Manager does not provide an accurate indication of how much memory is in use by a process.</p>
<p>If this is indeed the case, what's the easiest way to find these things out?</p>
<p>I'd like to know:</p>
<ul>
<li>Total Memory in use (whether in RAM or paged or whatever)</li>
<l... | <p>Grab <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer">Process Explorer</a>, right-click -> Properties the process in the list, and then click the ".NET" tab. Select ".NET CLR Memory" from the combobox, and you'll have more live info about your process than you'll know what to ... | <p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="nofollow noreferrer">Process Explorer</a> will show you some of this if you double-click on on a process.</p>
| 46,641 |
<p>As a programming exercise, I've written a Ruby snippet that creates a class, instantiates two objects from that class, monkeypatches one object, and relies on method_missing to monkeypatch the other one.</p>
<p>Here's the deal. This works as intended:</p>
<pre><code>class Monkey
def chatter
puts "I am a ch... | <p><code>define_method</code> is a (private) method of the object <em>Class</em>. You are calling it from an <em>instance</em>. There is no instance method called <code>define_method</code>, so it recurses to your <code>method_missing</code>, this time with <code>:define_method</code> (the name of the missing method)... | <p>self.class.define_method(:screech) doesn't work,because define_method is private method
you can do that</p>
<pre><code>class << self
public :define_method
end
def method_missing(m)
puts "No #{m}, so I'll make one..."
Monkey.define_method(:screech) do
puts "This is the new screech."
end
</code></pre>
| 22,492 |
<p>Has anybody used the MS Project Gantt chart control in C#?
If yes, can you share some resources regarding this?</p>
| <p>You could also check <a href="http://DlhSoft.com/GanttChart" rel="nofollow noreferrer">Gantt Chart Library</a> for WPF or Windows Forms, they do not require Microsoft Project installed on the client computer, but provide similar UI for project and related Gantt Charts.</p>
| <p>My company decided to buy the Infragistics NetAdvantage for .NET. We will be using their Gantt control.</p>
<p>Thanks for your answers.</p>
| 4,208 |
<p>I'm trying to unit test (JUnit) a DAO i've created. I'm using Spring as my framework, my DAO (JdbcPackageDAO) extends SimpleJdbcDaoSupport. The testing class (JdbcPackageDAOTest) extends AbstractTransactionalDataSourceSpringContextTests. I've overridden the configLocations as follows:</p>
<pre><code>protected St... | <p>In order to have HSQLDB register itself, you need to access its jdbcDriver class. You can do this the same way as in this <a href="http://hsqldb.org/doc/guide/running-chapt.html#rgc_connecting_db" rel="noreferrer">example</a>.</p>
<pre><code>Class.forName("org.hsqldb.jdbcDriver");
</code></pre>
<p>It triggers stat... | <p>It might be that </p>
<blockquote>
<p>hsql://localhost</p>
</blockquote>
<p>can't be resolved to a file. Look at the sample program here:</p>
<p><a href="http://hsqldb.org/doc/guide/apb.html" rel="nofollow noreferrer">Sample HSQLDB program</a></p>
<p>See if you can get that working first, and then see if you ... | 19,417 |
<p>Should I stick with Sun's Java code conventions for PHP code?</p>
| <p>For PHP, i'd suggest to follow <a href="http://framework.zend.com/manual/1.12/en/manual.html" rel="nofollow noreferrer">Zends suggestions</a></p>
<p>As you might know, <a href="https://stackoverflow.com/questions/2648/what-php-framework-would-you-choose-for-a-new-application-and-why">Zend is the most widely used fr... | <p>There are many different coding conventions out there. Have a look at what other people use (read some example code and see how easy it is to understand what is being done) and take your pick.</p>
<p>The important part is to choose one and stick to it.</p>
| 16,868 |
<p>I'm using <a href="http://www.ddj.com/cpp/184401251?pgno=2" rel="nofollow noreferrer">Lawrence Philips Double-Metaphone</a> algorithm with great success, but I have found the odd "unexpected result" for some combinations.</p>
<p>Does anyone else have additions or changes to the algorithm for other parts of it they ... | <p>All Soundex, Metaphone and variant schemes are occasionally going to give results that aren't identical to what you expect. This is unavoidable - they can be regarded as more or less simple hash algorithms with special information preserving properties, and will sometimes produce collisions when you'd rather they d... | <p>regular metaphone is returning a difference between Peashill and Bushley</p>
<p>Peashill PXL
Bushley BXL</p>
| 28,449 |
<p>Routines, procedures, methods - whatever you call them, they are important building blocks for us developers. What single characteristic would you rate as the <em>most important</em> one?</p>
<p>(By providing one characteristic per answer, it is possible to vote for them individually. I.e. the purpose of this quest... | <p>I think the most important criteria would be that it has a single purpose.</p>
<p>After that, that it satisfies that purpose (and only that purpose) correctly.</p>
| <p>A single return point</p>
| 47,557 |
<p>We need to start adding internationalisation to our program. Thankfully not the whole thing yet, just a few bits, but I want the way we do it to scale up to potentially cover the whole program. The thing is, our program is based on plugins, so not all strings belong in the same place.</p>
<p>As far as I understand ... | <p>You don't <em>have</em> to implement ResourceBundles as a series of classes, with one class per locale (i.e. a class named <code>MyProgramStrings</code>, <code>MyProgramStrings_fr</code>, <code>MyProgramStrings_de</code>). The ResourceBundle class will fall back to using properties files if need be:</p>
<pre><code>... | <p>I know Struts and Spring have something for that. But let's say you can't use Struts or Spring then what I would do is to create a subclass of ResourceBundle and load the *.properties (one per plugin) in this ResourceBundle. Then you can use </p>
<blockquote>
<p>ResourceBundle bundle = ResourceBundle.getBundle("M... | 35,839 |
<p>I have a dual-extruder printer with a separate heating element for each head, thus able to combine materials in a single print job even if they don't share a single temperature range.</p>
<p>Now the question: When (outside of using expensive dedicated support material or doing multicolor prints for aesthetic reason... | <p>The answers are </p>
<ol>
<li><p>yes</p></li>
<li><p>yes</p></li>
<li><p>probably</p></li>
</ol>
<p>Which is to say, if you only want to use MaterialNumberTwo for disposable supports, then you should be fine. Presumably the slicer software is material-aware and adjusts the feed so the layer heights are the same ... | <p>I have printed ABS on top of PLA and it has bonded well. It was simple, then "campaign"-style buttons with Prusament Galaxy Black on the bottom and HatchBox white ABS on top. There was no tendency to warp, as I would expect if the ABS were shrinking more than the PLA.</p>
<p>I expected this to not work, but I nee... | 1,439 |
<p>Disclaimer: I am new to Winforms.</p>
<p>I need to declare a datatable that I can load with data when the main form loads. I then want to be able to reference the datatable from within events like when a button is clicked etc.</p>
<p>Where/how should I declare this?</p>
| <p>I'd suggest a private member at the top of the form class meaning it will be accessible throughout the entire form. No need for a public property, unless you have to access it outside of the form but its best to default to private if you are unsure.</p>
| <p>Update: If it is a simple one form app, please check the suggestion by Quarrelsome..</p>
<p>Just Declare as a public property of your Data Access class.</p>
| 20,273 |
<p>How can I display a sort arrow in the header of the sorted column in a list view which follows the native look of the operating system?</p>
| <p>You can use the following extension method to set the sort arrow to a particular column:</p>
<pre><code>[EditorBrowsable(EditorBrowsableState.Never)]
public static class ListViewExtensions
{
[StructLayout(LayoutKind.Sequential)]
public struct HDITEM
{
public Mask mask;
public int cxy;
... | <p>For any other lazy C++ programmers (like me):</p>
<pre><code>// possible sorting header icons / indicators
enum class ListViewSortArrow { None, Ascending, Descending };
BOOL LVHeader_SetSortArrow(HWND hHeader, int nColumn, ListViewSortArrow sortArrow)
{
ASSERT(hHeader);
HDITEM hdrItem = { 0 };
hdrItem... | 31,690 |
<p>I have noticed major watches watch brands do not seem to offer manuals to 3D print your own parts.</p>
<p>Is there a reason for this?</p>
<p>I would assume in this day and age, with <a href="https://www.careeronestop.org/Toolkit/Careers/Occupations/occupation-profile.aspx?keyword=Watch%20repairers&onetcode=49906... | <p>The OpenSCAD <code>surface</code> function will do this. You can feed it a greyscale image or a textfile containing a matrix. Documentation and examples can be found at <a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Surface" rel="nofollow noreferrer">https://en.wikibooks.org/wi... | <p>FreeCAD can import JPG (and IIRC TIFF and PNG as well) image files and produce a lithophane type height-map based on the brightness of each pixel. I'd be rather surprised if other 3D CAD software aimed at the 3D printing user base couldn't do the same. Most of the common free-to-use 3D CAD packages have Linux vers... | 1,956 |
<p>How do I connect to a MySQL database using a python program?</p>
|
<h2>Connecting to MYSQL with Python 2 in three steps</h2>
<p><strong>1 - Setting</strong></p>
<p>You must install a MySQL driver before doing anything. Unlike PHP, Only the SQLite driver is installed by default with Python. The most used package to do so is <a href="http://pypi.python.org/pypi/MySQL-python/" rel="n... | <p>First, install python-mysql connector from <a href="https://dev.mysql.com/downloads/connector/python/" rel="nofollow noreferrer">https://dev.mysql.com/downloads/connector/python/</a></p>
<p>on Python console enter: </p>
<pre><code>pip install mysql-connector-python-rf
import mysql.connector
</code></pre>
| 48,751 |
<p>Writing a python script and it needs to find out what language a block of code is written in. <strong>I could easily write this myself, but I'd like to know if a solution already exists.</strong></p>
<p>Pygments is insufficient and unreliable.</p>
| <p><a href="http://pygments.org" rel="noreferrer">Pygments</a> can guess too. Here is an example from the documentation:</p>
<pre><code>>>> from pygments.lexers import guess_lexer, guess_lexer_for_filename
>>> guess_lexer('#!/usr/bin/python\nprint "Hello World!"')
<pygments.lexers.PythonLexer>... | <p>As other have said Pygments will be your best bet.</p>
| 42,099 |
<p>Consider this:</p>
<pre><code>public class TestClass {
private String a;
private String b;
public TestClass()
{
a = "initialized";
}
public void doSomething()
{
String c;
a.notify(); // This is fine
b.notify(); // This is fine - but will end in an exception
c.... | <p>The language defines it this way.</p>
<p>Instance variables of object type default to being initialized to null.
Local variables of object type are not initialized by default and it's a compile time error to access an undefined variable.</p>
<p>See section 4.12.5 for SE7 (same section still as of SE14)
<a href="http... | <p>You've actually identified one of the bigger holes in Java's system of generally attempting to find errors at edit/compile time rather than run time because--as the accepted answer said--it's difficult to tell if b is initialized or not.</p>
<p>There are a few patterns to work around this flaw. First is "Final by ... | 33,741 |
<p>What is your preferred method for reading through the contents of zipped directories with Perl ?</p>
| <p>There are several modules on CPAN for working with various archive formats (zip, tar, etc.), the one you're probably after is <a href="http://search.cpan.org/~adamk/Archive-Zip-1.24/lib/Archive/Zip.pm" rel="nofollow noreferrer">Archive::Zip</a>.</p>
| <p>If you want the contents of a .tar.gz archive</p>
<pre><code>open(DIR_LISTING, "gzip -dc concert25.tgz | tar -tf -|") || die;
while (<DIR_LISTING>) {
print;
}
close (DIR_LISTING);
</code></pre>
| 16,300 |
<p>I have a .Net desktop application with a TreeView as one of the UI elements.</p>
<p>I want to be able to multi-select that TreeView, only that isn't supported at all.</p>
<p>So I'm adding check-boxes to the tree, My problem is that only some items are selectable, and those that aren't can't consistently cascade se... | <p>The default behavior of TreeView is that when the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.checkboxes%28VS.80%29.aspx" rel="nofollow noreferrer">Checkboxes</a> property is set to true, that checkboxes will be shown for all TreeNodes.</p>
<p>The behavior that you are looking for... | <p><a href="http://www.codeproject.com/KB/tree/Multiselect_Treeview.aspx" rel="nofollow noreferrer">MultiSelectTreeView</a>:</p>
<blockquote>
<p>Why doesn't .NET have a multiselect treeview? There are so many uses for one and turning on checkboxes in the treeview is a pretty lousy alternative.</p>
</blockquote>
| 6,020 |
<p>I've been running Tomcat 5.5 with Java 1.4 for a while now with a huge webapp. Most of the time it runs fine, but sometimes it will just hang, with no exception generated, and no apparant way of getting it to run again other than re-starting Tomcat. The tomcat instance is allowed a gigabyte of memory on the heap, ... | <p>For any jvm process, force a thread dump. In windows, this can be done with CTRL-BREAK, I believe, in the console window.</p>
<p>In *nix, it is almost always "kill -3 jvm-pid".</p>
<p>This may show if you have threads waiting on db connection pool/thread pool, etc.</p>
<p>Another thing to check out is how many co... | <p>It sounds like you're hitting a deadlock.</p>
<p>If you can reproduce it in a dev environment then try attaching a debugger once it's happened. Take a look at your threads and see if you have any deadlocks.</p>
<p>If you can't get a debugger to attach you should be able to generate a thread dump, as Dustin pointe... | 9,176 |
<p>I am developing a program that continually sends a stream of data in the background and I want to allow the user to set a cap for both upload and download limit.</p>
<p>I have read up on the <a href="http://en.wikipedia.org/wiki/Token_bucket" rel="noreferrer">token bucket</a> and <a href="http://en.wikipedia.org/wi... | <p>Based on @0xDEADBEEF's solution I created the following (testable) solution based on Rx schedulers:</p>
<pre><code>public class ThrottledStream : Stream
{
private readonly Stream parent;
private readonly int maxBytesPerSecond;
private readonly IScheduler scheduler;
private readonly IStopwatch stopwa... | <p>I came up with a different implementation of the ThrottledStream-Class mentioned by arul. My version uses a WaitHandle and a Timer with a 1s Interval:</p>
<pre><code>public ThrottledStream(Stream parentStream, int maxBytesPerSecond=int.MaxValue)
{
MaxBytesPerSecond = maxBytesPerSecond;
parent = parentStrea... | 48,486 |
<p>I have an ajax page which pulls data from a database. I'd like to add a <a href="http://www.processing.org/" rel="nofollow noreferrer">processing</a> applet to visualize the data but i can't figure out how to update the visualization as the data changes. The idea is to be able to push new data into the visualization... | <p>The easiest way is to construct your own XML structure (base64 encode binary data if you need) and add a timer in your applet to retrieve updates from the server (through HTTP requests). How to prepare and process the XML is up to you.</p>
<p>Applets are a bit heavy-weight for visualization, so if the same thing ca... | <p>You could make http requests from the java applet. I don't know anything about processing applets though.</p>
| 47,351 |
<p>I've used ZenTest and autotest to work on Ruby projects before, and I used to using them for test-driven development a la <a href="http://blog.internautdesign.com/2006/11/12/autotest-growl-goodness" rel="noreferrer">this configuration</a>. I have a project that I'm currently working on in Java, and I was wondering i... | <p>Might I also suggest Infinitest, it is under active development and works with other languages besides Java. I believe it works fine with Scala, but I haven't had much luck using it with Groovy.</p>
<p>It is free for personal use and is being developed by Improving.</p>
| <p>I used the tool and looks pretty cool for first release.. I would request him to come up with next version soon...</p>
| 16,591 |
<p>I want to return <code>StudentId</code> to use elsewhere outside of the <em>scope</em> of the <code>$.getJSON()</code></p>
<pre><code>j.getJSON(url, data, function(result)
{
var studentId = result.Something;
});
//use studentId here
</code></pre>
<p>I would imagine this has to do with scoping, but it doesn't ... | <p>Yeah, my previous answer does not work because I didn't pay any attention to your code. :)</p>
<p>The problem is that the anonymous function is a callback function - i.e. getJSON is an async operation that will return at some indeterminate point in time, so even if the scope of the variable were outside of that ano... | <p>hmm, if you've serialized an object with the <code>StudentId</code> property then I think that it will be:</p>
<pre><code>var studentId;
function(json) {
if (json.length > 0)
studentId = json[0].StudentId;
}
</code></pre>
<p>But if you're just returning the <code>StudentId</code> itself maybe it's:<... | 5,103 |
<p>Looking for good project methodologies.Anyone got some good reference links..want to share.</p>
| <p>This is a link from google video of Ken Schwaber co-developer of the Agile process, Scrum called as Scrum et al.
<a href="http://video.google.com/videoplay?docid=-7230144396191025011" rel="nofollow noreferrer">http://video.google.com/videoplay?docid=-7230144396191025011</a>. I gives a nice briefing about what scrum... | <p>There are SO many project methodologies that you could spend ages searching and still not finding what you are looking for. </p>
<p>To start with, it's important to have a good understanding of the type of project you deal with. Different metholodogies will suit different types of projects. A large scale project wi... | 37,425 |
<p>I'm betting that someone has already solved this and maybe I'm using the wrong search terms for google to tell me the answer, but here is my situation.</p>
<p>I have a script that I want to run, but I want it to run only when scheduled and only one at a time. (can't run the script simultaneously) </p>
<p>Now the... | <p>add a column <code>exec_status</code> to <code>myhappytable</code> (maybe also <code>time_started</code> and <code>time_finished</code>, see pseudocode)</p>
<p>run the following cron script every x minutes</p>
<p>pseudocode of cron script:</p>
<pre><code>[create/check pid lock (optional, but see "A potential pitf... | <p>I came across this question while researching for a solution to the queuing problem. For the benefit of anyone else searching here is my solution.</p>
<p>Combine this with a cron that starts jobs as they are scheduled (even if they are scheduled to run at the same time) and that solves the problem you described as ... | 28,008 |
<p>How can I include a bookmarklet in a Markdown parsed document? Is there any "tag" for markdown that basically says "don't parse this"??</p>
<p>For example you could have something like:</p>
<pre><code><a href="javascript:function my_bookmarklet()
{alert('Hello World');}
my_bookma... | <p>Markdown will leave any HTML alone, so you can just enter</p>
<pre><code><a href="javascript:function my_bookmarklet()
{alert('Hello World');}
my_bookmarklet();">Hello</a>
</code></pre>
<p><del>and get Hello.</del> <em>Edit: No longer works on SO, which is a good thing</... | <p>I know this is a very old question, but (in case someone else finds their way here, as I did), if you url-encode your script, it will work.</p>
<p>For example:</p>
<pre><code> [Hello World](javascript:%28function%28%29%7Balert%28%22Hello%20World%22%29%7D%29%28%29%3B)
</code></pre>
<p>And of course, as mentione... | 24,851 |
<p>I just recently noticed <code>Dictionary.TryGetValue(TKey key, out TValue value)</code> and was curious as to which is the better approach to retrieving a value from the Dictionary.</p>
<p>I've traditionally done:</p>
<pre><code>if (myDict.Contains(someKey))
someVal = myDict[someKey];
...
</code></pre>
... | <p>TryGetValue is slightly faster, because FindEntry will only be called once. </p>
<blockquote>
<p>How much faster? It depends on the
dataset at hand. When you call the
Contains method, Dictionary does an
internal search to find its index. If
it returns true, you need another
index search to get the actua... | <p>I imagine that trygetvalue is doing something more like:</p>
<pre><code>if(myDict.ReallyOptimisedVersionofContains(someKey))
{
someVal = myDict[someKey];
return true;
}
return false;
</code></pre>
<p>So hopefully no try/catch anywhere.</p>
<p>I think it is just a method of convenience really. I generally use... | 49,571 |
<p>Is there a tool to detect unneeded jar-files?</p>
<p>For instance say that I have myapp.jar, which I can launch with a classpath containing hibernate.jar, junit.jar and easymock.jar. But actually it will work fine using only hibernate.jar, since the code that calls junit.jar is not reachable.</p>
<p>I realize that... | <p>This is not possible in a system that might use reflection.</p>
<p>That said, a static analysis tool could do a pretty good job if you don't use ANY reflection.</p>
| <p>Something to add to Bill K's reply: you might not use reflection at all, but the JARs you are using might. I remember encountering something like that with xalan & xerces, where a ClassNotFoundException has been thrown at runtime.</p>
| 10,189 |
<p>I am writing code for a search results page that needs to highlight search terms. The terms happen to occur within table cells (the app is iterating through GridView Row Cells), and these table cells may have HTML.</p>
<p>Currently, my code looks like this (relevant hunks shown below):</p>
<pre><code>const string ... | <p>This regex should do the job : <code>(?<!<[^>]*)(regex you want to check: Fred|span)</code> It checks that it is impossible to match the regex <code><[^>]*</code> going backward starting from a matching string.</p>
<p>Modified code below:</p>
<pre><code>const string notInsideBracketsRegex = @"(?<... | <p>Hmm, I'm not a C# programmer so I don't know the flavor of regex it uses but (?!<.+?>) should ignore anything inside of tags. It will force you to use &#60 &#62 in your HTML code, but you should be doing that anyway.</p>
| 21,692 |
<p>What is the command-line equivalent of "Switch Port Client User" as found in the p4win gui client? </p>
<p>I am already logged under one port but now I am attempting to connect to a different port on the same server in order to access a separate source control file depot. I assume it would involve using:</p>
<pre>... | <p>The P4PORT configuration variable stores the Perforce server name and port number to connect to. You can set this value as an environment variable or, if you're using Windows, in the registry using 'p4 set':</p>
<pre><code>p4 set P4PORT=perforce:1669
</code></pre>
<p>To see what the current value of P4PORT is:</p>... | <p>E.g:</p>
<pre><code>p4 set P4PORT=1666
</code></pre>
<p>From the help:</p>
<pre><code>C:\> p4 help environment
Environment variables used by Perforce:
Variable Defines For more information see
-------- ------- ------------------------
P4AUDI... | 41,722 |
<p>I have a database for a web application that is home to some personal information about my users.</p>
<p>What should I do to make sure the data is secure?</p>
<p>Encrypting the data makes sense, of course... but what about stopping somebody from getting on the machine to begin with?</p>
<p>What do I do about the ... | <p>Depending on the type of data I'm not sure that encryption is necessary providing you secure access to the system and the database itself. All of our production database servers are behind a firewall. Only systems that are on the administrative network are allowed access through the firewall and then only on speci... | <p>You need to pratice standard security for a windows server. A good place to start is to use integrated logins rather that SQL logins.</p>
<p>You will need to study the books on-line. You can give some users read-only access. Others can be denied access to sensitive tables.</p>
| 25,890 |
<p>What are some best practices to orchestrate the interaction between complex components that are in your View?</p>
<p>I'm not talking about simple widgets like a combo box or a grid control but components that are made up of multiple widgets and that may deserve being unit tested on their own.</p>
<p>Would you:</p>... | <p>Option #3 sounds like the Mediator pattern and is often the best approach when the update logic and communication between the objects is complex. It also has the added advantage of keeping the control logic and initialization centralized which tends to make tracing through and debugging these types of cases easier.<... | <p>It sounds like you have the knowledge to answer your own question on this one but maybe just lack the confidence to dive in. Are you just exploring or are you stuck somewhere?</p>
<p>I would add that one extra thing you can do is place a component manager in between all of the objects to facilitate the communicatio... | 23,069 |
<p>I continue to get this error:</p>
<pre><code>Object '%s' cannot be renamed because the object participates in enforced dependencies
</code></pre>
<p>I need to find a script that will help me to find all the dependencies that there is with this table. I will need to drop them, rename, then bring them back.</p>
<p>... | <p>To disable all contraints</p>
<pre><code>sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
go
sp_msforeachtable "ALTER TABLE ? DISABLE TRIGGER all"
go
</code></pre>
<p>To Re-enable</p>
<pre><code>sp_msforeachtable"ALTER TABLE ? CHECK CONSTRAINT all"
go
sp_msforeachtable "ALTER TABLE ? ENABLE TRIGGER all"... | <p><a href="https://stackoverflow.com/questions/181909/tool-for-scripting-table-data#181942">This posting</a> contains a db reverse engineer script that I originally wrote for SQL Server 2000 and ported to 2005. If you look at the bit that does foreign key relationships you can see how to get the dependencies from the... | 25,837 |
<p>Let's say you got a file containing texts (from 1 to N) separated by a $
How can a slit the file so the end result is N files? </p>
<blockquote>
<p>text1 with newlines $<br>
text2 $etc... $<br>
textN</p>
</blockquote>
<p>I'm thinking something with awk or sed but is there any available unix app that already... | <p>Maybe <code>split -p</code> <em>pattern</em>?</p>
<p>Hmm. That may not be exactly what you want. It doesn't split a line, it only starts a new file when it sees the pattern. And it seems to be supported only on BSD-related systems.</p>
<p>You could use something like:</p>
<pre><code>awk 'BEGIN {RS = "$"} { ... ... | <p>If I'm reading this right, the UNIX <a href="http://www.manpagez.com/man/1/cut/" rel="nofollow noreferrer">cut</a> command can be used for this.</p>
<pre><code>cut -d $ -f 1- filename
</code></pre>
<p>I might have the syntax slightly off, but that should tell cut that you're using $ separated fields and to return ... | 37,030 |
<p>We've got a few pages in our web systems that use the .net system.net.mail control to send emails. The thing has been working great, except it's now starting to look like the smptclient class may not actually be disconnecting from the server, such that the SMTP server leaves that connection open, and we ended up ma... | <p>The problem of emails not being sent right away with SmtpClient is because under some conditions, it does not send the SMTP command 'QUIT' when it should (i.e. it doesn't disconnect properly). I have used the following code to force a disconnect successfully in the past:</p>
<pre><code>var smtp = new SmtpClient();... | <p>Are you properly disposing of your MailMessage once it has been sent? I've never seen any indication that SmtpClient wasn't closing it's connection though</p>
| 47,587 |
<p>I'm setting up a simple SQLite database to hold sensor readings. The tables will look something like this:</p>
<pre><code>sensors
- id (pk)
- name
- description
- units
sensor_readings
- id (pk)
- sensor_id (fk to sensors)
- value (actual sensor value stored here)
- time (date/time the sensor... | <p>Are you setting indexes properly? Besides that and reading <a href="http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html" rel="nofollow noreferrer">http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html</a>, the only answer is 'you'll have to measure yourself' - especially since this will be heavil... | <p>SQLite now supports R-tree indexes ( <a href="http://www.sqlite.org/rtree.html" rel="nofollow noreferrer">http://www.sqlite.org/rtree.html</a> ), ideal if you intend to do a lot of time range queries.</p>
<p>Tom</p>
| 22,515 |
<p>It looks like <a href="http://brew.qualcomm.com/brew/" rel="nofollow noreferrer">BREW</a> 4.0 will have Lua included. But is it possible to use Lua on older BREW 3.0 (or even BREW 2.0)?</p>
| <p>It is possible, but you will have to link lua interpreter source code to your application source code and wrap BREW API functions in order to use them from lua scripts.</p>
<p>Check out <a href="http://luaforge.net/projects/luabrew" rel="nofollow noreferrer">LuaBREW</a> project as an example of approach I briefly e... | <p>We don't wait BREW 4.0. We are writing our LuaBREW implementation right now.</p>
| 9,671 |
<p>How can I get notifications about what is the currect active window and when this changes without polling GetActiveWindow or using global hooks?</p>
<p>I don't like polling, and I'm working in C# and global hooks don't work (mostly).</p>
| <p>I have never found a clean way to get notified. I use <a href="http://msdn.microsoft.com/en-us/library/ms633505.aspx" rel="nofollow noreferrer">GetForegroundWindow</a> with a timer. :(</p>
| <p>You can't but you might want to try something someone has already created like this <a href="http://www.vbaccelerator.com/home/Vb/Code/Libraries/Hooks/vbAccelerator_Hook_Library/article.asp" rel="nofollow noreferrer">product</a>.</p>
| 43,332 |
<p>I know that this is a very specific C++ and Qt related question, but maybe someone can help me, anyway ...</p>
<p>See the code below: I want to display an image within a scroll area. The view port of the scroll area shall have a defined initial size. That means, if the image's size is bigger than the initial size o... | <p>I think that you are looking at the problem the wrong way. The QScrollArea is just a widget that you put in a frame or QMainWindow. The size of the widget is controlled by the layout of the widget that contains it.</p>
<p>Take a look at this example from Trolltech: <a href="http://doc.qt.io/qt-5/qtwidgets-widgets... | <p>I don't think you can do exactly that very easily, which is (if I'm reading correctly), size the widget so that the internal area is 300x300. You might be able to fudge it, however, since a scroll area is a type of frame, which inherits from QWidget. This means you could just call <code>area->resize( 300 + fudg... | 29,844 |
<p>How can we handel key pressed event in asp.net</p>
| <p>Presumably you mean from the website itself. ASP.NET has no support for this, you will need to <a href="http://docs.jquery.com/Events/keypress" rel="nofollow noreferrer">capture the keypress with javascript</a> and then send it to ASP.NET via <a href="http://ferry.ferryandtheria.com/?p=3" rel="nofollow noreferrer">a... | <p>It depends on your situation. In most cases, you will have to handle keypressed event in javascript, and somehow propagate that event to server side.
Consider revising your question to include more background.</p>
| 32,686 |
<p>I would much prefer to do this without catching an exception in <code>LoadXml()</code> and using this results as part of my logic. Any ideas for a solution that doesn't involve manually parsing the xml myself? I think VB has a return value of false for this function instead of throwing an XmlException. Xml input i... | <p>Just catch the exception. The small overhead from catching an exception drowns compared to parsing the XML.</p>
<p>If you want the function (for stylistic reasons, not for performance), implement it yourself:</p>
<pre><code>public class MyXmlDocument: XmlDocument
{
bool TryParseXml(string xml){
try{
Pa... | <p>AS already been said, I'd rather catch the exception, but using <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlparsercontext.aspx" rel="nofollow noreferrer">XmlParserContext</a>, you could try to parse "manually" and intercept any anomaly; however, unless you're parsing 100 xml fragments per second, ... | 11,181 |
<p>A quick question: When declaring the DLLImport Attribute in .Net, where does the runtime look to resolve that DLL dependency? Would I have to dump the DLL and all of <em>its</em> dependencies in the bin folder?</p>
| <p>I think it is working like LoadLibrary.</p>
<p>Maybe <a href="https://stackoverflow.com/questions/154281/windows-path-searching-in-loadlibrary-with-manifest">Windows path searching in LoadLibrary with manifest</a> will be helpfull.</p>
<p><strong>Edit</strong> <a href="http://msdn.microsoft.com/en-us/library/ms682... | <p>Generally, you'd expect it to look at whatever's defined in the user's Path. </p>
<p>To find out what this contains, from a command prompt, type <code>echo %PATH%</code> [Enter]</p>
| 33,717 |
<p><strong>Update:</strong> Thanks for the suggestions guys. After further research, I’ve reformulated the question here: <a href="https://stackoverflow.com/questions/217020/pythoneditline-on-os-x-163-sign-seems-to-be-bound-to-ed-prev-word">Python/editline on OS X: £ sign seems to be bound to ed-prev-word</a></p>
<p>O... | <p>Not the best solution, but you could type:</p>
<pre><code> pound = u'\u00A3'
</code></pre>
<p>Then you have it in a variable you can use in the rest of your session.</p>
| <p>Must be your setup, I can use the £ (Also european keyboard) under IDLE or the python command line just fine. (python 2.5).</p>
<p>edit: I'm using windows, so mayby its a problem with the how python works under the mac OS?</p>
| 20,223 |
<p>I'm looking for a good open source message bus that is suitable for embedded Linux devices (Linux and uClinux).</p>
<p>It needs to satisfy the following criteria:</p>
<ul>
<li>Must be free software and LGPL or a more liberal license due to uClinux only supporting static linking</li>
<li>Must have a C API</li>
<li>... | <p>It all depends on your architecture. Are you intending to message across a backplane to other nodes in a cluster, or is this all within a single node, but in different address spaces?</p>
<p>If the latter, then like carson said: <code>man mq_overview</code>.</p>
<p>If the former, then look first to your embedded ... | <p>This sounds like a good use for <a href="http://linux.die.net/man/7/mq_overview" rel="nofollow noreferrer">SYSV or POSIX message queues</a>. They can meet all the needs you have listed. POSIX are newer so they won't match the Kernel requirements but SYSV is in the older Kernels.</p>
| 39,797 |
<p>I need to learn about Postgresql. I'm trying to branch an application framework which is dependent on Oracle to use Postgresql. I can easily find communities of Java and JavaScript programmers via the web. Oracle communities a little more difficult, but between OTN and AskTom, I do pretty well. But Postgresql seems ... | <p>Have you tried the <a href="http://groups.google.com/group/comp.databases.postgresql.general/topics" rel="nofollow noreferrer">Postgres newsgroup</a>?
There's also <a href="http://www.postgresql.org/community/" rel="nofollow noreferrer">a community page</a> on the official Postgres website with links to IRC, forums,... | <p>#postgresql on Freenode is very useful, there are also language-specific channels - check the community page which Don mentioned.</p>
| 43,793 |
<p>I currently have two text boxes which accept any number. I have a text block that takes the two numbers entered and calculates the average. </p>
<p>I was wondering if there was a way I could bind this text block to both text boxes and utilize a custom converter to calculate the average? I currently am catching the ... | <p>You're looking for <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.multibinding.aspx" rel="noreferrer"><code>MultiBinding</code></a>.</p>
<p>Your <code>XAML</code> will look something like this:</p>
<pre><code><TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticRe... | <p>Just to add step-by-step procedure to Timothy's answer:</p>
<ol>
<li>Setup the View.TextBlock.Text property to bind to the ViewModel.AvgValue property.</li>
<li>Catch the TextChanged event of the TextBox control, then set the AvgValue in the handler of that TextChanged event.</li>
<li>As part of that handler in ste... | 32,556 |
<p>I have a problem with Lucene.NET. During an index, I receive the error 'Access to the path segments is denied'. Or sometimes 'Access to the path deletable is denied'. I eventually gave 'Everyone' full security rights to the index directory, but the problem still existed.</p>
<p>I then found out that during the inde... | <p>I suspect that your IndexModifier is in contention with a Searcher.</p>
<p>Here's how I use Lucene.Net in my <a href="http://ifdefined.com/bugtrackernet.html" rel="nofollow noreferrer">bug tracking</a> app, <a href="http://ifdefined.com/bugtrackernet.html" rel="nofollow noreferrer">BugTracker.NET</a>, which seems t... | <p>I read about this. However, I do not have any virus scanners running. I also disabled Vista Search Index for the index directory, killed the search index process from the task manager, to make sure no other process is locking the file. Unfortunately, to no avail. Moreover, the problem seems more to be that the 'segm... | 34,169 |
<p>I'm quoting myself on a previous question I asked to further explain:</p>
<p><em>"I'm trying to run a freshly created ASP.NET Website using C#, however when I do so it launches FireFox and attempts to connect to <a href="http://localhost:1295/WebSite1/Default.aspx" rel="nofollow noreferrer">http://localhost:1295/We... | <p>Within Nod32 enter the Advanced Setup options, and turn off protocol filtering.</p>
| <p>It's a known problem with NOD32. Looks like it's IMON module (protocol filter) accidentally does some modifications of TCP packets that go through it. </p>
<p>The solution is to either turn it off, or use a different software.</p>
| 36,389 |
<p>Assuming network access is sporadic with no central server, what would be the best way to use git to keep three or more branches in sync? Is there a way to extract just my deltas, email those, and merge them on the other end?</p>
| <p>While "git format-patch" and "git am" are great ways to manage patches from non-git sources, for git repositories you should investigate "git bundle".</p>
<p>"git bundle" and the subcommands "create" and "unbundle" can be used to create and use a binary blob of incremental commits that can be used to transfer branc... | <p>There are a few tools in git to use to mail patches or import mailed patches: <strong>git-am</strong> (apply patches from a mailbox), <strong>git-format-patch</strong> (prepare email for mailing), <strong>git-send-email</strong> (send a collection of patches via mail), etc. man 1 git has a complete list.</p>
| 11,060 |
<p>So, when I was a comparative novice to the novice I am right now, I used to think that these two things were syntactic sugar for each other, i.e. that using one over the other was simply a personal preference. Over time, I'm come to find that these two are not the same thing, even in a default implementation (see <a... | <p>MSDN has clear and solid descriptions of both things.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bsc2ak47.aspx" rel="noreferrer">object.Equals method</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/53k8ybth(VS.71).aspx" rel="noreferrer">operator ==</a></p>
<p><a href="http://msdn.microsof... | <p>Two of the most often used types, <b>String and Int32</b>, implement both operator==() and Equals() as value equality (instead of reference equality). I think one can consider these two <b>defining examples</b>, so my conclusion is that <b>both have identical meanings</b>. If Microsoft <a href="http://msdn.microsoft... | 13,768 |
<p>I have been given a set of COBOL DAT, IDX and KEY files and I need to read the data in them and export it into Access, XLS, CSV, etc. I do not know the version, vendor of the COBOL code as I only have the windows executable that created the files.</p>
<p>I have tried Easysoft and Parkway ODBC drivers but I have not... | <p>A few possibilities.</p>
<p>1/ See if you can find the names of the people that worked for the company. They may be helpful.</p>
<p>2/ Open the DAT file in a text editor. The data may be decodable from that. If the basic format can be discerned, quick'n'dirty code can be written to extract it.</p>
<p>3/ Open u... | <p>I have read COBOL DAT files only with FD, when I do not have the FD, I open the file in a Text Editor, and try to guess the columns, and try again, until I have this working, the big problem with this approach is when the DAT file have COMP columns, that can be any kind of COMP type, but with a litthe patience I col... | 12,510 |
<p>I have a single large table which I would like to optimize.
I'm using MS-SQL 2005 server. I'll try to describe how it is used and if anyone has any suggestions I would appreciate it very much.</p>
<p>The table is about 400GB, has 100 million rows and 1 million rows are inserted each day.
The table has 8 columns, 1 ... | <p>As I hinted in a comment, I have done this with a single Oracle table approaching 8 TB consisting of over two billion rows growing at the rate of forty million rows per day. However, in my case, the users were two million (and growing) customers accessing this data over the web, 24x7, and literally ANY of the rows ... | <p>You need to create an index which will reduce the number of possible rows returned as quickly as possible.</p>
<p>Therefore the simplest index to create would be on column k4, as that can have to highest number of different values.
It is only necessary to index the initial substring of k4 where the expected values ... | 45,598 |
<p>I have this piece of code:</p>
<pre><code>$("#faq").click(function () {
var url = $.get("faq", { pagina: "page" });
alert(url);
});
</code></pre>
<p>On "faq" responds to a Servlet that sets an attribute on the request </p>
<pre><code>....
request.setAttribute("pageFAQ", pageFAQ);
....
</cod... | <p>I'm not sure that a servlet request attribute is shared with the client.</p>
<p>You can get hold of the response text in jQuery like so:</p>
<pre><code>$("#faq").click(function () {
$.get(
"faq",
{ pagina: "page" },
function(data) { // callback function, executed on GET success... | <p>setAttribute() Method sets the value that one can retrieve inside the server but not at client side. We use it to set and get the values in servlet communication. You can not access any information thru this method that is outside the server i.e. client program. </p>
<p>We use req.getParameter(paramname) to access ... | 37,551 |
<p>I have a GUI application that executes (in a new process) "console" applications and parse the output. To redirect the Output i set the pConsole.StartInfo.RedirectStandardOutput to true. I also subscribes to the event pConsole.Exited.</p>
<p>The problem I see is that I have to use Thread.Sleep() in the Exited event... | <p>I don't know if it is any better, but I've just been looking at something similar using threads to read both stderr/stdout, like below. It involves a few extra threads (to avoid deadlocks / complex async code), but seems to work pretty robustly.</p>
<p>The key here is that I <code>Join()</code> on the two threads h... | <p>In addition to Marc Gravell's answer</p>
<p>proc.StandardError, proc.StandardOutput both has a EndOfStream method.
This will be useful to determine the case where the output does not yield a newline before user inputs/prompts</p>
| 32,247 |
<p>How can I open a web-page and receive its cookies using PHP?</p>
<p><strong>The motivation</strong>: I am trying to use <a href="http://www.feed43.com" rel="nofollow noreferrer">feed43</a> to create an RSS feed from the non-RSS-enabled HighLearn website (remote learning website). I found the web-page that contains ... | <p>For a server-side HTTP client you should use the <a href="http://au2.php.net/curl" rel="noreferrer">cURL</a> module. It will allow you to persist cookies across multiple requests. It also does some other neat things like bundling requests (curl_multi) and transparently handling redirects.</p>
<p>When it comes to re... | <p>Unfortunately, this is not possible unless the websites are on the same domain. Cookies are only valid on the domain they originated from. Also, subdomains count as different domains. Otherwise, (keep in mind I haven't used much php) you could pull the headers out of the response, and copy the cookie out to the clie... | 38,128 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.