instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm trying to create a very simple form in an Access database. Whenever I drag a textbox on the form, a label gets created with it. I want to be able to move the label without moving the textbox,but whenever I try to do that, the textbox moves with it. Its like they're linked with each other. Is there a way to separ...
<p>Yes, but you are better off looking for the small square black box that appears on the top left corner of each control when you click the textbox or label. This box will allow you to drag each control independently. Don't forget Format->Align (Left,Right,Top,Bottom) it is probably more useful for tidying up controls...
<p>You can also use Group/Ungroup menu commands to establish/remove the connection. Grouping the label and control causes them to move together in design view.</p>
39,720
<p>I am new to C++ and I had a few general questions about code separation. I have currently built a small application, all in one file. What I want to do now is convert this into separate files such that they contain similar code or whatnot. My real question right now is, how do I know how to separate things? What i...
<p>Header files should contain class and function declarations.</p> <p>Source files contain class and function definitions.</p> <p>It is standard practice (i.e. read easier) to have one declaration per header file and one definition per source file, though for small (read simpler helper) objects you sometimes group the...
<p>Suggestion: 1. Have a design ready for your application now. 2. Based on the design, create necessary objects that interact with each other. 3. Refactor or completely change the existing code to suit the newly created design.</p> <p>Header files provide an interface to the other classes that might use it's function...
35,398
<p>I'm setting the below variables in my vimrc to control how windows get split when I bring up the file explorer plugin for vim. But it appears these variables are not being read because they have no effect on how the file explorer window is displayed. I'm new to vim. I know the vimrc file is being read because I can ...
<p>Wherever you got those settings from is outdated. They were valid in vim 6.x, but not 7.x.</p> <p>For 7.x, use the following settings instead:</p> <pre><code>let g:netrw_winsize=10 let g:netrw_alto=1 </code></pre> <p>There is no option for disabling "detailed help" that I can find, but the help provided by netrw ...
<p>Create a gvimrc right beside your vimrc file and add those settings in there.</p>
33,461
<p>In C++ often do something like this:</p> <pre><code>typedef map&lt;int, vector&lt;int&gt; &gt; MyIndexType; </code></pre> <p>Where I then use it like this:</p> <pre><code>MyIndexType myIndex; for( ... some loop ...) { myIndex[someId].push_back(someVal); } </code></pre> <p>If there was no entry in the map the c...
<p>You want to use:</p> <pre><code>from collections import defaultdict myIndex = defaultdict(list) myIndex[someId].append(someVal) </code></pre> <p>Standard Library <a href="http://docs.python.org/library/collections.html#id3" rel="nofollow noreferrer"><code>defaultdict</code> objects</a>.</p> <p>Example usage from ...
<p>How about this? It may not be performance-optimal, but I think it's the "simplest thing that could possibly work".</p> <pre><code>myIndex = {} for (someId,someVal) in collection: if someId not in myIndex: myIndex[someId] = [] myIndex[someId].append(someVal) </code></pre>
42,040
<p>What is the best way to convert between HTML, XML, and XSL-FO in C#?</p> <p>I already have the HTML (piped in from FCKEditor) and I'd like to print a PDF (I have an XSL->PDF converter). I just can't seem to find a library that will convert from HTML into anything XSL friendly.</p>
<p>A year or two back, I had to generate pdfs from a C++/C# program. In the end I settled on launching Apache's Java <a href="http://xmlgraphics.apache.org/fop/" rel="nofollow noreferrer">FOP</a> as a separate process to do the conversion. The experience with xsl-fo was not a pleasant one. At the time, there didn't app...
<p>Very informative exchange here. I have created a web application using ASP.NET and C#.NET for my IT contract business. One of the major goals of the web app is to generate customized resumes in various formats. I store my resume content in a SQL Server database and build the XML mostly raw in a C# method. I used...
25,799
<p>In Firefox I can get the stack trace of an exception by using <code>exception.stack</code>.</p> <p>Is there a way to get that in other browsers, too?</p> <p><b>Edit:</b> I actually want to save the stack trace automatically (if possible) and not debug it at the time (i.e. I know how to get the stack trace in a deb...
<p>Place this line where you want to print the stack trace:</p> <pre><code>console.log(new Error().stack); </code></pre> <p><strong>Note:</strong> tested by me on <strong>Chrome 24</strong> and <strong>Firefox 18</strong></p> <p>May be worth taking a look at <a href="https://github.com/ebobby/tracing.js" rel="norefe...
<p>Not really, at least not easily.</p> <p>In IE, you can debug the browser process with MS Script Debugger (which for some reason is an Office component) or Visual Studio, and then you can see the stack on breakpoints.</p>
17,807
<p>I have seen simple example Ajax source codes in many online tutorials. What I want to know is whether using the source code in the examples are perfectly alright or not?</p> <p>Is there anything more to be added to the code that goes into a real world application?</p> <p>What all steps are to be taken to make the ...
<p>The code you posted is missing one important ingredient: the function stateChanged.</p> <p>If you don't quite understand the code you posted yourself, then what happens is when the call to getchats.php is complete, a function "stateChanged" is called and that function will be responsible for handling the response. ...
<p>I would use a framework like <a href="http://www.domassistant.com/" rel="nofollow noreferrer">DOMAssistant</a> which has already done the hard work for you and will be more robust as well as adding extra useful features.</p> <p>Apart from that, you code looks like it would do the job.</p>
6,510
<p>I'm setting up a server to offer JIRA and SVN. I figure, I'll use LDAP to keep the identity management simple. </p> <p>So, before I write one.... is there a good app out there to let users change their ldap password? I want something that lets a user authenticate with ldap and update their password. A form wit...
<p>This should do it:</p> <pre><code>private enum Alignment { LEFT, RIGHT }; String drawCellValue (int maxCellLength, String cellValue, Alignment align){ if (align == Alignment.LEFT) { //Process it... } } </code></pre>
<p>Sure, you could use an enum. Would something like the following work?</p> <pre><code>enum Alignment { LEFT, RIGHT } </code></pre> <p>private static String drawCellValue(int maxCellLength, String cellValue, Alignment alignment) { }</p> <p>If you wanted to use a boolean, you could rename the align paramete...
17,215
<p>While checking out the generic collection in .net i found about KeyedByTypeCollection. Although I worked with it and got to know how to use it, I did not get in which scenario it will be useful.</p> <p>I read through <a href="https://stackoverflow.com/questions/178255/serviceprovider-cache-etc-done-with-generics-wi...
<p>AFAIK, this generic collection serves just as a simple wrapper for <code>KeyedCollection&lt;KEY,VALUE&gt;</code> when <code>KEY</code> is the Type of the <code>VALUE</code> to store.</p> <p>For example, it is very convinient to use this collection if you want to implement a factory returning singletons:</p> <pre><...
<p>In analyzing this class, my take is that it is totally irrelevant. Use the base class <code>KeyedCollection</code> and write the <code>GetKeyForItem</code> method to return the Type of the Item parameter.</p> <p>There are four methods defined on the <code>KeyedByTypeCollection</code> that are irrelevant (<code>Find...
42,798
<p>As per RFC1035, dns names may contain \ddd \x and quote symbol. Please explain with examples about those.</p>
<p><a href="http://www.ietf.org/rfc/rfc1035.txt" rel="nofollow noreferrer">RFC1035</a> doesn't say that DNS <strong>names</strong> can contain those characters. In section 5 (MASTER FILES) it says that the <strong>file</strong> that contains the RR information can contain those characters. Specifically: "Because thes...
<p>The recommended reading is <a href="http://www.ietf.org/rfc/rfc2181.txt" rel="nofollow noreferrer">RFC 2181</a>, whose section 11 explains well the issue.</p> <p>Otherwise, for an example, see <code>maps-to-nonascii.rfc-test.net</code>. This name is an alias for a name with non-ASCII characters.</p>
28,931
<p>I'm trying to create web applications that use JavaScript. I'd like to be able to use animation in these applications. I've tried to use basic JavaScript, but I've decided that the best thing to do is to use a library (such as <a href="http://en.wikipedia.org/wiki/Yahoo!_UI_Library" rel="nofollow noreferrer">YUI</...
<p>I have found <a href="http://en.wikipedia.org/wiki/MooTools" rel="nofollow noreferrer">MooTools</a> to be pretty slick for animations, just a little smoother than jQuery. </p> <p>I generally prefer jQuery, which I find to be a little more intuitive (in my head anyway), but I would use MooTools if slick animation i...
<p>JQuery has animation, but I don't know what it is like on a Mac (I don't have a mac). If things are going slow, then you are probably making the animations too complicated. Remember, JavaScript is a slow language, and DOM is not designed for animation, so try to limit yourself with respect to the number of animation...
5,120
<p>What is the default capacity of a <code>StringBuilder</code>?</p> <p>And when should (or shouldn't) the default be used?</p>
<p>The default capacity of StringBuilder is 16 characters (I used .NET Reflector to find out).</p>
<p>[edit: at the time, the question asked about <code>StringList</code>]</p> <p>Do you mean <code>StringCollection</code>? This uses an empty <code>ArrayList</code> initially, so the answer is 0. And you have no option to change it. When you first add an item, the capacity jumps to 4, then uses a doubling strategy whe...
30,550
<p>I'm using the ReportViewer control to display a Report within a WebForm, i've also implemented the "Export to Excel" feature, by calling the Render method of the Server Report</p> <p>eg</p> <pre><code>ReportViewerControl.ServerReport.Render("Excel",etc,etc,etc); </code></pre> <p>My problem is that the exported re...
<p>regarding your question about list traversal - you can start by writing a function that returns lists that represent the path - that's I think easier and it will be later easy to turn it into a function that returns a number.</p> <p>This one takes a list as the first argument (path so far) and a tree and returns a ...
<p>Regarding laziness - You can make this lazy by using F# "seq" type instead of "list" type. Here is an example:</p> <pre><code>let rec visitor2 lst tree = match tree with | Branch(n, sub) -&gt; Seq.map_concat (visitor2 (lst * 10 + n)) sub | Leaf(n) -&gt; seq { do printfn "--yielding: %d" (lst * 10 + n) ...
35,959
<p><strong>SpousesTable</strong> <em>SpouseID</em></p> <p><strong>SpousePreviousAddressesTable</strong> <em>PreviousAddressID</em>, <em>SpouseID</em>, FromDate, AddressTypeID</p> <p>What I have now is updating the most recent for the whole table and assigning the most recent regardless of SpouseID the AddressTypeID =...
<p>Presuming you are using SQLServer 2005 (based on the error message you got from the previous attempt) probably the most straightforward way to do this would be to use the ROW_NUMBER() Function couple with a Common Table Expression, I think this might do what you are looking for:</p> <pre><code>WITH result AS ( SELE...
<pre><code>UPDATE spa SET spa.AddressTypeID = 1 WHERE spa.SpouseID IN ( SELECT DISTINCT s1.SpouseID FROM Spa S1, SpousePreviousAddresses S2 WHERE s1.SpouseID = s2.SpouseID AND s2.CountryID = 181 AND s1.PreviousAddressId = s2.PreviousAddressId ...
37,156
<p>I'm not talking about algorithmic stuff (eg use quicksort instead of bubblesort), and I'm not talking about simple things like loop unrolling.</p> <p>I'm talking about the <em>hardcore</em> stuff. Like <a href="http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html" rel="noreferrer">Tiny Teensy ELF</a>, <a h...
<p>I once wrote a brute force RC5 key search that processed two keys at a time, the first key used the integer pipeline, the second key used the SSE pipelines and the two were interleaved at the instruction level. This was then coupled with a supervisor program that ran an instance of the code on each core in the syste...
<p>The <a href="http://en.wikipedia.org/wiki/EFF_DES_cracker" rel="nofollow noreferrer">EFF DES cracker</a>, which used custom-built hardware to generate candidate keys (the hardware they made could prove a key isn't the solution, but could not prove a key was the solution) which were then tested with a more convention...
27,973
<p>How do you check that monkey patching has been done to a specific class in Ruby? If that is possible, is it also possible to get the previous implementation(s) of the attribute that's been patched?</p>
<p>There are the hooks <code>method_added</code> and <code>method_undefined</code>. Garry Dolley has written an I<a href="http://scie.nti.st/2008/9/17/making-methods-immutable-in-ruby" rel="noreferrer">mmutable module</a> that prevents monkey patching.</p>
<p>There are the hooks <code>method_added</code> and <code>method_undefined</code>. Garry Dolley has written an I<a href="http://scie.nti.st/2008/9/17/making-methods-immutable-in-ruby" rel="noreferrer">mmutable module</a> that prevents monkey patching.</p>
43,522
<p>Our company has a point of sale system with many extras, such as ordering and receiving functionality, sales and order history etc. Our main issue is that the system was not designed properly from the ground up, so it takes too long to make fixes and handle requests from our customers. Also, the current technology w...
<p>Java for language (or Scala if you want to be "bleeding edge", depending on how you plan to support it and what your developers are like it might be better, but also worse)</p> <p>H2 for database</p> <p>Swing for GUI</p> <p>Reason: Free, portable and pretty standard.</p> <p>Update: Missed the part where the syst...
<p>I suggest you use browser for the UI. </p> <p>Organize your application as a web application. </p> <p>There are tons of options for the back-end. You can use Java + MySQL. Java backend will save you from windows/linux debate as it will run on both platforms. You won't have any licensing cost for both Java and MySQ...
23,317
<p>I'd like to check a few queries generated by ActiveRecord, but I don't need to actually run them. Is there a way to get at the query before it returns its result?</p>
<p>Both of these articles should help you do what you want.</p> <p><a href="http://weblog.jamisbuck.org/2007/1/8/watching-activerecord-do-it-s-thing" rel="nofollow noreferrer">http://weblog.jamisbuck.org/2007/1/8/watching-activerecord-do-it-s-thing</a></p> <p><a href="http://weblog.jamisbuck.org/2007/1/31/more-on-wat...
<p>Jamis' article is outdated, or at least doesn't work my Rails app (possibly due to some other reason with a 3 year old 30,000 line app). However this works in a console any time:</p> <pre><code>ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT) </code></pre>
30,190
<p>I'm looking for a web based upload manager, with good support for images. It should be as easy as possible for novice users to "add images to a website". I could use such a thing for two use cases:</p> <ul> <li>A CMS for external use, needs proper image support (1-file upload doesn't quite cut it).</li> <li>A Wiki ...
<p>I found this explanation: <code>http://www.astahost.com/info.php/max_allowed_packet-mysql_t2725.html</code></p> <blockquote> <p>It's safe to increase the value of this variable because the extra memory is allocated only when needed. For example, mysqld allocates more memory only when you issue a long quer...
<p>I suggest not touching this variable, instead adjusting your storage implementation to handle any size files using the default settings.</p> <p>Can you see <a href="http://www.dreamwerx.net/phpforum/?id=1" rel="nofollow noreferrer">here</a> for an example.</p>
37,769
<p>I notice that modern C and C++ code seems to use <code>size_t</code> instead of <code>int</code>/<code>unsigned int</code> pretty much everywhere - from parameters for C string functions to the STL. I am curious as to the reason for this and the benefits it brings.</p>
<p>The <code>size_t</code> type is the unsigned integer type that is the result of the <code>sizeof</code> operator (and the <code>offsetof</code> operator), so it is guaranteed to be big enough to contain the size of the biggest object your system can handle (e.g., a static array of 8Gb).</p> <p>The <code>size_t</cod...
<p>size_t is the size of a pointer. </p> <p>So in 32 bits or the common ILP32 (integer, long, pointer) model size_t is 32 bits. and in 64 bits or the common LP64 (long, pointer) model size_t is 64 bits (integers are still 32 bits).</p> <p>There are other models but these are the ones that g++ use (at least by defaul...
15,987
<p>I would like to intercept any URL which the user enters in their browser and perform some tasks before allowing the navigation to continue (any way could be good - i.e. via plug in, via proxy or any other creative suggestion). To clarify - I am not referring to a specific application that needs to catch this, but ra...
<p>I do not think you can "intercept" what the user enters via javascript. It smells like a big security exploit. You can detect when the user leaves the page, but you cannot detect where he is going next.</p> <ul> <li><p>A proxy is a good choice if you just need the URL string to be processed. But anything more compl...
<p>If you're using Javascript, there's an event which fires when the user exists a page called <code>onunload</code>.</p> <pre><code>window.onunload = function() { alert("You're leaving this page."); }; </code></pre>
34,972
<p>My Virtual Machine's clock drifts pretty significantly. There's documentation out there about dealing with this, but nothing seems to be working very well.</p> <p>Anyone have any suggestions, things that worked well for them, ...</p> <p>Supposedly updating regularly via ntp is not a good solution.</p>
<p>vmware have <a href="http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf" rel="nofollow noreferrer">a really good PDF doc</a> on this problem.</p> <p>Basically, the host will slew the ticks delivered to your guests as it can. <strong>Don't</strong> run NTP or timed or junk like that. Just install vm...
<p>You can use the cmd and </p> <pre><code>net time \\computer_name /set </code></pre> <p>to set the clock remotly (or in a script for example)</p>
14,301
<p>I'm probably going to be using Tomcat and the Apache Axis webapp plugin, but I'm curious as to any other potential lightweight solutions.</p> <p>The main goal of this is to connect to MySQL database for doing some demos.</p> <p>Thanks, Todd</p>
<p>Define lightweight? (What DOES that mean anyway nowadays??)</p> <p>With JAX-WS/Metro you need to simply make a boiler plate change to the web.xml, and then annotate a POJO with @WebService, and, tada, instant web service.</p> <p>The distribution has several jars in it (around a dozen I think, but they're all in th...
<p>Check out <a href="http://xfire.codehaus.org/" rel="nofollow noreferrer">XFire</a>, which apparently has morphed into <a href="http://cxf.apache.org/" rel="nofollow noreferrer">CXF</a>.</p> <p>They have a <a href="http://cwiki.apache.org/CXF20DOC/index.html" rel="nofollow noreferrer">user guide</a> to get you start...
35,721
<p>I have plenty of experience with NUnit and MBUnit, but I'm new to .NET Compact Framework development and I'd like to get off on the right foot.</p> <p>Is there a prevailing unit testing framework for the .NET Compact Framework, and if so, what is it?</p>
<p>Check out NUnitLite: <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=NUnitLite" rel="nofollow noreferrer">http://www.codeplex.com/Wiki/View.aspx?ProjectName=NUnitLite</a></p>
<p>For an embedded project running on Portable.NET, we ended up writing our own minimal version of NUnit, since we couldn't get the NUnit code to compile and run on that runtime. It wasn't really all that hard to do, actually.</p>
38,419
<p>I like Steve Yegge's <a href="http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html" rel="noreferrer">Prototype Pattern example</a> and decided to whip up a quick proof of concept example.</p> <p>However, I didn't really think things through. While it is great for dynamically specifying the behavio...
<p>Doesn't it depend how you actually implement the inheritance in your system?</p> <p>For example, in a JavaScript version of what you describe, the <code>prototype</code> for <code>AwesomeDragonImmuneToFire</code> would normally be an <em>instance</em> of an <code>AwesomeDragon</code>, and since you'd always be work...
<blockquote> <p>This will involve updating the 'position' property of AwesomeDragon. However, the moment I do this AwesomeDragonImmuneToFire will take off as well.</p> </blockquote> <p>Maybe I misunderstand but I am not sure why you think the AwesomeDragonImmuneToFire will take off as well. If they are two distinct ...
28,234
<p>I'm trying to refactor a large, old project and one thing I've noticed is a range of different Iterator implementations:</p> <pre><code>while($iterator-&gt;moveNext()) { $item = $iterator-&gt;current(); // do something with $item; } for($iterator = getIterator(), $iterator-&gt;HasNext()) { $item = $...
<p>The SPL version is definitely the way to go. Not only is it the easiest to read, but it's a part of PHP now, so will be familiar to many more people.</p> <p>There's nothing "wrong" with the others, but as you stated, having all these different versions in one project isn't helping anyone.</p>
<p>Imo, simply utilising one or more of the SPL libraries as an interface tends to be less ugly in use at the front end. However, the backing behind the implementation can get a bit ugly. </p> <p>For instance, I wrote an iterator that efficiently iterated a database result set, so that results that were never requeste...
46,833
<p>Is it possible to to change a <code>&lt;span&gt;</code> tag (or <code>&lt;div&gt;</code>) to preformat its contents like a <code>&lt;pre&gt;</code> tag would using only CSS?</p>
<p>Look at the <a href="https://www.w3.org/TR/CSS21/sample.html" rel="noreferrer">W3C CSS2.1 Default Style Sheet</a> or the <a href="https://www.w3.org/TR/CSS22/sample.html" rel="noreferrer">CSS2.2 Working Draft</a>. Copy all the settings for PRE and put them into your own class.</p> <pre class="lang-css prettyprint-o...
<p>Why not just use the &lt;pre&gt; tag, instead of the span tag? Both are inline, so both should behave in the way you would like. If you have a problem overriding the entire definition of &lt;pre&gt;, just give it a class/id.</p>
26,978
<p>Hi I'm doing the Collatz sequence problem in project Euler (problem 14). My code works with numbers below 100000 but with numbers bigger I get stack over-flow error. </p> <p>Is there a way I can re-factor the code to use tail recursion, or prevent the stack overflow. The code is below:</p> <pre><code>import java.u...
<p>Your problem is not with the size of the stack (you're already memoizing the values), but with </p> <ol> <li>the size of some of the numbers in the sequences, and </li> <li>the upper limits of a 32-bit integer. </li> </ol> <p>Hint:</p> <pre><code>public static int seqCount(int n) { if(hm.get(n) != null) { ...
<pre><code>import java .util.*; public class file { public static void main(String [] args) { long largest=0; long number=0; for( long i=106239;i&lt;1000000;i=i+2) { long k=1; long z=i; while(z!=1) { if(z%2==0) { k++; z=z/2; } else...
49,261
<p>I know that there is no way to fully protect our code. I also know that if a user wants to crack our app, then he or she is not a user that would buy our app. I also know that it is better to improve our app.. instead of being afraid of anticracking techniques. I also know that there is no commercial tool that can p...
<p>Unfortunately, VM-protected software is more likely to get affected by false positives than conventional packing software. The reason for that is that since AV protection is so complicated, AV software are often unable to analyze the protected code, and may rely on either pattern libraries or may issue generic warni...
<p>Software VM protection is quite popular today, especially as it's now available at an accessible price for small companies and independent software developers. It also takes a considerable amount of effort to crack in comparison to non-VM techniques - the wrappers usually have the standard anti-debugging tricks that...
46,207
<p>I'm interested in writing eclipse plugins where do I start? </p> <p>What resources have helped you?</p> <p>I'm looking for:<br> 1. Tutorials<br> 2. Sites devoted to plugin development<br> 3. Books </p>
<p>You can find a good step by step detailed tutorial here:</p> <p><a href="http://www.eclipsepluginsite.com/" rel="nofollow noreferrer">http://www.eclipsepluginsite.com/</a></p> <p>Other tutorials:</p> <p><a href="http://www.ibm.com/developerworks/opensource/library/os-eclipse-snippet/index.html?ca=dgr-lnxw16RichEc...
<p>Here's all the books available for developing Eclipse Plugins: <a href="http://www.eclipseplugincentral.com/books-index-req-view_subcat-sid-4.html" rel="nofollow noreferrer">http://www.eclipseplugincentral.com/books-index-req-view_subcat-sid-4.html</a></p>
7,083
<p>Do any of you know of a tool that will search for .class files and then display their compiled versions?</p> <p>I know you can look at them individually in a hex editor but I have a lot of class files to look over (something in my giant application is compiling to Java6 for some reason).</p>
<p>Use the <a href="http://java.sun.com/javase/6/docs/technotes/tools/solaris/javap.html" rel="noreferrer">javap</a> tool that comes with the JDK. The <code>-verbose</code> option will print the version number of the class file.</p> <pre><code>&gt; javap -verbose MyClass Compiled from "MyClass.java" public class MyCla...
<p>The simplest way is to scan a class file using many of the answers here which read the class file magic bytes.</p> <p>However some code is packaged in jars or other archive formats like WAR and EAR, some of which contain other archives or class files, plus you now have multi-release JAR files - see <a href="https://...
4,671
<p>I have a couple CSS files with overlapping CSS selectors that I'd like to programmatically merge (as in not just appending one file to the end of the other). Is there any tool to do this online? or a Firefox extension perhaps?</p>
<p>I found <a href="http://zamez.org/factorcss" rel="noreferrer">Factor CSS</a> - complete with source code, but I think it does way more than I'd need. I really just want to combine CSS blocks that have the same selectors. I'll check out the source code and see if it can be converted to something usable as a TextMate ...
<p>I wrote a Perl utility to do this several years ago.</p> <p>As well as merging one or more stylesheets into a single coherent sorted output (complete with comments to show which file(s) each property appeared in, and warnings when a property has conflicting values), you can also <em>selectively</em> search or merge...
3,744
<p>In bash shell with emacs key-binding, you can use key combination like M-f, M-b to move one word forward or backward on the shell prompt respectively. Usually, the meta key is mapped to Alt key on Windows and Linux. However, in iTerm, I could not find a way to map this meta key to either Option or Command key on my ...
<ol> <li>Open &quot;Preferences&quot; (<kbd>⌘</kbd><kbd>,</kbd>) -&gt; <code>Profiles</code> -&gt; <code>Keys</code> -&gt; <code>General</code> tab.</li> <li>Set <code>Left Option key:</code> to act as <code>Esc+</code>.</li> </ol> <p>Works for me in Emacs, though I'm not sure if it will have any other undesirable effe...
<p>Try "export LANG=C". I'm not emacs expert, but I found this enables emacs on OS X to recognize the Option key as the Meta key in iTerm,</p>
23,855
<p>How do I call an external command within Python as if I'd typed it in a shell or command prompt?</p>
<p>Use the <a href="https://docs.python.org/library/subprocess.html" rel="noreferrer"><code>subprocess</code></a> module in the standard library:</p> <pre class="lang-py prettyprint-override"><code>import subprocess subprocess.run([&quot;ls&quot;, &quot;-l&quot;]) </code></pre> <p>The advantage of <a href="https://docs...
<p>I use this for Python 3.6+:</p> <pre><code>import subprocess def execute(cmd): &quot;&quot;&quot; Purpose : To execute a command and return exit status Argument : cmd - command to execute Return : result, exit_code &quot;&quot;&quot; process = subprocess.Popen(cmd, shell=True, ...
11,480
<p>My question is about one particular usage of static keyword. It is possible to use <code>static</code> keyword to cover a code block within a class which does not belong to any function. For example following code compiles:</p> <pre><code>public class Test { private static final int a; static { ...
<p>The code block with the static modifier signifies a <em>class</em> initializer; without the static modifier the code block is an <em>instance</em> initializer. </p> <p>Class initializers are executed in the order they are defined (top down, just like simple variable initializers) when the class is loaded (actually...
<p>The <em>static initializer blocks</em> are invoked (in the order they were defined in) when the JVM loads the class into memory, and before the main method. It's used to conditionally initialize static variables.</p> <p>Similarly we have the <em>instance initializer blocks</em> (aka IIBs) which are invoked upon obje...
43,488
<p>I didn't know I would be getting too many replies so fast. I can provide more details. It is definitely for use within the company. I was looking for some info on whether I should be more careful or anything to watch out for...</p> <p>My boss is asking me to put some tracking info on what users do with their applic...
<p>At work, there is no privacy. Think of it this way, if you work for a financial institution, or a government one, monitoring users may be the difference between keeping sensitive information secret and not. (I want my personal information kept private). They are paid to do work at work. If they are afraid about ...
<p>If the client is external, this should be disclosed to the client. Actually, if the client is internal OR external, if you do not disclose it, it is totally unethical.</p> <p>An employment agreement that states that there can be no expectation of privacy constitutes disclosure.</p>
16,554
<p>I'm trying to find some references in regards to x86 Assembly languages. Tutorials/Examples to help my understanding. -Thanks</p>
<ul> <li><a href="http://download.savannah.gnu.org/releases/pgubook/ProgrammingGroundUp-1-0-booksize.pdf" rel="noreferrer">Programming from the Ground Up</a> (free book, highly recommended)</li> <li><a href="http://en.wikibooks.org/wiki/X86_Assembly" rel="noreferrer">x86 Assembly</a> (wikibooks.org)</li> <li><a href="h...
<p>The best, most comprehensive source of Assembly I've seen is the "<a href="http://www.plantation-productions.com/Webster/www.artofasm.com/Windows/index.html" rel="nofollow noreferrer">Art of Assembly Language</a>" book. It's a free download, in several versions.</p>
26,395
<p>I'm new to Ruby, so I'm having some trouble understanding this weird exception problem I'm having. I'm using the ruby-aaws gem to access Amazon ECS: <a href="http://www.caliban.org/ruby/ruby-aws/" rel="nofollow noreferrer">http://www.caliban.org/ruby/ruby-aws/</a>. This defines a class Amazon::AWS:Error:</p> <pre><...
<p>Ok, I'll try to help here : </p> <p>First a module is not a class, it allows you to mix behaviour in a class. second see the following example : </p> <pre><code>module A module B module Error def foobar puts "foo" end end end end class StandardError include A::B::Error end Stand...
<p>One issue you're running into is that <code>Amazon::AWS::Error::AWSError</code> is not actually an exception. When <code>raise</code> is called, it looks to see if the first parameter responds to the <code>exception</code> method and will use the result of that instead. Anything that is a subclass of <code>Exceptio...
9,547
<p>I am trying to link the as3corelib library to use their JSON functionality following <a href="http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/" rel="nofollow noreferrer">this tutorial</a>. But am having trouble compiling it. My command looks like:</p> <pre> mxmlc --str...
<p>I found an older version of the library bundled with some tutorial which worked. Submitted a bug report to as3corelib, of course I am not entirely sure how valid the bug is.</p>
<p>Are you using the flex Gubmo sdk? Looks like the method it's complaining about is in an interface that's part of Gumbo. If so, then as3corelib probably won't work with it.</p>
36,723
<p>I'm working with an older MakerBot Replicator clone, actually a Flashforge Creator 1, with original Creator firmware.</p> <ul> <li>I'm able to design objects, using Solidworks, and exporting the file as xxx.stl (ascii)</li> <li>Then I use Slic3r to generate tool paths with output as xxx.gcode</li> <li>finally, I use...
<p>So it turns out there are elements from each of the previous answers that make sense here, but its not a clear picture. I've spent a whole lot of time trying to make sense of this. I also upgraded my firmware to <a href="https://www.thingiverse.com/thing:32084" rel="nofollow noreferrer">Sailfish.</a> </p> <p>For ...
<p>It sounds like you have "Origin at center" checked in your slicer's printer definition. That is generally only used with delta printers. Most Cartesian printers have the origin at the front-left corner of the build plate. Uncheck "Origin at center" and re-slice.</p> <p>Providing that you have set up your slicer wit...
1,495
<p>I would like to create an application wide keyboard shortcut for a Java Swing application. Looping over all components and adding the shortcut on each, has focus related side effects, and seems like a brute force solution.</p> <p>Anyone has a cleaner solution?</p>
<p>Install a custom KeyEventDispatcher. The KeyboardFocusManager class is also a good place for this functionality.</p> <p><a href="http://java.sun.com/javase/6/docs/api/java/awt/KeyEventDispatcher.html" rel="noreferrer">KeyEventDispatcher</a></p>
<p>Use the following piece of code</p> <pre><code>ActionListener a=new ActionListener(){ public void actionPerformed(ActionEvent ae) { // your code } }; getRootPane().registerKeyboardAction(a,KeyStroke.getKeyStroke("ctrl D"),JComponent.WHEN_IN_FOCUSED_WINDOW); </code></pre> <p>Replace "ctrl D" with the s...
12,534
<p>I am using Apache <a href="http://hc.apache.org/httpclient-3.x/" rel="noreferrer">HttpClient</a> and would like to communicate HTTP errors (400 Bad Request, 404 Not Found, 500 Server Error, etc.) via the Java exception mechanism to the calling code. Is there an exception in the Java standard library or in a widely u...
<p>If it's not an Exception in HttpClient design philosophy, but an Exception in your code, then create your own Exception classes. ( As a subclass of org.apache.commons.httpclient.HttpException )</p>
<p>There is <a href="http://hc.apache.org/httpclient-3.x/tutorial.html" rel="nofollow noreferrer">org.apache.commons.httpclient.HttpException</a> if you want a library exception. We have also sometimes created our own for specific purposes, both creating an exception for specific HTTP status codes and a generic one for...
26,087
<p>Given a select with multiple option's in jQuery. </p> <pre><code>$select = $("&lt;select&gt;&lt;/select&gt;"); $select.append("&lt;option&gt;Jason&lt;/option&gt;") //Key = 1 .append("&lt;option&gt;John&lt;/option&gt;") //Key = 32 .append("&lt;option&gt;Paul&lt;/option&gt;") //Key = 423 </code></pre> ...
<p>Like lucas said the value attribute is what you need. Using your code it would look something like this ( I added an id attribute to the select to make it fit ):</p> <pre><code>$select = $('&lt;select id="mySelect"&gt;&lt;/select&gt;'); $select.append('&lt;option value="1"&gt;Jason&lt;/option&gt;') //Key = 1 .ap...
<p>If you are using HTML5, you can use a <a href="http://ejohn.org/blog/html-5-data-attributes/" rel="nofollow noreferrer">custom data attribute</a>. It would look like this:</p> <pre><code>$select = $("&lt;select&gt;&lt;/select&gt;"); $select.append("&lt;option data-key=\"1\"&gt;Jason&lt;/option&gt;") //Key = 1 .a...
4,683
<p>I have created a Dynamic Web Project in my Eclipse workspace. It is also a Maven project, and under SVN control. But in "Open Resource" (Ctrl+Alt+R) no file from this project appears, unless I check from the window's options (top right drop-down) "Show Derived Resources".</p> <p>I have checked on some of the projec...
<p>I experienced a similar issue in Eclipse (Ganymede), when using the Maven and Subclipse plugins. I have not determined which plugin caused this problem, but I suspect that it is related to my pom.xml containing nested modules (ie. a <code>&lt;modules&gt;&lt;module&gt;main-module&lt;/module&gt;&lt;module&gt;integrati...
<p>In fact, I think that somehow this is eclipse in its own right, as I don't have m2eclipse or using maven for this.</p> <p>By default, eclipse uses /bin as the target directory. My situation is similar to having maven in the project in that the target directory was changed to lib/classes to accommodate an existing p...
21,954
<p>I am using Django and the Google Web Toolkit (GWT) for my current project. I would like to pass a ModelForm instance to GWT via an Http response so that I can "chop" it up and render it as I please. My goal is to keep the form in sync with changes to my models.py file, yet increase control I have over the look of th...
<p>If you were using pure Django, you'd pass the form to your template, and could then call individual fields on the form for more precise rendering, rather than using ModelForm.to_table. You can use the following to iterate over each field and render it exactly how you want:</p> <pre><code>{% for field in form.field...
<p>If your problem is just to serialze a ModelForm to json, just write your own simplejson serializer subclass.</p>
48,221
<p>This is along similar lines as these recent questions:</p> <p><a href="https://stackoverflow.com/questions/93290/best-java-obfuscation-application-for-size-reduction">Best Java Obfuscation Application For Size Reduction</a> <a href="https://stackoverflow.com/questions/149937/creating-non-reverse-engineerable-java-p...
<p>Proguard is a better product; especially if you take the time to go through the settings for J2ME. </p> <p>Specifically for J2ME there is a far better (commercial) product called <a href="http://www.innaworks.com/mBooster.html" rel="noreferrer">mBooster</a></p> <p>I've been getting around 25% improvement in size o...
<p>My opinion is - ProGuard is better. Output is smaller a bit. Optimizing is better and much faster. </p> <p>Decompiling is simple in both cases. Well, i mean, if u know Java well and really <em>know</em> business-logic of what you're decompiling, there is no problem to get it back to sources from obfuscated classes....
18,162
<p>I have a very complicated .NET application that contains cut/copy/paste functionality. I want to enable/disable cut/copy/paste buttons depending on the selected control/content. The app has many user controls. What is the best way to achieve this?</p> <p>Thanks</p>
<p>Are you talking about catching the focus of the control or about a design pattern in which to do this?</p> <p>I would probably register each control that is to be enabled/disabled with the control that it's dependent on. Then when the dependent control gets selected/focused, spin through the controls and enable/dis...
<p>One approach:</p> <p>Add a delegate to the appropriate event for each control you wish to monitor. </p> <p>e.g. : <code>textBox.GotFocus += myFunctionalityEnabler;</code></p>
44,501
<p>I've developed an application at working using MySQL 5, that uses Views to access the major pieces of data. It turns out that our production server uses MySQL 4, which does not have Views included.</p> <p>Does anybody have a quick and dirty way to deal with this that doesn't involve rewriting all my code? </p>
<p>This certainly points out the importance of using the same technology in your development and production environments!</p> <p>Workarounds involving triggers or stored procedures won't work, because these are also not supported on MySQL 4.x.</p> <p>Your options at this point:</p> <ul> <li><p>Rewrite application co...
<p>Unfortunately, without upgrading to MySQL 5, probably not.</p>
43,050
<p>Is there a way to temporary swap Flex's main application to another then switch back. Scenario : Main app started, display login box - then go on with main app. Login box is an application as well. </p> <p>Application.application is a read only property, that attempt failed.</p>
<p>I've had great success with a modular application whereby the main application basically consists of a module loader, that initially loads a logon module.</p> <p>Once the logon module has done it's stuff (in my case validated inputs, called the logon service and retrieved a token), it dispatches an event (imaginati...
<p>That's funny, this is exactly what I am attempting to figure out the best way to do at the moment. I had thought of using a ViewStack, but as I already have a lot of other nested ViewStacks being used, I was also looking into the State tag. If anyone knows "the right thing" to do I'll be very interested too!</p>
26,908
<p>I need to keep a couple of <a href="http://jena.sf.net" rel="nofollow noreferrer">Jena</a> Models (OntModels, specifically) synchronized across a socket, and I'd like to do this one change at a time (for various reasons -- one being that each Statement added or removed from the OntModels is also adapting a JESS rule...
<p>I would serialize the changes out in N-TRIPLES format. Jena has built-in N-TRIPLES serializer and parser, but the N-TRIPLES syntax is (deliberately) very simple so it would be easy to generate manually in your code. </p> <p>However, it might be even easier to keep a plain mem model around to hold the changes, have ...
<p>Maybe you should try to replace the String parameter of createStatement by Model.createLiteral(String)... </p>
49,161
<p>Why is the following C# code not allowed:</p> <pre><code>public abstract class BaseClass { public abstract int Bar { get;} } public class ConcreteClass : BaseClass { public override int Bar { get { return 0; } set {} } } </code></pre> <blockquote> <p>CS0546 'ConcreteClass.Bar.set...
<p>I think the main reason is simply that the syntax is too explicit for this to work any other way. This code:</p> <pre><code>public override int MyProperty { get { ... } set { ... } } </code></pre> <p>is quite explicit that both the <code>get</code> and the <code>set</code> are overrides. There is no <code>set</code>...
<p>Because at the IL level, a read/write property translates into two (getter and setter) methods.</p> <p>When overriding, you have to keep supporting the underlying interface. If you could add a setter, you would effectively be adding a new method, which would remain invisible to the outside world, as far as your cla...
10,818
<p>I thought this was pretty straight forward but I don't get the same results as the tutorials I read. I have a button on an html page that calls a function in script tags. I also have a reference to the prototype.js file which I haven't even begun to implement yet. If I leave that reference in the page, my function c...
<p>A couple of things: first, make sure your HTML is valid. Run it through the validator at <a href="http://validator.wc.org" rel="nofollow noreferrer">http://validator.wc.org</a>.</p> <p>Next, once you're sure that your page is valid, add the prototype.js library as the first script reference on the page:</p> <pre...
<p>That worked. I'm just puzzled why none of the examples I have been working from have done this. </p> <p>Thanks!</p>
48,241
<p>I made some 3D printed supports for tools, using screws to fix it to the wall, some of them broken because of the screw forces. Is there a way to reinforce only the screw holes where it will have more stress/compress? I am using PLA, Fusion 360 and Ultimaker Cura.</p>
<p>You can test different print settings. Trying to visualize, but I believe you can increase the <strong>perimeter lines</strong>, since there is a hole, this will increase the resistance in that area. Or try to change the <strong>orientation</strong> with which the part will be printed</p>
<p>You can use a washer between the screw head and the plastic material to distribute the load</p> <p>In my designs I also put in a depression to fit the washer so that it sits flush with the resultant surface. </p> <p><a href="https://i.stack.imgur.com/2Mh31.png" rel="nofollow noreferrer"><img src="https://i.stack...
1,198
<p>Anyone know of an opensource PHP Load Testing Framework similar to the Grinder " "<a href="http://grinder.sourceforge.net/" rel="nofollow noreferrer">http://grinder.sourceforge.net/</a>". </p>
<p>I haven't used the grinder, but It sounds similar to <a href="http://jakarta.apache.org/jmeter/" rel="nofollow noreferrer">JMeter</a>. Also at times I have used plain old <a href="http://selenium-rc.openqa.org/" rel="nofollow noreferrer">Selenium</a> for load testing.</p>
<p>RedLine has a <a href="http://www.redline13.com" rel="nofollow">Cloud Load Testing</a> tool in PHP on Amazon AWS now. it is free for the service, but you have to pay for the Spot Instances on your account (for example 50,000 user test on 200 m1.small is about $2/hour).</p>
31,228
<p>My colleagues and I have tried to build a project containing several thousand classes , but we're getting a LNK1102 error ( Linker out of memory ) . I've seen several tips on the internet , such as increasing the virtual memory . We tried but this didn't help . We've also seen some as enabling different warning leve...
<p>Project (right click) &rarr; Properties &rarr; Configuration Properties &rarr; Linker &rarr; Optimization &rarr; References &rarr; change to <strong>Keep Unreferenced Data</strong></p> <p>Worked on my machine!</p>
<p>Run the 64 bits version of the Linker? Downside: you'll get a amd64 executable. (Unlike the 32->64 crosscompilation toolset, there is no 64->32 bit toolset)</p>
20,970
<p>I have a syntax highlighting function in vb.net. I use regular expressions to match "!IF" for instance and then color it blue. This works perfect until I tried to figure out how to do comments. </p> <p>The language I'm writing this for a comment can either be if the line starts with a single quote ' OR if anywhere...
<p>Something along the lines of:</p> <pre><code>^(\'[^\r\n]+)$|(''[^\r\n]+)$ </code></pre> <p>should give you the commented line (of part of the line) in group n° 1</p> <p>Actually, you do not even need group</p> <pre><code>^\'[^\r\n]+$|''[^\r\n]+$ </code></pre> <p>If it finds something, it is a comment.</p> <pre...
<p>Using the regex pattern: REM((\t| ).*$|$)|^\'[^\r\n]+$|''[^\r\n]+$</p> <p>see more <a href="https://code.msdn.microsoft.com/How-to-find-code-comments-9d1f7a29/" rel="nofollow">https://code.msdn.microsoft.com/How-to-find-code-comments-9d1f7a29/</a></p>
40,194
<p>I want to create an MSI in WiX such that it can take a command line parameter to indicate whether it is a per-machine or per-user installation and consequently whether to raise a UAC dialog.</p> <p>What is the best way to accomplish this?</p>
<p>This is the link for per-machine/per-user from <a href="http://msdn.microsoft.com/en-us/library/aa371865(VS.85).aspx" rel="nofollow noreferrer">MSDN</a>.</p> <p>so to change the values from the command line parameter, you'll need something like so:</p> <p>msiexec /i myinstaller.msi ALLUSERS=[1|2]</p> <p>Also, hav...
<p>The UAC dialog is controlled by a bit in the SummaryInformation stream. That, unfortunately, means it cannot be controlled at "run time" (install/repair/uninstall). You have to build different MSI files to truly change the UAC prompt.</p>
40,620
<p>I'm looking for publications about the history of the internet browsers. Papers, articles, blog posts whatever. Cannot find anything on ACM IEEE etc. and my blog search also didn't reveal anything remarkable.</p>
<p>Did you take a look at the entries in Wikipedia? It's a useful starting point.</p> <p>Here are a few to start you off:</p> <p><a href="http://en.wikipedia.org/wiki/Web_browser" rel="nofollow noreferrer">Wikipedia - Web browser</a></p> <p><a href="http://en.wikipedia.org/wiki/Timeline_of_web_browsers" rel="nofollo...
<p>I would start with Wikipedia as Eward mentioned.</p> <p>But after you read wikipedia, check the bottom of the articles for the sources used. Then read those sources. If this is for a school paper I doubt you'll get full points for using wikipedia.</p>
13,883
<p>How do I discover how many bytes have been sent to a TCP socket but have not yet been put on the wire?</p> <p>Looking at the diagram here: <a href="https://i.stack.imgur.com/pHB5a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pHB5a.png" alt="http://www.tcpipguide.com/free/diagrams/tcpswpointers...
<p>Under Linux, see the man page for tcp(7).</p> <p>It appears that you can get the number of untransmitted bytes by ioctl(sock,SIOCINQ ...</p> <p>Other stats might be available from members of the structure given back by the TCP_INFO getsockopt() call.</p>
<p>Some Unix flavors may have an API way to do this, but there is no way to do it that is portable across different variants.</p>
13,119
<p>I have a helper method has been created which allows a MovieClip-based class in code and have the constructor called. Unfortunately the solution is not complete because the MovieClip callback <b>onLoad()</b> is never called. </p> <p>(Link to the <a href="http://www.flashdevelop.org/community/viewtopic.php?f=13&amp...
<p>Do I understand correctly that you want to create an instance of an empty movie clip with class behavior attached and without having to define an empty clip symbol in the library?</p> <p>If that's the case you need to use the packages trick. This is my base class (called View) that I've been using over the years an...
<p>Do I understand correctly that you want to create an instance of an empty movie clip with class behavior attached and without having to define an empty clip symbol in the library?</p> <p>If that's the case you need to use the packages trick. This is my base class (called View) that I've been using over the years an...
19,063
<p>Anyone know if it's possible to databind the ScaleX and ScaleY of a render transform in Silverlight 2 Beta 2? Binding transforms is possible in WPF - But I'm getting an error when setting up my binding in Silverlight through XAML. Perhaps it's possible to do it through code?</p> <pre><code>&lt;Image Height="60" Hor...
<p>ScaleTransform doesn't have a data context so most likely the binding is looking for SelectedDive.Visibility off it's self and not finding it. There is much in Silverlight xaml and databinding that is different from WPF... </p> <p>Anyway to solve this you will want to set up the binding in code**, or manually list...
<p>Ah I think I see your problem. You're attempting to bind a property of type Visibility (SelectedDive.Visibility) to a property of type Double (ScaleTransform.ScaleX). WPF/Silverlight can't convert between those two types.</p> <p>What are you trying to accomplish? Maybe I can help you with the XAML. What is "Selecte...
4,697
<p>I have several small open-source projects that I wrote. All my attempts to find collaborators (looked on sourceforge.net and codeplex) failed miserably - I either couldn't find anyone, or I found people who either weren't interested or didn't contribute anything. Thus comes the question: how and where can I find peo...
<p>The short answer is: Be awesome.</p> <p>If your software really addresses a pain point and addresses it well, people will come to it on their own (assuming a reasonable amount of promotion on your part) via SourceForge/GitHub/etc., Google, and word of mouth. If you attract a critical mass of people who need what ...
<p><a href="http://www.builditwith.me" rel="nofollow">http://www.builditwith.me</a> also is an option if you're looking for designers and/or developers</p>
46,160
<p>During a discussion about security, a developer on my team asked if there was a way to tell if viewstate has been tampered with. I'm embarrassed to say that I didnt know the answer. I told him I would find out, but thought I would give someone on here a chance to answer first. I know there is some automatic validati...
<p>EnableViewStateMac page directive</p>
<p>You might be able to do it manually, but you'd just be implementing the same algorithm that's already there for you. It's generally a bad idea to disable the ViewState validation on a page.</p>
9,431
<p>I want to embed a swf over a html page, like a floating video watching panel. I already have a swf file which will automatically adjust its size according to the browser size, and the swf file is partially transparent. I thought I can just add a div tag, make the position absolute and change z-index bigger, but that...
<p>Once you get your sizing to work properly you will need to set the <em>wmode</em> to <em>transparent</em> to be able to see what's behind the flash, if you don't it's background will be opaque.</p> <p>This is a quick copypaste from the <a href="http://code.google.com/p/swfobject/wiki/documentation" rel="noreferrer"...
<p>I believe the problem with this is that the CSS doesn't work well with <code>&lt;object /&gt;</code> tags. The <code>swfobject.embedSWF</code> turns the <code>&lt;div id="header"&gt;&lt;/div&gt;</code> into an <code>&lt;object /&gt;</code> tag with a bunch of attributes that might be effecting the CSS. If you crea...
38,474
<p>I know about this question: <a href="https://stackoverflow.com/questions/100548/which-third-party-debug-visualizers-for-visual-studio-20052008-do-you-use">Which (third-party) debug visualizers for Visual Studio 2005/2008 do you use?</a></p> <p>But I don't want to know what debug visualizers you use, I want to know w...
<p>From a quick web search...</p> <p>There is the one referenced in the blog post from the related question:</p> <ul> <li><a href="http://blogs.msdn.com/dparys/archive/2007/10/23/das-debugger-visualizer-item-template.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/dparys/archive/2007/10/23/das-debugger-visualizer...
<p>There's also <a href="http://osherove.com/blog/2005/11/26/announcing-regex-kit-regular-expression-visualizers-for-vs-2.html" rel="nofollow">Regex Kit</a>, a regular expression debugger visualizer.</p>
33,787
<p>I am working on a project where the requirement is to have a date calculated as being the last Friday of a given month. I think I have a solution that only uses standard Java, but I was wondering if anyone knew of anything more concise or efficient. Below is what I tested with for this year:</p> <pre><code> for...
<p>Based on <a href="https://stackoverflow.com/questions/76223/get-last-friday-of-month-in-java#76437">marked23's</a> suggestion:</p> <pre><code>public Date getLastFriday( int month, int year ) { Calendar cal = Calendar.getInstance(); cal.set( year, month + 1, 1 ); cal.add( Calendar.DAY_OF_MONTH, -( cal.get( ...
<pre><code>public static Calendar getNthDow(int month, int year, int dayOfWeek, int n) { Calendar cal = Calendar.getInstance(); cal.set(year, month, 1); cal.set(Calendar.DAY_OF_WEEK, dayOfWeek); cal.set(Calendar.DAY_OF_WEEK_IN_MONTH, n); return (cal.get(Calendar.MONTH) == month) &amp;&amp; (cal.get(...
10,183
<p>I am getting the following error when running a reporting services report.</p> <pre><code>Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: Exception type: XmlException Exception message: For security reasons DTD is prohibited in this XML document. To enable DTD pr...
<p>Check to see if your reporting server website has the correct local path folder. You might need to do an iisreset if it is not correct. </p>
<p>I have noticed this when using SSRS 2005 and running large reports containing XML data.</p> <p>It would work when running say a monthly report, but give me this error when I ran a quarterly report.</p> <p>Upgrading to SQL/SSRS 2008 fixed the issue for me!</p>
12,360
<p>Having a problem getting a TreeView control to display node images. The code below works sometimes but fails to show any image at other times.</p> <pre><code> private TreeNode AddNodeForCore(TreeNode root, Core c) { string key = GetImageKey(c); TreeNode t = root.Nodes.Add(c.Name, c.Name, key, key); t.Ta...
<p>The helpful bit of the googled posts above is in fact:</p> <p>"This is a known bug in the Windows XP visual styles implementation. Certain controls, like ImageList, do not get properly initialized when they've been created before the app calls Application.EnableVisualStyles(). The normal Main() implementation in ...
<p>The solution posted by Yossarian nor the popular "Call Application.DoEvents() between Application.EnableVisualStyles() and Application.Run()" worked for me.</p> <p>After much flailing, gnashing of teeth, and Googling, the solution posted by <a href="http://blogs.msdn.com/asanto/archive/2004/08/18/216825.aspx" rel="...
15,306
<p>Let's just assume for now that you have narrowed down where the typical bottlenecks in your app are. For all you know, it might be the batch process you run to reindex your tables; it could be the SQL queries that runs over your effective-dated trees; it could be the XML marshalling of a few hundred composite object...
<p>Two points:</p> <ol> <li><p>Beware of the infamous "optimizing the idle loop" problem. (E.g. see the <a href="http://c2.com/cgi/wiki/wiki?OptimizationStories" rel="noreferrer">optimization story</a> under the heading "Porsche-in-the-parking-lot".) That is, just because a routine is taking a significant amount of ...
<p>It's an interesting question. I don't think anyone knows the answer. I believe that significant part of the problem is that for more complicated programs, no one can predict their complexity. Therefore, even if you have profiler results, it's very complicated to interpret it in terms of changes that should be made t...
20,017
<p>I was wondering if something exists (in Java world) able to take an snapshot of the JVM current state with the following features:</p> <ul> <li>Do it while an exception is being thrown.</li> <li>Capture local variables, method's arguments, etc.</li> <li>Put it in a handy file which can be used to extract or reprodu...
<p>I give a look to <a href="http://kenai.com/projects/jvm-frame-introspect" rel="nofollow noreferrer">JavaFrame</a> and it seems a good starting point. Just install Apache Ant, do <code>ant</code> in the javaframe directory and launch the test suite (inside test directory) with:</p> <pre><code>LD_LIBRARY_PATH=../buil...
<p>Not sure if this is viable in a production environment, but there's the Omniscient debugger:</p> <blockquote> <p>What if your debugger could go "go backwards in time?" Would that make debugging easier? By simply recording all variable assignments, it is possible to do essentially this. This is the underlying idea...
48,704
<p>For various reasons calling <code>System.exit</code> is frowned upon when writing <strong>Java Applications</strong>, so how can I notify the calling process that not everything is going according to plan?</p> <p><strong>Edit:</strong> The 1 is a <code>standin</code> for any non-zero exit code.</p>
<p>The use of <code>System.exit</code> is frowned upon when the 'application' is really a sub-application (e.g. servlet, applet) of a larger Java application (server): in this case the <code>System.exit</code> could stop the JVM and hence also all other sub-applications. In this situation, throwing an appropriate excep...
<p>It's frowned upon for <em>normal</em> exits. If "not everything is going according to plan", then System.exit is fine.</p> <p>Update: I should add that I assume your '1' has meaning that is documented somewhere.</p>
5,279
<p><a href="http://oreilly.com/catalog/9780596515829/" rel="nofollow noreferrer">Python for Unix and Linux System Administration</a> is aimed at sysadmins. Any other favorites besides this.</p>
<p>Mark Pilgrim's <a href="http://www.diveintopython.net/" rel="nofollow noreferrer">http://www.diveintopython.net/</a> is very good and clear.</p>
<p>I started with Mark Lutz's Programming Python (O'Reilly).</p>
20,717
<p>Yet again, my teacher was unable to answer my question. I knew who may be able to...</p> <p>So, I've never really learned C. In C++, I would, obviously, use a cout statement all of the time. In a recent assignment, my teacher told us to make sure to put </p> <pre><code>setbuf( stdout , NULL ); </code></pre> <p>at...
<p>By default, iostreams and stdio are synchronised. <a href="http://en.cppreference.com/w/cpp/io/ios_base/sync_with_stdio" rel="nofollow noreferrer">Reference.</a></p> <p>This doesn't mean that manually adjusting the stdio buffering is a good idea, though! You may wish to utilise <code>std::endl</code> or <code>std::...
<p>Usually, when it's important to see the output immediately, we're talking about complex highly-reliable financial routine that must log a transaction all the way to hard drive before actually sending it to counterparty. Or, (much more common case) we want to see debug messages even when the program is crashing.</p> ...
18,901
<p>I know Microsoft has made efforts in the direction of semantic and cross-browser compliant XHTML and CSS, but it still seems like a PitA to pull off elegant markup. I've downloaded and tweaked the CSS Friendly Adapters and all that. But I still find myself frustrated with bloated and unattractive code.</p> <p>Is el...
<p>The easiest way to generate elegant HTML and CSS is to use MVC framework, where you have much more control over HTML generation than with Web Forms.</p>
<p>As long as you use the Visual Studio designer, it's probably a pipe dream. I write all of my ASP.NET code (all markup, and CSS) by hand, simply to avoid the designer. Later versions of Visual Studio have gotten much better at not mangling your .aspx/.ascx files, but they're still far from perfect.</p>
5,323
<p>How does the HttpBrowserCapabilities.Crawler property (<a href="http://msdn.microsoft.com/en-us/library/aa332775(VS.71).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa332775(VS.71).aspx</a>) work? I need to detect a partner's custom crawler and this property is returning false. </p> <p>Where/How...
<p>This is all driven by the default browsercaps declarations that are part of the .NET framework.</p> <p>To setup this specific crawler, you would need to add a custom browserCaps section to your web.config to identify it as a crawler.</p> <p>The MSDN documentation on how to go about this is pretty well documented, ...
<p>HttpBrowserCapabilities is populated from a set of *.browser files in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\Browsers. You can add your own file in ~/App_Browsers/ with the details of your custom crawler. The schema is <a href="http://msdn.microsoft.com/en-us/library/ms228122.aspx" rel="nofollow norefe...
27,461
<p>I've been doing some performance testing around the use of System.Diagnostics.Debug, and it seems that all code related to the static class Debug gets completely removed when the Release configuration is built. I was wondering how the compiler knows that. Maybe there is some class or configuration attribute that all...
<p>You can apply the <a href="https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.conditionalattribute?view=netframework-4.8" rel="nofollow noreferrer">ConditionalAttribute</a> attribute, with the string "DEBUG" to any method and calls to that item will only be present in DEBUG builds.</p> <p>This differs ...
<p>Have a look at <a href="http://www.csharphelp.com/archives/archive36.html" rel="nofollow noreferrer">preprocessor directives</a>...</p> <pre><code>#if DEBUG //code #endif </code></pre>
43,785
<p>Any ideas on how to disable, but not uninstall Resharper 4.x or above?</p>
<p>You can disable ReSharper 4 and lower using the Visual Studio Add-In Manager (remove the check from check box on the left).</p> <p>In ReSharper 5 and above (tested up to version 7.0.1), <a href="https://stackoverflow.com/questions/253063/disable-but-not-uninstall-resharper-4-x/1900927#1900927">this is how you can s...
<p>You can also press Ctrl+8.</p>
31,542
<p>I'm trying to compile a project and I'm getting this error.</p> <p>The error occurs in a RemObjects source file, but I think it doesn't have anything to do with RemObjects.</p> <p>Anyway this error is too generic, and I don't quite get why it happens, so how can I solve it?</p>
<p>The problem was that we translated the unit SysConsts and the Interface changed, removing that unit solved the problem.</p>
<p>This error occurs if you mix libraries. You are probably using a (third-party) library that is compiled with a different version. Try to get the latest version, or recompile if you have the source.</p> <p>If the problem persists, try to get a minimal subset of the project to find the offending unit / dcu file.</p>
33,709
<p>I'm working on a page has an ol with nested p's, div's, and li's. Internet Explorer 6 and 7 both render the numbers for the ol tag after the p element at the end (at the very, very bottom of the li tag) rather than at the top of the outermost li as expected. I'm working on a PowerPC Mac and can't do any testing. Is ...
<p>Congratulations, you are the victim of IE's <a href="http://msdn.microsoft.com/en-us/library/ms533776.aspx" rel="noreferrer">hasLayout</a> property.</p> <p>Short version: You've got it easy this time. Changes these rules:</p> <pre><code>... ol { font-size: 1.1em; } ... li.main_item { width: 700px; c...
<p>I just tested your example html in firefox 3/webkit nightly/internet explorer 7 and all of them rendered exactly the same with the number at the top where it should be.</p> <p>The problem is probably in your CSS, can you show us the actual page that is broken?</p>
13,552
<p>Let's say we have these tables;</p> <p>table user:<br> - id<br> - username<br> - email</p> <p>table user2group:<br> - userid<br> - groupid</p> <p>table group:<br> - id<br> - groupname</p> <p>How do I make one query that returns all users, and the groups they belong to (as an array in the resultset or something.....
<pre><code>select u.id, u.username, u.email, g.groupid, g.groupname from user u join user2group ug on u.userid=ug.userid join group g on g.groupid=ug.groupid order by u.userid </code></pre> <p>As you are looping through the result set, each time you see a new userid make a new user object (or whatever) and add the gr...
<p>Both of the above are more or less correct (deepends if each user has a group or not). But they will also both give a result set with several entries for each user.</p> <p>There are ways of concatenating every group member into one comma separated string, I'd suggest you read about it here: <a href="http://www.sim...
36,172
<p>Is it possible to make FlexBuilder show all compile errors in all files? FlexBuilder does not show errors in Action Script files, that are not referenced. Also very often I fix a problem just to see new problems pop up after compiling the whole project although these errors existed long before.</p> <p>IntelliJ is s...
<p>The compiler can (and will) show errors only in code that you tell it to compile, and like you said, whatever is not referenced in the code you compile, will not be compiled, and thus, checked by the compiler.</p> <p>So if you want to have the compiler check some part of your code, you need to tell it to compile it...
<p>The following MXMLC compiler arguments might be useful:</p> <p><strong>-includes <em>className</em> [...]</strong></p> <p>Links one or more classes into the output SWF, regardless of whether they are required at compile time.</p> <p><strong>-include-libraries <em>swcPath</em> [...]</strong></p> <p>Links the enti...
46,403
<p>How can I change the width of a textarea form element if I used ModelForm to create it?</p> <p>Here is my product class:</p> <pre><code>class ProductForm(ModelForm): long_desc = forms.CharField(widget=forms.Textarea) short_desc = forms.CharField(widget=forms.Textarea) class Meta: model = Produc...
<p><strong>The easiest way for your use case is to use CSS</strong>. It's a language meant for defining presentation. Look at the code generated by form, take note of the ids for fields that interest you, and change appearance of these fields through CSS.</p> <p>Example for <code>long_desc</code> field in your Product...
<p>Set row and your css class in your admin model view:</p> <pre><code>'explicacion': AutosizedTextarea(attrs={'rows': 5, 'class': 'input-xxlarge', 'style': 'width: 99% !important; resize: vertical !important;'}), </code></pre>
13,563
<p>Is it valid to have a 'choice' of 'group' elements when defining an XML Schema (XSD)</p> <p>i.e. is the following valid</p> <pre><code>&lt;xs:complexType name=&quot;HeaderType&quot;&gt; &lt;xs:sequence&gt; &lt;xs:element name=&quot;reservation-number&quot; type=&quot;ReservationNumberType&quot; minOccurs=&quot...
<p>I'm no XML expert, although I use it quite a lot. This isn't the way I'd generally do this sort of structure. I would prefer a separate complex types rather than a choice of two groups (see the very end of this answer).</p> <p>I suspect that the problem is that ReservationGroup and CancellationGroup start with the ...
<p>Whether this is valid depends on the content of the groups: if they're 'sequence' or 'choice' model groups, it's perfectly legal; 'all' model groups are more problematic and generally not allowed in this case.</p>
12,681
<p>I have a form that I would like to style. specifcally I would like to chnage the background color of the form item's label. (the backgorundColor attribute changes both the label and the inputs background color)</p> <p>i.e.</p> <pre> <code> &lt;mx:Form> &lt;mx:FormItem label="username:"> &lt;mx:TextInpu...
<p>A formitem has an object it uses to display the label called the FormItemLabel, this objects purpose is so you can style the label of a form item.</p> <p>In flex 2 to change the style you can try:</p> <pre><code>FormItemLabel { } </code></pre> <p>However I looked over the flex 2 lang ref and it doesn't seem like...
<p>Try using the flex style explorers to create your desired style:</p> <ul> <li><p><a href="http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html" rel="nofollow noreferrer">Flex 3 Style Explorer</a></p></li> <li><p><a href="http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2Style...
21,066
<p>I want to find out if length property for Java arrays is an int/long or something else.</p>
<p>It is an int. See the <a href="http://java.sun.com/docs/books/jls/third_edition/html/arrays.html#10.7" rel="noreferrer">Java Language Specification</a>, section 10.7.</p>
<p>In JavaCard array indexes are shorts, but JavaCard is odd like that. Everywhere else, int like everyone else says.</p>
25,959
<p>In the documentation of hardware that allows us to control it via UDP/IP, I found the following fragment:</p> <blockquote> <p>In this communication protocol, DWORD is a 4 bytes data, WORD is a 2 bytes data, BYTE is a single byte data. The storage format is little endian, namely 4 bytes (32bits) data is stored a...
<p>C# itself doesn't define the endianness. Whenever you convert to bytes, however, you're making a choice. The <a href="http://msdn.microsoft.com/en-us/library/system.bitconverter.aspx" rel="noreferrer">BitConverter</a> class has an <a href="http://msdn.microsoft.com/en-us/library/system.bitconverter.islittleendian.as...
<p>If you're parsing and performance is not critical, consider this very simple code:</p> <pre><code>private static byte[] NetworkToHostOrder (byte[] array, int offset, int length) { return array.Skip (offset).Take (length).Reverse ().ToArray (); } int foo = BitConverter.ToInt64 (NetworkToHostOrder (queue, 14, 8)...
26,808
<p>Java is one of my programming languages of choice. I always run into the problem though of distributing my application to end-users.</p> <p>Giving a user a JAR is not always as user friendly as I would like and using Java WebStart requires that I maintain a web server.</p> <p>What's the best way to distribute a J...
<p>There are a variety of solutions, depending on your distribution requirements.</p> <ol> <li><p>Just use a jar. This assumes that the user has the the correct java version installed, otherwise the user will get "class-file format version" exceptions. This is fine for internal distribution inside a company.</p></li> ...
<p>I would zip the jar file along with other dependent jars, configuration files and documentation along with a run.bat/run.sh. End user should be able unzip it to any location and edit the run.bat if required (It should run without editing in most of the cases). An installer may be useful if you want to create entries...
10,554
<p>I have any ASP.NET control. I want the HTML string how to do I get the HTML string of the control?</p>
<p>This appears to work.</p> <pre><code>public string RenderControlToHtml(Control ControlToRender) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.IO.StringWriter stWriter = new System.IO.StringWriter(sb); System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(s...
<p>If your control is a web user control, this is how you can get to the HTML it emits from another page or handler:</p> <pre><code>public void GetHtmlFromMySweetControl(HttpContext context) { HttpRequest httpRequest = context.Request; HttpResponse httpResponse = context.Response; string foo = httpRequest...
8,337
<p>We need to implement a large-scale key-value store (let's say up to 500GB) and BerkeleyDB seemed like it might be a decent option, but we would really like it to be network accessible. This led me to look at memcachedb. I haven't found much on the web where people talk about actual experiences with memcachedb, so my...
<p>When I was trying to use BerkeleyDB (Which memcachedb apparrently uses as a backend), I found the insert speed to be atrociously slow. It really was unusable in that respect. My insert pattern and configuration was fairly standard, so I have no idea if it's just a general weakness of BDB, or something strange with m...
<p>I have used memcached a little bit in one of my projects. I think it's a very efficient and scalable caching platform. By changing small configurations, you're able to replicate the cached objects in more than one server. Facebook uses memacached for their in-memory storage and it's a large scale entity on the web. ...
26,460
<p>How can I open multiple Eclipse workspaces at the same time on the Mac?</p> <p>On other platforms, I can just launch extra Eclipse instances, but the Mac will not let me open the same application twice. Is there a better way than keeping two copies of Eclipse?</p>
<p><strong>EDIT:</strong> <a href="https://stackoverflow.com/a/386470/16562">Milhous's answer</a> seems to be the officially supported way to do this as of 10.5. Earlier version of OS X and even 10.5 and up should still work using the following instructions though.</p> <hr> <ol> <li><p>Open the <strong>command line</...
<pre><code>Window -&gt; New Window </code></pre> <p>This opens a new window and you can then open another project in it. You can use this as a workaround hopefully. </p> <p>It actually allows you to work in same workspace. </p>
14,392
<p>In a nutshell, the hashCode contract, according to Java's object.hashCode():</p> <ol> <li>The hash code shouldn't change unless something affecting equals() changes</li> <li>equals() implies hash codes are ==</li> </ol> <p>Let's assume interest primarily in immutable data objects - their information never changes ...
<p><a href="http://www.jqno.nl/equalsverifier/" rel="noreferrer">EqualsVerifier</a> is a relatively new open source project and it does a very good job at testing the equals contract. It doesn't have the <a href="https://stackoverflow.com/questions/188311#188681">issues</a> the EqualsTester from GSBase has. I would def...
<p>If I have a class <code>Thing</code>, as most others do I write a class <code>ThingTest</code>, which holds all the unit tests for that class. Each <code>ThingTest</code> has a method</p> <pre><code> public static void checkInvariants(final Thing thing) { ... } </code></pre> <p>and if the <code>Thing</code> c...
22,830
<p>I have a table with a TEXT column where the contents is just strings of CSV numbers. Example ",1,76,77,115," Each string can have an arbitrary number of numbers.</p> <p>I am trying to set up Full Text Indexing so that I can search this column rapidly. This works great. Instead of running queries with</p> <pre><cod...
<p>Working with relational databases that way is going to hurt.</p> <p>Use a proper schema. Either store the values in different rows or use an array datatype for the column.</p> <p>That will make solving the problem trivial.</p>
<p>I fixed my own problem, although I'm not exactly sure what fixed it.</p> <p>I dropped my table and populated a new one (my program does batch processing) and created a new Full Text Index. Maybe I wasn't being patient enough to allow the indexing to fully rebuild.</p>
39,912
<p>I have a somewhat messily-formatted Objective-C code base. Is there a way to have Xcode reformat an entire project to conform to a coding standard (i.e., properly indent, spaces v. tabs, etc.)? Are there other tools that might accomplish this?</p>
<p>Uncrustify: <a href="http://uncrustify.sourceforge.net/" rel="noreferrer">http://uncrustify.sourceforge.net/</a></p> <blockquote> <p>Source Code Beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA</p> </blockquote> <p>If you want something simpler, you could probably get some way by simply stripping ou...
<p>One way to go that uses uncrustify in a different context is</p> <p><a href="http://universalindent.sourceforge.net/" rel="nofollow">http://universalindent.sourceforge.net/</a></p>
20,581
<p>I have a class <code>Application</code> that my global.asax inherits from. The class has this method:</p> <pre><code>protected void Application_Start(object sender, EventArgs e) { // ... } </code></pre> <p>In my understanding this is basically an event handler that is automatically added to an event (based on ...
<p>HttpApplicationFactory is an internal class defined in System.Web.dll. You can check it out in .NET Reflector if you are interested. </p> <p>Internal means that it is not normally visible outside the dll where it is defined, so you can't use it in your own code.</p>
<p>Like Rune said, <code>HttpApplicationFactory</code> is an internal class defined in System.Web.dll.</p> <p>What it does is create the application and start it, basically managing the runtime of your web application.</p>
41,507
<p>We use GNU Make for our system. At the end of our makefiles, we have an include called Makedepends which generates a bunch of .d files using -MM switch on gcc. We then include the .d file for each .cc file using an include $(CXXFILES:.cc=.d) line. But when we delete file or move files, the dependancies step break...
<p><a href="http://make.mad-scientist.net/papers/advanced-auto-dependency-generation" rel="nofollow noreferrer">http://make.mad-scientist.net/papers/advanced-auto-dependency-generation</a> has a description of this exact problem, and a couple of ways around it. The first is a bit misguided, but the "advanced" is essen...
<p>Two possibilities:</p> <p>First, can you add a rule to your Makefile to run the dependency step:</p> <pre><code>.SUFFIXES: .d %.d:: makedepend_command_here </code></pre> <p>If not, then from the <code>Last Resort</code> section of the <code>info</code> page for GNU Make:</p> <blockquote> <p>For example, wh...
29,570
<p>WinXP Pro Oracle 10g Instant Client 10.2.0.1 MS Access 2003</p> <p>When I link a table in MS Access, the pick list that appears shows me every table and view in the system I have access to. This list is quite large. Normally, I really only want to look at the tables that I own. Is there a way to filter the items di...
<p>You may want to mark the constants as final.</p>
<p>That seems to be a fairly easy way to do that. Although I would name the images with the same name as what they are for ("ok.png", "cancel.png"). And make sure that it is clear that removing or renaming the images may cause issues.</p>
48,238
<p>Is there a Rails plugin or a rubygem that gives you a starting point for adding an api to your Rails app? We want to use the API Key/Secret Key model, the API should also be versionable. Is there something out there that will give us some, if not all of this?</p>
<p>Check out this plugin for AuthLogic:</p> <p><a href="http://github.com/phurni/authlogic_api" rel="noreferrer">http://github.com/phurni/authlogic_api</a></p> <p>I think that does what you are looking for.</p>
<p>The <a href="http://code.google.com/p/oauth/" rel="nofollow noreferrer">OAuth plugin</a> could be useful for the keys. It may look like <a href="http://oauth.net/" rel="nofollow noreferrer">OAuth</a> is only for user authentication, but if you autogenerate the access tokens and give them to developers, instead of ha...
45,593
<p>I want to know how to make a mold of a 3D design in .stl format.</p> <p>Suppose I have a 3D partin .stl format (for e.g. a cylinder) and I want to make/design a mold for this object (i.e. the structure through which I could make the cylinder). Is there any way to do so? Are there any tools to do so?</p> <p>My requ...
<p>You can also bring the model and a big box into slic3r, align and orient them (enclose the model in the box), and do a subtract modifier, leaving a hollow where the two intersected. You probably want to do this twice, for a top mould and a botom mould. I've done this, but I don't see any instructions online for it. ...
<p>In addition to the answer of Davo (which describes a surprising feature of the slicer software I was unaware of), a more generic description would involve the use of a 3D solid model CAD program. You should be aware that a model in STL format is not a solid model, it is a surface model. In order to make a mold you w...
894
<p>The "instruments" that are used with Guitar Hero and Rock Band have USB connections. Is there any documentation or reverse-engineering info out there about how to read the messages they generate?</p>
<p>Check out <a href="http://www.wiiuse.net/?nav=docs" rel="nofollow noreferrer">Wiiuse</a> - it suppors the Guitar Hero 3 controller, as well as Wiimotes :)</p>
<p>You could check <a href="http://fretsonfire.sourceforge.net/" rel="nofollow noreferrer">Frets on Fire</a> project. It's opensource GH-like game, and as far as I remember documentation said you could use Guitar Hero controller instead of the keyboard.</p> <p>Here's some additional semi-info: <a href="http://kotaku.c...
25,769
<p>I have a textbox and a link button. When I write some text, select some of it and then click the link button, the selected text from textbox must be show with a message box.</p> <p>How can I do it?</p> <hr /> <p>When I click the submit button for the textbox below, the message box must show <em>Lorem ipsum</em>. Bec...
<p>OK, here is the code I have:</p> <pre><code>function ShowSelection() { var textComponent = document.getElementById('Editor'); var selectedText; if (textComponent.selectionStart !== undefined) { // Standards-compliant version var startPos = textComponent.selectionStart; var endPos = textComponent.sel...
<pre><code>// jQuery var textarea = $('#post-content'); var selectionStart = textarea.prop('selectionStart'); var selectionEnd = textarea.prop('selectionEnd'); var selection = (textarea.val()).substring(selectionStart, selectionEnd); // JavaScript var textarea = document.getElementById(&quot;post-content&quot;); var s...
34,759