instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I had two domains for ex. domain1 and domain2, I am opening domain2/index.aspx page as popup from domain1/default.aspx page. While closing domain2 page i need to reload the domain1 page, i had given the javascript code as "Opener.Location.Reload();". I am getting <strong>Permission denied</strong> javascript error. ...
<p>I found that setting a parentUrl variable in the popup window (gotten from a query string) and then using :</p> <pre><code>window.opener.location.href = parentUrl; </code></pre> <p>works.</p> <p>I don't know why, I think it's magic, but it works (tested on IE, chrome and Firefox). You cannot read the value of win...
<p>Certain properties and actions are specifically blocked in cross-domain scenarios. What you <em>might</em> be able to do is create a function on the parent that does the code you want, then call that function from the child.</p> <p>Example:</p> <pre><code>// On the parent... function DoTheRefresh() { location....
44,220
<p>I have a need to reference two different versions of the Sharepoint API dll. I have a webservice that needs to run under both Sharepoint 2 and Sharepoint 3, but also needs to work with new features provided by the Sharepoint 3 API (Checkout and Content Approval)</p> <p>What is the best way to acheive this - I'm cu...
<p>This is how I spit out .NET 1.1 versions compiled against WSSv2 API and .NET 2.0 compiled against WSSv3 assembly. It will work for VS 2005 and 2008.</p> <p>You will need to use MSBEE <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=MSBee" rel="nofollow noreferrer">http://www.codeplex.com/Wiki/View.aspx?Pr...
<p>You could give an "extern alias" a go.</p> <p>This is one of those times when the VB late binding (option strict off) approach works well. Roll on C# 4.0 and <code>dynamic</code>.</p> <p>You might try writing an interface for the bits you need (in a base library), and write 2 dlls: one referencing each version of ...
36,470
<p>Any information on how to display the ODBC connections dialog and get the chosen ODBC back?</p>
<pre><code>// a_RootKey is Microsoft.Win32.RegistryKey // DSN is a class not provided in this code sample - you can see what properties are needed from the usage below. List&lt;DSN&gt; DsnList = new List&lt;DSN&gt;(); Microsoft.Win32.RegistryKey SearchKey = a_RootKey.OpenSubKey("SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data S...
<p>OK since no one seems to have an answer, how about iterating throught the ODBC connections by DBSource, I.e. SQLServer or MySQL</p>
9,015
<p>On a SQL Server 2005 database, one of our remote developers just checked in a change to a stored procedure that changed a "select scope_identity" to "select @@identity". Do you know of any reasons why you'd use @@identity over scope_identity?</p>
<p><code>@@IDENTITY</code> will return the last identity value issued by the current session. <code>SCOPE_IDENTITY()</code> returns the last identity value in the current session and same scope. They are usually the same, but assume a trigger is called which inserted something somewhere just before the current statemen...
<p>If you wanted the trigger use you could get another trigger added on is the only reason I can come up with. Even then it's dangerous as another trigger could be added and again you would get the wrong identity. I suspect the developer doesn't know what he is doing. But honestly the best thing to do is to ask him why...
46,044
<p>I was trying to follow some instructions today, and it starts with the comment </p> <pre><code> REM In SQLPlus I manually copy in each line and execute it. </code></pre> <p>That's nice, I don't have SQLPlus, I have SQLDeveloper. The lines that were pasted in were of the type:</p> <pre><code> @\\server\dir\dir\d...
<p>To run scripts in SQL Developer:</p> <pre><code>@"\Path\Scriptname.sql" </code></pre> <p>(You only need the quotes if there are any spaces)</p> <p>You can set a default Path: Tools menu > Preferences > Database > Worksheet > Select default path to look for scripts </p>
<p>This would do it:</p> <pre><code>begin procedure_name ('parameter1', 'parameter2'); end; / </code></pre>
36,790
<p>For background see my question <a href="https://stackoverflow.com/questions/291761/converting-a-fairly-simple-c-class-library-into-a-com-object">here</a>.</p> <p>So the problem now isn't that I can't send a <code>DataSet</code> to classic ASP but that it can't do anything with it. So I found some code to create a ...
<p>I think you want to work with Data-based objects and XML based data. If it's true, I suggest using <code>ADODB</code> Classes (It is in COM References: Microsoft ActiveX Data Objects 6.0 Library -Or in other versions like 2.8-).</p> <p>You can convert your <code>DataTable</code> to a <code>ADODB.Recordset</code> by...
<p>First, the line:</p> <pre><code>theStream = (MemoryStream)theWriter.BaseStream; </code></pre> <p>is redundant as the <code>MemoryStream</code> should already be the base stream for the writer.</p> <p>What it sounds like you want is just:</p> <pre><code>theWriter.Close(); theStream.Position = 0; // So you can sta...
38,600
<p>I've been using Subversion for code control with TortoiseSVN to interface with the server for the past few months, and in general it's been going great! However, occasionally my FoxPro IDE will change the case of a file extension without warning where "<em>program.prg</em>" becomes "<em>program.<strong>PRG</em></st...
<p>Unfortunately, Subversion is case-sensitive. This is due to the fact that files from Subversion can be checked out on both case-sensitive file systems (e.g., *nix) and case-insensitive file systems (e.g., Windows, Mac).</p> <p><a href="http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/case-insen...
<p>Nope you sure can't. SVN is case-sensitive unless you were to rewrite the code somehow ... it <em>is</em> open-source.</p>
3,539
<p>What's an easy to use SNMP client library for c++?</p>
<p>Probably the best choice is <a href="http://www.net-snmp.org/" rel="noreferrer">net-snmp</a>. Note that the library has "C" linkage but will work just fine with C++.</p>
<p><a href="http://sourceforge.net/projects/opensnmp/" rel="nofollow">OpenSNMP</a> contains a complete multi-threaded implementation of SNMPv3 that is done in C++ (complete with classes, etc). It's not heavily used and maintained though.</p> <p>Net-SNMP with v3 over TLS/DTLS is likely to be threadsafe as it's really ...
30,957
<p>I'm working on a web app that is somewhere between an email service and a social network. I feel it has the potential to grow really big in the future, so I'm concerned about scalability.</p> <p>Instead of using one centralized MySQL/InnoDB database and then partitioning it when that time comes, I've decided to cr...
<p>The place where this will fail is if you have to do what's called "shard walking" - which is finding out all the data across a bunch of different users. That particular kind of "query" will have to be done programmatically, asking each of the SQLite databases in turn - and will very likely be the slowest aspect of y...
<p>Having one database per user would make it really easy to restore individual users data of course, but as <a href="https://stackoverflow.com/users/1786/john-sheehan">@John</a> said, schema changes would require some work.</p> <p>Not enough to make it hard, but enough to make it non-trivial.</p>
15,673
<p>I need to find whether the web page is cached or not. That s loaded newly or its appeared in cache.</p>
<p>Include generated timestamp somewhere in your response, and store the the timestamp somewhere in the server (maybe in the cache object). That way you know the version of the page by examining those values. </p> <p>If you could elaborate more on the scenario you're facing, I'm sure you'll get better answer.</p>
<p>You have either client-side or server-side caching and these are discrete in that they have no knowledge of each other.</p> <p>On the server-side examine the Response.Cache object.</p>
34,983
<p>As a consultant I get to toy around with many different products and APIs as the customer demands we use X and Y. I think it is great fun and I learn a lot from it.</p> <p>What will make a great developer over time is, in my opinion, the will to understand and learn new things. Therefore, I will always try to under...
<p>For me it depends. When I'm learning a new technology stack or API I'll typically break out Reflector, and my usage of it goes up.</p> <p>For instance I recently started working with the Commerce Server 2007 API. I found much of the documentation around the Profile System incomplete or lacking in sufficient detai...
<p>Since I develop for both .net and compact .net framework, I sometimes decompile the full .net assemblies to "copy" existing functionality to the compact framework.</p> <p>Other than that I don't spend that much time decompiling libs. Mostly only when something doesn't works and the problem clearly points to an asse...
10,900
<p>A similar question was already asked ( <a href="https://stackoverflow.com/questions/7492/how-do-you-stress-test-a-web-application">Performing a Stress Test on Web Application?</a>), but I'd like to test a web application that prevents double-submits and takes some counter-XSRF actions and therefore REQUIRES JavaScr...
<p><a href="http://wtr.rubyforge.org/" rel="nofollow noreferrer">Watir</a>? </p> <blockquote> <p>Watir is a simple open-source library for automating web browsers. Watir drives browsers the same way people do. It clicks links, fills in forms, presses buttons. Watir also checks results, such as whether expected te...
<p>I've tried Badboy which is OK. The big, fat, heavy tool is SilkTest. It requires a lot of programming to get up and running, but you can get something very solid done!</p> <p>If you only need to stress test request from e.g. IIS log files, I have a custom build tool. I will publish it at CodePlex very soon.</p>
26,505
<p>There are many types of external dependencies. Interfacing with external applications, components or services (e.g. Outlook to send emails, TWAIN or WIA for scanning, ActiveX objects and Web services for various purposes, and so on).</p> <p>What is your strategy for making sure that your application is robust, and ...
<p>Our strategy, is that our software may not except in exceptional circumstances. So we program quite defensively:</p> <ul> <li>If there is no mail connection, the mail functionality is not available.</li> <li>Graphic output depends on available graphics card.</li> <li>Only the availability of a network enables the d...
<p>Also note, that with external interfaces, much as with user input, you should <em>not trust that input</em>. Always <em>validate input</em>, and check for consistency (or existence) when calling.</p>
47,332
<p>I like the status email sent by TFS's alerts mechanism when a build breaks. However I would like to send such an email to the entire team and not rely on the team to subscribe to the alert...</p> <p>Having a hard time producing a nice and detailed enough message by myself when overriding the "OnBuildBreak" and usin...
<p>You could try.</p> <p><a href="http://www.woodwardweb.com/gadgets/000434.html" rel="nofollow noreferrer">Brian the build bunny</a></p> <p>:-)</p>
<p>In my mind, a open source project named 'Web Deployment Projects' can do this. your can search for it.</p>
5,886
<h2>Problem</h2> <p>Language: C# 2.0 or later</p> <hr> <p>I would like to register context handlers to create menues when the user right clicks certain files (in my case *.eic). What is the procedure to register, unregister (clean up) and handle events (clicks) from these menues?</p> <p>I have a clue it's something...
<p>Resist writing Shell Extensions in managed languages - there are a multitude of things that could go bang if you pursue this route.</p> <p>Have a browse through this thread for more details. It contains links to do it if really want, and sagely advice of why it can be done, but shouldn't.</p> <p><a href="http://s...
<p>As the prior comments mention, it isn't the best idea to write shell extensions in managed languages, but I thought I'd share an Open Source project that is doing just that :)</p> <p><a href="http://code.google.com/p/shellglue/" rel="nofollow noreferrer">ShellGlue</a> is a managed shell extension that is actually q...
14,327
<p>Internationalizing web apps always seems to be a chore. No matter how much you plan ahead for pluggable languages, there's always issues with encoding, funky phrasing that doesn't fit your templates, and other problems.</p> <p>I think it would be useful to get the SO community's input for a set of things that prog...
<p>Internationalization is hard, here's a few things I've learned from working with 2 websites that were in over 20 different languages:</p> <ul> <li>Use UTF-8 everywhere. No exceptions. HTML, server-side language (watch out for PHP especially), database, etc.</li> <li>No text in images unless you want a ton of work. ...
<p>I have a couple apps that are "bilingual" I used resource files in ASP.NET1.1</p> <p>There is also something called the String Resource Tool Basically you put all your strings in a .RES file for both languages and then determine what file to read from based on Culture or whether someone clicked a Link for the langu...
18,836
<p><strong>NOTE: the original question is moot but scan to the bottom for something relevant.</strong></p> <p>I have a query I want to optimize that looks something like this:</p> <pre><code>select cols from tbl where col = "some run time value" limit 1; </code></pre> <p>I want to know what keys are being used but w...
<p>You are getting "Impossible WHERE noticed" because the value you specified is not in the column, not just because it is a constant. You could either 1) use a value that exists in the column or 2) just say <code>col = col</code>:</p> <pre><code>explain select cols from tbl where col = col; </code></pre>
<blockquote> <p>How do you optimize a query with values that are constant only to the query but where I, the programmer, don't known in advance what value will be used?</p> </blockquote> <p>By using indexes on the specific columns (or even on combination of columns if you always query the given columns together). If...
40,189
<p>I've scoured the groovy doc and haven't found an analogue, but things there are organized a bit haphazardly. I'm switching from beanshell to groovy and was using the source("fileloc") method in beanshell to inline-include other, utility beanshell scripts for reuse. Is there a standard function to do this in groovy o...
<p>You can assemble all the parts of your scripts into a String, then have a GroovyShell object evaluate your script. I picked this up from Venkat Subramanium's DSL examples.</p> <pre><code>part1 = new File("part1.groovy").text part2 = new File("part2.groovy").text script = """ println "starting execution" ${part1} ...
<p>The reason you're not finding this is because Groovy is compiled. Your Groovy code gets compiled into Java bytecode that gets run by the JVM right along side any Java code in your app. This is why things like writing Groovified unit tests for large bodies of Java code requires zero extra effort.</p> <p>The BeanSh...
38,940
<p>When creating the <code>id</code> attributes for HTML elements, what rules are there for the value?</p>
<p>For <a href="http://www.w3.org/TR/html4/types.html#type-id" rel="noreferrer">HTML 4</a>, the answer is technically:</p> <blockquote> <p>ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (...
<p>alphabets → caps &amp; small</p> <p>digits → 0-9</p> <p>special characters → ':', '-', '_', '.'</p> <p>The format should be either starting from '.' or an alphabet, followed by either of the special characters of more alphabets or numbers. The value of the id field must not end at an '_'.</p> <p>Also, spaces are not...
9,602
<p>I'm using Visual C++ 2005 and would like to know the simplest way to connect to a MS SQL Server and execute a query.</p> <p>I'm looking for something as simple as ADO.NET's SqlCommand class with it's ExecuteNonQuery(), ExecuteScalar() and ExecuteReader().</p> <p>Sigh offered an answer using CDatabase and ODBC.</p>...
<p>With MFC use CDatabase and ExecuteSQL if going via a ODBC connection.</p> <pre><code>CDatabase db(ODBCConnectionString); db.Open(); db.ExecuteSQL(blah); db.Close(); </code></pre>
<p>Try the Microsoft Enterprise Library. A version should be available <a href="http://www.codeplex.com/entlib" rel="nofollow noreferrer">here</a> for C++. The SQlHelper class impliments the methods you are looking for from the old ADO days. If you can get your hands on version 2 you can even use the same syntax.</p>
4,513
<p>I recently started working on a large complex application, and I've just been assigned a bug due to this error:</p> <pre><code>ORA-04091: table SCMA.TBL1 is mutating, trigger/function may not see it ORA-06512: at "SCMA.TRG_T1_TBL1_COL1", line 4 ORA-04088: error during execution of trigger 'SCMA.TRG_T1_TBL1_COL1' </...
<p>I think I disagree with your description of what the trigger is trying to do. It looks to me like it is meant to enforce this business rule: For a given value of t1_appnt_event, only one row can have a non-NULL value of t1_prnt_t1_pk at a time. (It doesn't matter if they have the same value in the second column or...
<p>I agree with Dave that the desired result probalby can and should be achieved using built-in constraints such as unique indexes (or unique constraints).</p> <p>If you really need to get around the mutating table error, the usual way to do it is to create a package which contains a package-scoped variable that is a ...
49,198
<p>I've got a problem where incoming SOAP messages from one particular client are being marked as invalid and rejected by our XML firewall device. It appears extra payload data is being inserted by Visual Studio; we're thinking the extra data may be causing a problem b/c we're seeing "VsDebuggerCausalityData" in these ...
<p>A quick google reveals that this should get rid of it, get them to add it to the web.config or app.config for their application. </p> <pre><code>&lt;configuration&gt; &lt;system.diagnostics&gt; &lt;switches&gt; &lt;add name="Remote.Disable" value="1" /&gt; &lt;/switches&gt; &lt;/system.diagnostic...
<p>Or use "Start without debugging" in Visual Studio.</p>
5,288
<p>There is an actual running Java ServerPages (JSP) application within a *NIX box which I somewhat administer with kind of good permissions. The idea is to create a new but dead simple JSP page to control some Korn Shell scripts I've got running there. So the goal is to make some sort of HTML form that will be writing...
<p>You may have security issues here. Consider what risks you have and take appropriate steps to authenticate users and ensure they are authorized for this operation. The steps necessary for this depend to some extent on the servlet container you are using.</p> <p>You don't need a library like Apache Commons IO for a ...
<p>Possibly <a href="http://commons.apache.org/io/api-release/org/apache/commons/io/FileUtils.html#touch(java.io.File)" rel="nofollow noreferrer">http://commons.apache.org/io/api-release/org/apache/commons/io/FileUtils.html#touch(java.io.File)</a> ?</p>
39,368
<p>I use ASP.Net and I have a custom 404 page. When user pastes url that is not found it will redirected to the custom 404 page. However google indexes my custom 404 page. Search 404(page not found).</p> <p>Anyone have solution?</p>
<p>You can make your errors directory or each file off-limits to google by adding it to your robots.txt file in the root of your site. This actually applies to any directories/files that you don't want google to index.</p> <p>More information on robots.txt can be found at <a href="http://en.wikipedia.org/wiki/Robots....
<p>You will always see a log entry for Google hitting your 404 page. Because Google needs to request the page in order to know that it has a status of 404. However you should never see this page in the search results, if that is what you are asking?</p>
33,559
<p>The system I'm currently working on consists of a controller PC running XP with .Net 2 connected to a set of embedded systems. All these components communicate with each other over an ethernet network. I'm currently using TcpClient.Connect on the XP computer to open a connection to the embedded systems to send TCP/I...
<p>Try using a Socket for your client instead of the TcpClient Class.</p> <p>Then you can use Socket.Bind to target your local network adapter</p> <pre><code> int port = 1234; IPHostEntry entry = Dns.GetHostEntry(Dns.GetHostName()); //find ip address for your adapter here IPAddress localAddress = ent...
<p>Basically, once the TcpClient.Connect method has been successful, it will have created a mapping between the physical MAC address of the embedded system and the route it should take to that address (i.e. which network card to use).</p> <p>I don't believe that all messages then sent over the TcpClient connection wil...
7,211
<p>Even on big-time sites such as Google, I sometimes make a request and the browser just sits there. The hourglass will turn indefinitely until I click again, after which I get a response instantly. So, the response or request is simply getting lost on the internet. </p> <p>As a developer of ASP.NET web applicatio...
<p>It's possible that a request made from the client took a particular path which happened to not work at that particular moment. These are unavoidable - they're simply a result of the internet, which is built upon unstable components and which TCP manages to ensure a certain kind of guarantee for.</p> <p>Like someone...
<p>This problem/situation isn't only ASP related, but it covers the whole concept of keeping your apps up and its called informally the "5 nines" or "99.999% availability".</p> <p>The wikipedia article is <a href="http://en.wikipedia.org/wiki/High_availability" rel="nofollow noreferrer">here</a></p> <p>If you lookup ...
36,823
<p>When running the below code a type is never returned, despite there being a class with the correct attribute assigned. In fact the attr array always has a length of 0.</p> <pre><code>Assembly a = Assembly.LoadFile(file); foreach (Type t in a.GetTypes()) { object[] attr = t.GetCustomAttributes(typeof(SchemeNameA...
<p>You mixed two different contexts of loading assemblies: "Load Context" in which your application is running, and "No context" in which you load secondary assembly from using LoadFile. You want to read <a href="http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx" rel="nofollow noreferrer">this</a> and <a href...
<p>I suspect you have re-declared the attribute - i.e. the SchemeNameAttribute type is declared (separately) in two assemblies (perhaps by copying a .cs). This will not work; types are scoped by their assembly, so SchemeNameAttribute in Foo.dll is a different type to SchemeNameAttribute in Bar.dll/Bar.exe.</p> <p>You ...
39,163
<p>This exception is consistently thrown on a SOAP Request which takes almost three minutes to receive and is 2.25 megs in size. </p> <p>When scouring the web I find all sorts of posts which all seem to be about setting headers on the Request, some want me to not send the "Expect:" header, some want me to send the "Ke...
<p>You tagged the post as .NET35, so are you using WCF? </p> <p>If so, here is an example of the App.config we use for large data sets:</p> <pre><code>&lt;system.serviceModel&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="BasicHttpBinding" maxBufferSize="2147483647" maxReceivedMessa...
<p>For WCF with EF, just add the following code in the context class.</p> <p>base.Configuration.ProxyCreationEnabled = false;</p>
36,221
<p>Has anyone had experience with MySource Matrix as a content management system? If so, thoughts/opinions/comments? </p> <p>Thanks in advance. </p>
<p>Absolutely excellent. It takes little while to get used to how it does things with its asset structure, but it is really flexible and powerful. Simple edit interfaces are great too.</p> <p>Make sure you give it enough hardware. If you want dynamic content without caching you need heaps of grunt to make it hum.</p>
<p>I've recently been trying to use it in an organization where many non power users are generating content. - it has many interface bugs and odd behavior, so that many simple tasks (i.e. loading images) often have to be done by an power user (i.e. me).</p> <p>When you are editing the HTML of page content white space ...
29,935
<p>I have a little project with some jsp deployed on an Tomcat 5.5. Recently the Servlets which are also deployed with the jsp files (one war archive) stopped working. I also checked out a previous version from my svn which should work. What I noticed that the <code>displayname</code> (I use a german version of Tomcat ...
<p>Is the <code>&lt;display-name&gt;</code> element in the web.xml file? Is the <code>web.xml</code> file in the WAR and at <code>/WEB-INF/web.xml</code>? Does it validate (eclipse can do that, or try <a href="http://validator.w3.org/" rel="noreferrer">w3c.org's validation service</a>)? </p>
<p>I would start by looking at the deployment descriptor for your application. i.e. web.xml. Usually, when an application is deployed but does not start its because of either a misconfig or not well formed web.xml.</p>
45,966
<p>I have a textbox whose value I want to set based on the inner text of an anchor tag. In other words, when someone clicks on this anchor:</p> <pre><code>&lt;a href="javascript:void();" class="clickable"&gt;Blah&lt;/a&gt; </code></pre> <p>I want my textbox to populate with the text "Blah". Here is the code I am cu...
<p>I wrote this code snippet and it works fine:</p> <pre><code>&lt;a href="#" class="clickable"&gt;Blah&lt;/a&gt; &lt;input id="textbox"&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("a.clickable").click(function(event){ event.preventDefault(); $("input#t...
<p>Following redsquare: You should not use in href attribute javascript code like "javascript:void();" - it is wrong. Better use for example href="#" and then in Your event handler as a last command: "return false;". And even better - use in href correct link - if user have javascript disabled, web browser follows the ...
37,693
<p>I am currently in the process of restructuring my local Subversion repository by adding some new projects and merging legacy code and data from a couple of older repositories into it. </p> <p>When I have done this in the past I have usually put the legacy code in a dedicated "legacy" folder, as not to "disturb" the...
<p>All code becomes 'legacy' one day, why seperate it at all? Source control is by project/branch or project/platform/branch and that type of hierarchy. Who cares how long in the tooth it is?</p>
<p>Use <em>Externals Definitions</em> (<a href="http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html" rel="nofollow noreferrer">svn:externals</a> property) to reference your legacy code as you would a third-party repository. </p> <p>Then you can separate your refactoring work from your dependent projects an...
7,463
<p>What sort of mathematics do you use in your .NET application, excluding <em>everything</em> that's in <a href="http://msdn.microsoft.com/en-us/library/system.math.aspx" rel="nofollow noreferrer">System.Math</a>? </p> <p>I think that System.Math is woefully inadequate. For example, in several official <a href="http:...
<p>I rarely need anything outside of basic 'accounting math'.</p>
<p>Expression evaluation like that in <a href="http://codeplex.com/flee" rel="nofollow noreferrer">Flee</a> or <a href="http://hebertsoft.com/dotmath/" rel="nofollow noreferrer">Dotmath</a> (see <a href="https://stackoverflow.com/questions/174664/operators-as-strings">here</a> and <a href="https://stackoverflow.com/que...
27,192
<p>I'm running a master-slave MySQL binary log replication system (phew!) that, for some data, is not in sync (meaning, the master holds more data than the slave). But the slave stops very frequently on the slightest MySQL error, can this be disabled? (perhaps a my.cnf setting for the replicating slave ignore-replicati...
<p>Yes, with --slave-skip-errors=xxx in my.cnf, where xxx is 'all' or a comma sep list of error codes.</p>
<p>i think you are doing replication with out sync the database first sync the database and try for replication and servers are generating same unique ids and try to set auto incerment offset</p>
5,054
<p>I'm looking for a <i>free</i> JavaScript obfuscator. Would compression be enough? What tools would you recommend? Of course, I don't need military-style obfuscation, I need a <i>simple</i> way to prevent kiddies from stealing my javascript by looking at the source or by using something simple such as unescape().<br ...
<p>Your problem is that no matter how much you compress it or hide it, eventually the browser has to interpret it. The best you can do is renaming all variables to meaningless random vars, and removing all comments and whitespace.</p> <p><strong>A few good tools:</strong></p> <ul> <li><a href="http://www.dev411.com/...
<p><a href="http://www.javascriptobfuscator.com/Default.aspx" rel="nofollow noreferrer">http://www.javascriptobfuscator.com/Default.aspx</a></p> <p><a href="http://ajaxian.com/archives/utility-javascript-obfuscator" rel="nofollow noreferrer">http://ajaxian.com/archives/utility-javascript-obfuscator</a></p>
34,271
<pre><code>$(document).ready(function(){ $(".txtDate").datepicker({ showOn: "both", buttonImage: "library/ui/datepicker/img/calendar2.gif", dateFormat: "yy/mm/dd", buttonImageOnly: true }); //added this checkbox click for something I given earlier $("#Table input").click(function() { if ...
<p>There's nothing wrong with your JQuery code - though it'd be cleaner if you used <a href="http://docs.jquery.com/Attributes/toggleClass#class" rel="noreferrer">toggleClass</a>:</p> <pre><code> $('#Table INPUT').click(function() { $(this).parent().parent().toggleClass('highlight'); }); </code></pre> <p>I'd gu...
<p>The first problem that I see is that there is no element with id "Table input" ie that matches "#Table input" -- at least not in the html you provided. No matter what, the id can't have a space so check that. I'll be glad to help you further if you need.</p>
47,460
<p>Can anoyne recommend a good library that will let me easily read/write private member fields of a class? I was looking through apache commons, but couldnt see it. I must be getting blind ?</p> <p>Edit: Asking questions on the border of legalities always give these questions of "why"? I am writing several javarebel ...
<p>In most of the cases java <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/package-summary.html" rel="nofollow noreferrer">reflection</a> solves the problem:</p> <p>Example:</p> <pre><code>public class Foo { /** * Gets the name Field. * * @return the name */ public f...
<p>The <code>java.lang.reflect</code> package classes and methods allow this access, within certain limits.</p> <p>See <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/package-summary.html" rel="nofollow noreferrer">java.lang.reflect</a></p>
30,260
<p>I'm losing my mind, it all started out with the idea of a project where I want an abstract shape (I'm going to call it a stretched cube with an angle), now I know a bit of Vectorworks - a 3D/Architecture drawing program. I found nothing in all the tutorials how to make something low poly but still be able to for exa...
<p>Yes, you can accomplish threading easily with something like 3Ds Max, Blender, Maya etc. I use Maya personally so, in Maya, all you have to do is:</p> <ol> <li>Create a cylinder. This will be the main body of your 'screw'.</li> <li>To make the thread, you need to create a helix primitive. You can edit the number of...
<p>I've had my share of struggles with the issues you're having - bridging the software gap between hard-edge, parametric modeling tools (typically CAD) and more free-form, 'soft'/organic, modeling tools. It's not a trivial task to work across both domains simultaneously.</p> <p>The simplest workflow I've developed is...
259
<p>When reading about SQL Injection and XSS i was wondering if you guys have a single string that could be used to identify those vulnerabilities and others.</p> <p>A string that could be thrown into a website database to black box check if that field is safe or not. (going to do a large test on a few inhouse tools)</...
<p>I've found some nice firefox addons that do the trick.</p> <p><a href="https://addons.mozilla.org/en-US/firefox/addon/7598" rel="noreferrer">XSS Me</a></p> <p><a href="https://addons.mozilla.org/en-US/firefox/addon/7597" rel="noreferrer">SQL Inject Me</a></p>
<p>See the <a href="http://www.owasp.org/index.php/Main_Page" rel="nofollow noreferrer">OWASP</a> site for examples.</p>
34,604
<p>My cron job is running an hour later after end of DST. This didn't happen to other user's jobs on the same machine (AIX). What am I doing wrong?</p>
<p>I think the first thing to find out is the timezone that cron is running under:</p> <p>0 1 * * * (/usr/bin/date ; /usr/bin/date -u) > ~/cron.out</p> <p>You might also want to get one of the users whose cron jobs are working to do it as well.</p>
<p>You have probably already checked this, but was the time changed correctly on the server?</p>
32,982
<p>Suppose I have code like this:</p> <pre><code>template&lt;class T, T initial_t&gt; class Bar { // something } </code></pre> <p>And then try to use it like this:</p> <pre><code>Bar&lt;Foo*, NULL&gt; foo_and_bar_whatever_it_means_; </code></pre> <p>GCC bails out with error (on the above line):</p> <blockquote> ...
<p>Rethinking your code is probably the best way to get around it. The thread you linked to includes a clear quote from the standard indicating that this isn't allowed.</p>
<p>Have you tried:</p> <pre><code>Bar&lt;Foo*, (Foo*)NULL&gt; foo_and_bar_whatever_it_means_; </code></pre> <p>? </p> <p>or reinterpret_cast(0)?</p>
34,773
<p>I have an HTTP server which is in our internal network and accessible only from inside it. I would like to put another server that would listen to an HTTPS port accessible from outside, and forward the requests to that HTTP server (and send back the responses via HTTPS). I know that there are several ways to do this...
<p>With Apache look into mod_proxy.</p> <p><a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html" rel="nofollow noreferrer">Apache 2.2 mod_proxy docs</a></p> <p><a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html" rel="nofollow noreferrer">Apache 2.0 mod_proxy docs</a></p>
<p>With Apache look into mod_proxy.</p> <p><a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html" rel="nofollow noreferrer">Apache 2.2 mod_proxy docs</a></p> <p><a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html" rel="nofollow noreferrer">Apache 2.0 mod_proxy docs</a></p>
12,347
<h2>Setup</h2> <p>I have a website that draws RSS feeds and displays them on the page. Currently, I use percentages on the divs that contain each feed, so that multiples can appear next to each other.</p> <p>However, I only have two next to each other, and if the window resizes, there can be some ugly empty space on ...
<p>You probably cannot get what you want with just CSS/HTML, but you can get somewhat close.</p> <p>A trick I used for a photo album is this:</p> <ol> <li>Make sure each feed has a fixed width, I would recommend something like '20em';</li> <li>Make sure each feed has the same height.</li> <li>Float everything left.</...
<p>The only way I can think of is a mixture of dynamic CSS and javascript. Every time a column (feed) is added, use the javascript to rewrite the width (in percentage) of each div. </p> <p>jQuery would come in handy here.</p> <pre><code>var columns = $(".feed").size(); var size = 100/columns; $(".feed").css("width",...
34,247
<p>Is there an open-source alternative to MATLAB's <a href="https://www.mathworks.com/help/optim/index.html;jsessionid=95cd06964ab253598de29e7d0a80" rel="nofollow noreferrer"><code>fmincon</code></a> function for constrained linear optimization? I'm rewriting a MATLAB program to use Python / <a href="https://numpy.org/...
<p>Is your problem convex? Linear? Non-linear? I agree that SciPy.optimize will probably do the job, but fmincon is a sort of bazooka for solving optimization problems, and you'll be better off if you can confine it to one of the categories below (in increasing level of difficulty to solve efficiently)</p> <ul> <li>L...
<p>Scilab has an implementation of fmincon (using IPOpt) which is now regularly updated:</p> <p><a href="https://atoms.scilab.org/toolboxes/fmincon" rel="nofollow noreferrer">https://atoms.scilab.org/toolboxes/fmincon</a></p> <p>For large-scale optimization it outperforms Matlab's fmincon.</p>
7,254
<p>I have an AST derived from the ANTLR Parser Generator for Java. What I want to do is somehow construct a control flow graph of the source code, where each statement or expression is a unique Node. I understand there must be some recursiveness to this identification, I was wondering what you would suggest as the best...
<p>Usually CFGs are computed on a lower-level representation (e.g. JVM bytecode). Someone did <a href="http://www.ssw.uni-linz.ac.at/General/Staff/TW/Wuerthinger06Bachelor.pdf" rel="noreferrer">a thesis</a> on such things a few years ago. There might be a helpful way described in there for how to get at that represen...
<p>Did you ever tryed <a href="http://placidsystems.com/screenshots.aspx" rel="nofollow noreferrer">ANTLR Studio</a>? It does not generate the hole AST graph, but for review, its already quite helpful.</p>
11,798
<p>I want to take a screenshot via a python script and unobtrusively save it.</p> <p>I'm only interested in the Linux solution, and should support any X based environment.</p>
<p>This works without having to use scrot or ImageMagick.</p> <pre><code>import gtk.gdk w = gtk.gdk.get_default_root_window() sz = w.get_size() print "The size of the window is %d x %d" % sz pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,sz[0],sz[1]) pb = pb.get_from_drawable(w,w.get_colormap(),0,0,0,0,sz[0],sz[1...
<p>Try it:</p> <pre><code>#!/usr/bin/python import gtk.gdk import time import random import socket import fcntl import struct import getpass import os import paramiko while 1: # generate a random time between 120 and 300 sec random_time = random.randrange(20,25) # wait between 120 and 300 seconds (o...
9,499
<p>After looking at other questions related to sharing solutions between VS 2005 and VS 2008 it seems that the way to go is to have two solution files (one for VS 2005 and one for VS 2008). </p> <p>However, if the solution is under source control (VisualSVN in our case), how would we maintain two solution files and n...
<p>I'm not sure I see the problem - if you've got two solution files, why would either of them be overwritten? I do really mean two files, e.g. MyApp2005.sln and MyApp2008.sln, where when you create a new project you do it in the 2005 solution and then just "add existing project" in the 2008 solution.</p> <p>What woul...
<p>It's working now.</p> <p>I was trying to upgrade/convert the solution to 2008 (solution name the same as the 2005 one) and somehow block the 2008 solution file from commit/update.</p> <p>I have now created a new blank solution in VS 2008 (different name) and used "add existing project" as you suggested.</p> <p>Th...
28,355
<p>I'm writing a custom file selection component. In my UI, first the user clicks a button, which pops a <code>JFileChooser</code>; when it is closed, the absolute path of the selected file is written to a <code>JTextField</code>.</p> <p>The problem is, absolute paths are usually long, which causes the text field to e...
<p>It may depend on the layout manager your text field is in. Some layout managers expand and some do not. Some expand only in some cases, others always. </p> <p>I'm assuming you're doing</p> <pre><code>filedNameTextField = new JTextField(80); // 80 == columns </code></pre> <p>If so, for most reasonable layouts, ...
<p>I solved this by setting the maximum width on the container of the text field, using <code>setMaximumSize</code>.</p> <p>According to davetron's answer, this is a fragile solution, because the layout manager might disregard that property. In my case, the container is the top-most, and in a first test it worked.</p>...
15,581
<p>Suppose I have the following two strings containing regular expressions. How do I coalesce them? More specifically, I want to have the two expressions as alternatives.</p> <pre><code>$a = '# /[a-z] #i'; $b = '/ Moo /x'; $c = preg_magic_coalesce('|', $a, $b); // Desired result should be equivalent to: // '/ \/[a-zA-Z...
<p>I see that porneL actually <a href="https://stackoverflow.com/questions/244959/coalescing-regular-expressions-in-php#245326">described</a> a bunch of this, but this handles most of the problem. It cancels modifiers set in previous sub-expressions (which the other answer missed) and sets modifiers as specified in eac...
<pre><code>function preg_magic_coalasce($split, $re1, $re2) { $re1 = rtrim($re1, "\/#is"); $re2 = ltrim($re2, "\/#"); return $re1.$split.$re2; } </code></pre>
30,391
<p>I am planning a fresh installation of <strong>SQL Server 2005</strong> on a new machine, which I have to order. I know that <strong>tempdb tuning</strong> is very important to the overall <strong>performance</strong> of the SQL Server instance.</p> <p>I've read that it's best practice to create as many tempdb files...
<p><em>Here is what I researched myself from a variety of sources.</em></p> <p>In order to optimize tempdb performance pay attention to physical disk configuration, file configuration, as well as some settings within the database. </p> <p><strong>Physical disk configuration</strong></p> <p>tempdb should reside on it...
<p>i would recommend to create data files between 1/2 and 1/4 * number of cores. you should place these files on the fastest disk you have </p> <p>for more information you can look here: <a href="http://www.sqlserveroptimizer.com/2013/03/how-to-configure-sql-server-tempdb-for-optimal-performance/" rel="nofollow">SQL S...
46,991
<p>For instance, does the compiler know to translate</p> <pre><code>string s = "test " + "this " + "function"; </code></pre> <p>to</p> <pre><code>string s = "test this function"; </code></pre> <p>and thus avoid the performance hit with the string concatenation?</p>
<p>Yes. This is guaranteed by the C# specification. It's in section 7.18 (of the C# 3.0 spec):</p> <blockquote> <p>Whenever an expression fulfills the requirements listed above, the expression is evaluated at compile-time. This is true even if the expression is a sub-expression of a larger expression that ...
<p>I believe the answer to that is yes, but you'd have to look at what the compiler spits out ... just compile, and use reflector on it :-)</p>
36,766
<p>When using gdb and Vim, often I want to stop on a particular line. Normally in Vim I copy-paste the line number showing on the rule area to the gdb session. It'd save me a lot of hassle if I could use something like <code>"+&lt;magic-incantation&gt;</code> to copy the line number of the current cursor position into ...
<p>put this in your vimrc</p> <pre><code>map ,n &lt;Esc&gt;:let @*=line(".")&lt;CR&gt; </code></pre> <p>then using <kbd>,</kbd><kbd>n</kbd> will copy the current line number into the clipboard</p>
<p>Not sure if this is what you're after but have you tried using markers?</p> <p>Put the cursor on the line you want, then enter m and a letter, say a.</p> <p>Entering 'a will take you to the line containing the marker. </p> <p>Entering `a will take you to the actual letter that you marked in the line.</p> <p>Hmm,...
37,737
<p>I need a cross platform solution for clearing the console in both Linux and Windows written in C++. Are there any functions in doing this? Also make note that I don't want the end-user programmer to have to change any code in my program to get it to clear for Windows vs Linux (for example if it has to pick between t...
<p>Short answer: you can't.</p> <p>Longer answer: Use a curses library (ncurses on Unix, <a href="http://pdcurses.sf.net/" rel="noreferrer">pdcurses</a> on Windows). NCurses should be available through your package manager, and both ncurses and pdcurses have the exact same interface (pdcurses can also create windows i...
<p>Wouldn't </p> <pre><code>for (int i=0;i&lt;1000;i++){cout&lt;&lt;endl;} </code></pre> <p>clear the screen in all OSes?</p>
28,291
<p>After upgrading a project from Delphi 2007 to Delphi 2009 I'm getting an Unknown memory leak, so far I've been tryin to track it down using fastMM, here is what fastMM stack trace reports:</p> <pre><code>A memory block has been leaked. The size is: 20 This block was allocated by thread 0x111C, and the stack trace ...
<p>This memory leak was being caused by a Delphi bug, QC <a href="http://qc.embarcadero.com/wc/qcmain.aspx?d=67709" rel="noreferrer">#67709</a></p> <p>It was fixed by the last Delphi 2009 update, no wonder I wasn't able to fix it.</p>
<p>IIRC VCL had a few very small leaks like this that you can ignore without much worry. This might be one of them!? Hope somebody clarifies this point.</p>
34,202
<p>I've executed a JDBC query to obtain a resultset. Before iterating over it, I'd like to quickly find out how many rows were returned. How can I do this with high performance?</p> <p>I'm using Java 6, Oracle 11g, and the latest Oracle JDBC drivers.</p>
<p>You're going to have to do this as a separate query, for example:</p> <pre><code>SELECT COUNT(1) FROM table_name </code></pre> <p>Some JDBC drivers might tell you but this is optional behaviour and, more to the point, the driver may not know yet. This can be due to how the query is optimised eg two example execut...
<p>Code:</p> <pre><code>//Create a Statement class to execute the SQL statement Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT COUNT(*) AS COUNT FROM TABLENAME"); while(rs.next()) { System.out.println("The count is " + rs.getInt("COUNT")); } //Closing the connection con.clo...
19,658
<p>In asp.net, you can retrieve MULTIPLE datatables from a single call to the database. Can you do the same thing in php?</p> <p>Example:</p> <pre><code>$sql ="select * from t1; select * from t2;"; $result = SomeQueryFunc($sql); print_r($result[0]); // dump results for t1 print_r($result[1]); // dump results for t2 ...
<p>This is called "multi-query." The mysql extension in PHP does not have any means to enable multi-query. The mysqli extension does allow you to use multi-query, but only through the multi_query() method. See <a href="http://php.net/manual/en/mysqli.multi-query.php" rel="nofollow noreferrer">http://php.net/manual/e...
<p>This should be possible with newer MySQL and the mysqli (improved) php extension. I'm not sure if any DB abstraction layers support this.</p> <p>See relevant <a href="http://dev.mysql.com/doc/refman/5.0/en/c-api-multiple-queries.html" rel="nofollow noreferrer">MySQL docs</a> and <a href="http://php.net/manual/en/m...
24,205
<p>Working with TCL and I'd like to implement something like the <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="nofollow noreferrer">Strategy Pattern</a>. I want to pass in the "strategy" for printing output in a TCL function, so I can easily switch between printing to the screen and printing to a log fi...
<p>TCL allows you to store the name of a procedure in a variable and then call the procedure using that variable; so</p> <pre><code>proc A { x } { puts $x } set strat A $strat Hello </code></pre> <p>will call the proc A and print out Hello</p>
<p>How about using variable functions? I don't remember much TCL (it's been a while...) but maybe one of these would do what you need:<br></p> <ul> <li>[$var param1 param2]</li> <li>[$var] param1 param2</li> <li>$var param1 param2</li> </ul> <p>If i'm wrong, anyone is free to correct me.</p>
31,590
<p>We use QuickBooks for financial management, and feed it from a variety of sources. I now need to hook it up to BizTalk, and I'd hate to reinvent the wheel. I've done searches, and as far as I can tell there's no QuickBooks adapter for BizTalk. Does anyone know of anything that'll do the job, preferably something tha...
<p>Quickbooks talks .NET quite easily. You'll need the QuickBooks SDK 7.0 and a copy of Visual Studio.NET, but after that it's very easy to do anything with Quickbooks. </p> <pre><code>Imports QBFC7Lib Sub AttachToDB() If isAttachedtoQB Then Exit Sub Lasterror = "Unknown QuickBooks Error" Try QbS...
<p>Unfortunately it does. It also asks you to authorise any application you've built. (at least once.) </p> <p>I don't know any way around it. </p>
6,765
<p>I have a webapp which resizes its window to exactly fit its contents:</p> <pre><code>window.resizeTo(200,300) </code></pre> <p>People do like having the page fit its window in this way. However with Firefox the next browser window the user opens comes up at the same size, which is ridiculously small.</p> <p>Is th...
<p>Two different questions at work here:</p> <p><strong>1. Specifying Window Dimensions-</strong></p> <p>Specifying window attributes using <strong>window.open</strong> will not affect the dimensions of other windows.<br> You are getting the <strong>expected behavior</strong> from Firefox with regards to the resizeTo...
<p>Here's some related information that may help users reading this post.</p> <p>Firefox has been pressured to remove support for window.resizeTo, and it appears for a short while did. See <a href="http://kb.mozillazine.org/Resizing_oversize_window#JavaScript_no_longer_allowed_to_resize_windows" rel="nofollow">http://...
22,366
<p>I'd love to create a "back" left-arrow-bezel button in a <code>UIToolbar</code>.</p> <p>As far as I can tell, the only way to get one of these is to leave <code>UINavigationController</code> at default settings and it uses one for the left bar item. But there's no way I can find to create one as a <code>UIBarButton...
<p>I used the following psd that I derived from <a href="http://www.teehanlax.com/blog/?p=447" rel="noreferrer">http://www.teehanlax.com/blog/?p=447</a></p> <p><a href="http://www.chrisandtennille.com/pictures/backbutton.psd" rel="noreferrer">http://www.chrisandtennille.com/pictures/backbutton.psd</a></p> <p>I then j...
<p>Why are you doing this? If you want something that looks like a navigation bar, use UINavigationBar.</p> <p>Toolbars have specific visual style associated with them. The Human Interface Guidelines for the iPhone state:</p> <blockquote> <p>A toolbar appears at the bottom edge of the screen and contains buttons th...
28,095
<p>I've opened a new window with window.open() and I want to use the reference from the window.open() call to then write content to the new window. I've tried copying HTML from the old window to the new window by using myWindow.document.body.innerHTML = oldWindowDiv.innerHTML; but that's doesn't work. Any ideas?</p>
<p>The reference returned by <code>window.open()</code> is to the child window's <code>window</code> object. So you can do anything you would normally do, here's an example:</p> <pre><code>var myWindow = window.open('...') myWindow.document.getElementById('foo').style.backgroundColor = 'red' </code></pre> <p>Bear in ...
<pre><code>myWindow.document.writeln(documentString) </code></pre>
20,499
<p>I have a SharePoint virtual machine in one active directory domain (for example domain1) and I want to transfer all the sites it has to another active directory domain (domain2). I don’t know which could be the best procedure to do this, if I detach and attach my virtual machine from domain1 to domain2 it probably d...
<p>There is a <a href="http://stsadm.blogspot.com/2007/09/move-web.html" rel="nofollow noreferrer">STSADM Custom Extension: move web</a> that should be what you are looking for:</p> <blockquote> <p>C:>stsadm -help gl-moveweb</p> <p>stsadm -o gl-moveweb</p> <p>Moves a web.</p> <p>Parameters: -...
<p>You may have some sucess by adding a local account to the administrators group and joining the server to the new domain. Then manualy updateing all of the AD accounts that are used in the server. I sould note that all of your users will then have new accounts that are not related to the old ones.</p> <p>You sould a...
9,920
<p>I am currently looking at different ORM solutions for a project that is planned for this spring. Entity Framework is one of the products I am looking closer at, but EF 2.0 would be quite a lot more interesting.</p> <p>Has there been any indications to when version 2.0 of Entity Framework is planned to be released? ...
<p>AFAIK it hasn't been officially announced. The best hint I saw is <a href="http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx" rel="nofollow noreferrer">here</a>, so it's probably coming with .NET 4.0. I bet they will release a CTP before that.</p>
<p>AFAIK it hasn't been officially announced. The best hint I saw is <a href="http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx" rel="nofollow noreferrer">here</a>, so it's probably coming with .NET 4.0. I bet they will release a CTP before that.</p>
32,658
<p>Does anyone know of a good code obsfucator for Perl? I'm being ask to look into the option of obsfucating code before releasing it to a client. I know obsfucated code can still be reverse engineered, but that's not our main concern. </p> <p>Some clients are making small changes to the source code that we give them ...
<p>I've been down this road before and it's an absolute nightmare when you have to work on "obfuscated" code because it drives up costs tremendously trying to debug a problem on the client's server when you, the developer, can't read the code. You wind up with "deobfuscators", copying the "real code" to the client's s...
<p>Another not serious suggestion is to use <a href="https://metacpan.org/pod/Acme%3a%3aBleach" rel="nofollow">Acme::Bleach</a>, it will make your code very clean ;-)</p>
9,648
<p>In the business I work for we are discussion methods to reduce the read load on our primary database.</p> <p>One option that has been suggested is to have live one-way replication from our primary database to a slave database. Applications would then read from the slave database and write directly to the primary da...
<p>A few cons:</p> <ul> <li>2 points of failure</li> <li>Application logic will have to take into account the delay between writing something and then reading it, since it won't be available immediately from the secondary database</li> </ul> <p>A strategy I have used is to send key reporting data to a secondary datab...
<p>We are using one-way replications, but not from the same application. Our applications are reading-writing to the master database, the data gets synchronized to the replca database, and the reporting tools are using this replica.</p> <p>We don't want our application to read from a different database, so in this sce...
6,509
<p>i know that i can get stacktrace by using Thread.getAllStackTraces()(it returns Map, but clear does not work). When I run recursion method i can get exception because of stacktrace being too big, is there any way to clear it?</p>
<p>It's not the stack trace that is causing your problem, it's the stack itself. Every time you call a method, information gets put on the stack that allows you to return to the calling method. If you recurse enough, eventually you fill all the space on the stack (which is bound by a maximum size) and your program st...
<p>First check that your program doesn't have a bug in its code causing an infinite recursion leading to the stack overflow.</p> <p>If it is not the case, you may try to allocate more stack space to your program. Under Linux you can do it with the <code>ulimit</code> bash command like:</p> <pre><code>ulimit -s 8000 <...
25,553
<p>What are the main differences between XHTML and HTML? Which one is better in your opinion, and why? Do most browsers support both?</p>
<p><strong>XHTML</strong> is based on <strong>XML</strong>, and thus requires the source to be well-formed. Since XHTML is more strict than HTML, less pre-processing is needed by the rendering engine. </p> <p>XHTML should be served as application/xhtml+xml for you to take advantage of the benefits, otherwise XHTML wil...
<p>An example of a difference is the break tag.</p> <pre><code>&lt;br&gt; </code></pre> <p>is proper HTML, but in XHTML where the elements need to validate as XML, you must self-close the tag:</p> <pre><code>&lt;br /&gt; </code></pre>
23,799
<p>One of my columns type is DateTime (Date Registered). I cannot create a query that filters all the data for eg. All registrations who registered on the 22/10/2008 between 18:00 and 20:00.</p> <p>Thanks</p>
<pre><code>SELECT * FROM YourTable WHERE DateRegistered BETWEEN '10/22/2008 18:00:00' AND '10/22/2008 20:00:00' </code></pre> <p>Should do the trick</p>
<p>have you tried using datediff?</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms189794.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms189794.aspx</a></p>
46,580
<p>Using any member of the Windows Server family, I can set up an active directory, and have a single pool of users for a large scale of computers; access can be given / removed for any shared resources in the given domain (including access to client computers, etc).</p> <p>What similar (and widespread) solutions exis...
<p>Not sure if this is what you had in mind, but Linux w/Samba can act as a domain controller for Windows desktops. For example, see <a href="http://www.howtoforge.com/samba_setup_ubuntu_5.10" rel="nofollow noreferrer">SAMBA (Domain Controller) Server For Small Workgroups</a> at HowToForge. This works for file/print sh...
<p>Supposedly Linux computers can use <a href="http://www.centeris.com/products/likewise_open/" rel="nofollow noreferrer">Likewise Open</a> to connect to Active Directory Domains. i.e. use the Active Directory credentials for authentication and access control.</p> <p>I have tried it briefly myself and had no luck thou...
15,827
<p>I want to create extra rules in FXCop. Custom Rules to help ensure specific best practices like checking against inline sql. </p> <p>I'm really looking for good resources and examples. Thanks! </p>
<p><a href="http://www.binarycoder.net/fxcop/html/index.html" rel="nofollow noreferrer">This tutorial</a> seems really comprehensive.</p>
<p>You can also use the commercial tool <a href="http://www.NDepend.com" rel="nofollow noreferrer">NDepend</a> to write your <a href="http://www.ndepend.com/Features.aspx#CQL" rel="nofollow noreferrer">custom code rules over LINQ queries (CQLinq)</a>. <em>Disclaimer: I am one of the developers of the tool</em></p> <p>...
47,787
<p>I'm having a problem obtaining the total row count for items displayed in a Gridview using Paging and with a LinqDataSource as the source of data.</p> <p>I've tried several approaches:</p> <pre><code>protected void GridDataSource_Selected(object sender, LinqDataSourceStatusEventArgs e) { totalLabel.Text = ...
<p>The LinqDataSourceEventArgs returned in those events return -1 on these occasions:</p> <blockquote> <p>-1 if the LinqDataSourceStatusEventArgs object was created during a data modification operation; -1 if you enabled customized paging by setting AutoPage to true and by setting RetrieveTotalRowCount to false. </p...
<p>The TotalRowCount property is only valid for certain values of AutoPage and AllowPaging. They should both be true (in your case) or both be false.</p> <p>chech out the following page for an explanation of the TotalRowCount property.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols....
4,735
<p>Can someone explain this result to me. The first test succeeds but the second fails, although the variable tested is changed in the first test.</p> <pre><code>&gt;&gt;&gt; class MyTest(unittest.TestCase): def setUp(self): self.i = 1 def testA(self): self.i = 3 self.assertEqual(self.i...
<p>From <a href="http://docs.python.org/lib/minimal-example.html" rel="noreferrer">http://docs.python.org/lib/minimal-example.html</a> :</p> <blockquote> <p>When a setUp() method is defined, the test runner will run that method prior to each test.</p> </blockquote> <p>So setUp() gets run before both testA and t...
<p>The setUp method, as everyone else has said, runs before every test method you write. So, when testB runs, the value of i is 1, not 3.</p> <p>You can also use a tearDown method which runs after every test method. However if one of your tests crashes, your tearDown method will never run.</p>
9,803
<p>This may sound strange but sometimes when your ASP.NET webapp isn't working and you can't tell why, you call Microsoft, pay them something like $300 and get about 1-3 weeks of 1-3 people looking at your configuration, memory dumps, sometimes code... but usually not the db, and with a fairly good percentage they help...
<p>I haven't ever looked for paid support for these open source technologies, but in general I would guess until there is significant market penetration there won't be a business case for 'dial in support' of an app built by a third party.</p> <p>In general, you'll be looking for a niche technology expert consultant t...
<p>I haven't ever looked for paid support for these open source technologies, but in general I would guess until there is significant market penetration there won't be a business case for 'dial in support' of an app built by a third party.</p> <p>In general, you'll be looking for a niche technology expert consultant t...
30,266
<p>Why do elements with the CSS <code>position: fixed</code> applied to them cause Firefox to eat 100% CPU when scrolling the page they are in? And are there any workarounds?</p> <p>I've noticed this behavior on a few sites, for example the notification bar at the top of the page on StackOverflow. I'm using Linux in c...
<p>This is <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=201307" rel="nofollow noreferrer">bug #201307</a>.</p>
<p>Are you sure that there's a direct link here? Have you created a static HTML page with fixed elements to verify your theory? Given how widely these CSS properties are used, I'd think someone else would have noticed it by now, whatever browser/OS you're running.</p>
9,313
<p>What does it take to get C++ <strong>tr1</strong> members (shared_ptr especially, but we'd like function and bind and ALL the others) working with <strong>GCC 3.4.4</strong> (for the Nokia <strong>N810</strong> tablet computer). </p> <p>Has anyone done this? Attempted this? </p> <p>It may <strong>not</strong> b...
<p>For shared_ptr from boost, at least, the number of dependencies is pretty small. You can use <a href="http://www.boost.org/doc/libs/1_36_0/tools/bcp/bcp.html" rel="nofollow noreferrer">bcp</a> to extract subsets from boost as well, so you don't need the whole of boost to compile your application.</p>
<p>On a different topic, I'm installing the <code>g++-3.4</code> package on my Ubuntu laptop now, and I'm going to see if I can compile <code>libstdc++</code> from the Subversion trunk on it. If so, I'll let you know! (If not, I'll let you know too. :-P)</p>
15,950
<p>I am using jquery and the getJSON method and I am wondering if there is a way to display a message saying loading before it loads my content. i know with the jquery ajax calls there is the before submit callbacks where you can have something but the getJSON only has like three options.</p> <p>Any ideas?</p>
<p>there is the custom <code>.ajax</code> "before" and "success" events which you can trigger. </p> <p>Normally however, you would just do something like</p> <pre><code> showLoadingAnimation(); $.getJSON( ..... function(){ dontShowLoadingAnimation(); }); </code></pre> <p>or something similar. </p> <p...
<p>Kent,</p> <p>Something like that would work, just display a simpling div element with the display text Loading... then display my JSON results.</p> <p>Ryan</p>
42,473
<p>How do I get the substring <code>" It's big \"problem "</code> using a regular expression?</p> <pre><code>s = ' function(){ return " It\'s big \"problem "; }'; </code></pre>
<pre><code>/"(?:[^"\\]|\\.)*"/ </code></pre> <p>Works in The Regex Coach and PCRE Workbench.</p> <p>Example of test in 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...
<p>Messed around at <a href="http://regexpal.com" rel="nofollow">regexpal</a> and ended up with this regex: (Don't ask me how it works, I barely understand even tho I wrote it lol)</p> <pre><code>"(([^"\\]?(\\\\)?)|(\\")+)+" </code></pre>
31,067
<p><strong>How do you install svn 1.5 on debian etch?</strong> The svn 1.5 packages available for etch are 1.4 and I really need the cool new merge tracking feature in svn1.5 (according to CollabNet its as good as ClearCase...an interesting statement in oh so many ways). So, what's the least painful way to go?</p> ...
<p>Have you considered <a href="http://wiki.debian.org/AptPinning" rel="nofollow noreferrer">pinning</a>? Basically, you can upgrade <em>some</em> of your system (i.e. just Subversion and its dependencies) to Lenny, while keeping the rest as Etch.</p>
<p>It depends on whether you want to be able to upgrade Subversion in future using Debian's package management tools. Building it from source should be easy enough, and lets you configure it the way you want, but then each time you want to upgrade, you'll need to build it from source again, rather than a simple apt-ge...
9,224
<p>In the following snippet:</p> <pre><code>public class a { public void otherMethod(){} public void doStuff(String str, InnerClass b){} public void method(a){ doStuff("asd", new InnerClass(){ public void innerMethod(){ otherMethod(); ...
<p>In general you use <code>OuterClassName.this</code> to refer to the enclosing instance of the outer class.</p> <p>In your example that would be <code>a.this.otherMethod()</code></p>
<pre><code>OuterClassName.this.outerClassMethod(); </code></pre>
8,116
<p>I am trying to get some accurate runtime comparisons of PHP vs Python (and potentially any other language that I have to include). Timing within a script is not my problem but timing within a script does not account for everything from the moment the request is made to run the script to output.</p> <blockquote> <...
<p>If your idea is to compare the languages, I'd say anything outside them is not relevant for comparison purposes. </p> <p>Nonetheless you can use the time command to measure everything and can compare it with the timing within a script.</p> <p>Like this:</p> <pre><code>$ time script.php HI! real 0m3.218s user ...
<ol> <li><p>It's worth taking speed into account if you're optimizing code. You should generally know why you're optimizing code (as in: a specific task in your existing codebase is taking too long, not "I heard PHP is slower than Python"). It's <em>not</em> worth taking speed into account if you don't actually plan on...
8,743
<p>I'm looking for a getopt library for c#. So far I found a few (<a href="http://www.phpguru.org/static/getopt.html" rel="noreferrer">phpguru</a>, <a href="http://69.10.233.10/KB/cs/XGetoptCS.aspx" rel="noreferrer">XGetOptCS</a>, <a href="http://www.codeproject.com/KB/cs/geoptfordotnet.aspx" rel="noreferrer">getoptfor...
<p>Miguel de Icaza <a href="http://tirania.org/blog/archive/2008/Oct-14.html" rel="noreferrer">raves about Mono.Options</a>. You can use the <a href="https://www.nuget.org/packages/Mono.Options/" rel="noreferrer">nuget package</a>, or just copy the <a href="https://github.com/mono/mono/blob/master/mcs/class/Mono.Option...
<p>For the record, <a href="http://nunit.org" rel="nofollow">NUnit</a> includes a simple one-file command-line parser in <code>src\ClientUtilities\util\CommandLineOptions.cs</code> (see example usage in <code>ConsoleRunner.cs</code> and <code>Runner.cs</code> located under <code>src\ConsoleRunner\nunit-console</code>)....
20,782
<p>Morning all,</p> <p>Bit of a language theory question here... I've found some references online suggesting that exception handling and delegates in C# have some different behaviour in some cases but I cannot find any concrete documentation on the matter.</p> <p>We recently had some big problems with exceptions ins...
<p>I think what you might find here is that you are not releasing the MS Excel COM objects you are implicitly creating when an exception is thrown. In my experience MS Office apps are very sensitive to their resources not being released (though most of my experience is with Outlook). </p> <p>I would tend NOT to try ...
<p>Side note: The whole idea of exception catching is not to "swallow" them and display the error message, but to recover, if possible from the situation, as well as to cleanup resources.</p> <p>Better use try/catch wherever you need (i.e. around the code which may throw), and then call a common function to display/lo...
26,022
<p>We have a Hibernate/Spring application that have the following Spring beans:</p> <pre><code>&lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" /&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" /&...
<p>While I haven't used Spring, I have used Hibernate in a project which has classes which must either be instantiated by factory methods or through multiple argument constructors.</p> <p>You can do this through an Interceptor, which is a class which listens in to several key hibernate events, such as when an object n...
<p>I don't think you can make Hibernate (or any external framework) call a private constructor on your objects, unless it's through some javassist or cglib runtime created subclass.</p> <p>If you want to let Hibernate call your constructor, why don't you just make it <code>public</code>, or <code>package</code>? Hiber...
43,658
<p>Got a little problem with a Seam application I'm working on and I was wondering if anyone knows a way round it. I've got a form in my application that uses AJAX to show certain input boxes depending on an item in a dropdown box. The code works fine except for setting the ID's in my input boxes. It looks like JSF ...
<p>You see why they don't let you set the ID, right? JSF takes over id creation because you're in a repeated loop of components and, if they let you just set the id, you'd end up with duplicate IDs, which wouldn't help you anyway.</p> <p>Without knowing WHY you want to set the ID explicitly, it's hard to give you a w...
<p>Have you tried use facelets?</p> <p>That will allow you to assing your own ids ie:</p> <p></p> <p>me:labelKeyThingo can then use the id=#{labelKey} to make a unique label. Here is an example facelet called <strong>m:textPassword</strong> from my bad code:</p> <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD ...
40,906
<p>We need to get data out of some Hyperion cubes (databases) using SSIS. Are there any connection managers available for this? Has anyone done this? </p>
<p>There are some third party connectors out there. Don't think any exist from oracle or microsoft.</p>
<p>I don't have any experience with Hyperion, but can you make use of the Script Task in SSIS?</p>
9,698
<p>I've used bash, csh, and tcsh. But I asked <a href="http://web.archive.org/web/20151121164806/http://stackoverflow.com/questions/198723/whats-in-your-cshrc" rel="nofollow noreferrer">this question</a>, and Jonathan informed me that csh isn't to be trusted. So what Linux shell is good for development. and why?</p>
<p>The most common shell, by far, on Linux is bash. Unless you have a good reason to use an alternative, I'd suggest that sticking with bash, or the most commonly used shell by your project team (or that the bulk of the shell scripts you have to work with) uses.</p> <p>The only other very common contender is dash, wh...
<p>Select one: a. tcsh b. ksh c. zsh d. login e. bash</p> <p>I would use login. Just sayin. </p>
24,345
<p>Is it possible to merge to a branch that is not a direct parent or child in TFS? I suspect that the answer is no as this is what I've experienced while using it. However, it seems that at certain times it would be really useful when there are different features being worked on that may have different approval cycl...
<p>I agree with Harpreet that you may want to revisit how you you have setup you branching structure. However you if you really want to perform this type of merge you can through something called a baseless merge. It runs from the tfs command prompt, </p> <pre><code>Tf merge /baseless &lt;&lt;source path&gt;&gt; &lt...
<p>I am far from a TFS expert, but I think you can merge siblings, and I think it is not a baseless merge. </p> <p>We branched off our main branch (branch name "main") for a feature (branch name "feature"), then I needed some of the work in a branch that was also branched off the main branch (branch name "dev"). I wou...
7,616
<p>Which is more efficient for the compiler and the best practice for checking whether a string is blank? </p> <ol> <li>Checking whether the length of the string == 0</li> <li>Checking whether the string is empty (strVar == "")</li> </ol> <p>Also, does the answer depend on language?</p>
<p>Yes, it depends on language, since string storage differs between languages.</p> <ul> <li>Pascal-type strings: <code>Length = 0</code>.</li> <li>C-style strings: <code>[0] == 0</code>. </li> <li>.NET: <code>.IsNullOrEmpty</code>.</li> </ul> <p>Etc. </p>
<p>Actually, IMO the best way to determine is the IsNullOrEmpty() method of the string class.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.string.isnullorempty." rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.string.isnullorempty.</a></p> <p>Update: I assumed .Net, in other...
3,145
<p>I want to know what's the difference between string and stream in c++, and what's stringstream?</p>
<p>Very Informally: A string is a collection of characters, a stream is a tool to manipulate moving data around. A string stream is a c++ class that lets you use a string as the source and destination of data for a stream.</p>
<p>My guess is that a stringstream is like an iostream, but instead of writing to or reading from a file, you write to or read from a string.</p>
40,241
<p>We are developing a little application that given a directory with PDF files creates a unique PDF file containing all the PDF files in the directory. This is a simple task using iTextSharp. The problem appears if in the directory exist some files like Word documents, or Excel documents.</p> <p>My question is, is th...
<p>Office 2007 allows for this. I have found <a href="http://sourceforge.net/projects/pdfcreator/" rel="nofollow noreferrer">PDFCreator</a> to be good, the VBA is included in sample files, and have heard that <a href="http://www.cutepdf.com/" rel="nofollow noreferrer">CutePDF</a> is also good. PDFCreator and CutePDF ar...
<p>You can also use a component like activePDF's <a href="http://www.activepdf.com/products/serverproducts/docconverter2009/" rel="nofollow noreferrer">DocConverter</a> to convert a <strong>lot</strong> formats to PDF. </p>
6,005
<p>When I try to create a new RegionInfo with certain ISO 3166 country codes ("BD" for Bangladesh, "SO" for Somalia, "LK" for Sri Lanka), I get an ArgumentException that says it's not recognized.</p> <p>What's the deal? The Intellisense of RegionInfo(string) says it conforms to ISO 3166, but these country/region codes...
<p>.NET doesn't provide all Cultures/Regions out-of-the-box. Note the 'predefined' RegionInfos here: <a href="http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo(VS.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo(VS.80).aspx</a>. </p> <p>Unfortunat...
<p><strike>Some</strike>All of the regions you missed are now supported (in newer versions of the .NET Framework and of the operating system).</p> <p>The following code finds all <code>RegionInfo</code> that are "reachable" from a specific culture:</p> <pre><code>foreach (var ri in CultureInfo.GetCultures(CultureType...
27,610
<p>I have a collection of items that the user needs to group/categorize in several ways. For the sake of an example, let's say it's a collection of cars and the user wants to categorize them in the following ways:</p> <ul> <li>Color (red, silver, blue, black, etc.)</li> <li>Body shape (hatch, sedan, coupe, stationwago...
<p>It sounds like you have two tasks: Task 1 Categorize Objects, where for a series of objects, the user assigns each a category (value) on each of multiple dimensions (attributes). Task 2: Create and Modify Dimension and Categories. </p> <p>Outside of data modelers, object-oriented programmers, and database designers...
<p>I may be misunderstanding you question, but isn't that very similar if not exactly what tags are for (as in stack overflow and gmail). Or are you looking for something more specific than that?</p>
35,589
<p>I know in a lot of asynchronous communication, the packet begins starts with a start bit.</p> <p>But a start bit is just a 1 or 0. How do you differentiate a start bit from the end bit from the last packet?</p> <p>Ex. If I choose my start bit to be 0 and my end bit to be 1. and I receive 0 (data stream A) 1 0 (da...
<p>Great question! Most asynchronous communication also specifies a <em>stop</em> bit, which is the complement of the start bit, ensuring each new symbol begins with a stop-to-start transition.</p> <p>Example: let's transmit the characters <code>ABC</code>, which are ASCII 65, 66, and 67:</p> <pre><code>A = 65 = 0x...
<p>The start and stop bits come from the days of the <a href="http://en.wikipedia.org/wiki/ASR33" rel="nofollow noreferrer">teletypes</a>. They essentially were pulses that took up time to sort of let the mechanical hardware set. Dos text file lines are ended with CR LF which literally caused the carriage to return...
34,732
<p>I have Eclipse 3.3.2 with PDT doing PHP development. All projects that I create, even SVN projects have code completion. Now I just opened another SVN project and it has no code completion or PHP templates (CTRL-space does nothing in that project). However, I can open the other projects and code completion all work ...
<p>Maybe Eclipse doesn't understand the project has a "PHP nature". Try comparing the .project file on both projects to look for differences. It should contain something like:</p> <pre><code> &lt;natures&gt; &lt;nature&gt;org.eclipse.php.core.PHPNature&lt;/nature&gt; &lt;/natures&gt; </code></pre> <p>The .project ...
<p>One solution could be to include a dummy php file wich requires all your PHP classes. So that the PHP parser recognizes these classes too. Example dummy file:</p> <pre><code>if(false) { require_once 'class/one.php'; require_once 'class/two.php'; require_once 'class/three.php'; } </code></pre>
21,395
<p>I'm currently developing a Facebook application which will eventually end up on a Facebook Page. The problem is that I don't know how to remove the box header (handle?) with the application name and the close-button.</p> <p>I've seen other applications on Pages being able to remove the header. Look at Apples Page h...
<p>In my experience, interfaces are best used when you have several classes which each need to respond to the same method or methods so that they can be used interchangeably by other code which will be written against those classes' common interface. The best use of an interface is when the protocol is important but t...
<p>Only inherit from Interfaces and abstract classes.</p> <p> If you have a couple of classes wich are almost the same, and you need to implement the majority of methods, use and Interface in combination with buying the other object. <br> If the Mustang classes are so different then not only create an interface ICar, ...
33,729
<p>I am using my own db for phpbb3 forum, and I wish to insert some data from the forum into my own tables. Now, I can make my own connection and it runs my query but in trying to use the $db variable(which I think is what you're meant to use??) it gives me an error.</p> <p>I would like someone to show me the bare bon...
<p>Well.. You haven't given us very much information, but there are two things you need to do to connect and query to a database.</p> <p>For phpbb, you may want to read the documentation they have presented:</p> <p><a href="http://wiki.phpbb.com/Database_Abstraction_Layer" rel="nofollow noreferrer">http://wiki.phpbb....
<p>I presumed that phpBB already had a connection to my database. Thus I wasnt going to use a new one? Can i make a new one and call it something else and not get an error?</p> <p>And $resultid = mysql_query($sql,$db345);</p> <p>Where $db345 is the name of my database connection</p>
21,013
<p>I'm a bit of a DI newbie, so forgive me if this is the wrong approach or a silly question.</p> <p>Let's say I have a form which creates/updates an order, and I know it's going to need to retrieve a list of products and customers to display. I want to pass in the Order object that it's editing, but I also want to in...
<p>Matt, you shouldn't mix normal parameters with dependencies. Since your object will be created in the internals of IoC container, how are you going to specify necessary arguments? </p> <p>Mixing dependency and normal arguments will make logic of your program more complicated.</p> <p>In this case it would be better...
<p>I am just a bit late to the party, but I would suggest using a factory in this case: the factory constructor would take the required <code>*Service</code> dependencies which the DI system would resolve and inject, while its <code>Build()</code> method would accept any additional state parameter - like <code>Order</c...
18,904
<p>What's the widest overview and where are the deepest analysis of different replication methods and problems?</p>
<p>I would start here: <a href="http://en.wikipedia.org/wiki/Replication_(computer_science)" rel="nofollow noreferrer">wikipedia's replication article</a>, then read a couple of related papers on general replication techniques such as the replicated distributed state machine approach (<a href="http://research.microsoft...
<p>In my opinion, you should pick a mainstream database (such as Oracle) and study everything it offers and go from there. </p> <p>Oracle offers:</p> <ul> <li>Replication </li> <li>Data guard (standby database and beyond- physical, logical)</li> <li><p>Real Application Clusters - (multiple instances, one DB) and more...
13,015
<p>Here's some Ruby code:</p> <pre><code>puts %x{ pstree #{$$} } # never forks puts %x{ pstree '#{$$}' } # forks on amd64 only </code></pre> <p>On 32-bit Ubuntu Dapper, I get this output:</p> <pre><code>t.rb---pstree t.rb---pstree </code></pre> <p>Which makes sense to me. But on 64-bit Ubuntu Hardy, I get this:<...
<p>Ruby performs shell expansion when %x is used with a single argument (like you are doing).</p> <p>Here's my guess as to what is going on:</p> <p>Ruby scans the command to determine if there are any special characters that would result in the need to perform shell expansion, if so it calls the shell to do that. In...
<p>I went through this situation by developing an asynchronous processor work that has a series of subprocesses(fork), and it happened when the master was in the foreground and received a SIGINT.</p> <p>I run: puts "the result is %(monster-delayed-job)"</p> <p>and the output was only: "the result is "</p> <ul> <li>Y...
26,334
<p>I'm writing a Delphi expert. I need to be able to write a value to a property on a property which is an object. E.g. I have a GroupBox on the form and I want to edit the Margins.Left property. I'm using the following procedure to do it but if gives an AV on the marked line.</p> <p>The procedure takes a component fr...
<p>If you want the database behind a firewall, and believe me, you do want your database behind a firewall, see if you can have a VPN for going directly into the box. Once you are on the VPN, you can use whichever management tool you currently use for managing the database. So if you use SQL Server, you can connect v...
<p>On my current project, we use <a href="http://www.quest.com/sql-navigator/" rel="nofollow noreferrer">SQL Navigator</a> in order to run queries on our Oracle database. I've also heard decent things about <a href="http://www.toadsoft.com/toad_oracle.htm" rel="nofollow noreferrer">TOAD</a>. I would advise against writ...
17,366