instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm using the <a href="http://code.msdn.microsoft.com/silverlightut/" rel="noreferrer">Silverlight UnitTest framerwork</a> does anyone have a good example have how to unit test an application with it? I'm using it quite successfully to unit test a silverlight class library.</p> <p>Any pointers and links would be gr...
<p>Nath, The Silverlight Control Toolkit uses it. Why not take a look at the unit tests there?</p> <p><a href="http://www.codeplex.com/silverlight" rel="nofollow noreferrer">http://www.codeplex.com/silverlight</a></p>
<p>You should also try to use <a href="http://www.typemock.com/Silverlight_unit_testing_page.php" rel="nofollow noreferrer">SilverUnit</a> for real <a href="http://www.typemock.com/Silverlight_unit_testing_page.php" rel="nofollow noreferrer">Silverlight unit testing</a>, it is a really easy to use framework, which also...
39,781
<p>I know I could just ask, but that would involve bureaucratic entanglements.</p>
<p>Try ping or nslookup _ldap._tcp. with your AD Domain (e.g. _ldap._tcp.test.com) in a console (cmd.exe) - this should give you the AD Server IP.</p> <pre><code>_ldap._tcp.* </code></pre> <p>Is a general SRV entry made by your active directory server for locating LDAP (AD) servers in your domain. Your domain itself ...
<p>I believe that on an AD network that is DNS enabled the root zone points at all the AD servers. So, for instance, if your official AD username is joebloe@company.ad, doing an nslookup of company.ad from cmd.exe will tell you all the IPs of the controllers (and hence all the IPs you could use for LDAP).</p> <p>This...
21,165
<p>I've always felt that my graphic design skills have lacked, but I do have a desire to improve them. Even though I'm not the worlds worst artist, it's discouraging to see the results from a professional designer, who can do an amazing mockup from a simple spec in just a few hours. I always wonder how they came up w...
<p>Most of artistic talent comes from putting in the time. However, as in most skills, practicing bad habits doesn't help you progress.</p> <p>You need to learn basic drawing skills (form, mainly) and practice doing them well and right (which means slowly). As you practice correctly, you'll improve much faster.</p> ...
<p>I, too was not born with a strong design skillset, in fact quite the opposite. When I started out, my philosophy was that if the page or form <em>just works</em> then my job was done! </p> <p>Over the years though, I've improved. Although I believe I'll never be as good as someone who was born with the skills, site...
5,242
<p>I am using <a href="http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fillpolygon.aspx" rel="nofollow noreferrer">FillPolygon</a> with a semi-transparent color to draw a triangle (an arrow pointer). I have noticed that FillPolygon gives awkward results with an isocel triangle. One of the sides is overl...
<p>You want use a bitmap and do something like this. Note this is not runnable code.</p> <pre><code> Dim image As New Bitmap(&lt;my_Xsize&gt;, &lt;my_Ysize&gt;) Dim gr As Graphics = Graphics.FromImage(image) &lt;Draw your FillPolygon&gt; &lt;Erase the leftside of the polygon&gt; &lt;Draw your Polygo...
<p>Hack: Draw the whole arrow as opaque in an intermediate buffer, then draw the whole buffer onto your image using the appropriate transparency.</p>
47,400
<p>I want to enumerate all available drive letters (which aren't already taken) in Windows using VC++.</p> <p>How can I do this?</p>
<p><a href="https://msdn.microsoft.com/en-us/library/aa364972(v=vs.85).aspx" rel="noreferrer">::GetLogicalDrives()</a> returns a list of available (read: used) drives as bits in a mask. This should include mapped network drives. Thus, you can simply walk the bits to find bits that are zero, meaning no drive is present....
<p>The following code will do the job:</p> <pre><code>for (w_chDrv = 'C'; w_chDrv &lt;= 'Z'; w_chDrv++) { // make root path _stprintf_s(w_szRootPath, 3, _T(&quot;%c:&quot;), w_chDrv); // get driver type w_nDriverType = GetDriveType(w_szRootPath); if ((w_nDriverType != DRIVE_REMOVABLE) &amp;&amp; (w...
36,414
<p>I know I have already answered a similar question (<a href="https://stackoverflow.com/questions/289498">Running Batch File in background when windows boots up</a>), but this time I need to launch a batch:</p> <ul> <li>from another batch,</li> <li>without any console window displayed,</li> <li><em>with all arguments...
<p>Here is a possible solution:</p> <p>From your first script, call your second script with the following line:</p> <pre><code>wscript.exe invis.vbs run.bat %* </code></pre> <p>Actually, you are calling a vbs script with:</p> <ul> <li>the [path]\name of your script</li> <li>all the other arguments needed by your sc...
<p>You can run your .bat file through a .vbs file<br> Copy the following code into your .vbs file :</p> <pre><code>Dim WshShell Dim obj Set WshShell = WScript.CreateObject("WScript.Shell") obj = WshShell.Run("C:\Users\file1.bat", 0) obj = WshShell.Run("C:\Users\file2.bat", 0) and so on set WshShell = Nothing </cod...
38,225
<p>I'm building a framework and want developers who build with it to have the ability to allow parts of it to both share data with other sites and allow other sites to add/edit/delete data.</p> <p>For example, if someone makes a site that has book reviews, authors, quotes, code examples, comments, etc. the developer c...
<p><strong>Am I locking myself out from taking advantage of some standard if I dont' use these?</strong></p> <p>You are yourself locking out from the HTTP standard. Of course you can use GET parameters to do the same thing. It's just not REST then, but something RPC-Like. </p> <p>May I suggest the book <a href="https...
<p>I find nothing restfull about REST. To me, its a great concept from an abstract point of view for web geeks that do not have to deal with the more gritty coding issues involved in complex HTTP communication.</p> <p>Wouldn'd it be nice if a REST API was available that abstracted us from all the HTTP. But it doesn't....
44,644
<p>I'm using the <a href="http://msdn.microsoft.com/en-us/library/ms178329.aspx" rel="nofollow noreferrer">ASP.NET Login Controls</a> and <a href="http://msdn.microsoft.com/en-us/library/aa480476.aspx" rel="nofollow noreferrer">Forms Authentication</a> for membership/credentials for an ASP.NET web application.</p> <p>...
<p>This works for me in Java 1.5 - I stripped out specific exceptions for readability.</p> <pre><code>import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import java.io.ByteArrayInputStream; public Document loadXMLFromString(String xml) throws Except...
<p>To manipulate XML in Java, I always tend to use the Transformer API:</p> <pre><code>import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.stream.StreamSource; public sta...
5,330
<p>I am modelling a few cut templates to be used on an hexagonal grid (honeycomb) material using OpenSCAD. Basically, from a reference cell, I need to select all cells that are within a given range and given angle.</p> <p>I implemented this by creating an in memory grid that covers an area larger than what I need (ex...
<p>I ended up finding a reasonable solution myself:</p> <p><a href="https://i.stack.imgur.com/mp3ET.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mp3ET.png" alt="enter image description here"></a></p> <p>Basically, I diffed two identical, non-hollow geometries, in which the first one had the cell...
<p>Unfortunately, OpenSCAD does not have a 2D hull() transformation, although it has been requested. You might be able to find a pre-written package that implements a 2D hull. However, if all you want is a hexagonal grid with a border of some arbitrary shape, could you not cheat, and get your slicer to generate the gri...
752
<p>I've made some performance improvements to my application's backend, and to show the benefit to the end users of the GUI, we've been using the Trace.axd page to take timings. (The frontend is .Net 1.1 and the backend is Java, connected via Web services.)</p> <p>However, these timings show no difference between the ...
<p>OK, I kind of got what I wanted in the end. The problem is the IIS Trace doesn't include the time the POST takes to return.</p> <p>I found that I could use Trace.Write() to add custom entries to the trace log, and even add a category, using Trace.Write(string category, string message).</p> <p>Adding a call to Trac...
<p>I'm not sure how you're making the requests on the .NET side, but I'll assume that there's a HttpWebRequest involved somewhere. I'd expect HttpWebRequest.GetResponse() to return as soon as it has received the response headers. That way, you can start processing the start of a large response while the rest is still d...
25,016
<p>During my apprenticeship, I have used <a href="http://nhibernate.org/" rel="noreferrer" title="NHibernate for .NET">NHibernate</a> for some smaller projects which I mostly coded and designed on my own. Now, before starting some bigger project, the discussion arose how to design data access and whether or not to use ...
<p>There's been an explosion of growth with ORMs in recent years and your more experienced coworkers may still be thinking in the "every database call should be through a stored procedure" mentality.</p> <p>Why would an ORM make things harder to debug? You'll get the same result whether it comes from a stored proc or...
<p>Every ORM, even a "good one", comes saddled with a certain number of assumptions that are related to the underlying mechanics that the software uses to pass data back and forth between your application layer and your data store.</p> <p>I have found that for moderately sophisticated application, that working around ...
23,588
<p>Many times I use 'mqsc' for create MQ queue manager from script files but I don't know how to generate script files.</p> <p>Thanks</p>
<p>There is a SupportPac that installs a program called "saveqmgr.exe". </p> <p>Here's a link to the download of the Pac: <a href="http://shrinkster.com/17kc" rel="noreferrer">http://shrinkster.com/17kc</a></p> <p>IBM seems to frequently reorganize its website, so the above link might not work if you check back here...
<p>If you are parsing the MQSC files with script, SupportPac <a href="http://bit.ly/aPJ8tZ" rel="nofollow noreferrer">MO72: MQSC Client for WebSphere MQ</a> is invaluable. It runs in client or bindings mode and acts like runmqsc but you can also specify output to be formatted on one line. That enables you to submit a...
37,752
<p>I have a database with a few dozen tables interlinked with foreign keys. Under normal circumstances, I want the default <code>ON DELETE RESTRICT</code> behavior for those constraints. But when trying to share a snapshot of the database with a consultant, I needed to remove some sensitive data. I wish that my memory ...
<p>You do not need to dump and restore. You should be able to just drop the constraint, rebuild it with cascade, do your deletes, drop it again, and the rebuild it with restrict.</p> <pre><code>CREATE TABLE "header" ( header_id serial NOT NULL, CONSTRAINT header_pkey PRIMARY KEY (header_id) ); CREATE TABLE deta...
<p>You may want to look into using <a href="http://www.postgresql.org/docs/8.2/static/ddl-schemas.html" rel="nofollow noreferrer">schemas</a> with PostgreSQL. I've done this in past projects to allow different groups of people or developers to have their own data. Then you can use your scripts to create multiple copi...
6,754
<p>I'm looking to have code coverage in C. I cannot rely on tools like gcov as I am working on different platforms/compilers.</p> <p>Basically I am looking for a strategy to incorporate code coverage into my(own implementation) unit-test framework. </p>
<p>Do you have so many platform-specific code that you want to measure the unit test coverage on every platform ? I mean that unless you have a lot of platform-specific code, your unit testing coverage should be similar on all your targets so you might not need to measure it on each and every target you have. It could ...
<p>You might consider building a set of test cases as part of the application itself, or as an alternate build target. Then the application could test itself, with the added benefit of having access to all the "internals," rather than trying to test all the branches using black-box techniques.</p>
46,561
<p>I have a program that was written for linux and I am trying to build and run it on my MacOS 10.5 machine. The program builds and runs without problem, however it makes many calls to syslog. I know that syslogd is running on my mac, however I can't seem to find where my syslog calls are output to.</p> <p>The syslog ...
<p>You should probably use the Console.app to view logfiles. It's purdy.</p> <p>Select your device on the left and filter messages on the right:</p> <p><a href="https://i.stack.imgur.com/ui8BD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ui8BD.png" alt="enter image description here"></a></p>
<p>Check for a call to <code>openlog</code> somewhere in the program. After a call to <code>openlog</code>, <code>syslog</code> will save its output to that log file instead of the default location.</p>
49,823
<p>Is it acceptable to add types to the <code>std</code> namespace. For example, I want a TCHAR-friendly string, so is the following acceptable?</p> <pre><code>#include &lt;string&gt; namespace std { typedef basic_string&lt;TCHAR&gt; tstring; } </code></pre> <p>Or should I use my own namespace?</p>
<p>No ... part of the point of a namespace is to prevent name collisions on upgrade.</p> <p>If you add things to the std namespace, then your code might break with the next release of the library if they decide to add something with the same name.</p>
<p>I totally agree with other answers saying that you should put your types in your own namespace to avoid unfortunate name collisions. </p> <p>However, I wanted to precise that <em>sometimes</em>, you can (and should !) add stuff in the std namespace. This is the case for template specializations of the std::swap met...
41,501
<p>I'm looking for some sample code that will sort the list items in an HTML list by alphabetical order. Can anyone help?</p> <p>Here is a sample list for people to work with:</p> <pre><code>&lt;ul class="alphaList"&gt; &lt;li&gt;apples&lt;/li&gt; &lt;li&gt;cats&lt;/li&gt; &lt;li&gt;bears&lt;/li&gt; &lt;...
<pre><code>var items = $('.alphaList &gt; li').get(); items.sort(function(a,b){ var keyA = $(a).text(); var keyB = $(b).text(); if (keyA &lt; keyB) return -1; if (keyA &gt; keyB) return 1; return 0; }); var ul = $('.alphaList'); $.each(items, function(i, li){ ul.append(li); /* This removes li from the old ...
<p>For future googlers, I've found this plugin very useful. It has option to define character order for non-latin languages.</p> <p><strong>Older versions (jQuery dependent)</strong></p> <pre><code>$('.submenu &gt; li').tsort({ charOrder: 'abcçdefgğhıijklmnoöprsştuüvyz' }); </code></pre> <p>For English only char...
39,118
<p>In .NET should you place unit test projects in with the rest of the solution? Or should there be a test solution that houses all the test projects?</p> <p>We have all the test projects in with our code base solution...it seems a bit cumbersome. </p> <p>What do you usually do?</p>
<p>In our current project we decided to put all unit tests in separate projects. The application code and tests are in the same solution, but at least we can build (and deploy) a version without the unit test code.</p> <p>The downside of this -so far- has been that sometimes your unit tests can't reach certain members...
<p>I don't use .NET, but when I develop test cases of any sort, I keep them isolated from the rest of the code so that I can deploy the application without the tests. The user doesn't need, or even want that stuff.</p>
33,892
<p>I am currently working on a project that is moving from .NET 2.0 to 3.5 across the board.</p> <p>I am well aware that 3.5 is basically a set of added functionality (libraries, if you will) on top of what 2.0 offers.</p> <p>Are there any gotchas that I might hit by simply re-targeting the compiler to 3.5?</p>
<p>This isn't a gotcha, it's more of a heads up. .NET v3.0 and v3.5 are not new CLRs but simply an added set up assemblies, compilers, resources etc...</p> <p><strong>Both .NET v3.0 AND v3.5 use the v2.0 CLR.</strong> Because of this you won't be able to say set an IIS App Pool to use a v3.5 CLR...cause it doesn't exi...
<p>Nope</p> <p>3.5 is completely compatible with 2.0, not the other way around of course</p>
8,168
<p>This is a second-hand question from an OS development site, but it made me curious since I couldn't find a decent explanation anywhere.</p> <p>When compiling and linking a free-standing C++ program using gcc, sometimes a linker error like this occurs:</p> <pre><code>out/kernel.o:(.eh_frame+0x11): undefined referen...
<p>It is used in the stack unwiding tables, which you can see for instance in the assembly output of <a href="https://stackoverflow.com/questions/307610/how-do-exceptions-work-behind-the-scenes-in-c#307716">my answer to another question</a>. As mentioned on that answer, its use is defined by the <a href="https://itaniu...
<p>The answers above are correct: it is used in exception handling. The <a href="https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Java-Exceptions.html#Java-Exceptions" rel="nofollow noreferrer">manual</a> for GCC version 6 has more information (which is no longer present in the version 7 manual). The error can arise when...
42,641
<p>I need a compact representation of an array of booleans, does Python have a builtin bitfield type or will I need to find an alternate solution?</p>
<p><a href="http://pypi.python.org/pypi/bitarray/" rel="noreferrer">Bitarray</a> was the best answer I found, when I recently had a similar need. It's a C extension (so much faster than BitVector, which is pure python) and stores its data in an actual bitfield (so it's eight times more memory efficient than a numpy bo...
<p>For mostly-consecutive bits there's the <a href="https://pypi.org/project/range_set/" rel="nofollow noreferrer">https://pypi.org/project/range_set/</a> module which is API compatible to Python's built-in <code>set</code>. As the name implies, it stores the bits as begin/end pairs.</p>
17,255
<p>When I ran <a href="http://en.wikipedia.org/wiki/ReSharper" rel="noreferrer">ReSharper</a> on my code, for example:</p> <pre><code> if (some condition) { Some code... } </code></pre> <p>ReSharper gave me the above warning (Invert "if" statement to reduce nesting), and suggested the f...
<p>A return in the middle of the method is not necessarily bad. It might be better to return immediately if it makes the intent of the code clearer. For example:</p> <pre><code>double getPayAmount() { double result; if (_isDead) result = deadAmount(); else { if (_isSeparated) result = separatedAmou...
<p>I think it depends on what you prefer, as mentioned, theres no general agreement afaik. To reduce annoyment, you may reduce this kind of warning to "Hint"</p>
33,649
<p>My new ASP.NET MVC Web Application works on my development workstation, but does not run on my web server...</p> <hr> <h1>Server Error in '/' Application.</h1> <hr> <h2>Configuration Error</h2> <p><strong>Description:</strong> An error occurred during the processing of a configuration file required to service t...
<p>I just wrote a blog post addressing this. You could install ASP.NET MVC on your server OR you can follow the <a href="http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx" rel="noreferrer">steps here</a>.</p> <hr> <p><strong>EDIT:</strong> (by jcolebrand) I went through this link, then had the same issu...
<p>I am using Jenkins with .net projects and had troubles with MVC 4 references.</p> <p>I finallys solved my issue by using a .Net reference search engine functionality based on the registry using : </p> <p>"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v2.0.50727\AssemblyFoldersEx"</p> <p>You can c...
33,480
<p>Imagine I have an function which goes through one million/billion strings and checks smth in them.</p> <p>f.ex:</p> <pre><code>foreach (String item in ListOfStrings) { result.add(CalculateSmth(item)); } </code></pre> <p>it consumes lot's of time, because CalculateSmth is very time consuming function.</p> <p>...
<p>You could try the <a href="http://msdn.microsoft.com/en-us/concurrency/default.aspx" rel="noreferrer">Parallel extensions</a> (part of .NET 4.0)</p> <p>These allow you to write something like:</p> <pre><code>Parallel.Foreach (ListOfStrings, (item) =&gt; result.add(CalculateSmth(item)); ); </code></pre> <p>Of...
<p>Not that I have any good articles here right now, but what you want to do is something along Producer-Consumer with a Threadpool.</p> <p>The Producers loops through and creates tasks (which in this case could be to just queue up the items in a List or Stack). The Consumers are, say, five threads that reads one item...
12,558
<p>I'm going to be developing a C++ application that uses a MySQL database.</p> <p>I've written similar apps in Java using JDBC, as well as the Spring Framework. </p> <p>Are there equivalent libraries for C++? What have you had the most success with?</p>
<p>I would use the MySQL C API, it is the simplest solution. You can easily write a class to wrap up the C api for your own uses.</p>
<p>It looks like writing a data access layer using the <a href="http://dev.mysql.com/doc/refman/5.0/en/c.html" rel="nofollow noreferrer">MySQL C API</a> is going to be the best bet.</p>
41,280
<p>Is this doable in either IE7 or Firefox?</p>
<p>You can do it in both - get the position relative to the document, then subtract the scroll position.</p> <pre><code>var e = document.getElementById('xxx'); var offset = {x:0,y:0}; while (e) { offset.x += e.offsetLeft; offset.y += e.offsetTop; e = e.offsetParent; } if (document.documentElement &amp;&am...
<p>You could subtract the div's offsetTop from the document.body.scrollTop</p> <p>This seems to work on IE7 and FF3, but on a very simple page. I haven't checked with nested DIVs.</p>
26,021
<p>I'd love a <em>good</em> native Python library to write XLS, but it doesn't seem to exist. Happily, Jython does.</p> <p>So I'm trying to decide between jexcelapi and Apache HSSF: <a href="http://www.andykhan.com/jexcelapi/tutorial.html#writing" rel="noreferrer">http://www.andykhan.com/jexcelapi/tutorial.html#writi...
<p>What's wrong with <a href="http://pypi.python.org/pypi/xlwt" rel="noreferrer">xlwt</a>?</p>
<p>Excel exposes the same OLE automation API used by VBA to anything that supports COM. You can use win32com (which is included with ActiveState Python by default) to manipulate spreadsheets in much the same way that you would do in VBA.</p>
30,417
<p>Given this in a grails action:</p> <pre><code>def xml = { rss(version: '2.0') { ... } } render(contentType: 'application/rss+xml', xml) </code></pre> <p>I see this:</p> <pre><code>&lt;rss&gt;&lt;channel&gt;&lt;title&gt;&lt;/title&gt;&lt;description&gt;&lt;/description&gt;&lt;link&gt;&lt;/link&gt;&...
<p>This is a simple way to pretty-print XML, using Groovy code only:</p> <pre><code>def xml = "&lt;rss&gt;&lt;channel&gt;&lt;title&gt;&lt;/title&gt;&lt;description&gt;" + "&lt;/description&gt;&lt;link&gt;&lt;/link&gt;&lt;item&gt;&lt;/item&gt;&lt;/channel&gt;&lt;/rss&gt;" def stringWriter = new StringWriter() def n...
<p>Use MarkupBuilder to pretty-print your Groovy xml</p> <pre><code>def writer = new StringWriter() def xml = new MarkupBuilder (writer) xml.rss(version: '2.0') { ... } } render(contentType: 'application/rss+xml', writer.toString()) </code></pre>
28,676
<p>What is the dependency inversion principle and why is it important?</p>
<p>Check this document out: <a href="https://drive.google.com/file/d/0BwhCYaYDn8EgMjdlMWIzNGUtZTQ0NC00ZjQ5LTkwYzQtZjRhMDRlNTQ3ZGMz/view" rel="noreferrer">The Dependency Inversion Principle</a>.</p> <p>It basically says:</p> <ul> <li>High level modules should not depend upon low-level modules. Both should depend upon ...
<p>Dependency Inversion Principle (DIP) says that </p> <p>i) High level modules should not depend upon low-level modules. Both should depend upon abstractions.</p> <p>ii) Abstractions should never depend upon details. Details should depend upon abstractions.</p> <p>Example: </p> <pre><code> public interface ICus...
8,803
<p>I'm hearing more and more about domain specific languages being thrown about and how they change the way you treat business logic, and I've seen <a href="http://ayende.com/blog/tags/domain-specific-languages" rel="noreferrer">Ayende's blog posts</a> and things, but I've never really gotten exactly why I would take m...
<p>DSL's are good in situations where you need to give some aspect of the system's control over to someone else. I've used them in Rules Engines, where you create a simple language that is easier for less-technical folks to use to express themselves- particularly in workflows.</p> <p>In other words, instead of making ...
<p>DSL is basically creating your own small sublanguage to solve a specific domain problem. This is solved using method chaining. Languages where dots and parentheses are optional help make these expression seem more natural. It can also be similar to a builder pattern. DSL aren't languages themselves, but rather a pat...
6,312
<p>What's the most useful hack you've discovered for Mozilla's new <a href="https://wiki.mozilla.org/Labs/Ubiquity" rel="nofollow noreferrer">Ubiquity</a> tool? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>"translate this" and "edit-page". I think I'd find the Google Apps features useful if they supported hosted domains.</p>
<p>My co-worker has had 3 blue-screens on his machine since installing it. Not totally convinced this is what did it, but it's the only thing he's changed today. I'm uninstalling it for now (and so is he).</p>
5,108
<p>When running command-line queries in MySQL you can optionally use '<strong>\G</strong>' as a statement terminator, and instead of the result set columns being listed horizontally across the screen, it will list each column vertically, which the corresponding data to the right. Is there a way to the same or a similar...
<p>I don't think such an option is available with the DB2 command line client. See <a href="http://www.dbforums.com/showthread.php?t=708079" rel="nofollow noreferrer">http://www.dbforums.com/showthread.php?t=708079</a> for some suggestions. For a more general set of information about the DB2 command line client you mig...
<p>DB2 command line utility always displays data in tabular format. i.e. rows horizontally and columns vertically. It does not support any other format like \G statement terminator do for mysql. But yes, you can store column organized data in DB2 tables when DB2_WORKLOAD=ANALYTICS is set.</p> <pre><code>db2 =&gt; conn...
19,310
<p>When you create a link to an executable file intended for download (like say update.exe), on a web page, IE7 gives the user the option to "Run" or "Save". I don't want users to be running the update file they should be downloading.</p> <p>Is it possible to disable the "Save" option on the dialog the IE displays, or...
<p>EDIT: Sorry, I thought this piece of code would be self-explaining. Given the OP tagged it ASP.NET, I thought we were in the context of ASP.NET.</p> <p>This could should go in a proxy file that is linked to, instead of directly to the .exe file. The proxy file then sends the .exe file and forces (tries to persuade)...
<p>I'm just guessing, but you could force the content-type header field to something beside what it defaults to. I've seen "application/x-msdownload" which may do what you want. </p>
27,300
<p>I am creating a chat using Ajax requests and I'm trying to get messages div to scroll to the bottom without much luck.</p> <p>I am wrapping everything in this div:</p> <pre><code>#scroll { height:400px; overflow:scroll; } </code></pre> <p>Is there a way to keep it scrolled to the bottom by default using JS?<...
<p>Here's what I use on my site:</p> <pre><code>var objDiv = document.getElementById("your_div"); objDiv.scrollTop = objDiv.scrollHeight; </code></pre>
<p>use :</p> <pre><code>var element= $('element'); var maxScrollTop = element[0].scrollHeight - element.outerHeight(); element.scrollTop(maxScrollTop); </code></pre> <p>or check scroll to bottom :</p> <pre><code> var element = $(element); var maxScrollTop = element[0].scrollHeight - element.outerHeight(); ...
34,017
<p>Our team develops distributed winform apps. We use ClickOnce for deployment and are very pleased with it.</p> <p>However, we've found the pain point with ClickOnce is in <em>creating</em> the deployments. We have the standard dev/test/production environments and need to be able to create deployments for each of the...
<p>I would look at using <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx" rel="noreferrer">msbuild</a>. It has built in <a href="http://msdn.microsoft.com/en-us/library/6wc2ccdc.aspx" rel="noreferrer">tasks</a> for handling clickonce deployments. I included some references which will help you get start...
<p>I've used nAnt to run the overall build strategy, but pass parameters into MSBuild to compile and create the deployment package.</p> <p>Basically, nAnt calls into MSBuild for each environment you need to deploy to, and generates a separate deployment output for each. You end up with a folder and all ClickOnce file...
4,105
<p>When thinking about what areas should be taken into account for a localized version of an application a number of things pop up right away:</p> <ul> <li>Text display</li> <li>Date and time</li> <li>Units</li> <li>Numbers and decimals</li> <li>User input formats</li> <li>LeftToRight support</li> <li>Dialog and contr...
<p>After <a href="http://www.kudzuworld.com/Bio.EN.aspx" rel="noreferrer">Kudzu</a>'s <a href="http://www.woo-hoo.net/abstracts/Arch_Localization.aspx" rel="noreferrer">talk about l10N</a> I left the room with way more questions then I had before and none of my old questions answered. But it gave me something to think...
<p>Don't forget the overhead of converting all documentation and help files.</p>
35,034
<p>I was wondering what would be the best approach you guys would take to relocate an entire Eclipse workspace? Assuming it's either versioned and exported, what would you do? Import the file? Checkout the whole thing from the repo? Thanks much in advance!</p>
<p>As you ask for the "best way" and already mention "versioned" I assume that you have some version control (as opposed to eclipses "Local History" involved. Basically, it's "best practice" to have version control, even when working alone. Use this and you're done.</p> <p>This enables you not only to migrate to a new...
<p>Maybe I'm missing something, but wouldn't you just start Eclipse, and either select the new workspace to use or select <code>Switch workspace</code> from the <code>File</code> menu?</p>
31,233
<p>I'm importing some data from another test/bug tracking tool into tfs, and I would like to convert it's description, which is in simple HTML, so a plain string, where the 'layout' of the HTML is preserved.</p> <p>For example:</p> <pre><code>&lt;body&gt; &lt;ol&gt; &lt;li&gt;Log on with user Acme &amp;amp; Co....
<p>Rather than regex, you could try loading it into the <a href="http://www.codeplex.com/htmlagilitypack" rel="noreferrer">HTML agility pack</a>? If it was xhtml, then an xslt transformation might be a good option.</p>
<p>In the end, once I got more comfortable with TFS, I customized the work item type to include a new HTML Field, and just copied the contents into that field.</p> <p>This solution was so much better, because we could now see the intended formatting of the field.</p>
46,495
<p>Currently there are 2 pages in a jsp file: one of them displays the data and the second one is used for pagination. The task is to include exactly the same paginator table above the data table. Sorry, couldn't resist to draw it :)</p> <pre><code>|-----------------------------------------| | Pag...
<p>The four mechanisms of abstracting within JSP today are the jsp:include tag, the &lt;%@ include> directive, custom tag libraries, and custom tag files.</p> <p>jsp:include inserts the results of executing another JSP page, so you could do:</p> <pre><code>&lt;jsp:include "page_naviagtor.jsp"/&gt; &lt;table id="resul...
<p>Perhaps you can define the pagination stuff in a separate jsp, and then include it twice into your main jsp. For example:</p> <pre><code>&lt;jsp:include page="pagination.jsp" flush="true" /&gt; &lt;table&gt;...business data...&lt;/table&gt; &lt;jsp:include page="pagination.jsp" flush="true" /&gt; </code></pre> ...
30,657
<p>What tricks can be used to stop javascript callouts to various online services from slowing down page loading?</p> <p>The obvious solution is to do all the javascript calls at the bottom of the page, but some calls need to happen at the top and in the middle. Another idea that comes to mind is using iframes. </p> ...
<p>window onload is a good concept, but the better option is to use jQuery and put your code in a 'document ready' block. This has the same effect, but you don't have to worry about the onload function already having a subscriber.</p> <p><a href="http://docs.jquery.com/Core/jQuery#callback" rel="nofollow noreferrer">...
<p>If you don't need a particular script ad load time, you can load it later by adding another script element to your page at run time.</p>
24,755
<p>How come one user in the local Administrators Group has no problem hitting <a href="http://localhost:8080/services/v1.0/Registration.asmx" rel="nofollow noreferrer">http://localhost:8080/services/v1.0/Registration.asmx</a> while other users in the local Administrators Group get 403 (access denied) errors (with nothi...
<p>Have you checked the permissions of all three areas. You need permisssion on server, reporting service and sharepoint for this.</p> <p>I would strongly recommend you download <a href="http://go.microsoft.com/fwlink/?LinkId=59385" rel="nofollow noreferrer">Team Foundation Server Administrator tool</a> to do this as...
<p>dove, I’m not sure about how the Team Foundation Server Administrator tool would help here. I installed it on the TF server and got an empty interface that looks like it is expecting pre-exiting Team projects.</p>
19,958
<p>For instance in the snippet below - how do I access the h1 element knowing the ID of parent element (header-inner div)?</p> <pre><code>&lt;div id='header-inner'&gt; &lt;div class='titlewrapper'&gt; &lt;h1 class='title'&gt; Some text I want to change &lt;/h1&gt; &lt;/div&gt; &lt;/div&gt;...
<pre><code>function findFirstDescendant(parent, tagname) { parent = document.getElementById(parent); var descendants = parent.getElementsByTagName(tagname); if ( descendants.length ) return descendants[0]; return null; } var header = findFirstDescendant("header-inner", "h1"); </code></pre> <p>Finds ...
<p>Here I get the H1 elements value in a div where the H1 element which has CSS class="myheader":</p> <pre><code>var nodes = document.getElementById("mydiv") .getElementsByTagName("H1"); for(i=0;i&lt;nodes.length;i++) { if(nodes.item(i).getAttribute("class") == "myheader") alert(nodes....
29,280
<p>What do you do when you join a team that says they use Scrum, but only use it as a time-management tool and not the whole process? How can I reinstate back testing and documentation?</p> <p>I was thinking to start off with adding user stories specifically for testing and documenting. Perhaps someone else has more e...
<p>The key to scrum is that a task be identifiable as "done" before it can be classed as done. How does you company assess whether something is done without reviewing documentation and tests?</p> <p>Perhaps they have an unusual, but valid, way of doing it. Or perhaps they have missed the point of "done tasks". I'd sug...
<p>"adding user stories specifically for testing and documenting"</p> <p>While meta-user stories might make sense in some circles, it rarely works out well. Software folks rarely cope well with meta-user stories, they either don't get the idea that they can change their own processes by writing a story, or -- more ty...
38,539
<p>I am trying to make a form in which the user fills in values. It is quite long. I wish to use an expandable tree to fit it into my one form. Is there any way to give each TreeView Node a TextBox by its side? Having the node text edited by itself is not enough.</p>
<p>Is the textbox for editing the node? or for secondary data? If the node, it can already be editable (Edit/BeginEdit or something). If secondary data, I would be quite tempted to push this into a single textbox that displays/edits the data for the current selected node. That may text-boxes is going to be confusing!</...
<p>Don't use useless 3rd party controls, as they are native in Windows ! (in particular the TreeListView, which is native since NT 3.5)</p>
42,128
<p>To me at least, the Pair class is a very multi-purpose class. So why did Microsoft put it into the System.Web.UI namespace?</p> <p>Is there a reason that my tiny brain cannot comprehend?</p> <p>Thanks.</p>
<p>It is used to serialize viewstate (along with its cousin Triplet).</p> <p>I would guess that the reason they are not part of the base library (even though there is nothing ASP.NET-specific about them) is that they are not very useful since they are untyped. </p> <p>To include untyped pair and triplet in the base l...
<p>God forbid we should have a typed Pair that is lighter than a dictionary and can be embeeded in a typed list so that it is indexable :). Of course creating one of these is painless, but why.</p>
43,896
<p>I wrote a simple web service in C# using SharpDevelop (which I just got and I love).</p> <p>The client wanted it in VB, and fortunately there's a Convert To VB.NET feature. It's great. Translated all the code, and it builds. (I've been a "Notepad" guy for a long time, so I may seem a little old-fashioned.)</p> ...
<p>In VB.NET, namespace declarations are relative to the default namespace of the project. So if the default namespace for the project is set to X.Y, everithyng between <code>Namespace Z</code> and <code>End Namespace</code> will be in the X.Y.Z namespace. In C# you have to provide the full namespace name, regardless o...
<pre><code>&lt;%@ WebService Class="flightinfo.Soap,flightinfo" %&gt; </code></pre> <p>What is the name of your class?</p>
8,490
<p>I'm thinking about exploring the idea of having our client software run as a service on a high port and listen for simple http GET requests from 127.0.0.1. The theory is that I would be able to access this service via js from a web page that is served from my site.</p> <p>1) User installs client software that inst...
<p>I can't see any potential pitfalls. I do have a couple of points however.</p> <p>1/ You probably want to make sure your service only accepts incoming connection from the local machine (127.0.0.1). Otherwise, anyone could look at your JavaScript and figure out that it's talking to [your-ip]:8080. They could then tr...
<p>I think it is much better for you to avoid implementation of application logic in JavaScript and html. Once user clicks button on a web page JavaScript should send request to your service and allow it do the rest of the work.</p>
43,127
<p>I am developing a Reporting Services solution for a DOD website. Frequently I'll have a report and want to have as a parameter the Service (in addition to other similar mundane, but repetitive parameters like Fiscal Year, Data Effective Date, etc). Basically everything I've seen of SSRS 2005 says it can't be done....
<p>I am not clear if you need to share a dataset, since you have some SQL results that you need to use twice, and don't want to re-compute the same data twice, or you want to do something regarding parameters. So with this "I didn't really understand the question" preface... </p> <ol> <li>You cannot share a dataset. M...
<p>If you cannot use Stored Procedures, I hope you can use a view.</p> <p>Else you could leave SQL Server and use CSV sheets as data storage.</p>
3,901
<p>How would you refactor these two classes to abstract out the similarities? An abstract class? Simple inheritance? What would the refactored class(es) look like?</p> <pre><code>public class LanguageCode { /// &lt;summary&gt; /// Get the lowercase two-character ISO 639-1 language code. /// &lt;/summary&gt...
<p>It depends, if they are not going to do much more, then I would probably leave them as is - IMHO factoring out stuff is likely to be more complex, in this case.</p>
<p>This is a rather simple question and to me smells awefully like a homework assignment.</p> <p>You can obviously see the common bits in the code and I'm pretty sure you can make an attempt at it yourself by putting such things into a super-class.</p>
9,606
<p>Is there any way to remove the dotted line rectangle, which indicates the keyboard focus, on a Win32 common control, without owner draw or subclass them? </p> <p>It seems that under WPF one can control the visual style of the focus rectangle, but I failed to find corresponding API on a Win32 common control.</p>
<p>I don't believe there is a simple style that allows you to turn off the focus rect on a list view control. The only way I've ever seen it done is with an owner draw control. I know this is not the answer you were looking for, but there are examples of owner draw controls that do this available... just so you don't h...
<p>I don't believe there is a simple style that allows you to turn off the focus rect on a list view control. The only way I've ever seen it done is with an owner draw control. I know this is not the answer you were looking for, but there are examples of owner draw controls that do this available... just so you don't h...
32,568
<p>I'd like to do some server-side scripting using Python. But I'm kind of lost with the number of ways to do that.</p> <p>It starts with the do-it-yourself CGI approach and it seems to end with some pretty robust frameworks that would basically do all the job themselves. And a huge lot of stuff in between, like <a hre...
<p>CGI is great for low-traffic websites, but it has some performance problems for anything else. This is because every time a request comes in, the server starts the CGI application in its own process. This is bad for two reasons: 1) Starting and stopping a process can take time and 2) you can't cache anything in ...
<p>OK, rails is actually pretty good, but there is just a little bit too much magic going on in there (from the Ruby world I would much prefer merb to rails). I personally use Pylons, and am pretty darn happy. I'd say (compared to django), that pylons allows you to interchange ints internal parts easier than django doe...
6,527
<p>I am using sp_send_dbmail in SQL2005 to send an email with the results in an attachment. When the attachment is sent it is UCS-2 Encoded, I want it to be ANSI or UTF-8.</p> <p>Here is the SQL</p> <pre><code>EXEC msdb.dbo.sp_send_dbmail @recipients = 'temp@example.com' , @query = 'DECLARE @string_to_trim va...
<p>After some research on SQL Server 2008 R2:</p> <ol> <li><p>Add to <code>sp_send_dbmail</code>:</p> <pre><code>@ANSI_Attachment BIT = 0 WITH EXECUTE AS 'dbo' </code></pre></li> <li><p>Replace</p> <pre><code>IF(@AttachmentsExist = 1) BEGIN ....... END </code></pre> <p>with:</p> <pre><code>IF(@AttachmentsE...
<p>In order to have the file be ANSI/UTF-8 </p> <p>alter the sp_send_dbmail that lives in the <code>msdb</code> with this line along with the other variables: <code>@ANSI_Attachment BIT = 0</code> i.e. </p> <pre><code>@mailitem_id INT = NULL OUTPUT, @ANSI_Attachment BIT = 0 WITH EXECUTE AS 'dbo' </code></p...
6,425
<p>I have a number of heroshot images, that have a modal popup when clicked. I'm trying to get my cursor to turn into magnifying glass whenever it is moved over the image. The following CSS does not appear to work even though my <code>magnify.cur</code> is present in the right location.</p> <pre><code>a.heroshot img...
<p>Your problem may be that cursor URLs don't work in Firefox for the Mac.</p> <p>You can get the same effect on Firefox by using the <code>-moz-zoom-in</code> keyword.</p> <pre><code>cursor:url(/img/magnify.cur), -moz-zoom-in, auto; </code></pre> <p>This will show magnify.cur, the Mozilla-specific zoom cursor or a ...
<p>My side url property is working for cursor in following way </p> <pre class="lang-css prettyprint-override"><code> #myid{cursor:url('myimage.png') , auto} </code></pre> <p>But here I think image size issue. Because If I use 32*32 size or below this then this work perfectly.</p> <p>A comma separated list of URLs t...
43,709
<p>Just say I have a file: "HelloWorld.pm" in multiple subdirectories within a Git repository.</p> <p>I would like to issue a command to find the full paths of all the files matching "HelloWorld.pm":</p> <p>For example:</p> <pre><code>/path/to/repository/HelloWorld.pm /path/to/repository/but/much/deeper/down/HelloWo...
<p><a href="http://www.kernel.org/pub/software/scm/git/docs/git-ls-files.html" rel="noreferrer"><code>git ls-files</code></a> will give you a listing of all files in current state of the repository (the cache or index). You can pass a pattern in to get files matching that pattern.</p> <pre><code>git ls-files HelloWorl...
<p>The script by Uwe Geuder (@uwe-geuder) is great but there really is no need to dump each of the ls-tree outputs in its own directory, unfiltered. </p> <p>Much faster and using less storage: Run the grep on the output and then store it, as shown in this <a href="https://gist.github.com/dirkjot/073ffac502567e32f7ad" ...
35,026
<p>I have CSV data loaded into a multidimensional array. In this way each "row" is a record and each "column" contains the same type of data. I am using the function below to load my CSV file.</p> <pre><code>function f_parse_csv($file, $longest, $delimiter) { $mdarray = array(); $file = fopen($file, "r"); wh...
<p>You can use <a href="http://php.net/manual/en/function.array-multisort.php" rel="noreferrer">array_multisort()</a></p> <p>Try something like this:</p> <pre><code>foreach ($mdarray as $key =&gt; $row) { // replace 0 with the field's index/key $dates[$key] = $row[0]; } array_multisort($dates, SORT_DESC, $m...
<p>I prefer to use array_multisort. See the documentation <a href="http://us2.php.net/manual/en/function.array-multisort.php" rel="nofollow noreferrer">here</a>.</p>
12,229
<p>One thing I never understood is the so-called <strong>Extrusion Multiplier (EM)</strong> or <strong>Flow</strong> setting in slicers like Simplify3D (S3D) or CURA.</p> <p>The description for this setting reads...</p> <ul> <li>S3D: <em>Multiplier for all extrusion movements (...)</em></li> <li>CURA: <em>The amount ...
<p>No, the Flow rate or Extrusion multiplier is to compensate for different materials and temperature ranges.</p> <h2>Where does the factor come from?</h2> <p>Let's say we calibrated our nozzle for work at 200°C with PLA, so 100 mm extrusion are correct and want to print ABS. ABS behaves differently and we get bad prin...
<p>The extrusion multiplier is just to compensate for amounts of flow. A material like PLA is very fluid when at 190-200C, so to extrude slightly less then 100% would reduce zits on the print, slightly increase tolerance, reduce stringing and also reduce risk of heatcreep. Materials like ABS and Nylon aren't as liquid ...
1,237
<p>I'm looking for a multiline regex that will match occurrences after a blank line. For example, given a sample email below, I'd like to match "From: Alex". <code>^From:\s*(.*)$</code> works to match any From line, but I want it to be restricted to lines in the body (anything after the first blank line).</p> <pre> ...
<p>I'm not sure of the syntax of C# regular expressions but you should have a way to anchor to the beginning of the string (not the beginning of the line such as ^). I'll call that "\A" in my example:</p> <pre><code>\A.*?\r?\n\r?\n.*?^From:\s*([^\r\n]+)$ </code></pre> <p>Make sure you turn the multiline matching opti...
<p>Writing complicated regular expressions for such jobs is a bad idea IMO. It's better to combine several simple queries. For example, first search for "\r\n\r\n" to find the start of the body, then run the simple regex over the body.</p>
9,336
<p>I'm a recent AI graduate (circa 2 years) working for a modest operation. It has fallen to me (primarily as I'm the first 'adopter' in the department) to create a basic (read useful?) C# coding standards document. </p> <p>I think I should explain that I'm probably the most junior software engineer going, but I'm loo...
<p>We start with </p> <ul> <li>Microsoft's .NET guidelines: <a href="http://msdn.microsoft.com/en-us/library/ms229042.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms229042.aspx</a> (link updated for .NET 4.5)</li> <li>Microsoft's C# guidelines: <a href="http://blogs.msdn.com/brada/articles/361363.asp...
<p>I think I echo the other comments here that the MS guidlines already linked are an excellent starting point. I model my code largely on those.</p> <p>Which is interesting because my manager has told me in the past that he is not too keen on them :D</p> <p>You have a fun task ahead of you my friend. Best of luck, a...
3,575
<p>I just fell in love with NHibernate and the fluent interface. The latter enables very nice mappings with refactoring support (no more need for xml files).</p> <p>But nobody is perfect, so I am missing the many-to-any mapping in fluent. Does anybody know if it is already there? If so, a simple line of code would be ...
<p>Darryl Hein,</p> <p>Yeah, there isn't anything in the error logs. I even increased error reporting and still nothing relevant to print_r().</p> <p>In response to Jay: I ran </p> <pre><code>echo count($lines); </code></pre> <p>and I get a result of 105,546 but still print_r() only displays 7280. </p> <p>Taking R...
<p>I'm gonna agree with Cory. I'm thinking your PHP is probably configured default memory of 8MB, which 4MB x 2 is already more. The reason for the x2 is because you have to load the file, then to create the array you need to have the file in memory again. I'm just guessing, but that would make sense. </p> <p>Are you ...
20,653
<p>I am trying to get a Flex application to communicate with a custom python webserver I have developed. </p> <p>I am noticing that I cannot read the postdata received because Flex does not seem to include the Content-Length in the HTTP headers. (My webserver work when posted to from plain HTML)</p> <p>Is this a know...
<p>It should, so long as you set your HTTPService's method property to POST. If you omit it, it will default to GET, and the parameters will be sent as part of the query string, not as POST data.</p> <p>I set up this scenario using this Flex code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Ap...
<p>I don't believe this is a known problem.</p> <p>Are you sure no Content-Length is being sent? You've posted the request side of the HTTP interaction, coming from your browser; there is never a Content-Length header on that side of the protocol.</p>
17,759
<p>Our dev team is looking for an IDE like vi or nano or even textpad for windows that has the capability to autocomplete and error correction for bash or shell script for linux. Basically something similar to .NET autocompletion where you will be able to see if an </p> <pre><code> if[ $# -ne 5 ]; then </code></pre>...
<p>In vim, apart from adding syntax highlighting to show incorrect syntax (the "if" example would not highlight the if correctly) you can add this to your .vimrc:</p> <pre><code>autocmd FileType sh set makeprg=bash\ -n\ '%' autocmd FileType sh let &amp;efm = "%E%f:\ line\ %l:\ %m," . &amp;efm </code></pre> <p>Now whe...
<p>Red Hat splits up the VIM RPM's into vim-minimal, vim-enhanced and then some. You need the vim-enhanced RPM's to do syntax highlighting. As CentOS is nothing more than repackaged RHEL, the same goes for CentOS. And if it has to be for Windows: GVim is readily available.</p> <p>You could see the syntax highlighting ...
49,709
<p>Is there a built in way in SQL Server 2005 to audit things specifically like deleting a stored procedure? Is there a history table that I can query? We have a mystery sproc that has disappeared a few times now.</p>
<p>You can build this using DDL triggers:</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms190989.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms190989.aspx</a></p>
<p>You can setup a profiler trace to capture the Audit Schema Object Management event and filter based on the database name you care about. Any time an object in the schema is created, dropped, edited it will fire an event in profiler that includes the person who did the change and the name of the stored procedure.</p>...
47,017
<p>since JTree &amp; TreeModel don't provide tooltips straight out-of-the-box, what do you think, what would be the best way to have item-specific tooltips for JTree?</p> <p>Edit: (Answering my own question afterwards.) </p> <p>@Zarkonnen: Thanks for the getTooltipText idea. </p> <p>I found out another (maybe still ...
<p>See <a href="http://docs.oracle.com/javase/7/docs/api/javax/swing/JTree.html#getToolTipText(java.awt.event.MouseEvent)" rel="nofollow noreferrer">getTooltipText</a> on JTree. This should allow you to show tooltips depending on what in the tree is being hovered over. (Do read the docs though, you need to register the...
<p>Yeah, you can use <code>onMouseMoved</code> and then use a method (I don't remember the name) that tells you in which node you are over. If you get null, obviously then you are not over a node.</p>
34,246
<p>1st post on stackoverflow, hope to have great feedback :)</p> <p>I'm currently trying to load balance our web site. We have set up a 2 cluster NLB on windows server 2003 with IIS 6.</p> <p>While testing the setup, I found that sometimes, our session is lost. A day and a half later, here's the result:</p> <ol> <li...
<p>I finally found the answer to my problem. It's origin are within the application code (like 99% of a programmer's 3rd party tools 'bugs'). I decided to post it anyway in case someone is in a similar scenario.</p> <p>This code was part of WebServiceRequester class. The web service requester class was instanciated wh...
<p>Not strictly an answer to your question, but have you tried it using a sql server based session store? (Search on MSDN for the permanent script rather than the temp script that's provided with asp.net)</p> <p>I've heard "bad things" about the executable session service, and consequently have not used it. Never had ...
41,719
<p>I am having a really hard time attempting to debug LINQ to SQL and submitting changes.</p> <p>I have been using <a href="http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx" rel="noreferrer">http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx</a>, whic...
<p>I always found useful to know exactly what changes are being sent to the DataContext in the SubmitChanges() method.</p> <p>I use the <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.getchangeset.aspx" rel="noreferrer">DataContext.GetChangeSet()</a> method, it returns a <a href="http://m...
<p>Hrm.</p> <p>Taking a WAG (Wild Ass Guess), it looks to me like LINQ - SQL is trying to find an object with an id that doesn't exist, based somehow on the creation of the JobMaster class. Are there foreign keys related to that table such that LINQ to SQL would attempt to fetch an instance of a class, which may not e...
11,222
<p>Is there a way to use verbatim String literals in managed C++? Similar to C#'s</p> <pre><code>String Docs = @"c:\documents and settings\" </code></pre>
<p>in C++11, there is raw string literal:</p> <pre><code>cout&lt;&lt;R"((\"ddd\aa)\n)"&lt;&lt;endl; cout&lt;&lt;R"delimiter((\"ddd\aa)\n)delimiter"&lt;&lt;endl; </code></pre> <p>output is:</p> <pre><code>(\"ddd\aa)\n (\"ddd\aa)\n </code></pre>
<p>snip .. For .NET Programming, Visual C++ in Visual Studio 2017 supports the creation of mixed assemblies by using the /clr (Common Language Runtime Compilation) compiler option. The /clr:pure and clr:safe options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017. If your code needs to be saf...
46,032
<p>As a web developer, a number of the projects I work on fall under government umbrellas and hence are subject to <a href="http://www.section508.gov/" rel="noreferrer">508 Accessibility</a> laws, and sometimes <a href="http://www.w3.org/TR/WCAG/" rel="noreferrer">W3C accessibility</a> guidelines. To what extent can Ja...
<p>If accessibility is your primary concern, always start a website using standards-compliant (pick a Document Type Definition and stick to it) HTML. If it's a web application (form submissions, etc), make sure the forms will work using just HTTP GET and POST. Once you have a complete website/application you can add bi...
<blockquote> <p>JQuery has the capability to be unobtrusive and therefore accessible. The trick is to have redundancy around your AJAX calls so browsers without JavaScript can still utilize your service. In other words, wherever you have JavaScript responses, dialogs, etc you need to have a degraded equivalent.</p> <...
33,444
<p>I am using a machine on which I do not have root access and would like to access files on a Samba server in random access mode. I know I can transfer the files in their entirety using smbclient but the files are very large (>1GB) and I would rather just treat them as remote files on which I can do random access.</p>...
<p>To answer my own question after digging around in the Samba source: there is a client library libsmbclient which includes all the usual file handling stuff: smbc_open, smbc_fstat, smbc_lseek, smbc_read etc. For instance, here is a snippet I just wrote which reads a file backwards (just to check it was doing a true s...
<p>Try to use <code>smbmount</code> to mount the filesystem without root permissions:</p> <pre><code>mkdir ~/temp smbmount //{server}/{share} ~/temp -o username=username={username},password={password} </code></pre> <p><em>Edit: Updated to use <code>smbmount</code> instead of <code>mount</code>.</em></p>
33,199
<p>Can you please tell me how much is <code>(-2) % 5</code>? According to my Python interpreter is 3, but do you have a wise explanation for this?</p> <p>I've read that in some languages the result can be machine-dependent, but I'm not sure though.</p>
<p>By the way: most programming languages would disagree with Python and give the result <code>-2</code>. Depending on the interpretation of modulus this is correct. However, the most agreed-upon mathematical definition states that the modulus of <em>a</em> and <em>b</em> is the (strictly positive) rest <em>r</em> of t...
<p>Well, -2 divided by 5 would be 0 with a remainder of 3. I don't believe that should be very platform dependent, but I've seen stranger things.</p>
6,535
<blockquote> <p>The ability to use BitKeeper free of charge had been withdrawn by the copyright holder Larry McVoy after he claimed Andrew Tridgell had reverse engineered the BitKeeper protocols in violation of the BitKeeper license. At Linux.Conf.Au 2005, Tridgell demonstrated during his keynote that the reverse eng...
<p>Not creating them in the first place.</p>
<p>Being extremely careful about them, and making sure only the right people get the right documentation (this includes making sure management does not get a hold of the proprietary documentation).</p> <p>I was working on customizing some proprietary software my company wrote (which relied on security through obscurit...
29,522
<p><a href="https://i.stack.imgur.com/qNWsZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qNWsZ.png" alt="extruded text on flat surface"></a></p> <p>Hey!</p> <p>Pretty new to all this. Wondering how you would approach this problem to have an extruded element on top of a flat surface. I want to av...
<p>welcome to 3DPrinting.</p> <p>To make this easier to talk about, let me call the surface on which you want to print the letters the "tabletop". </p> <p>Looking at your picture, let me guess that you would print the object with the tabletop down. Then everything prints naturally, with no bridging and no overhangs....
<p>One way that I have solved that issue is by model it in openscad and embed the letters in the surface. then with my dual headed printer, print the letters in a different color. No support material is needed in that case.</p>
1,018
<p>I have a bunch of files that I need to be able to <em>transport</em> and <em>install</em> quickly. My current method for doing so is moving a flash drive with a readme file of where stuff goes whenever I need to move stuff, which is rather inelegant and cumbersome.</p> <p>My idea for a solution would be to write up...
<p>Sounds like <code>robocopy</code> tool is exactly what you need. Very <em>powerful</em> replication command-line tool.</p> <ul> <li><a href="http://technet.microsoft.com/en-us/library/cc733145" rel="nofollow noreferrer">MS TechNet reference</a>,</li> <li><a href="http://en.wikipedia.org/wiki/Robocopy" rel="nofollow...
<p>I like to use VBscript for this kind of thing. The VBS engine is on every recent windows machine and the language is a little more like real programming than a batch script.</p> <p>Also, if your installer grows to require WMI functions too, this becomes a piece of cake.</p>
3,709
<p>So, I have an autocomplete dropdown with a list of townships. Initially I just had the 20 or so that we had in the database... but recently, we have noticed that some of our data lies in other counties... even other states. So, the answer to that was buy one of those databases with all towns in the US (yes, I know, ...
<p>Are you trying to autocomplete after only 1 character is typed? Maybe wait until 2 or more...?</p> <p>Also, can you just return the top 10 rows, or something?</p>
<p>I'd just limit the SQL query with a TOP clause. I also like using a "less than" instead of a like:</p> <pre><code>select top 10 name from cities where @partialname &lt; name order by name; </code></pre> <p>that "Ce" will give you "Cedar Grove" and "Cedar Knolls" but also "Chatham" &amp; "Cherry Hill" so you alway...
21,292
<p>What is the proper way to minimize a WinForms app to the system tray? </p> <p>Note: minimize to <strong><em>system tray</em></strong>; on the right side of the taskbar by the clock. I'm not asking about minimizing to taskbar, which is what happens when you hit the "minus" button on the window.</p> <p>I've seen hac...
<p>There is actually no managed way to do that form of animation to the tray in native winforms, however you can P/Invoke shell32.dll to do it:</p> <p>Some good info here (In the comments not the post):</p> <p><a href="http://blogs.msdn.com/jfoscoding/archive/2005/10/20/483300.aspx" rel="noreferrer">http://blogs.msdn...
<p>In the constructor of the Form:</p> <pre><code>this.Resize += new EventHandler(MainForm_Minimize); </code></pre> <p>Then use this Event Handler method:</p> <pre><code> private void MainForm_Minimize(object sender, EventArgs e) { if(this.WindowState == FormWindowState.Minimized) Hide(); ...
6,910
<p>Is it possible to place an application using vsto if the office is not installed? It doesn't appear to be so, but I was wondering if anyone had a work-around.</p>
<p>VSTO wraps Office's Automation interfaces. Office is doing the work under the covers, so must be installed.</p>
<p>Just to compare with Web Office Extensions, did it also need Office installed on the server?</p>
10,039
<p>What do you do with classes that have no member data, only methods?</p> <p>Do you make them static?</p> <p>In my case it is an repository class that executes queries against the database. Maybe I got the repository pattern wrong... (It does implement an interface)</p>
<p>Inherit from an Interface mean that you cannot use static. Simply create a class and instantiate it.</p>
<p>It depends. Most of the time it might be possible to make the class static, but sometimes you need to pass an instance of it around. Sounds like you might be having this situation. In this case perhaps you should consider a Singleton pattern, since more than 1 instance of the class is not likely to be needed?</p>
48,153
<p>I know that you can make a virtual network interface in Windows (see <a href="http://support.microsoft.com/kb/236869" rel="nofollow noreferrer">here</a>), and in Linux it is also pretty easy with ip-aliases, but does something similar exist for <strong>Mac OS X</strong>? I've been looking for loopback adapters, virt...
<p>The loopback adapter is always up.</p> <p><strong>ifconfig lo0 alias 172.16.123.1</strong> will add an alias IP 172.16.123.1 to the loopback adapter</p> <p><strong>ifconfig lo0 -alias 172.16.123.1</strong> will remove it</p>
<p>ifconfig interfacename create will create a virtual interface,</p>
11,303
<p>Where is the best place to add a method to the integer class in Rails? I'd like to add a <code>to_meters</code> and <code>to_miles</code> methods.</p>
<p>If you have your heart set on mucking with the Numeric (or integer, etc) class to get unit conversion, then at least do it logically and with some real value. </p> <p>First, create a Unit class that stores the unit type (meters,feet, cubits, etc.) and the value on creation. Then add a bunch of methods to Numeric ...
<p>If you were going to do this, which you shouldn't, then you would put your code into:</p> <pre><code>config/initializers/add_methods_that_are_naughty_to_numeric.rb </code></pre> <p>Rails would automatically run these for you.</p>
33,453
<p>I'm pretty new to my company (2 weeks) and we're starting a new platform for our system using .NET 3.5 Team Foundation from DotNetNuke. Our "architect" is suggesting we use one class project. Of course, I chime back with a "3-tier" architecture (Business, Data, Web class projects). </p> <p>Is there any disadvantage...
<p>I guess a fairly big downside is that the extra volume of code that you have to write, manage and maintain for a <strong>small</strong> project may just be overkill.</p> <p>It's all down to what's appropriate for the size of the project, the expected life of the final project and the budget! Sometimes, whilst doin...
<p>As with anything abstraction creates complexity, and so the complexity of doing N-tiered should be properly justified, e.g., does N-tiered actually benefit the system? There <em>will</em> be small systems that will work best with N-tiered, although a lot of them will not.</p> <p>Also, even if your system is small a...
2,774
<p>I'm putting together a little tool that some business people can run on their local filesystems, since we don't want to setup a host for it.</p> <p>Basically, its just HTML + Javascript (using jQuery) to pull some reports using REST from a 3rd party.</p> <p>The problem is, FF3 and IE don't allow the ajax call, I g...
<p>In a similar situation, my solution was to use Mark Of The Web, which is a special HTML comment that IE recognizes. It places the page in a different security zone.</p> <p>Reference: <a href="http://msdn.microsoft.com/en-us/library/ms537628(VS.85).aspx" rel="nofollow noreferrer">MSDN</a></p>
<p>If you have Python installed, a webserver to serve files can be as simple as </p> <pre><code>python -c “import SimpleHTTPServer;SimpleHTTPServer.test()” </code></pre> <p><strong>Edit:</strong> Original poster can't use this approach, but in general I think this is the way to solve this particular problem for futu...
19,813
<p>I have this code to give me a rollover on submit buttons, and I'm trying to make it more generic:</p> <pre><code>$('.rollover').hover( function(){ // Change the input image's source when we "roll on" srcPath = $(this).attr("src"); srcPathOver = ??????? ...
<pre><code>$('.rollover').hover( function(){ // Change the input image's source when we "roll on" var t = $(this); t.attr('src',t.attr('src').replace(/([^.]*)\.(.*)/, "$1-over.$2")); }, function(){ var t= $(this); t.att...
<p>You should be able to use a regex replace to modify your source path. Like this: </p> <pre><code>srcPathOver = srcPath.replace(/([^.]*)\.(.*)/, "$1-over.$2"); </code></pre> <p>More on JavaScript regexes <a href="http://www.regular-expressions.info/javascript.html" rel="nofollow noreferrer">here</a></p> <p>As far...
28,958
<p>How do I make sure the correct encoding (UTF-8) is used by Grails?</p>
<p>Easier than I thought - simply make sure your editor is set to UTF-8 encoding.</p>
<p>Maybe you shouldn't use UTF-8. Maybe you should try one of the 8859 ISO charsets:<a href="http://www.global-translation-services.com/iso8859.html#ISO-8859-1" rel="nofollow noreferrer">http://www.global-translation-services.com/iso8859.html#ISO-8859-1</a></p>
26,426
<p><strong>Note:</strong> Question <a href="https://stackoverflow.com/questions/220465/using-256-x-256-vista-icon-in-application">Using 256 x 256 Vista icon in application</a> deals with using a "Vista" icon as the application's icon. This question deals with manually painting a Vista icon.</p> <p><strong>Note:</stron...
<p>The <code>ResourceManager</code> loads the icon based on the bits stored in the resources. However, the way it handles loading won't let you access the 256x256 icon (this information does not make its way into the <code>System.Drawing.Icon</code> that you are getting back).</p> <p>I am sorry to disappoint you, but ...
<p>I asked a similar question a while ago but with not much luck. Some of the answers in my post may help you, there was one way but it looks pretty hard. Link to my post <a href="https://stackoverflow.com/questions/220465/using-256-x-256-vista-icon-in-application">here</a></p>
36,507
<p>I have this naive regex "&lt;([\s]|[^&lt;])+?>" (excluding the quotation marks). It seems so straightforward but it is indeed evil when it works against the below HTML text. It sends the Java regular expression engine to an infinite loop. </p> <p>I have another regex ("&lt;.+?>"), which does somewhat the same thing...
<p>The reason the Java regex engine crashes is that this part of your regex causes a stack overflow (indeed!):</p> <pre><code>[\s]|[^&lt;] </code></pre> <p>What happens here is that every character matched by \s can also be matched by [^&lt;]. That means there are two ways to match each whitespace character. If we ...
<p>The regex <code>([\s]|[^&lt;])</code> in plain terms means any single character that IS white-space or IS NOT a <code>&lt;</code> character, which is redundant because white-space characters are NOT a <code>&lt;</code> character. It appears to me that what you really mean is:</p> <pre><code>`"&lt;([^&lt;])+?&gt;"` ...
36,767
<p>Recently building a new printer, I went with a Wambam PEX system. When I began printing ABS I found it did not stick very well and eventually purchased a new build plate and a PEI sheet since PEX isn't suited to ABS.</p> <p>Not altering some of the setting while trying to get ABS to stick to the PEX I started print...
<p>Heat up your bed to the print temperature; maybe even as hot as 100 °C. This will soften the ABS and make it easier to scrape off. It will distort a print to remove it this way, but is good for cleaning.</p> <p><strong>Less preferred method</strong>: Acetone will dissolve ABS but may be rough on your PEI, even cau...
<p>Heating the bed didn't help much, but Someone suggested using the flush cutters which pryed it up just enough... to get the bigger chunk off.</p>
1,995
<pre><code>foreach ($_GET as $field =&gt; $label) { $datarray[]=$_GET[$field]; echo "$_GET[$field]"; echo "&lt;br&gt;"; } print_r($datarray); </code></pre> <hr> <p>This is the output I am getting. I see the data is there in datarray but when I <code>echo $_GET[$field]</code> </p> <p>I only get "Array"</p> ...
<p>EDIT: When I completed your test, here was the final URL:</p> <p><a href="http://hofstrateach.org/Roberto/process.php?keys=Grade1&amp;keys=Nathan&amp;keys=North%20America&amp;keys=5&amp;keys=3&amp;keys=no&amp;keys=foo&amp;keys=blat&amp;keys=0%3A0%3A24" rel="nofollow noreferrer">http://hofstrateach.org/Roberto/proce...
<p>Perhaps the GET variables are arrays themselves? i.e. <a href="http://site.com?var[]=1&amp;var[]=2" rel="nofollow noreferrer">http://site.com?var[]=1&amp;var[]=2</a></p>
10,948
<p>I acquired an Anycubic Chiron yesterday. I went through the leveling procedure and I think the level test print came out okay so I printed a 20&nbsp;mm calibration cube and a benchy. Both of these came out with a sort of spongy consistency.</p> <p>I have no idea what could be causing this so some advice would be ap...
<p>It turned out I had the wrong filament size set in Ultimaker Cura. Fixing this resolved the issue. </p> <p><a href="https://i.stack.imgur.com/3KFlw.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/3KFlw.jpg" alt="under extruded calibration cube"></a></p>
<p>I would lay odds on it being your filament is moisture saturated. You don't state what type of filament you're using, but to my understanding this is what happens when it is saturated. The water evaporates as it goes through the nozzle, which causes the filament to puff up, which leaves voids in your print. </p> <p...
1,287
<p>OK, this is an odd request, and it might not even be fully true... but I'm upgrading someone's system ... and they are using OSCommerce (from a long time ago).</p> <p>It appears their variables are referrenced without a dollar sign in front of them (which is new to me). I haven't done PHP in about 7 years, and I've...
<p>I believe OSCommerce actually DEFINES these values, so the usage is correct (without the $).</p> <p>Look for <pre>define("DB_SERVER", "localhost");</pre> or something similar.</p> <p>In other words, do <em>not</em> go through and update these with a $ before if they're actually defined constants.</p>
<p>You can use <a href="http://www.php.net/constant" rel="nofollow noreferrer">constants</a>.</p>
41,783
<p>If it's possible, I'm interested in being able to embed a PostgreSQL database, similar to <a href="http://www.sqlite.org/" rel="noreferrer">sqllite</a>. I've read that it's <a href="http://bytes.com/forum/thread647637.html" rel="noreferrer">not possible</a>. I'm no database expert though, so I want to hear from yo...
<p>Unless you do a major rewrite of code, it is not possible to run Postgres "embedded". Either run it as a separate process or use something else. SQLite is an excellent choice. But there are others. MySQL has an embedded version. See it at <a href="http://mysql.com/oem/" rel="noreferrer">http://mysql.com/oem/</a>. Al...
<p>Anyone tried on Mac OS X:</p> <p><a href="http://pagesperso-orange.fr/bruno.gaufier/xhtml/prod_postgresql.xhtml" rel="nofollow noreferrer">http://pagesperso-orange.fr/bruno.gaufier/xhtml/prod_postgresql.xhtml</a></p> <p><a href="http://www.macosxguru.net/article.php?story=20041119135924825" rel="nofollow noreferre...
8,515
<p>I am thinking about buying an iPod touch to make some money on developing apps for the iPhone. I like the concept of the App Store and had a quick look at it with iTunes. Looks like applications are categorized, to be iPhone OR iPod applications. Some apps which are free for the iPod seem to cost for iPhone users.</...
<p>The iPod touch is missing:</p> <ul> <li>GPS</li> <li>Bluetooth <em>(iPod Touch 4G has Bluetooth)</em></li> <li>Cellular network</li> <li>Camera <em>(iPod Touch 4G has front and back cameras)</em></li> <li>Microphone (thanks <a href="https://stackoverflow.com/users/1450/john-topley">John Topley</a>) <em>(iPod Touch ...
<p>I would recommend skipping the iPod Touch and going straight to the iPhone if development is your goal. It has more capabilities (GPS, Bluetooth, Cellular network and Camera) which makes for a wider range of potential applications that may actually be used.</p>
16,224
<p>I'm working on a eclipse plug-in and I've tried to create another test project seperate from the plug-in. The reason I do this is to not let the plug-in depend on jUnit when it is exported. However, I can't access the Eclipse Plug-in API when I do the testing. Whenever I try to add Plug-in dependencies the import li...
<p>The recomended way of ding this seems to be with Plug-in fragments:</p> <p><a href="http://rcpquickstart.com/2007/06/20/unit-testing-plug-ins-with-fragments/" rel="nofollow noreferrer">http://rcpquickstart.com/2007/06/20/unit-testing-plug-ins-with-fragments/</a></p> <p>The fragment gets a high-degree of access to ...
<p>You could try to add the plugin nature to your new myplugin.test project.</p> <p>In your .project file:</p> <pre><code>&lt;natures&gt; &lt;nature&gt;org.eclipse.pde.PluginNature&lt;/nature&gt; [...] &lt;/natures&gt; </code></pre> <p>Then in the .classpath, add:</p> <pre><code>&lt;classpath&gt; ...
30,540
<p>Back in the earlier days of the internet I remember that in certain browsers, every time you downloaded an image or a file, the URL of where that file was downloaded from would be written into that file's properties (I guess the summary tab?). I think Netscape v2 did this if I remember correctly.</p> <p>I really mi...
<p>If you use the <a href="https://addons.mozilla.org/en-US/firefox/addon/201" rel="nofollow noreferrer">DownThemAll</a>! extension for Firefox, you can tell it to prepend the URL of the site to the downloaded file name...</p> <p>thus you end up with files like:</p> <pre><code>download.com_utils_compression_ABCD32.ex...
<p>For the IE Browser I use the hell out of Fidler to look at all traffic going across the wire. </p> <p>For FireFox, you can use the FireBug plugin. There is a "Net" tab that will show you request information that is going across the wire.</p> <p>Most of the time you can use one of these tools to see what URL was re...
30,915
<p>I'm not a Notes programmer, however, for my sins, have been working on some Notes features for an in-house project recently. I need to enable/disable editing of a field depending on circumstances. It seems to me to be a fairly standard feature, I need, but I can't find any information on how to do this anywhere.</p>...
<p>I'm not sure if I'm not mistaken, but as far as I see you're generating the commands but never passing them to the "execute" method... you're executing "".</p> <p>Try using Runtime.getRuntime().exec(commands) =)</p>
<p>I believe you aren't handling quoting correctly. The original sh command line includes double quotes to prevent the shell interpreting the semicolons. The shell strips them off before the soffice process sees them.</p> <p>In your Java code the shell will never see the arguments, so the extra double quotes (escape...
49,552
<p>I'd like to script, preferably in rake, the following actions into a single command:</p> <ol> <li>Get the version of my local git repository.</li> <li>Git pull the latest code.</li> <li>Git diff from the version I extracted in step #1 to what is now in my local repository.</li> </ol> <p>In other words, I want to g...
<p>You could do this fairly simply with refspecs.</p> <pre><code>git pull origin git diff @{1}.. </code></pre> <p>That will give you a diff of the current branch as it existed before and after the pull. Note that if the pull doesn't actually update the current branch, the diff will give you the wrong results. Another...
<p>If you drop this into your bash profile you'll be able to run grin (git remote incoming) and grout (git remote outgoing) to see diffs of commits that are incoming and outgoing for origin master.</p> <pre><code>function parse_git_branch { git branch --no-color 2&gt; /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/...
8,610
<p>Does anyone know what the character entity for a tab is in xhtml? (Um if there is one)...</p>
<p>(X)HTML has no special support for tabs: they're just another whitespace character, regardless of whether you escape them or not.</p>
<p>What most people do to simulate tabs is use DD &amp; DT tags. They are intended creating a glossary:</p> <pre><code>term definition goes here term definition goes here </code></pre>
27,434
<p>I need to copy the newest file in a directory to a new location. So far I've found resources on the <a href="http://www.ss64.com/nt/forfiles.html" rel="noreferrer">forfiles</a> command, a <a href="https://stackoverflow.com/q/51837">date-related question</a> here, and another <a href="https://stackoverflow.com/q/5090...
<p>Windows shell, one liner:</p> <pre><code>FOR /F &quot;delims=&quot; %%I IN ('DIR *.* /A-D /B /O:-D') DO COPY &quot;%%I&quot; &lt;&lt;NewDir&gt;&gt; &amp; EXIT </code></pre>
<p>Bash:</p> <pre><code> find -type f -printf "%T@ %p \n" \ | sort \ | tail -n 1 \ | sed -r "s/^\S+\s//;s/\s*$//" \ | xargs -iSTR cp STR newestfile </code></pre> <p>where "newestfile" will become the newestfile </p> <p>alternatively, you could do newdir/STR or just newdir </p> <p>Breakdown: </...
12,284
<p>I don't know if anyone has seen this issue before but I'm just stumped. Here's the unhandled exception message that my error page is capturing. </p> <blockquote> <p>Error Message: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifi...
<p>I seem to recall that this error can occur if you click a button/link etc before the page has fully loaded.</p> <p>If this is the case, the error is caused by an ASP.net 2.0 feature called Event Validation. This is a security feature that ensures that postback actions only come from events allowed and created by th...
<p>I know you can disable the Validation of viewstate MAC, but I think if the page is not loaded you can get into more trouble. When I ran into this problem I had to disable all buttons until the page was fully loaded.</p>
14,780
<p>I'm running the java cocoon 2 and castor oql. I'm trying to filter my oql query by today's date, but I can't seem to figure out (or find in google) the syntax of the date. The database is mySql, but the oql is mapped by the java classes... so doing a search on field_date >= Now() doesn't work. Any ideas? I really...
<p>Do this...Instead of trying to debug by hitting F5</p> <ul> <li>Go to Tools</li> <li>Attach to Process</li> <li>Click View Processes from all users</li> <li>Ensure you are selected only for Managed Code</li> <li>Select "W3WP.EXE". This is the ASP.NET Worker process.</li> <li>Click attach.</li> <li>You are now attac...
<p>Are you running on Vista or Server 2008? I'm not sure about Vista, but when I was running Server 2008 I had permission errors when trying to debug when I launched VS as my regular user. The solution for me was right-clicking on the VS icon and selecting 'Run as Administrator'.</p>
12,318
<p>Currently, I am writing up a bit of a product-based CMS as my first project.</p> <p>Here is my question. How can I add additional data (products) to my Product model?</p> <p>I have added '/admin/products/add' to my urls.py, but I don't really know where to go from there. How would i build both my view and my templ...
<p>You will want to wire your URL to the Django <a href="https://docs.djangoproject.com/en/1.4/ref/generic-views/#django-views-generic-create-update-create-object" rel="nofollow noreferrer">create_object generic view</a>, and pass it either "model" (the model you want to create) or "form_class" (a customized <a href="h...
<p>Follow the Django tutorial for setting up the "admin" part of an application. This will allow you to modify your database.</p> <p><a href="https://docs.djangoproject.com/en/dev/intro/tutorial02/" rel="nofollow noreferrer">Django Admin Setup</a></p> <p>Alternatively, you can just connect directly to the database us...
5,740
<p>The function <a href="http://msdn.microsoft.com/en-us/library/aa366537(VS.85).aspx" rel="noreferrer">CreateFileMapping</a> can be used to allocate space in the pagefile (if the first argument is <code>INVALID_HANDLE_VALUE</code>). The allocated space can later be memory mapped into the process virtual address space...
<p>From the CreateFileMappingFunction:</p> <pre><code>A single file mapping object can be shared by multiple processes. </code></pre> <p>Can the Virtual memory be shared across multiple processes?</p>
<p>One reason is to share memory among different processes. Different processes by only knowing the name of the mapping object can communicate over page file. This is preferable over creating a real file and doing the communications. Of course there may be other use cases. You can refer to <a href="http://msdn.microsof...
39,512