instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>What memory leak detection tools are available for use with open source C/C++ on Windows?</p>
<p>The <a href="http://teaching.idallen.com/c_programming/mem/" rel="nofollow noreferrer">mem (revised)</a> package is an effective and straightforward tool to detect memory buffer overflows, underflows, leaks, double-deletion, and dangling references.</p> <p><a href="http://c.snippets.org/browser.php?sect=37#37" rel=...
<p>WinDbg is always a good choice for any program open or closed.</p>
35,979
<p>I know, it depends on the webapp. But in the normal case, what do you do: one servlet, that serves different pages (like an standalone-application with changing content) or for every page a single servlet.</p> <p>Take for instance a blog. There is the start-page with the most recent blog-entries, an article-view fo...
<p>Usually you will create a servlet per use case. Servlets acts like controllers for your application. When you identify an interaction from a user then implement a servlet to control that interaction.</p> <p>That is, if you are using plain servlet/JSP to build the site. If you are using a framework like struts you w...
<p>It depends.</p> <p>In my latest projects, I have implemented a single servlet that delegates to several servlet-like objects which are instantiated in a dependency injection fashion. For instance, I have something like this in my servlet (pseudo-code):</p> <pre><code>for(Handler handler : handlers) { if(handle...
34,245
<p>Wondering if I need to do something in my swf to be able to access the assets on a different server, meaning more than just specify the url to the asset. Will flash handle the 'go get crossdomain.xml and authenticate everything' behind the scenes or do I need to include some special code beyond simply requesting the...
<blockquote> <p>Will flash handle the 'go get crossdomain.xml and authenticate everything' behind the scenes or do I need to include some special code beyond simply requesting the swf file?</p> </blockquote> <p>In the event of any cross-domain request, Flash will look for the crossdomain.xml file at the root...
<p>If you're just trying to access another swf, adding the crossdomain.xml will do all the work for you since Flash will do it for you</p>
26,237
<p>I have a Linq to Sql .dbml file which auto generates my method signatures for certain stored procedures. eg, I have in SQL <code>spGetEmployees(@Name)</code> so in my data context I have <code>spGetEmployees(string Name)</code>. </p> <p>Now, my underlying sp changed to add an additional parameter: <code>spGetEmploy...
<p>Currently if you use the ui you must drop the function and add it back there is no refresh yet. You can automate this class with sqlmetal.exe this will allow you to regenerate these files every time you update your database.</p>
<p>Currently if you use the ui you must drop the function and add it back there is no refresh yet. You can automate this class with sqlmetal.exe this will allow you to regenerate these files every time you update your database.</p>
31,255
<p>In a project we have text files looking like this:</p> <pre><code>mv A, R3 mv R2, B mv R1, R3 mv B, R4 add A, R1 add B, R1 add R1, R2 add R3, R3 add R21, X add R12, Y mv X, R2 </code></pre> <p>I need to replace the strings according to the following, but I am looking for a more general solution.</p> <pre><code>R1...
<p>I've actually had to use this sort of algorithm several times in the past two weeks. So here it is the world's second-most verbose language...</p> <pre><code>import java.util.HashMap; import java.util.regex.Pattern; import java.util.regex.Matcher; /* R1 =&gt; R2 R2 =&gt; R3 R3 =&gt; R1 R12 =&gt; R21 R21 =&gt; R...
<p>You can use a HashMap:</p> <pre><code>Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("R1", "R2"); map.put("R2", "R3"); for(String key: map.keySet()) { str.replaceAll(key, map.get(key)); } </code></pre> <p>replaceAll also handles regular expressions.</p> <p>EDIT: The above solution...
49,941
<p>I'm operating a neighbourhood <a href="http://maps.google.de/maps/ms?ie=UTF8&amp;hl=de&amp;msa=0&amp;msid=101021148567197540440.00043fcffa4cdf06fb4bc&amp;ll=51.791948,8.173571&amp;spn=0.033976,0.058365&amp;t=h&amp;z=14" rel="nofollow noreferrer">WIFI network in a rural environment</a>.</p> <p>Now I'm looking fo a m...
<p><a href="http://oss.oetiker.ch/mrtg/" rel="nofollow noreferrer">MRTG</a> is probably the easiest to setup. If your router has SNMP (as you mention), to setup it's a single command:</p> <pre><code>cfgmaker --output=mrtg_myrouter.cfg public@1.2.3.4 </code></pre> <p>MRTG is good for high-bandwidth routers and the lik...
<p>Also consider <a href="http://cactiez.cactiusers.org/" rel="nofollow">CactiEZ</a> on a VM or small server, it is a baremetal CentOS 6 based system.</p>
32,219
<p>Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote up a method using the registry to try and determine whether or not the current system is a 32 or 64bit system.</p> <pre><code>private Boolean is64BitOperatingSystem() { RegistryKey localEnvironment = Registr...
<p>Take a look at Raymond Chens solution:</p> <p><a href="http://blogs.msdn.com/oldnewthing/archive/2005/02/01/364563.aspx" rel="nofollow noreferrer">How to detect programmatically whether you are running on 64-bit Windows</a></p> <p>and here's the PINVOKE for .NET:</p> <p><a href="http://www.pinvoke.net/default.asp...
<p>Looking into the registry is perfectly valid, so long as you can be sure that the user of the application will always have access to what you need.</p>
2,595
<p>I'm developing a SOAP application that integrates with a 3rd party. I think the WSDL of this third party is very strange. I'm pretty new to SOAP, so I don't want to go asking them to fix it if it isn't broken. Here's some things I've noticed that I consider wrong about it, though I'm sure it's technically a valid...
<p>1 - They probably consider this a feature. :-)</p> <p>2 - That's horrible.</p> <p>3 - Lots of people recommend this. It's called wrapped format.</p> <p>4 - You're correct.</p> <p>5 - It depends. Theoretically, you're probably correct, but in practice lots of SOAP toolkits don't have very good support for SOAP ...
<p>What you have encountered is the typical third party laziness when creating their web services. I'd imagine you won't have much luck trying to reason with them, however you can hand edit the WSDL to remove the 1.1 definitions.</p>
35,767
<p>When doing case-insensitive comparisons, is it more efficient to convert the string to upper case or lower case? Does it even matter?</p> <p>It is suggested <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c#12137">in this SO post</a> that C# is more efficient with ToUpper because "Microsoft op...
<p>Converting to either upper case or lower case in order to do case-insensitive comparisons is incorrect due to &quot;interesting&quot; features of some cultures, particularly Turkey. Instead, use a <a href="http://msdn.microsoft.com/en-us/library/system.stringcomparer.aspx" rel="noreferrer">StringComparer</a> with th...
<p>It really shouldn't ever matter. With ASCII characters, it definitely doesn't matter - it's just a few comparisons and a bit flip for either direction. Unicode might be a little more complicated, since there are some characters that change case in weird ways, but there really shouldn't be any difference unless you...
29,038
<p>I'm looking for a Java library that is geared towards network math and already tested. Nothing particularly fancy, just something to hold ips and subnets, and do things like print a subnet mask or calculate whether an IP is within a given subnet. </p> <p>Should I roll my own, or is there already a robust library ...
<p>We developed a Java IPv4 arithmetic library ourselves. See it here: <a href="http://tufar.com/ipcalculator/" rel="noreferrer">http://tufar.com/ipcalculator/</a> It is under BSD license. </p>
<p>The <a href="https://seancfoley.github.io/IPAddress/" rel="nofollow noreferrer">open-source IPAddress Java library</a> can do ip address manipulation such as conversion to/from ipv4/ipv6 and subnet checking. Disclaimer: I am the project manager.</p> <p>It handles various network math operations, such as masking, b...
27,095
<p>I am reading a .csv file and returning its lines in string array. One of the members is manufacturer, for which I have Toyota, Ford, etc.</p> <p>I want to sort an array (Can be another collection) of the rows, by the value in manufacturer and alphabetical order.</p> <p>So I'd have:</p> <pre><code>28437 Ford Fiest...
<p>What version of .NET are you using? If you're using 3.5 - or can use C# 3.0 and <a href="http://www.albahari.com/nutshell/linqbridge.aspx" rel="nofollow noreferrer">LINQBridge</a> - then I'd definitely go with LINQ. First transform each line into some appropriate object, and then use OrderBy:</p> <pre><code>var car...
<p>If you just have a bunch of strings in an Array, use</p> <pre><code>Array.Sort(myArray) </code></pre> <p>That will put the strings in "myArray" in alphabetical order (case sensitive).</p> <p>If you want to to different comparisons (like case-insensitive for example), you can define an own ICcomparer or use Linq-E...
35,988
<p>I've written a control in C# that overrides the built-in DropDownList control. For this I need a javascript resource included, which I'm including as an embedded resource then adding the <code>WebResource</code> attribute, which works fine.</p> <p>However, I also need to reference a webservice, which I would norm...
<p>You can add a ScriptManagerProxy in the code or the markup of your control and add the service reference through it. The settings in the ScriptManagerProxy are merged with the "real" ScriptManager at compile time.</p>
<p>If you know the page the usercontrol is in you can do a ((PageName)this.Page).scriptmanager.Services.Add() from the user control</p>
13,860
<p>We've been fighting with <a href="http://haproxy.1wt.eu/" rel="noreferrer">HAProxy</a> for a few days now in Amazon EC2; the experience has so far been great, but we're stuck on squeezing more performance out of the software load balancer. We're not exactly Linux networking whizzes (we're a .NET shop, normally), but...
<p>Not really an answer to your question, but nginx and pound both have good reputations as load-balancers. Wordpress just <a href="http://barry.wordpress.com/2008/04/28/load-balancer-update/" rel="noreferrer">switched to nginx</a> with good results.</p> <p>But more specifically, to debug your problem. If you aren't s...
<p>Even though your issue solved. KEMP Technologies now have a fully blown load balancer for AWS. Might save you some hassle. </p>
32,552
<p>In the app I am working on, I want to allow the user to upload static HTML pages to replace the default "user profile" MVC View page. Is this possible? That is, the user uploaded html pages will totally run out of MVC, and it can include its own CSS links, etc.</p> <p>Ideas? Suggestions?</p>
<p>Obviously the .net MVC framework handles static content already for images / css / js etc. It would just be a matter of extending that (routing?) to pass .html files through straight to IIS. That coupled with a dash of rewriting to make prettier urls should do the trick.</p> <p>However, I would be very, very wary...
<p>I suggest you to make your custom ViewEngine that will allow to use static html markup with custom tags in it, that will be replaced by user info.</p> <p>So, your view engine may accept something like that:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;b&gt;&lt;user:FirstName /&gt;&lt;/b&gt; &lt...
47,647
<p>Does anyone have a good set of Visio Stencils for MS SQL Server?</p>
<p>Some versions of Visio have database support built in. There are a couple of links on the MVP site for Visio:</p> <p>New URL: <a href="http://visio.mvps.org/3rdParty/default.html" rel="nofollow noreferrer">http://visio.mvps.org/3rdParty/default.html</a> Old URL: <a href="http://visio.mvps.org/3rdparty.htm" rel="no...
<p>I haven't tried it myself but there is one at <a href="http://visiotoolbox.com/downloads.aspx?resourceid=1&amp;aid=562" rel="nofollow noreferrer">http://visiotoolbox.com/downloads.aspx?resourceid=1&amp;aid=562</a></p>
16,215
<p>in Javascript, the following:</p> <pre><code>var test = '"the quick" "brown fox" "jumps over" "the lazy dog"'; var result = test.match(/".*?"/g); alert(result); </code></pre> <p>yields "the quick","brown fox","jumps over","the lazy dog"</p> <p>I want each matched element to be unquoted: the quick,brown fox,jumps ...
<p>This seems to work:</p> <pre><code>var test = '"the quick" "brown fox" "jumps over" "the lazy dog"'; var result = test.match(/[^"]+(?=(" ")|"$)/g); alert(result); </code></pre> <p>Note: This doesn't match empty elements (i.e. ""). Also, it won't work in browsers that don't support JavaScript 1.5 (lookaheads are a ...
<p>Here's one way:</p> <pre><code>var test = '"the quick" "brown fox" "jumps over" "the lazy dog"'; var result = test.replace(/"(.*?)"/g, "$1"); alert(result); </code></pre>
17,771
<p>I'm looking for a book/site/tutorial on best practices for relational database design, tuning for performance etc. It turns out this kind of resource is a bit difficult to find; there's a lot of "here's normalization, here's ER diagrams, have at it," but not much in the way of real examples. Anyone have any ideas?</...
<p>Book: <a href="https://rads.stackoverflow.com/amzn/click/com/0201752840" rel="noreferrer" rel="nofollow noreferrer">Database Design for Mere Mortals</a></p>
<p>Here are some resources I could find on the web. They include examples you are looking for:</p> <ul> <li><a href="http://databases.ncl.ac.uk/databases/Design/default.aspx" rel="nofollow noreferrer">Designing and creating a Relational Database - Dr Lorna Scammell: Newcastle University Database Adviser</a></li> <li><...
3,270
<p>Do you have to pass delete the same pointer that was returned by new, or can you pass it a pointer to one of the classes base types? For example:</p> <pre><code>class Base { public: virtual ~Base(); ... }; class IFoo { public: virtual ~IFoo() {} virtual void DoSomething() = 0; }; class Bar : publ...
<p>Yes, it will work, <strong>if and only if</strong> the base class destructor is virtual, which you have done for the <code>Base</code> base class but not for the <code>IFoo</code> base class. If the base class destructor is virtual, then when you call <code>operator delete</code> on the base class pointer, it uses ...
<p>This doesn't relate to your given example, but since you mentioned that you're really interested in <code>shared_ptr</code>'s behavior when deleting its owned object, you might be interested in using <code>shared_ptr</code>'s 'deleter'.</p> <p>If the object owned by the <code>shared_ptr</code> needs special handli...
37,657
<p>Does anybody know a way to recursively remove all files in a working copy that are not under version control? (I need this to get more reliable results in my automatic build VMware.)</p>
<p>this works for me in bash:</p> <pre><code> svn status | egrep '^\?' | cut -c8- | xargs rm </code></pre> <p><a href="https://stackoverflow.com/users/50225/seth-reno">Seth Reno</a>'s is better:</p> <pre><code>svn status | grep ^\? | cut -c9- | xargs -d \\n rm -r </code></pre> <p>It handles unversioned folders and...
<p>For the people that like to do this with perl instead of python, Unix shell, java, etc. Hereby a small perl script that does the jib as well.</p> <p>Note: This also removes all unversioned directories</p> <pre><code>#!perl use strict; sub main() { my @unversioned_list = `svn status`; foreach my $line ...
29,613
<p>What is the accepted/most commonly used way to manipulate dynamic (with all dimensions not known until runtime) multi-dimensional arrays in C and/or C++.</p> <p>I'm trying to find the cleanest way to accomplish what this Java code does:</p> <pre><code>public static void main(String[] args){ Scanner sc=new Scanner...
<p>Use <strong><a href="http://www.boost.org/doc/libs/1_37_0/libs/multi_array/doc/user.html" rel="noreferrer">boost::multi_array</a></strong>.</p> <p>As in your example, the only thing you need to know at compile time is the number of dimensions. Here is the first example in the documentation :</p> <pre><code>#includ...
<p>There is no way to determine the length of a given array in C++. The best way would probably be to pass in the length of each dimension of the array, and use that instead of the .length property of the array itself.</p>
47,754
<p>I have this bit of script to widen a text box on mouseover and shorten it on mouseoff.</p> <p>The problem I am having is that Internet Explorer doesn't seem to extend it's hover over the options of a select box.</p> <p>This means in IE I can click the select, have the options drop down, but if I try to select one,...
<p>Apparently IE doesn't consider the drop down bit part of the select element. It's doable, but it takes a bit of cheating with expando properties and blur/focus events to enable and disable the 'hide' effect to stop it kicking in when the mouse enters the drop-down part of the element.</p> <p>Have a go with this:</p...
<p>Had the same problem, and WorldWidewebb's answer worked very well on IE8. I just made a slight change, removing "select" from the selector, since I included the select box's class in the selector. Made it a really simple fix. </p> <p>Also, i had it implemented on a menu that uses the hoverIntent jquery plugin, with...
25,366
<p>I've allocated an "array" of <code>mystruct</code> of size <code>n</code> like this:</p> <pre><code>if (NULL == (p = calloc(sizeof(struct mystruct) * n,1))) { /* handle error */ } </code></pre> <p>Later on, I only have access to <code>p</code>, and no longer have <code>n</code>. Is there a way to determine the le...
<p>No, there is no way to get this information without depending strongly on the implementation details of <code>malloc</code>. In particular, <code>malloc</code> may allocate more bytes than you request (e.g. for efficiency in a particular memory architecture). It would be much better to redesign your code so that you...
<p>In <a href="http://www.uclibc.org/" rel="nofollow">uClibc</a>, there is a <code>MALLOC_SIZE</code> macro in <a href="http://git.uclibc.org/uClibc/tree/libc/stdlib/malloc/malloc.h#n103" rel="nofollow"><code>malloc.h</code></a>:</p> <pre><code>/* The size of a malloc allocation is stored in a size_t word MALLOC_HE...
28,799
<p>I just read Joel Spolsky's article, <a href="http://www.joelonsoftware.com/articles/fog0000000026.html" rel="nofollow noreferrer">Up the tata without a tutu</a>, where Joel says,</p> <blockquote> <p>In those days, there were no application servers.</p> </blockquote> <p>and</p> <blockquote> <p>There really w...
<p>Ah, this takes me back. Yes, the very first web applications required writing your own web server. the first ones, like <a href="http://en.wikipedia.org/wiki/CERN_HTTPd" rel="noreferrer">CERN HTTPd</a>, where pretty straightforward programs: they listened on a port for basic connection requests, parsed out the fil...
<p>Your web server would call CGI script, usually (in my experience) written in Perl or C.</p> <p>I still have a few C-based web apps on my web site, including a fairly primitive forum system. It was pretty painful stuff, looking back - but it worked.</p>
47,260
<p>I am creating a left navigation system utilizing xml and xsl. Everything was been going great until I tried to use a special character in my xml document. I am using <code>&amp;raquo;</code> and I get th error.</p> <blockquote> <p>reason: Reference to undefined entity 'raquo'.<br> error code: -1072898046</p> </...
<p>You are trying to use an <a href="http://en.wikipedia.org/wiki/SGML_entity" rel="noreferrer">HTML entity</a> in a non-HTML or non-XHTML document. These entities are declared in the document's <a href="http://en.wikipedia.org/wiki/Document_Type_Definition" rel="noreferrer">Document Type Definition (DTD)</a>.</p> <p>...
<p>Are you using the » symbol directly or are you defining it as &amp;raquo; ? If you're using the escaped symbol, did you forget the semicolon?</p>
25,667
<blockquote> <h4>Moderator note:</h4> <p>This question is not a good fit for our question and answer format with the <a href="/help/on-topic">topicality rules</a> which currently apply for Stack Overflow. We normally use a &quot;historical lock&quot; for such questions where the content still has value. However, the an...
<h2>PART I: How To Log In</h2> <p>We'll assume you already know how to build a login+password HTML form which POSTs the values to a script on the server side for authentication. The sections below will deal with patterns for sound practical auth, and how to avoid the most common security pitfalls.</p> <p><strong>To HTT...
<p>Use <a href="http://openid.net/connect/" rel="noreferrer">OpenID Connect</a> or <a href="https://kantarainitiative.org/confluence/display/uma/Home" rel="noreferrer">User-Managed Access</a>.</p> <p>As nothing is more efficient than not doing it at all.</p>
2,296
<p>I am working on a project management web application. The user has a variety of ways to display a list of tasks. When viewing a list page, they click on task and are redirected to the task edit page. </p> <p>Since they are coming from a variety of ways, I am just curious as to the <strong>best</strong> way to <s...
<p>I would store the referring URL using the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.viewstate.aspx" rel="noreferrer">ViewState</a>. Storing this outside the scope of the page (i.e. in the Session state or cookie) may cause problems if more than one browser window is open.</p> <p>The exa...
<p>I personally would store the required redirection info in an object and handle globally. I would avoid using a QueryString param or the like since they could try bouncing themselves back to a page they are not supposed to (possible security issue?). You could then create a static method to handle the redirection obj...
5,734
<p>I'm new to RhinoMock's just been doing state unit testing up till now.</p> <p>How do you test void functions?</p> <p>Getting the following complie error when setting up expectation,</p> <p><em>Expression does not produce a value</em></p> <p>Basically I want to test that a certain mock's method is called a certai...
<p>You want to use LastCall.</p> <p><a href="http://ayende.com/projects/rhino-mocks/api/files/LastCall-cs.html" rel="nofollow noreferrer">http://ayende.com/projects/rhino-mocks/api/files/LastCall-cs.html</a></p>
<p>Better yet, you can use the Expect.Call method with a lambda:</p> <pre><code>Expect.Call(() =&gt; someVoidFunction()); </code></pre>
46,950
<p>I've started to add the time taken to render a page to the footer of our internal web applications. Currently it appears like this</p> <blockquote> <p>Rendered in 0.062 seconds</p> </blockquote> <p>Occasionally I get rendered times like this</p> <blockquote> <p>Rendered in 0.000 seconds</p> </blockquote> <p>...
<p>"Rendered instantly" sounds way better than "Rendered in less than a second".</p>
<p>I think I over-emphasized it was for the users.</p> <p>I know by using in trace in the web.config I can get accurate information on page render times along with times for accessing the database.</p> <p>We have in the past had problems with applications running too slowly over the network although it's now fixed I'...
3,006
<p>I've made this decorator, which results in an infinite redirect loop.</p> <p>The problem is this: </p> <pre><code>args[0].redirect(users.create_login_url(args[0].request.path)) </code></pre> <p>It appears to be a perfectly valid URL. So why wouldn't it properly redirect?</p> <pre><code>def admin_only(handler, *a...
<p>It seems that you aren't defining your decorator properly.</p> <p>A decorator is called only <strong>once</strong> every time you wrap a function with it; from then on the function that the decorator <strong>returned</strong> will be called. It seems that you (mistakenly) believe that the decorator function <strong...
<p>Are you sure proper status code is being sent, you can use live http headers add-on for firefox to check whether 301 or 303 is being sent or not.</p>
43,228
<p>I have an application that runs as a child application in a virtual directory.</p> <p>I want to pass a value from the parent application, but I believe that Session is keyed per application, and won't work.</p> <p>To further complicate things, the parent application is WebForms, while the child is NVelocity MVC.</...
<p>Sounds like web service is the way to go. You could do something like the following:</p> <ul> <li>Have the WebForms app create some data in its database with a key of some kind associated to it.</li> <li>Pass that key in the URL to the NVelocity MVC application.</li> <li>Allow the NVMVC application to call a web se...
<p>You can do a server-side HTTP Request, it looks something like this in C#:</p> <pre><code>HttpWebRequest req = (HttpWebRequest)WebRequest.Create("/ASPSession.ASP?SessionVar=" + SessionVarName); req.Headers.Add("Cookie: " + SessionCookieName + "=" + SessionCookieValue); HttpWebResponse resp = (HttpWebResponse)req.G...
9,343
<p>...I have read a few threads on here that have discussed various methods and was just looking for some feedback on a proposed solution we came up with. In one of the threads a comment was posted recommending a public/private key which sounded great, this is what we were thinking...</p> <p>Client Side - 1. Key is s...
<p>For a ridiculously short value ( Ie: values &lt; 64 characters ), MD5 as a hash becomes ineffective due to rainbow table attacks, and as the value you're sending will be shared over the wire, all they have to do is brute force the shared secret ( and they have a known product to work with ) </p> <p>As such, thats ...
<p>Wow</p> <p>Pretty hard solutions 8). </p> <p>I implemented system like this once. Although it won`t work for every game out there...</p> <p>You should replay the game on server. When user play -- you store "state changes" and then simply feed it to you game in some kind of "replay" mode.</p>
38,962
<p>I am getting into strange situation regarding the RSS viewer on SharePoint</p> <p>I have two environments of SharePoint (production &amp; testing)</p> <p>I was showing a specific RSS news (ABC) on both of them , and it was working after setting the proxies and other stuff.</p> <p>Suddenly (may be due to some chan...
<p>On top of the official Apple resources listed in the post arul linked to, here are some other good reads on the topic:<br><br> <a href="http://web.archive.org/web/20060418151507/http://www.stepwise.com/Articles/Technical/HoldMe.html" rel="nofollow noreferrer">Hold me, use me, free me</a><br> <a href="http://www.coco...
<p>I used the Memory Management video training course from the <a href="http://www.macdevnet.com" rel="nofollow noreferrer">Mac Developer Network</a>. Gave me exactly what I needed when I was starting out. It immediately paid benefits when I started having my own memory management problems. </p>
48,392
<p>A little while ago I managed to get Visual Studio 2008 (C++) into a state where, if I would select a keyword (or any symbol for that matter), by either double clicking on it or highlighting it, all other instances of that symbol within the current file would become highlighted too.</p> <p>This was a really useful f...
<p>I think you've installed <a href="http://www.hanselman.com/blog/IntroducingRockScroll.aspx" rel="noreferrer">RockScroll</a>. It also lights them up in the graphical scrollbar (its main feature)</p>
<p>There is something called "<strong>WordLight</strong>" by Mikhail Nasyrov. An add-in for Visual Studio 2008 that highlights all occurrences of a selected text. It searches and highlights substrings that are currently selected in a text editor. Can be found at below link <a href="https://marketplace.visualstudio.com/...
16,063
<p>I'm trying to get the unitpngfix to work but I can't seem to get the png to show up in IE6.</p> <p>This this my code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; #boxouter { width: 12em; height: 12em; background: url(gradient.gif) #ffdf00 bottom repeat...
<p>I also had some problems with unitpngfix and I really dislike using the [if lt IE 7] and embedding styles in the html. I found <a href="http://jquery.andreaseberhard.de/pngFix/" rel="nofollow noreferrer">this</a> jQuery plugin wich is unobtrusive and works well with PNG images and css backgrounds in IE6.</p>
<p>try</p> <pre><code>background-image: url(corner.png); </code></pre>
48,941
<p>Has anyone out there actually used inversion of control containers <em>within</em> compiler implementations yet? I know that by design, compilers need to be very fast, but I've always been curious about how IoC/DI could affect the construction of a programming language--hot-swappable syntaxes, anyone?</p>
<p>Lisp-style languages often do this. <a href="http://www.psg.com/~dlamkins/sl/chapter03-12.html" rel="nofollow noreferrer">Reader macros</a> are pieces of user-written code which extend the reader (and hence, the syntax) of a language. Plain-old macros are pieces of user-written code which also extend the language.</...
<p>I wouldn't really call it <em>inversion</em> of control because it's natural for compilers. They are usually a series of passes that transform code in the input language to code in the output language. You can, of course, swap in a different pass (for example, gcc compiles multiple languages by using a different fro...
49,379
<p>Is there a tag in HTML that will only display its content if JavaScript is enabled? I know <code>&lt;noscript&gt;</code> works the opposite way around, displaying its HTML content when JavaScript is turned off. But I would like to only display a form on a site if JavaScript is available, telling them why they can't ...
<p>Easiest way I can think of:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;noscript&gt;&lt;style&gt; .jsonly { display: none } &lt;/style&gt;&lt;/noscript&gt; &lt;/head&gt; &lt;body&gt; &lt;p class="jsonly"&gt;You are a JavaScript User!&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>No document.writ...
<p><a href="http://weblogs.asp.net/alex_papadimoulis/archive/2008/02/21/scriptonly-the-opposite-of-a-noscript.aspx" rel="nofollow noreferrer">Alex's article</a> springs to mind here, however it's only applicable if you're using ASP.NET - it could be emulated in JavaScript however but again you'd have to use document.wr...
5,023
<p>I've been working with <a href="http://www.microsoft.com/Sqlserver/" rel="nofollow noreferrer">Microsoft SQL Server</a> with many years now but have only just recently started to use <a href="http://www.mysql.com/" rel="nofollow noreferrer">MySQL</a> with my web applications, and I'm hungry for knowledge.</p> <p>To...
<p>Since you put up a bounty, I'll share my hard won secrets...</p> <p>In general, all the SQLs I tuned today required using sub-queries. Having come from Oracle database world, things I took for granted weren’t working the same with MySQL. And my reading on MySQL tuning makes me conclude that MySQL is behind Oracle i...
<p>InnoDB by default stores all tables in one global tablespace that will <em>never shrink</em>.</p> <p>You can use <code>innodb_file_per_table</code> which will put each table in a separate tablespace that will be deleted when you drop the table or database.</p> <p>Plan ahead for this since you have to dump and rest...
48,161
<p>We have 2 flowdocuments that we'd like to compare similar to when using a diff viewer (winmerge, beyond compare, etc). Has anybody done this or know how to get the text out of a flowdocument to do a compare?</p>
<p>While Chrome will execute Javascript marked as "javascript1.7", it does not support JS1.7 features like the "let" scoped variable operator.</p> <p>This code will run on Firefox 3.5 but not on Chrome using V8:</p> <pre><code>&lt;script language="javascript" type="application/javascript;version=1.7"&gt; function...
<p>This is an old thread, however here goes. Google Chrome does not respond to the following</p> <pre><code>function foo(){ let a = 4; alert(a); } foo(); </code></pre> <p>hence it does not support JavaScript 1.7</p>
38,472
<p>How is the guest account in SQL Server (2000, 2005, 2008) supposed to be used? What is it good for? I've tried enabling the account but I still can't get certain users to be able to refresh Excel 2007 PivotTables attached to views which I have given SELECT rights to GUEST.</p> <p>What am I missing? </p>
<p>There is com.sun.xml.txw2.output.IndentingXMLStreamWriter</p> <pre><code>XMLOutputFactory xmlof = XMLOutputFactory.newInstance(); XMLStreamWriter writer = new IndentingXMLStreamWriter(xmlof.createXMLStreamWriter(out)); </code></pre>
<p>With Spring Batch this requires a subclass since this <a href="https://jira.springsource.org/browse/BATCH-1867" rel="nofollow">JIRA BATCH-1867</a></p> <pre><code>public class IndentingStaxEventItemWriter&lt;T&gt; extends StaxEventItemWriter&lt;T&gt; { @Setter @Getter private boolean indenting = true; @Ove...
37,007
<p>Given a string with a module name, how do you import everything in the module as if you had called:</p> <pre><code>from module import * </code></pre> <p>i.e. given string S="module", how does one get the equivalent of the following:</p> <pre><code>__import__(S, fromlist="*") </code></pre> <p>This doesn't seem to...
<p>Please reconsider. The only thing worse than <code>import *</code> is <em>magic</em> <code>import *</code>.</p> <p>If you really want to:</p> <pre><code>m = __import__ (S) try: attrlist = m.__all__ except AttributeError: attrlist = dir (m) for attr in attrlist: globals()[attr] = getattr (m, attr) </cod...
<p>I didn't find a good way to do it so I took a simpler but ugly way from <a href="http://www.djangosnippets.org/snippets/600/" rel="nofollow noreferrer">http://www.djangosnippets.org/snippets/600/</a></p> <pre><code>try: import socket hostname = socket.gethostname().replace('.','_') exec "from host_setti...
17,760
<p>I am working with a set of data that looks something like the following.</p> <blockquote> <pre><code>StudentName | AssignmentName | Grade --------------------------------------- StudentA | Assignment 1 | 100 StudentA | Assignment 2 | 80 StudentA | Total | 180 StudentB | Assignment 1 ...
<p>I know you said no dynamic <code>SQL</code>, but I don't see any way to do it in straight <code>SQL</code>.</p> <p>If you check out my answers to similar problems at <a href="https://stackoverflow.com/questions/159456/pivot-table-and-concatenate-columns-sql-problem#159803">Pivot Table and Concatenate Columns</a> an...
<pre><code>select studentname,[Assign1],[Assign2],[Assign3],[Total] from ( select studentname, assignname, grade from student )s pivot(sum(Grade) for assignname IN([Assign1],[Assign2],[Assign3],[Total])) as pvt </code></pre>
26,271
<p>For some weeks now I simply can't run gem install in windows. It sticks on this line:</p> <pre><code>C:\Windows\System32&gt;gem install rails --version 2.1.2 Bulk updating Gem source index for: http://gems.rubyforge.org/ </code></pre> <p>Any ideas what it could be?</p>
<p>I had this same problem with gem version &lt; 1.2. Upgrading to 1.2 fixed it.</p>
<p>It worked fine on my Windows Server 2003 machine. I am using gem version 1.3.0.</p>
28,641
<p>How do I prevent vim from replacing spaces with tabs when autoindent is on?</p> <p>An example: if I have two tabs and 7 spaces in the beginning of the line, and <code>tabstop=3</code>, and I press Enter, the next line has four tabs and 1 space in the beginning, but I don't want that...</p>
<p>It is perhaps a good idea not to use tabs at all.</p> <pre><code>:set expandtab </code></pre> <p>If you want to replace all the tabs in your file to 3 spaces (which will look pretty similar to <code>tabstop=3</code>):</p> <pre><code>:%s/^I/ / </code></pre> <p>(where <code>^I</code> is the <kbd>TAB</kbd> charac...
<p><a href="http://www.jwz.org/doc/tabs-vs-spaces.html" rel="nofollow noreferrer">Maybe the bottom of this can help you?</a></p> <blockquote> <p>Standard vi interprets the tab key literally, but there are popular vi-derived alternatives that are smarter, like vim. To get vim to interpret tab as an ``indent'' command in...
9,542
<p>I am looking for a way to determine what the Name/IP Address of the domain controller is for a given domain that a client computer is connected to.</p> <p>At our company we have a lot of small little networks that we use for testing and most of them have their own little domains. As an example, one of the domains ...
<p>With the most simple programming language: DOS batch</p> <pre><code>echo %LOGONSERVER% </code></pre>
<p>To retrieve the information when the <code>DomainController</code> exists in a Domain in which your machine doesn't belong, you need something more.</p> <pre><code> DirectoryContext domainContext = new DirectoryContext(DirectoryContextType.Domain, "targetDomainName", "validUserInDomain", "validUserPassword"); ...
46,114
<p>In a previous life, I might have done something like this:</p> <pre><code>&lt;a href="#" onclick="f(311);return false;"&gt;Click&lt;/a&gt;&lt;br/&gt; &lt;a href="#" onclick="f(412);return false;"&gt;Click&lt;/a&gt;&lt;br/&gt; &lt;a href="#" onclick="f(583);return false;"&gt;Click&lt;/a&gt;&lt;br/&gt; &lt;a href="#"...
<p><a href="http://docs.jquery.com/Core/data#name" rel="nofollow noreferrer">JQuery.data</a> lets you associate a dictionary to a DOM element. This data can be set via jQuery:</p> <pre><code>&lt;a class="clicker"&gt;Click&lt;/a&gt;&lt;br/&gt; &lt;a class="clicker"&gt;Click&lt;/a&gt;&lt;br/&gt; &lt;a class="clicker"&gt...
<p>I'm sorry, but if you are already filling in the alt tag, I fail to see how delaying the assignment of the onclick handler to jQuery actually buys you anything. Isn't this just a case of "Now that I have a hammer, every problem looks like a nail." I think the jquery method is best used when the action does not dep...
47,572
<p>Is it possible to replicate selected objects (accounts) in an Active Directory Domain. We have a need to replicate selected accounts through our firewall to a DC sitting in the DMZ. We don't want to replicate <em>all</em> accounts to this machine, in case it is compromised.</p> <p>Any suggestions, help or products ...
<p>This isn't really a programming question, but anyway...</p> <p>Unless the DC on your DMZ is in a different domain, you don't need to replicate anything, it has everything already. If it's in a different domain, what exactly do you actually want to replicate and why? Permissions? Settings?</p>
<p>Apologies - I have just clarified the needs with one of the programmers (slight mis-communication before). Turns out we just need a one-way trust from the DMZ domain, to the internal domain, for accessing some internal objects (files, SQL). I thought they needed to verify some internal users on the DMZ - not so.</p>...
33,576
<p>I'm trying to debug some IE-only issues for a site I'm developing. I'm running WDE because there's no Firebug for IE. I want to see whether some changes fix a bug, but no matter what I do, IE never picks up my changes. I've tried all of the following:</p> <ul> <li>stopping and restarting the debug evnironment</l...
<p>IE Developer Toolbar has <em>"Clear Browser Cache ..."</em> and <em>"Clear Browser Cache for This Domain ..."</em> menu items.</p>
<p>Have you tried ctrl+f5? It reloads the current page and clears the cache. If even after that your changes don't propagate, the problems in your code.</p>
45,680
<p>What approach is the best way to make content-types restricted to a user in Django?</p> <p>Let us say I want all users with the user-role "blogger" to have its own blog.</p> <p>I have created a weblog app. How do I restrict it so that the user logged in can only post in his "own" blog, and how do I make views that...
<p>First your blog entries has to be attached to user, so you know on whos blog display, it, right? models.py:</p> <pre><code>class BlogEntry(models.Model): user = models.ForeignKey(User, related_name='blog_entries') other_field_1 = ... other_field_2 = ... </code></pre> <p>Next, skip it in ModelForm, form...
<p>I didnt try to implement this, but I found another soultion that worked very good. It was easy to implement and did everything i wanted.</p> <p><a href="http://www.djangosnippets.org/snippets/1054/" rel="nofollow noreferrer">Check it out...</a></p>
49,250
<p>How do you draw the following dynamic <strong>3D</strong> array with OpenGL <strong>glDrawPixels()</strong>? You can find the documentation here: <a href="http://opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html" rel="nofollow noreferrer">http://opengl.org/documentation/specs/man_pages/har...
<p>Uh ... Since you're allocating <i>each single pixel</i> with a separate <code>malloc()</code>, you will have to draw each pixel with a separate call to <code>glDrawPixels()</code>, too. This is (obviously) insane; the idea of bitmapped graphics is that the pixels are stored in an adjacent, compact, format, so that i...
<p>wouldn't you want to use glTexImage2D() instead: see <a href="https://stackoverflow.com/questions/1080545/how-to-display-a-raw-yuv-frame-in-a-cocoa-opengl-program">here</a></p>
32,478
<p>For a university mid-term project I have to design a configurable processor, to write the code in VHDL and then synthesize it on a Spartan 3E FPGA board from Digilent. I'm a beginner so could you point me to some information about configurable processors, to some ideas related to the concept?</p>
<p>You can check out my <a href="https://stackoverflow.com/questions/148229/best-way-to-learn-how-to-use-fpgas#367127">answer for a related question</a>. We did nearly the same, building a CPU in VHDL for a FPGA board.</p>
<p>This is just a mockup so please be aware i will clean it up<br> <br> fetch instruct1,<br> fetch instruct2, fetch datas1<br> fetch instruct3, fetch datas2, process datas1<br> fetch instruct4, fetch datas3, process datas2, store1 datas1<br> fetch instruct5, fetch datas4, process datas3, store2 datas1<br> fetch instruc...
28,340
<p>I have a page that spits out db data in long horizontal tables. </p> <p>I need to print it nicely so it does not cut off. Any tips ?</p>
<p>If it doesn't fit on the paper in a readable font, it just doesn't.. In my opinion, huge horizontal tables (be it a HTML table or an Excel sheet with many columns) don't lend well to printing. For that matter, they don't lend well to viewing on a screen either. Remember vertical scrolling is much easier for your use...
<p>To ensure your table won't disappear into the Printer Abyss, ensure that its container has a width set to 100%.</p> <p>I assume you know how to use print specific CSS (<code>&lt;style type="text/css" media="print"&gt;</code>).<br> Since printers and computer monitors can have very different resolutions, do most of ...
37,339
<p>Are there any alternatives to MS Access?</p> <p>Requirements:</p> <ul> <li>Portable Database file</li> <li><strong>Integrated form development for data entry</strong></li> <li>No compiling necessary. Can be modified on the fly.</li> </ul> <hr /> <p>Two more requirements:</p> <ul> <li><p>Available for Linux or Window...
<p><a href="http://www.sqlite.org/" rel="nofollow noreferrer">SQLite</a> is always my choice for lightweight databases, though it doesn't have a form creator as it's just a database. </p> <p>SQLite is great because:</p> <ul> <li>It's just a library to be called by your application, not a server.</li> <li>There's no c...
<p><a href="http://www.sqlite.org" rel="nofollow noreferrer">SQLite</a> is awesome.</p>
27,351
<p>I'm working with the SerialPort class in the Compact Framework, but I can't recive more than 2047 bytes. Exists any limit for the amount of bytes that I can recive? or How can I setup the object? I was trying with the WriteBufferSize and ReadBufferSize properties but they didn't work.</p>
<p>My guess is that it is either a processor or platform limitation. <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=22421&amp;SiteID=1" rel="nofollow noreferrer">This post</a> from the MSDN forums seems to confirm my suspicions. </p>
<p>Can you set up a thread to pull the data into another (larger) buffer that you allocate yourself? I'd say that's the best workaround.</p>
6,464
<p>What do I need to look at to see whether I'm on Windows or Unix, etc?</p>
<pre><code>&gt;&gt;&gt; import os &gt;&gt;&gt; os.name 'posix' &gt;&gt;&gt; import platform &gt;&gt;&gt; platform.system() 'Linux' &gt;&gt;&gt; platform.release() '2.6.22-15-generic' </code></pre> <p>The output of <a href="https://docs.python.org/library/platform.html#platform.system" rel="noreferrer"><code>platform.s...
<p>How about a simple Enum implementation like the following? No need for external libs!</p> <pre><code>import platform from enum import Enum class OS(Enum): def checkPlatform(osName): return osName.lower()== platform.system().lower() MAC = checkPlatform("darwin") LINUX = checkPlatform("linux") ...
2,412
<p>I have a problem that I feel is best implimented in a stand alone windows application, but needs to pass data to a web page that is already open. </p> <p>Is it possible to pass the data directly to the web page?</p> <p>If so, what is the best way to go about it?</p> <p>(Its my first question, so go easy on me!)</...
<p>They are usually used to add some form of standard functionality to a class, without having to redefine it all. You can probably think of them a bit like interfaces in Java, but instead of just defining a list of methods that need to be implemented, many of them will actually <em>be</em> implemented by including the...
<p>It is largely used as one might use multiple inheritance in C++ or implementing interfaces in Java/C#. I'm not sure where your experience lies, but if you have done those things before, mixins are how you would do them in Ruby. It's a systemized way of injecting functionality into classes.</p>
46,356
<p>I can never remember the number. I need a memory rule.</p>
<p>It's 2,147,483,647. Easiest way to memorize it is via a tattoo.</p>
<pre><code>max_signed_32_bit_num = 1 &lt;&lt; 31 - 1; // alternatively ~(1 &lt;&lt; 31) </code></pre> <p>A compiler should optimize it anyway.</p> <p>I prefer <code>1 &lt;&lt; 31 - 1</code> over </p> <p><code>0x7fffffff</code> because you don't need count <code>f</code>s</p> <p><code>unsigned( pow( 2, 31 ) ) - 1</...
12,017
<p>Here's the scenario</p> <p>I have a Grid with some TextBlock controls, each in a separate cell in the grid. Logically I want to be able to set the Visibility on them bound to a property in my ViewModel. But since they're each in a separate cell in the grid, I have to set each TextBlock's Visibility property.</p> <...
<p>There is no non-visual group that would make this possible.</p> <p>Setting the Visibility properties, directly or in a common Style shared by all of the TextBlocks, is probably the simplest solution.</p>
<p>It may be possible to make a custom control that redirects all its add/remove children methods to its own parent, while still keeping a record of its contents so it can apply its own property styles. Would be tricky though.</p>
43,590
<p>I want to automate tests on my web application, and it uses postgresql. Does anyone know how define a restore point on a postgresql database and restore to an earlier state? I heard something about point in time recovery, but i dont if this is what i need.</p> <p>Thanks in advance</p>
<p>I use <a href="http://www.sqlalchemy.org/" rel="noreferrer">SQL Alchemy</a> with cPython (I don't know if it'll work with IronPython though). It'll be pretty familiar to you if you've used Hibernate/nHibernate. If that's a bit too verbose for you, you can use <a href="http://elixir.ematia.de/trac/wiki" rel="norefe...
<p>If you are want the quick and dirty way with CPython (also works for 3.X python):</p> <p>Install PYWIN32 after you install python <a href="http://sourceforge.net/projects/pywin32/files/pywin32/" rel="nofollow">http://sourceforge.net/projects/pywin32/files/pywin32/</a></p> <p>Import the following library: import od...
36,949
<p>Like, let's say I had a tree structure, then I would use, naturally a tree control, since that GUI element maps perfectly to the structure.</p> <p>But what I have is a graph, potentially too wide to fit in one web page. I can't think of examples of GUIs that really match the structure. Some ideas I have that don'...
<p>Facebook used to do this, <em>way</em> back in the day, to visualize your friends. They drew nodes as little boxes, with lines connecting them, as expected. They drew the graphs into an SVG image, so you could easily zoom in and out.</p> <p>Another option might be to draw into a <code>&lt;canvas&gt;</code> tag and ...
<p>You could try <a href="http://prefuse.org/" rel="nofollow noreferrer">prefuse</a>. It is an open source interactive data visualization toolkit. It has a very nice collection of layouts that can be used for displaying node graphs along with other visualization effects. The toolkit comes in two different flavours, one...
30,491
<p>I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to crash?</p> <p>Ideally I'd want to ca...
<p>For logging standard output, you can use a stdout wrapper, such as this one:</p> <pre><code>from __future__ import with_statement class OutWrapper(object): def __init__(self, realOutput, logFileName): self._realOutput = realOutput self._logFileName = logFileName def _log(self, text): ...
<p>There are various ways. You can put a try..catch block in the wxApplication::OnInit, however, that would not always work with Gtk. </p> <p>A nice alternative would be to override the Application::HandleEvent in your wxApplication derived class, and write a code like this:</p> <pre><code>void Application::HandleEve...
20,070
<p>So you've just been put on the spot by The Boss. You've got 15 minutes to come up with a back of the envelope estimate for the addition of some new feature. Your boss (fortunately) recognizes that you can't provide an accurate estimate in that time so expecting something that is in the right order of magnitude.</p> ...
<p>Place finger in mouth, lick, wave in air and make up a number based on past experience. Then double it.</p> <p>Really, its just experience that counts. You imagine what the task entails you doing, and you know how long it'll take you to do that. Double it for unanticipated items. This is also why you never ask juni...
<p>I personally refuse this type of thing. But then i work for myself, so i dont answer to a boss. Just a client, but its easier to make them understand its hard to do on the spot.</p>
13,489
<p>Due to company constraints out of my control, I have the following scenario:</p> <p>A COM library that defines the following interface (no CoClass, just the interface):</p> <pre><code>[ object, uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx), dual, nonextensible, helpstring("IService Interface"), ...
<p>It could be a problem with the name <em>IServiceProvider</em>. Check that you haven't already imported an interface with the same name.</p> <p>When I create an COM Interface library using your IDL, and then try to import it from another client, I get the warning:</p> <pre><code>Warning 65 warning C4192: automati...
<p>You may have to specify additional attributes on your class to have it marshal correctly. I would look through available attributes <a href="http://msdn.microsoft.com/en-us/library/d4w8x20h(VS.71).aspx" rel="nofollow noreferrer">here</a> and maybe look at <a href="http://www.codeproject.com/KB/COM/cominterop.aspx" r...
23,757
<p>In the code below I am using a recursive CTE(Common Table Expression) in SQL Server 2005 to try and find the top level parent of a basic hierarchical structure. The rule of this hierarchy is that every CustID has a ParentID and if the CustID has no parent then the ParentID = CustID and it is the highest level.</p> ...
<p>If you just want want the highest recursion depth couldn't you do something like this?Then, when you actually query the CTE just look for the row with max(Depth)? Like so:</p> <pre><code>DECLARE @LookupID int --Our test value SET @LookupID = 1; WITH cteLevelOne (ParentID, CustID, Depth) AS ( SELECT a.P...
<p>First the cte will not be finished if any of the parent child are same. As it is a recursive CTE it has to be terminated. Having Parent and cust id same , the loop will not end.</p> <p>Msg 530, Level 16, State 1, Line 15 The statement terminated. The maximum recursion 100 has been exhausted before statement complet...
5,577
<p>Access Datasheet view appears to be blank(charaters appear in white hence not visible) in WSS3.0</p>
<p>It sounds like a styling problem on your SharePoint page.</p>
<p>I got the issue fixed, only the page property needed to be changed and it worked. Now the data sheet is visible with data inside it in balck color</p>
46,798
<p>Is there any way to re-generate views from newly updated model?</p>
<p>Unless you've made a lot of changes to the scaffold, it's probably easier just to overwrite the current scaffold:</p> <pre><code>./script/generate -f scaffold Model </code></pre>
<p>The scaffold is not intended to <em>create</em> the interface, only to make a starting point for further development. I'm not sure it's even possible (without a lot of unnecessary work) to redo a scaffold, it's much quicker to manually edit the view and controller anyway.</p>
42,792
<p>Can someone provide a simple explanation of <strong>methods</strong> vs. <strong>functions</strong> in OOP context?</p>
<p>A <strong>function</strong> is a piece of code that is called by name. It can be passed data to operate on (i.e. the parameters) and can optionally return data (the return value). All data that is passed to a function is explicitly passed.</p> <p>A <strong>method</strong> is a piece of code that is called by a name...
<p>A function is a set of instructions or procedures to perform a specific task. it can be used to split code into easily understandable parts, which can be invoked or reused as well.</p> <p>Methods are actions that can be performed on objects. it is also known as functions stored as object properties.</p> <p><strong>M...
18,825
<p>Does anyone know how to write to an excel file (.xls) via OLEDB in C#? I'm doing the following:</p> <pre><code> OleDbCommand dbCmd = new OleDbCommand("CREATE TABLE [test$] (...)", connection); dbCmd.CommandTimeout = mTimeout; results = dbCmd.ExecuteNonQuery(); </code></pre> <p>But I get an OleDbException ...
<p>You need to add <code>ReadOnly=False;</code> to your connection string</p> <pre><code>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=fifa_ng_db.xls;Mode=ReadWrite;ReadOnly=false;Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"; </code></pre>
<ul> <li>How do I check the permissions for writing to an excel file for my application (I'm using excel 2007)?</li> <li>The file is not read only, or protected (to my knowledge).</li> <li>My connection String is: </li> </ul> <blockquote> <p>"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=fifa_ng_db.xls;Mode=...
8,242
<p>I can't seems to change the default color of the required field validator. In the source it is:</p> <pre><code>&lt;span class="required"&gt;*&lt;/span&gt; &lt;asp:RequiredFieldValidator ID="valReq_txtTracks" runat="server" ControlToValidate="txtTracks" Display="Dynamic" /&gt; </code></pre> <p>Here's what ...
<p>There is a <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.basevalidator.forecolor.aspx" rel="noreferrer">RequiredFieldValidator.ForeColor</a> property you can set to control the color. Note that if you want to set the color in CSS, then you need to set ForeColor="" to clear it on the cont...
<p>Using <code>!important</code> seems to work fine in Firefox and IE, but for some reason not in Google Chrome... no biggie though, Chrome's share is still very low.</p> <pre><code>.form_error { font: bold 15px arial black,arial,verdana,helvetica !important; color: #ff0000 !important; } </code></pre>
27,052
<p>I have a few batch files I need to run frequently in developing a certain project. I'd like to create a Visual Studio toolbar called "MyProject" and have commands underneath to execute these batch files. What is the easiest way to accomplish this?</p>
<p>In the <em>Tools...</em> menu, select <em>External Tools...</em> and add references to the batch files. Then right-click on a toolbar, select <em>Customize...</em>, go to the <em>Toolbars</em> tab, click on <em>New...</em>, name your new toolbar, click on <em>OK</em>, go to the <em>Commands</em> tab, select the <em>...
<ol> <li>How to install an icon in Visual Studio to run a batch file.</li> <li>On the menu go to Tools > External Tools</li> <li>Click Add and fill in the following: <ol> <li>Title: The name that shows up for the icon name.</li> <li>Command: Browse to the file name and click ok or put the file path and file name here.<...
26,205
<p>Can anyone recommend a book or a website that explains Internet Explorer Automation using VB.NET? I understand that mshtml and ShDocVw.dll can do this, but I need a resource that will explain it to me. I want to read/write values as well as click buttons.</p> <p>The only book I have come across so far is .Net Test ...
<p>You can take a look at <a href="http://watin.sourceforge.net/index.html" rel="nofollow noreferrer">WatiN</a> if you want some source code that goes in depth in terms of automating IE. In fact it may do exactly what you are trying to do.</p>
<p>Check this article : Internet Explorer Late Binding Automation Internet Explorer automation sample code using late binding, without Microsoft.mshtml and shdocvw dependency.</p> <p><a href="http://www.codeproject.com/KB/cs/IELateBindingAutowod.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/IELateB...
12,246
<p>I have found the "Getting Started" documents for developing apps on iPhone.</p> <ol> <li><p>I wanted the community's opinion on <strong>what I should know/learn</strong> (in terms of languages or concepts)?</p></li> <li><p>How long would it take for a moderate programmer to learn and build an app that manages a lis...
<blockquote> <p>I wanted the community's opinion on what I should know/learn (in terms of languages or concepts)?</p> </blockquote> <p>You will be using Objective-C and Cocoa. These are fairly strange concepts to crasp if you have not done MAC programming before, but after a short while you will probably fall in l...
<p>First of all: buy a mac if you don't have one already, the windows tooling pipeline is basically non-existant. And trying to run OSX on non-apple harware is illegal in most situations.</p> <p>Download the iPhone SDK. <a href="http://developer.apple.com/iphone/" rel="nofollow noreferrer">http://developer.apple.com/i...
46,421
<p>I've been trying to figure out how to print in Adobe AIR. I know the standard javascript functions don't work. The AIRforJSDev guide says: "The window.print() method is not supported within Adobe AIR 1.0. There are other methods available via the exposed AIRAPIs that give you access to printing within the runtime"<...
<p>What you need to do is access the AS3 <a href="http://livedocs.adobe.com/flex/201/langref/flash/printing/PrintJob.html" rel="nofollow noreferrer">flash.printing.PrintJob</a> API. Here's a page on <a href="http://livedocs.adobe.com/air/1/devappshtml/help.html?content=ProgrammingHTMLAndJavaScript_05.html" rel="nofollo...
<p>If you're talking about just printing out to the console then you'll want the trace() method.</p> <p>This can be accessed using air.trace() from within javascript assuming you have the AIRAliases.js file included.</p>
14,475
<p>Does anyone have any best practices, tips &amp; tricks, or recommendations for how to create modal Alert Views with Cocoa Touch?</p> <p>I like to think there is a way to make this difficult task trivial or at least easier.</p>
<p>You can use something like this:</p> <pre><code>void AlertWithMessage(NSString *message) { /* open an alert with an OK button */ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Name of the Application" message:message delegate:nil ...
<p>I just use UIAlertView to display modal alerts. What additional functionality are you looking for?</p>
45,128
<p>I have a custom control that inherits from WebControl and implements IValidator, but I also want to have a property for ValidationGroup. From research, it appears I need to inherit from BaseValidator to do so. Can anybody provide a successfull example from a ASP.Net custom control that implements both BaseValidato...
<p>I use <a href="http://www.esperanto.mv.ru/UniRed/ENG/" rel="nofollow noreferrer">UniRed</a> for Unicode-intensive stuff. (I don't use it as a general purpose editor though: jEdit). UniRed displays the hex value for the current glyph in the lower screen, which is really handy (even for ASCII).</p>
<p><a href="http://www.ultraedit.com/products/ultraedit.html" rel="nofollow noreferrer">Ultraedit</a> is my favorite text editor and it is advertised as having good Unicode support</p> <p><a href="http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/unicode.html" rel="nofollow noreferrer">http://www.ultraed...
29,046
<p>I have a bit of a problem. I wrote an API a long time ago for our production system, and it used Apache XML Beans. The schema was homogeneous (ie no imports, everything was from within the same schema), and everything worked just fine, even if the code for API handling was incredibly verbose. I've since written a...
<p>Handle the Leave event of your textBox1. Inside the event handler, if your conditions are not met, for e.g. if the user has not entered some input, reset the focus back to the control.</p> <pre><code>private void textBox1_Leave(object sender, EventArgs e) { if string.isNullOrEmpty(textBox1.Text) { t...
<p>Handle the Leave event of your textBox1. Inside the event handler, if your conditions are not met, for e.g. if the user has not entered some input, reset the focus back to the control.</p> <pre><code>private void textBox1_Leave(object sender, EventArgs e) { if string.isNullOrEmpty(textBox1.Text) { t...
35,708
<p>In a .net system I'm building, there is a need for automated e-mail notifications. These should be editable by an admin. What's the easiest way to do this? SQL table and WYSIWIG for editing?</p> <hr> <p>The queue is a great idea. I've been throwing around that type of process for awhile with my old company.</p>
<p>From a high level, yes. :D The main thing is some place to store the templates. A database is a great option unless you're not already using one, then file systems work fine.</p> <p>WSIWIG editors (such as fckeditor) work well and give you some good options regarding the features that you allow.</p> <p>Some sor...
<p>Are you just talking about the interface and storage, or the implementation of sending the emails as well?</p> <p>Yes, a SQL table with FROM, TO, Subject, Body should work for storage and, heck, a textbox or even maybe a RichText box should work for editing.</p> <p>Or is this a web interface?</p> <p>For actually ...
2,803
<p>As part of the Nant copy task, I would like to change the properties of the files in the target location. For instance make the files "read-write" from "read-only". How would I do this?</p>
<p>Use the &lt;<a href="http://nant.sourceforge.net/release/0.85-rc1/help/tasks/attrib.html" rel="noreferrer">attrib</a>&gt; task. For example, to make the file "test.txt" read/write, you would use</p> <pre><code>&lt;attrib file="test.txt" readonly="false"/&gt; </code></pre>
<p>Also, for a list of files, the command is:</p> <pre><code>&lt;attrib readonly="false"&gt; &lt;fileset basedir="mydirectory"&gt; &lt;include name="**"/&gt; &lt;/fileset&gt; &lt;/attrib&gt; </code></pre>
10,106
<p>I have a program that uses the mt19937 random number generator from boost::random. I need to do a random_shuffle and want the random numbers generated for this to be from this shared state so that they can be deterministic with respect to the mersenne twister's previously generated numbers.</p> <p>I tried something...
<p>In C++03, you cannot instantiate a template based on a function-local type. If you move the rand class out of the function, it should work fine (disclaimer: not tested, there could be other sinister bugs).</p> <p>This requirement has been relaxed in C++0x, but I don't know whether the change has been implemented in...
<p>I thought it was worth pointing out that this is now pretty straightforward in C++11 using only the standard library:</p> <pre><code>#include &lt;random&gt; #include &lt;algorithm&gt; std::random_device rd; std::mt19937 randEng(rd()); std::shuffle(vec.begin(), vec.end(), randEng); </code></pre>
17,744
<p>I would like to build a web application on Castle MonoRail, I was wondering how can we use an action with extension and another action without extension? How can HTML helper generator url for us?</p> <p>Ex: </p> <ul> <li><a href="http://mysite.com/Products/list" rel="nofollow noreferrer">http://mysite.com/Products...
<p>The answer is <strong>Yes</strong>, you can, by using routing. The exact method you need to use to get the routing working depends upon which version of Monorail you are using. However, adding routing can have some negative impact on performance unless you are careful.</p> <p>It is also worth noting that you don't ...
<p>You can try creating a routing role like</p> <pre><code>/&lt;controller&gt;/&lt;action&gt;.castle </code></pre> <p>and it would do the trick.</p>
41,413
<p>I've been looking for a tool to extract exception information from a C++ program. The most wanted feature I'm looking for: I want to know all the exceptions that can be thrown from a function (which would include all the function that is called from that function recursively).</p> <p>I've always thought that docume...
<p><a href="http://www.gimpel.com/" rel="nofollow noreferrer">PC-Lint</a> claims to do static exception analysis of C++ code.<br> <a href="http://www.coverity.com/" rel="nofollow noreferrer">Coverity</a> is another static C++ code analysis tool that apparently informs you of unhandled exceptions.<br> <a href="http://ww...
<p>EDoC++ (<a href="http://edoc.sourceforge.net" rel="nofollow noreferrer">http://edoc.sourceforge.net</a>) is another alternative.</p>
4,793
<p>I need to be able to retrieve a CREATE TABLE script to recreate a specific table in a SQL Server (2000) database, programmatically (I'm using C#). Obviously you can do this with Enterprise Manager but I would like to automate it. </p> <p>I've been playing around with SQLDMO which offers a Backup command, but I'm no...
<p>Take a look at <a href="http://www.stackoverflow.com/questions/21547/in-mssql-how-do-i-generate-a-create-table-statement-for-a-given-table">my solution</a>. It's a sql script which uses the INFORMATION_SCHEMA tables to get the necessary information. It's basic, but might work for you.</p>
<p>You can use SMO to generate the scripts. For more info see: <a href="http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated" rel="nofollow noreferrer">http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated</a></p>
7,144
<p>Can pipes be used across LAN computers?</p> <p>In particular I'm looking for Windows, but if you have more info on other platforms, that will also help others who find this thread later. </p>
<p>Yes they can.</p> <blockquote> <p>Named pipes can be used to provide communication between processes on the same computer or between processes on different computers across a network. If the server service is running, all named pipes are accessible remotely</p> </blockquote> <p><a href="http://msdn.mic...
<p>It should also be noted that a TCP/IP connection is effectively a pipe in the sense that you shove bytes in one end and they come out the other. TCP/IP connections are available on pretty much any platform you are likely to care about.</p>
23,298
<p>I am using DoCmd.SendObject to send emails from MS access 2003. It opens the outlook with all relevant fields filled. But the user may not choose to send the email at that time. In that case, a prompt 'Send Action was cancelled' appears. Is there a way to catch this non-sending of email by user</p>
<p>It is possible to use Outlook events from Microsoft Access with a class module. You will find details in the <a href="http://wiki.lessthandot.com/index.php/Access_and_Email" rel="nofollow noreferrer">LessThanDot wiki</a>, under the heading "Example: Use Outlook Events with Access"</p>
<p>Perhaps Tony Toews's <a href="http://www.granite.ab.ca/Access/email.htm" rel="nofollow noreferrer">Access EMail FAQ</a> would be of use to you.</p>
22,670
<p>What is the best method for executing FTP commands from a SQL Server stored procedure? we currently use something like this:</p> <pre><code>EXEC master..xp_cmdshell 'ftp -n -s:d:\ftp\ftpscript.xmt 172.1.1.1' </code></pre> <p>The problem is that the command seems to succeed even if the FTP ended in error. Also, the...
<p>If you're running SQL 2005 you could do this in a CLR integration assembly and use the FTP classes in the System.Net namespace to build a simple FTP client.</p> <p>You'd benefit from being able to trap and handle exceptions and reduce the security risk of having to use xp_cmdshell.</p> <p>Just some thoughts.</p>
<p>If you need to do FTP from within the database, then I would go with a .NET assembly as Kevin suggested. That would provide the most control over the process, plus you would be able to log meaningful error messages to a table for reporting.</p> <p>Another option would be to write a command line app that read the d...
2,627
<p>When I press F5 in Visual Studio 2008, I want Google Chrome launched as the browser that my ASP.NET app runs in. May I know how this can be done?</p>
<p>Right click on an .aspx file and click "Browse with..." then select Chrome and click "Set as Default." You can select more than one browser in the list if you want.</p> <p>There's also this really great <a href="http://visualstudiogallery.msdn.microsoft.com/bb424812-f742-41ef-974a-cdac607df921/" rel="noreferrer">Wo...
<p>In case you are using Visual Studio 2019: To change default browser type defaults in home, then click browser.</p> <p>See this picture:</p> <p><a href="https://i.stack.imgur.com/qVaJp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qVaJp.jpg" alt="defaults apps" /></a></p> <p><a href="https://lear...
8,365
<p>Is there an easy way to create a table in SQL Server (2005) from an Excel spreadsheet. I'm thinking maybe some tool?</p> <p>Thanks in advance.</p>
<p>If the data is not that big and if it is a simple table, easiest way is to create and open the table in SQL Server Management Studio and copy paste the excel data into it.</p> <p>Other solutions are using DTS or using <a href="https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/datacenter/?p=205" re...
<p>You can write VBA code in Excel:</p> <ul> <li>Open a connection to the database</li> <li>Build the table</li> <li>Start filling records by looping through the rows of the spreadsheet Excel</li> </ul>
21,607
<p>As good developers we keep our code as standard compliant as possible to help in porting between platforms. But what tools are available that help us build the code in a uniform way across multiple platforms.</p> <p>*nix family has <code>make</code> but Windows needs <code>nmake</code>.</p> <p>I have read about <a...
<p>cmake for c/c++ environments is good. <a href="http://www.cmake.org/" rel="nofollow noreferrer">http://www.cmake.org/</a></p>
<p>If you're in the Java world, there are quite a few tools which are cross-platform. Apache Ant and Maven are both build tools which will run on any platform which has Java available for it.</p> <p>Cruise Control (continuous integration tool) also works on Windows and Linux (it's written in Java as well).</p> <p>I h...
21,397
<p>I'm trying to make it so when a user scrolls down a page, click a link, do whatever it is they need to do, and then come back to the pages w/ links, they are at the same (x-y) location in the browser they were before. How do I do that?</p> <p>I'm a DOM Newbie so I don't know too much about how to do this. </p> <...
<p>To get the x-y location of where a user clicked on a page, use the following jQuery code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ ...
<p>you can use offsetLeft and offsetTop</p>
9,323
<p> We recently switched our Windows software packages from RPM (cygwin) to MSI (wix). Having a native packaging is a much welcome change and we intend to stick with it. However, MSI feels overly complicated for what it does and doesn't seem to provide some basic abilities. But I'm probably mistaken. </p> <p> Is there ...
<p>Mabybe <a href="http://msdn.microsoft.com/en-us/library/aa394378(VS.85).aspx" rel="noreferrer">this</a> is a good starting point for you example VB Script from MSDN:</p> <pre><code>strComputer = "." Set objWMIService = GetObject("winmgmts:" &amp; _ "{impersonationLevel=impersonate}!\\" &amp; _ strComputer ...
<p>I'm not sure if this is what you need but you can query the uninstall list from the command line with:</p> <pre><code>REG QUERY HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall </code></pre>
24,122
<p>I regularly achieve 100% coverage of libraries using TDD, but not always, and there always seem to be parts of applications left over that are untested and uncovered.<br> Then there are the cases when you start with legacy code that has very few tests and very little coverage. </p> <p>Please say what your situatio...
<p>Delete code.</p> <p>This isn't snarky, but actually serious. Any time I would see the smallest amount of code duplication or even code that I couldn't get to execute, I deleted it. This increased coverage and increased maintainability.</p> <p>I should note that this is more applicable to increasing the coverage of...
<p><a href="http://en.wikipedia.org/wiki/Framework_for_Integrated_Tests" rel="nofollow noreferrer">FIT testing</a> has improved our code coverage. It has been great because it is an entirely different tack.</p> <p>Background: we have a mix of legacy and new code. We try to unit/integration test the new stuff as much ...
20,597
<p>Consider two tables transaction and category each having their own ID and information.</p> <p>A transaction can have more than one category, I have read creating a 3rd table to link transaction and category using their IDs is best. But what would you call this table, assuming you would have many like it?</p> <p>tr...
<p>My naming scheme for these is to use the terminology of the domain for the interaction if there is one (eg. not <code>student_class</code>, but <code>enrollment</code>). When there is no such terminology, then you fall back onto <code>transaction_category</code> or <code>category_transaction</code> whichever sounds...
<p>TransactionCategories is just fine. There probably isn't anything "better", just different.</p> <p>At times in the past, when I have created a table that just has the two foreign keys it needs to resolve the many-to-many, I append "Xref" to its name, which gives a clue that it doesn't have any attributes. It's ...
35,853
<p>Is there a <a href="http://en.wikipedia.org/wiki/ZeroConf" rel="nofollow noreferrer">ZeroConf</a> client extension for Firefox/XULRunner to be used in a zeroConf environment based on either <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt" rel="nofollow noreferrer">mDNS</a> or <a href="h...
<p><a href="http://www.opensrs.com" rel="nofollow noreferrer">www.opensrs.com</a> charge a one-off $95 setup fee (which converts into $95 credit on the account). That's not quite what you asked for, but it is pretty low. You get access to a well documented, functional API. However you need to pay for domains by making ...
<p><a href="http://www.dotster.com/resources/partnerships/" rel="nofollow noreferrer">Dotster</a> Actually has a free reseller program, and they used to have an API that you could use to register domain names. Something to look into anyway, if you want to automatically register domain names.</p>
23,427
<p>I'm looking for a (preferably free) component for Delphi for users to easily select about 100 different colours.</p> <p>I've currently got one as part of DevExpress's editors, but it only has about 20 proper colours to choose, with a bunch of other 'Windows' colours like clHighlight, clBtnFace, etc.</p> <p>It's fo...
<p>What's wrong with the TColorDialog?<br> It gives you the standard Windows color dialog, exactly the same as in MSPaint...<br> Add these options to show it directly expanded and with all colors available. </p> <pre><code>object ColorDialog1: TColorDialog Options = [cdFullOpen, cdAnyColor] end </code></pre>
<p>There was an article about creating a custom colour selection component in issue 3 of the blaise pascal magazine.</p> <p><a href="http://www.blaisepascal.eu/blaisepascal_3/color_selection_component_david_dirkse.php" rel="nofollow noreferrer">http://www.blaisepascal.eu/blaisepascal_3/color_selection_component_david_...
35,371
<p>Does anyone know how to debug <code>JSP</code> in <strong>IntelliJ</strong> IDEA?</p> <p>When I set breakpoint in my <code>JSP</code> files, those breakpoints never seem to take effect. The debugger never hits them. IDEA seems to think that the breakpoints are valid. I do see a red dot placed to the left of the lin...
<p>For JSP debugging in Intellij there are some configurations that must be in order. The fact that Intellij always allows you to add a breakpoint on a JSP line does not necessarily imply that you’ve configured JSP debugging. In the following I refer to Intellij 8 configuration, w.r.t. previous versions you will need ...
<p>For the second part of your question ("jsp files placed under web-inf won't be directly accessible by user") that is correct. To allow users to access JSP files in the WEB-INF folder servlet and servlet-mapping entries need to be made in the web.xml file for each JSP page. </p>
5,381
<p>I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy or packet sniffer for the browser to use in order to see what its sending?</p> <p>I'm already using ...
<p>Try winpcap . It's a driver/library combination which can be used to monitor packets. Based on what you are trying to do (watch traffic w/o a UI), this is probably a simpler solution than writing your own proxy.</p>
<p>Have you looked at implementing an Http Module or an Http Handler (.ashx)? They will allow you to intercept each and every web request and process them as you need before getting to your page.</p>
16,622
<p>When is this called? More specifically, I have a control I'm creating - how can I release handles when the window is closed. In normal win32 I'd do it during <code>wm_close</code> - is <code>DestroyHandle</code> the .net equivalent?</p> <hr> <p>I don't want to destroy the window handle myself - my control is liste...
<p>Normally <code>DestroyHandle</code> is being called in <code>Dispose</code> method. So you need to make sure that all controls are disposed to avoid resource leaks.</p>
<p>Normally <code>DestroyHandle</code> is being called in <code>Dispose</code> method. So you need to make sure that all controls are disposed to avoid resource leaks.</p>
6,506
<p>I would like to know what kind of toolkits, languages, libraries exist for agent-based modeling and what are the pros/cons of them?</p> <p>Some examples of what I am thinking of are <a href="http://www.swarm.org" rel="noreferrer">Swarm</a>, <a href="http://repast.sourceforge.net/" rel="noreferrer">Repast</a>, and <...
<p>I found a survey from June 2009 that answer your question: </p> <p>Survey of Agent Based Modelling and Simulation Tools</p> <p>Au. R.J. Allan </p> <blockquote> <p><strong>Abstract</strong><br> Agent Based Modelling and Simulation is a computationally demanding technique based on discrete event simulation an...
<p>PHP and Java developers should take a look at <a href="http://kato.sourceforge.net/kato.html" rel="nofollow noreferrer">KATO</a>.</p>
20,131
<p>In bash, environmental variables will tab-expand correctly when placed after an echo command, for example:</p> <pre><code>echo $HOME </code></pre> <p>But after cd or cat, bash places a \ before the $ sign, like so:</p> <pre><code>cd \$HOME </code></pre> <p>If I use a variable as the second argument to a command,...
<p>Try <strong><em>complete -r cd</em></strong> to remove the special programmatic completion function that many Linux distributions install for the <code>cd</code> command. The function adds searching a list of of directories specified in the CDPATH variable to tab completions for <code>cd</code>, but at the expense o...
<p>I'm answering 4-year-old question! Fantastic!</p> <p>This is a bash bug/feature which was unintentionally introduced in v4.2, and was unnoticed for a long period of time. This was pointed out by geirha in <a href="https://askubuntu.com/questions/41891/bash-auto-complete-for-environment-variables">this tread</a>. Co...
12,887
<p>I am developing a C++ domain model class library which should provide some facilities or a framework (i.e. interface classes etc) for writing/reading class instance data to/from both a binary file and a RDBMS. The basis for this library is an application that uses a RDBMS, and there are several methods which instant...
<p>I don't have a good solution for you, but I can tell you what I have, and some thoughts and experiences. I have built something very similar, based on a model I had seen used before, as a C++ library.</p> <p>Some thoughts, in no particular order:</p> <ul> <li>Have a separate instance of the DAO object for each ins...
<p>I don't know the best implementation, but here's what I've seen done:</p> <ol> <li>Separate for each instance.</li> <li>Created right before it is needed and destroyed right after.</li> <li>Don't know.</li> <li>Combine the data outside of the DAO instances, thereby avoiding the coupling.</li> </ol> <p>Disclaimer: ...
24,037
<p>I'm writing an editor for large <em>archive files</em> (see below) of 4GB+, in native&amp;managed C++.</p> <p>For accessing the files, I'm using <em>file mapping</em> (see below) like any sane person. This is absolutely great for reading data, but a problem arises in actually editing the archive. File mapping does ...
<p>What do you mean by 'editor software'? If this is a text file, have you tried existing production-quality editors, before writing your own? If it's a file storing binary data, have you considered using an RDBMS and manipulating its contents using SQL statements?</p> <p>If you absolutely have to write this from s...
<p>I'd build the large file from pieces at build-time. You have your editor deal with normal, flat files, in the usual file system (with subdirectories, etc., as appropriate). You then have a compile step that gathers all of these pieces together into your <em>archive</em> file format.</p>
23,783