instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have a request to display VRML models within a .NET application. Does someone know an easy way, maybe with standard .NET components, to achieve this? What are the issues I maybe have to face when representing VRML within an application?</p>
<p>Get yourself a VRML ActveX control an <a href="http://msdn.microsoft.com/en-us/library/aa446515.aspx" rel="nofollow noreferrer">insert</a> that into your .NET app, you should be able to find one at <a href="http://www.web3d.org/x3d/content/examples/X3dResources.html" rel="nofollow noreferrer">www.web3d.org</a></p>
<p>I think the main issue is that I hadn't seen anything/anyone using VRML in at least five years. I think you may be better off just finding a VRML->SVG converter. Displaying SVG in a browser is rather well-defined these days.</p>
22,550
<p>What is the best way to support multiple languages for the interface in an ASP.NET MVC application? I've seen people use resource files for other applications. Is this still the best way?</p>
<p>If you're using the default view engines, then local resources work in the views. However, if you need to grab resource strings within a controller action, you can't get local resources, and have to use global resources.</p> <p>This makes sense when you think about it because local resources are local to an aspx pa...
<p>This is another option, and you'll have access to the CurrentUICulture in the controller: </p> <p>Check <a href="http://subvert.ca/Blog/MVC3-multi-language" rel="nofollow">MVC3-multi-language</a></p>
2,604
<p>In HTML forms, buttons can be disabled by defining the "disabled" attribute on them, with any value:</p> <pre><code>&lt;button name="btn1" disabled="disabled"&gt;Hello&lt;/button&gt; </code></pre> <p>If a button is to be enabled, the attribute should not exist as there is no defined value that the disabled attribu...
<p>I use a custom JSP tag with dynamic attributes. You use it like this:</p> <pre><code>&lt;util:element elementName="button" name="btn1" disabled="$(isDisabled ? 'disabled' : '')"/&gt; </code></pre> <p>Basically, what this tag does is generate an XML element with elementName and puts all attributes present in the ta...
<p>I don't really use JSP (and I replied once, then deleted it when I understood the "must by valid XML" thing). The cleanest I can come up with is this:</p> <pre><code>&lt;% if (isDisabled) { %&gt; &lt;button name="btn1" disabled="disabled"&gt;Hello&lt;/button&gt; &lt;% } else { %&gt; &lt;button name="btn1"&gt;He...
18,999
<p>I'm relatively new to web application programming so I hope this question isn't too basic for everyone. </p> <p>I created a HTML page with a FORM containing a dojox datagrid (v1.2) filled with rows of descriptions for different grocery items. After the user selects the item he's interested in, he will click on th...
<p>You could just use a hidden input field; that gets transmitted as part of the form.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; function updateSelectedItemId() { document.myForm.selectedItemId.value = 2; alert(document.myF...
<p>Assuming that you are limited to using html pages, I think the best approach would be to pass the id along on the query string to the next page. It is relatively easy to pull that value back off the query string on the next page. If you need to be a little more stealthy about passing the variable (or you need the ...
26,620
<p>I've got a sections table, and an items table.</p> <p>The problem is each item may be in one or more sections, so a simple 'section_id' for each item won't work, and sql doesn't have a way to store arrays where I can do say "WHERE 5 in section_ids"...</p> <p>I've considered storing the list of ids as a comma separ...
<p>You need an intermediate lookup table:</p> <pre><code>CREATE TABLE item_in_section (item_id int, section_id int) </code></pre> <p>(I'm guessing about your key types, use whatever ones are appropriate).</p> <p>To find items in a section:</p> <pre><code>SELECT item.* from item, item_in_section WHERE item_in_sectio...
<p>You could store several IDs in a field, separated by a comma and then use the FIND_IN_SET command:</p> <pre><code>SELECT * FROM items WHERE FIND_IN_SET(5, section_id); </code></pre> <p><a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set" rel="nofollow noreferrer">http://dev.m...
17,592
<p>I have been reading carefully through the mediawiki documentation but I have not been able to find out how to create new groups. </p> <p>When I look at Special:Userrights, I see only 3 groups : Bots, Sysops, Bureaycrats</p> <p>I would like to create my own custom groups, so I can use some extensions like the <a h...
<p>You can add permissions for new groups to your LocalSettings.php file and they will automatically appear in the Special:UserRights page.</p> <p>For example, I wanted to disallow editing by regular users but create a "Trusted" group that was allowed to edit. The following code creates a "Trusted" group that is equal...
<p>I beleive I have found the answer, I just need to add the UserGroup and the permission to the wgGroupPermissions array in the LocalSettings.php file.</p> <pre><code>$wgGroupPermissions['TomatoUsers']['read'] = true; $wgGroupPermissions['TomatoUsers']['edit'] = false; </code></pre>
26,967
<p>Is it possible to access a constant value (i.e. a public static final variable defined in a Java class) from a Velocity template?</p> <p>I would like to be able to write something like this:</p> <pre><code>#if ($a lt Long.MAX_VALUE) </code></pre> <p>but this is apparently not the right syntax.</p>
<p>There are a number of ways. </p> <p>1) You can put the values directly in the context.</p> <p>2) You can use the <a href="http://velocity.apache.org/engine/devel/apidocs/org/apache/velocity/app/FieldMethodizer.html" rel="noreferrer">FieldMethodizer</a> to make all public static fields in a class available.</p> <...
<p>Velocity can only use anything it finds in its context, after e.g.</p> <pre><code>context.put("MaxLong", Long.MAX_VALUE); </code></pre> <p>You cannot use statics, or access static members of things in Velocity's context due to the way its lookup works (see Velocity's <a href="http://velocity.apache.org/engine/deve...
17,901
<p>I have inherited a c# class 'Button' (which I can't change) which clashes with the BCL class 'Windows.Forms.Button'. Normally, Id be very happy to go:</p> <pre><code>MyPackage.MyClass.Button; </code></pre> <p>But there are a large number or references to this class which is a pain to have to re-type.</p> <p>Is th...
<p>Add this to the top of the file:</p> <pre><code>using MyButton = MyPackage.MyClass.Button; </code></pre> <p>Now you can reference your custom button using a distinct name. You may need to do something similar for the stock button if you use that anywhere in the same file.</p>
<p>You can at least make it a small bit less painful/wordy with "using":</p> <pre><code>using MPMC = MyPackage.MyClass; </code></pre> <p>then you can say: </p> <pre><code>MPMC.Button </code></pre>
20,994
<p>I need to read data added to the end of an executable from within that executable .<br> On win32 I have a problem that I cannot open the .exe for reading. I have tried CreateFile and std::ifstream.<br> Is there a way of specifying non-exclusive read access to a file that wasn't initially opened with sharing.</p> <p...
<p>Why not just use resources which are designed for this functionality. It won't be at the end, but it will be in the executable.</p> <p>If you are adding to the .exe after it is built -- you don't have to add to the end, you can update resources on a built .exe</p> <p><a href="http://msdn.microsoft.com/en-us/library...
<p>We do this in one of our projects. What's the problem with it? If the EXE is running, then it's already held open for reading, and you can continue to open it read-only multiple times. I just checked our code, we just use:</p> <pre><code>HANDLE file=CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTI...
36,608
<p>Does anyone know how in ASP.Net's TreeView control, to have a custom style applied to an Expanded node? I have many root nodes and want the Expanded nodes to have a different background.</p>
<p>There is no way of doing this with out of the box controls and this goes for alot of MS ASP.NET controls, however there is an adapters project on codeplex that makes your ASP.NET controls CSS-friendly:<br/> <a href="http://www.codeplex.com/cssfriendly" rel="nofollow noreferrer">http://www.codeplex.com/cssfriendly</a...
<p>I didn't want to deviate from the original control, so I ended up writing some JavaScript that would modify the tree via node structures on page load. </p>
16,284
<p>Is it possible to make such buttons (<a href="http://img225.imageshack.us/img225/6452/buttonslw9.jpg" rel="nofollow noreferrer">http://img225.imageshack.us/img225/6452/buttonslw9.jpg</a>) using CSS? It should be Menu, and PHP would just feed the text to html/css and css should take care of the design. </p> <p>Maybe...
<p>"Pure" solution is possible in latest Safari with <code>text-shadow</code>, <code>-webkit-text-stroke</code> and <code>-webkit-gradient</code> properties (explained in <a href="http://webkit.org/blog/175/introducing-css-gradients/" rel="nofollow noreferrer">Safari blog</a>).</p> <p>You could also use SVG + CSS <cod...
<p>There is no cross-browser way to do this (as you said, especially with the red text outline), but the Webkit and Gecko teams are implementing some cool CSS things like gradients embossing with experimental CSS properties.</p> <p>You might see what jQuery can do for you. It does some pretty cool CSS-like things that...
23,674
<p>I've got some blank values in my table, and I can't seem to catch them in an IF statement. </p> <p>I've tried</p> <p><code>IF @value = ''</code> and <code>if @value = NULL</code> and neither one catches the blank values. Is there any way to test whether or not a varchar is entirely whitespace?</p> <p>AHA! Turns o...
<p>To compare with NULL, use the IS NULL keyword.</p> <pre><code>--Generic example: SELECT * FROM MY_TABLE WHERE SOME_FIELD IS NULL; --Instead of SELECT * FROM MY_TABLE WHERE SOME_FIELD = NULL; </code></pre>
<p>You may have fields with multiple spaces (' ') so you'll get better results if you trim that:</p> <pre><code>where ltrim(yourcolumnname) = '' </code></pre>
45,610
<p>I am building a modular application. Through configuration you can turn these application modules on and off. I'm trying to determine what database structure (mssql2005) I should use for the tables that hold data for each of the modules. The two options that I've thought of are:</p> <ol> <li>Put all the tables i...
<p>My alternative recommendation to those that you have proposed would be the Schema functionality available in SQL Server 2005.</p> <p>Please read this link for more info ...</p> <p><a href="http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1184503,00.html" rel="nofollow noreferrer">http://searchsqlserver....
<p>If you need query across the tables I suggest putting them into one database, otherwise it doesn't make a difference. However, having one database would be much easier to maintain.</p> <p>Unless you have a requirement for multiple databases, I suggest using just one.</p>
33,447
<p>I thought as a fun project to make my own 3D printer out of a normal printer parts + some parts out of old CD-ROM drives that are lying around. The printer of my choice is an HP PSC 1315 one. <a href="https://i.stack.imgur.com/aNHM2m.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aNHM2m.jpg" alt=...
<h1>No, Printers are not good sources</h1> <p>Common printers contain at best one stepper motor <strong>in the scanner</strong>, and it is usually too weak for use as an X or Y stepper, but for a very slow printer they might be useable, especially if you could source 2 or 4 of the same type.</p> <p>The main motors in t...
<p>You need not a "modern" inkjet printer, but an antique flatbed 2-D printer. These were the state-of-the art in the 1980s, and drove the print head (a felt pen clamped into a mount) in X &amp; Y over the printable area.<br> You'd still need to hang the whole thing on some Z-drive, of course. </p> <p>See info at the...
1,108
<p>Is hot glue suitable for FDM printing, or some process similar to it?</p> <p>I think it has all of the required properties, and could produce a flexible transluscent print. It's cheap, hotends are cheap, and the technology has been around for a while.</p> <p>I couldn't find any examples or anyone talking about su...
<p>You could mount a hot glue gun to a 3D positioning frame, but you would immediately notice the following:</p> <ul> <li>Hot glue sticks are fat, so you lose a lot of precision for each feed/retract increment. I.e., it's a lot harder to get precise feeds with a fat stick because the stick size is so much larger than ...
<p>I think not. Unless you intend to make a very special printer that feeds on glue stick, you must make filament from it. Should be doable.</p> <p>But my experience with cold hot glue, is that it is not very durable. It's a bit elastic but nothing like elastic filament. It breaks instead. So when you have your filame...
970
<p>In ASP.NET, is it possible to use both code behind and inline on the same page? I want to add some inline code that's related to the UI of the page, the reason to make it inline is to make it easy to modify as it outputs some HTML which is why I don't want to add it in the code behind, is this possible in ASP.NET?</...
<p>Yes, you can use inline code just like in classic asp. You can use 'this' or 'me' to get to the code behind fields, methods, etc.</p>
<p>Yes, that will work, make sure the code behind class is declared as a partial class, which is the default these days anyway. Don't think it would work in 1 or 1.1</p>
38,562
<p>While trying to generate classes from a xsd, i got this error:</p> <pre><code>java.lang.IllegalArgumentException: Illegal class inheritance loop. Outer class OrderPropertyList may not subclass from inner class: OrderPropertyList </code></pre> <p>My xsd define a element to group a unbounded element like this:</p> ...
<p>I believe what you need to to is set:</p> <pre><code>&lt;jaxb:globalBindings localScoping="toplevel"/&gt; </code></pre> <p>This will generate standalone classes instead of nested classes.</p> <p>Doing</p> <pre><code>&lt;jaxb:bindings schemaLocation="../xsd/Schema.xsd" node="/xs:schema"&gt; &lt;jaxb:bindings ...
<p>I believe this is happening because it's likely that the generated Java class representing the sequence of "orderProperty" is itself named "OrderPropertyList".</p> <p>What I would do is first generate it without any custom bindings, and look at the class names and hierarchies that it generates. Then, consider what...
17,382
<p>The offending command that msi executes is:</p> <pre><code> .\devenv.com /command "View.Toolbox" /setup </code></pre> <p>This fails with Date execution prevention error.</p> <p>devenv.exe log contains a bunch of errors like this:</p> <pre><code> &lt;entry&gt; &lt;record&gt;120&lt;/record&gt; &lt;time&gt;...
<p>Working with msiexec and forcing update/uninstall and uninstallation of clone detective (for VS.NET) solved this problem .</p>
<p>Have you sent this information to the developers of the MVC framework? I assume that they are glad for information like this.</p>
27,328
<p>In the helpfile entry for TDBComboBox, it says that the text of the selected option becomes the new value for the field. Is there any similar control that goes by ItemIndex instead of text? (To represent an enumerated type, for example.)</p>
<p>Try the TDBLookupComboBox. Check out the ListField, DataField and KeyField properties.</p>
<p>Try the TDBLookupComboBox. Check out the ListField, DataField and KeyField properties.</p>
38,382
<p>I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this.</p> ...
<p>With the warning that I think it's a tremendously bad idea to replace the default Python with an unreleased beta version:</p> <p>First, install 2.6rc2. You can download the source from the <a href="http://www.python.org/download/releases/2.6/" rel="noreferrer">Python website</a>. Standard <code>./configure &amp;&am...
<p>Is there any need to?</p> <p>Ubuntu in general doesn't package RC releases. 2.6 will not be available in Ubuntu until Jaunty Jackalope.</p> <p>However,, if you insist that you need to install it, then, you'll have to do so without a package manager.</p> <p>Download the package, and unzip it to a directory</p> <p...
17,250
<p>I have a class which has a method that is receiving an object as a parameter. This method is invoked via RMI.</p> <pre><code>public RMIClass extends Serializable { public RMIMethod(MyFile file){ // do stuff } } </code></pre> <p>MyFile has a property called "body", which is a byte array. </p> <pre...
<p>Wrap your byte array with a <a href="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html" rel="noreferrer">ByteArrayInputStream</a> and feed it into a <a href="http://java.sun.com/javase/6/docs/api/java/util/zip/GZIPInputStream.html" rel="noreferrer">GZipInputStream</a></p>
<p>Why don't you create your own class that extends <strong>OutputStream</strong> or , whatever is the archive writing to ?</p>
33,960
<p>I am tasked with moving quite a few web apps including the databases to new servers, they are ASP.NET. I was not the one to create and setup these originally so I must try to figure out what exactly I need to replicate in order to not break anything and so the customers have no idea that anything was moved. </p> <p...
<p>This might help: <a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;g=6&amp;i=1293" rel="nofollow noreferrer">IIS 6.0 Migration Tool</a></p> <blockquote> <p>"The Internet Information Services 6.0 Migration Tool is a command line tool that automates several of the steps needed to move a Web appl...
<p>We just went through the same thing--bought a new server and had to transfer ASP.NET sites + Databases to the new server. We experienced problems with the IIS Migration tool, so we followed a "staging environment" approach, as stated in Berkshire's answer and had much success. When all issues are cleared from the ...
35,092
<p>How to create editable PDF using ASP.NET. I want to create a Pdf from a master template, edit it (fill some value(input not from database)) and save. Is it possible without using a 3rd party? </p> <p>If some sample code available it will be great</p>
<p>I use <a href="http://www.o2sol.com/pdf4net/products.htm" rel="nofollow noreferrer">PDF4NET</a> in a couple of projects, can definitely recommend it. There are <a href="http://www.o2sol.com/pdf4net/samples.htm" rel="nofollow noreferrer">code samples</a> on their website.</p>
<p>Maybe you can try the <a href="http://www.gotreportviewer.com/" rel="nofollow noreferrer">ReportViewer control</a>.</p> <p>You can create a "report template", assign data to it in runtime (fill in values), render it, and save the result.</p>
14,638
<p>I'm working on a casual game on XNA with the intention of deploying to the Xbox 360. I'm not going to have access to hardware for a few weeks and I'm on a tight deadline, so I'd like to test that a few things -- Boo and a few custom libraries -- will work properly on the 360. If they don't, I need to work around t...
<p>Well, you could try writing a quick app for a Windows Smartphone, and run it in an emulator. Obviously, this won't work for XNA specific code; but for any runtime libraries that Boo or whatever you're using work on the emulator, they <em>should</em> work on the Xbox.</p> <p>For the XNA code you write yourself, just...
<p>The key thing here is to understand that only .Net code will run on the Xbox 360, so any custom library you want to use <i>must</i> be a .Net assembly. The second thing to understand is that the Xbox is running the compact framework, so anything that isn't included in that won't work. This is easy enough to test a...
14,487
<p>Given the code bellow, how do I style the radio buttons to be next to the labels and style the label of the selected radio button differently than the other labels?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-c...
<p>The first part of your question can be solved with just HTML &amp; CSS; you'll need to use Javascript for the second part.</p> <h3>Getting the Label Near the Radio Button</h3> <p>I'm not sure what you mean by "next to": on the same line and near, or on separate lines? If you want all of the radio buttons on the sa...
<p>This will get your buttons and labels next to each other, at least. I believe the second part can't be done in css alone, and will need javascript. I found a page that might help you with that part as well, but I don't have time right now to try it out: <a href="http://www.webmasterworld.com/forum83/6942.htm" rel=...
6,524
<p>I am using Apache Felix and its Declarative Services (SCR) to wire the service dependencies between bundles.</p> <p>For example, if I need access to a java.util.Dictionary I can say the following to have SCR provide one:</p> <pre><code>/** * @scr.reference name=properties interface=java.util.Dictionary */ protect...
<p>I think</p> <pre><code>target="(name=myDictionary)" </code></pre> <p>should do the trick in the <code>@scr.reference</code> annotation. See <a href="http://felix.apache.org/site/apache-felix-maven-scr-plugin.html" rel="nofollow noreferrer">http://felix.apache.org/site/apache-felix-maven-scr-plugin.html</a></p>
<p>In standard DS, you can use target attribute of the reference element. In Felix world, where annotations can be used, I don't know what is the equivalent.</p> <p>The target attribute is an LDAP filter, which matches against the service properties. So, your filter should be:</p> <p><code> (name=myDictionary) </code...
39,783
<p>How can I emulate classes (and namespaces) in JavaScript?</p> <p>I need to create a JavaScript library and have limited experience with the language. I always thought that it had native support for classes, but it is less related to Java than I had assumed. It seems that everything in JavaScript is actually a funct...
<ul> <li><a href="http://www.phpied.com/3-ways-to-define-a-javascript-class/" rel="noreferrer">3 ways to define a JavaScript class</a></li> <li><a href="http://www.xml.com/pub/a/2006/06/07/object-oriented-javascript.html" rel="noreferrer">Object-oriented JavaScript</a></li> <li><a href="http://www.webdevelopersjournal....
<p>See the <a href="http://en.wikipedia.org/wiki/Mozilla_Developer_Network" rel="nofollow noreferrer">Mozilla Developer Network</a> (MDC) article <em><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Class-Based_vs._Prototype-Based_Languages" rel="nofollow noreferrer">Class-Based vs. Prototype-Based L...
46,387
<p>What is the best way to transcode audio and video to show on the web? </p> <p>I need to do it programmatically. I'd like to do something like YouTube or Google Video where users can upload whatever format they want, and I encode it to flv, mp3, and/or mp4. I could do it on our server, but I would rather use an E...
<p>I strongly recommend ffmpeg. On Windows, I have found <a href="https://ffmpeg.zeranoe.com/builds/" rel="nofollow noreferrer">this site</a> to host good binaries.</p>
<p><a href="http://www.rhozet.com/carbon_coder.html" rel="nofollow noreferrer">Rhozet Carbon Coder</a> can handle a <a href="http://www.rhozet.com/rhozet_formatGuide.pdf" rel="nofollow noreferrer">wide range of formats</a> plus you can use plugins to alter the video (eg add a watermark)</p>
2,862
<p>Let me start off by saying that I know there is probably a much simpler way to do this. But this is what i have and yes hopefully I can make some improvements and/or simplifications at the end.</p> <p><strong>Goal as of this moment</strong></p> <p>To double space the output stored in the <code>$tmp</code> variable...
<p>The following awk script will double space the output and number the lines:</p> <pre><code>awk ' { print NF " " $0; print ""; }' </code></pre> <p>Your problem is to assign this to a variable:</p> <pre><code>( echo a; echo b) | awk ' { print NR " " $0; print ""; }' </code></pre> <p>gives:</p> <pre><code>1 a 2 b...
<p>An alternative to using a temporary file is to use quotes to suppress the newline/space substitution:</p> <pre><code>tmp="$(echo a; echo b)" echo "$tmp" </code></pre>
44,612
<p>I've read that it is possible to add a method to an existing object (i.e., not in the class definition) in Python. </p> <p>I understand that it's not always good to do so. But how might one do this?</p>
<p>In Python, there is a difference between functions and bound methods.</p> <pre><code>&gt;&gt;&gt; def foo(): ... print &quot;foo&quot; ... &gt;&gt;&gt; class A: ... def bar( self ): ... print &quot;bar&quot; ... &gt;&gt;&gt; a = A() &gt;&gt;&gt; foo &lt;function foo at 0x00A98D70&gt; &gt;&gt;&gt; a.b...
<p>Apart from what others said, I found that <code>__repr__</code> and <code>__str__</code> methods can't be monkeypatched on object level, because <code>repr()</code> and <code>str()</code> use class-methods, not locally-bounded object methods:</p> <pre><code># Instance monkeypatch [ins] In [55]: x.__str__ = show.__ge...
2,339
<p>I'd like to use your wisdom for picking up the right solution for a data-warehouse system. Here are some details to better understand the problem:</p> <p>Data is organized in a star schema structure with one BIG fact and ~15 dimensions. <br /> 20B fact rows per month <br /> 10 dimensions with hundred rows (somew...
<p>I cannot stress this enough: <em>Get something that plays nicely with off-the-shelf reporting tools.</em></p> <p>20 Billion rows per month puts you in VLDB territory, so you need partitioning. The low cardinality dimensions would also suggest that bitmap indexes would be a performance win.</p> <ul> <li><p>Forget ...
<p>An alternative for a low number of users would be a (beowulf) cluster. 20K buys you 50 nettops with 500G each. That's about 3KW peak power. Or 4 months of cloud storage.</p>
46,146
<p>I hope someone will be able to answer my question.</p> <p>I have Subversion set up, served by Apache2+SSL, doing web development.</p> <p>I want a post-commit hook that runs svn update on my testing server, so when someone commits, it will automatically update the testing site. The hook doesn't work because the cer...
<p>root owned the .subversion folder in my $HOME, so i deleted it and ran 'svn up' again. Everything is good now.</p>
<p>Are you using sudo or something in the script? Sudo usually cleans the environment variables so HOME doesn't exist. You must have writable home directory where subversion can store the information about permanently accepted certificate. So set HOME variable yourself in the beginning of the script and it should work....
31,019
<p>I have a flash app (SWF) running Flash 8 embedded in an HTML page. How do I get flash to reload the parent HTML page it is embedded in? I've tried using ExternalInterface to call a JavaScript function to reload the page but that doesn't seem to work. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
<p>Check the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html" rel="noreferrer">ExternalInterface</a> in Action Script. Using this you can call any JavaScript function in your code:</p> <pre><code> if (ExternalInterface.available) { var result = ExternalIn...
<p>In Flash 10 you can do:</p> <pre><code>navigateToURL(new URLRequest("path_to_page"), "_self"); </code></pre>
12,223
<p>I'm trying to save a couple of files to a container file. The files can be modified later which means the container might have to be enlarged. The user should only see this container as a single file in the file system. The application is written in C++ and running on Windows, but the files should be portable to oth...
<p>Is the HDF5 File Format what you are looking for if you are building an application in C++</p>
<p>Some archive format (zip, bzip2) might do the job.</p>
48,962
<p>What's the difference between toolkits and frameworks? Do you know a good comparison?</p>
<p>If I had to make a distinction, then I'd say a toolkit provides specific tools to do specific jobs, whereas a framework provides you with a foundation on which to build further, higher-level structures.</p> <p>Tools are useful on their own, frameworks have no innate function.</p>
<p>The names say it all really, a toolkit is a set of tools that you can use however you wish. A framework is an empty frame that you can fill in to form your application. The line between them is blurry though a framework contains tools, and a toolkit sometimes forces you to perform actions in a specific sequence.</p>...
19,532
<p>I have the following line of text</p> <pre><code>Reference=*\G{7B35DDAC-FFE2-4435-8A15-CF5C70F23459}#1.0#0#..\..\..\bin\App Components\AcmeFormEngine.dll#ACME Form Engine </code></pre> <p>and wish to grab the following as two separate capture groups:</p> <pre><code>AcmeFormEngine.dll ACME Form Engine </code></pre...
<p>If you are sincere of the string format, you can also solve that in an earthbound manner, without regex: Take everything after the last index of '\', and split that at '#'.</p>
<pre><code> using System.Text.RegularExpressions; Regex regex = new Regex( @"\\(?&lt;filename&gt;[\w\.]+)\#(?&lt;comment&gt;[\w ]+)$", RegexOptions.IgnoreCase | RegexOptions.Compiled ); </code></pre>
24,497
<p>For a long time i have tried to work out the best way to access certain site files which i don't wish to be apart of a project or to ease integration with multiple developers (and talents, e.g. designers) on a single project.</p> <p>A lot of sites i have created have had folders with large amounts of images and oth...
<p>They should really be source controlled like everything else. If you use Subversion you could have them stored in a different repository and included as an <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html" rel="nofollow noreferrer">svn-external</a> on your main project repository if you didn't want them clu...
<p>Images and other binaries should be in source control just like your code files. Especially since they are changing often.</p> <p>That said, there is absolutely no harm in setting up a different project that only contains your binary files; and having it on a different deployment schedule. </p>
13,050
<p>I've got a web app that sends out emails in response to a user-initaited action. These emails prompt the recipient for a response (an URL is included related to the specific action.)</p> <p>I've got some users asking for a "resend" feature to push that email again. </p> <p>My objection is that if the original emai...
<p>Definitely useful, at least from the user's point of view. By manually resending the email, they <em>know</em> that it has been sent and can check their spam folder immediately to catch the mail. Otherwise, they might not know about the mail and it will dissapear from their spam before they can catch it.</p>
<p>Absolutely pointless. But, if the user's want it, and it doesn't take too long, it may be worthwhile. Users are silly sometimes, and if it makes them happy...</p>
11,049
<p>After test driving Google Chrome for 30 minutes or so, I like it, even if it seems bare-bones at the moment. The obvious way to add a few things I can't live without would be through plugins. Does anyone have any links to resources on how to get started building a plugin/addon for Chrome? Thanks.</p>
<p><a href="http://www.mattcutts.com/blog/common-google-chrome-objections/" rel="nofollow noreferrer">Matt Cutts</a> (the Google SEO guru) has a Q&amp;A about chrome, and writes about it: </p> <blockquote>Q: But I can’t install extension X! Google Chrome is dead to me if I can’t use extension X!<br/> A: Then you’ll...
<p>The accepted answer is out of date. A couple of useful URLs:</p> <ul> <li>For developers: <a href="http://developer.chrome.com/extensions/index.html" rel="nofollow">http://developer.chrome.com/extensions/index.html</a></li> <li>For end users: <a href="https://chrome.google.com/webstore/category/home?hl=en-US" rel="...
6,192
<p>I'm learning about Win32 programming, and the <code>WinMain</code> prototype looks like:</p> <pre><code>int WINAPI WinMain ( HINSTANCE instance, HINSTANCE prev_instance, PSTR cmd_line, int cmd_show ) </code></pre> <p>I was confused as to what this <code>WINAPI</code> identifier was for and found:</p> <pre><code>#...
<p><code>__stdcall</code> is the calling convention used for the function. This tells the compiler the rules that apply for setting up the stack, pushing arguments and getting a return value.</p> <p>There are a number of other calling conventions, <code>__cdecl</code>, <code>__thiscall</code>, <code>__fastcall</code>...
<p>I never had to use this before until today. Its because in my code I am using multi-threadding and the multi-threading API I am using is the windows one (_beginthreadex).</p> <p>To start the thread:</p> <pre><code>_beginthreadex(NULL, 0, ExecuteCommand, currCommand, 0, 0); </code></pre> <p>The ExecuteCommand func...
38,093
<p>We have a 32-bit application that launches other 32-bit applications during its process. The application is working fine on other 64-bit platforms but on Windows Server 2003 64-bit, we get an error trying to launch the apps:</p> <pre><code>error 193 (not a valid 32 bit application) </code></pre> <p>We can manually...
<p>IIRC, you can get that error code even if the app really is a valid 32-bit .exe, for a host of various other reasons, such as a dll dependency problem. Or if the Windows loader is confused by 64-bit dlls in the path with the same name as the 32-bit dll it needs.</p>
<p>Are you sure the to-be-launched applications are compiled for 32-bit? When you run each of the apps directly, make sure they are running within WOW64. If they are not, then Windows is running them as 64-bit apps, which could cause the problem you are seeing.</p>
42,992
<p>Sorry for the subject line sounding like an even nerdier Harry Potter title.</p> <p>I'm trying to use AS3's Socket class to write a simple FTP program to export as an AIR app in Flex Builder 3. I'm using an FTP server on my local network to test the program. I can successfully connect to the server (the easy part...
<p>The FTP protocol predates UTF encoding. Switch to ANSI/ASCII for better results. If you do opt for writeMultiByte instead of writeUTFBytes, be aware that it is buggy in linux. <a href="http://www.flexiblefactory.co.uk/flexible/?p=75" rel="nofollow noreferrer">Here's</a> one way around it.</p> <p>There's another ques...
<p>We will need more info to resolve this.. What you're saying here appears correct to me. You're using the Socket class to send data though, not ByteArray.</p> <p>Are you sure data is not being sent? How are you receiving the response? It may be that it's working fine but you're just not aware of it? As i said, tell ...
8,857
<p>Has anyone found any documentation or research about what data is transfered to Google Analytics when it's added to a site. The main thing I'm wondering about is post data, but the details of exactly what is sent would be useful.</p> <p>I'm considering implementing it on a sites that have a lot of private data on t...
<p>The official information can be found <a href="https://developers.google.com/analytics/devguides/collection/gajs/" rel="nofollow noreferrer">here</a></p> <blockquote> <p>The visitor tracking information that you can get in the Google Analytics reports depends on Javascript code that you include in your website pa...
<p>look at <a href="http://www.google-analytics.com/urchin.js" rel="nofollow noreferrer">http://www.google-analytics.com/urchin.js</a> under the function urchinTracker and you'll see what's going on :)</p>
37,224
<p>I have a C++ library that provides various classes for managing data. I have the source code for the library.</p> <p>I want to extend the C++ API to support C function calls so that the library can be used with C code and C++ code at the same time.</p> <p>I'm using GNU tool chain (gcc, glibc, etc), so language an...
<p>Yes, this is certainly possible. You will need to write an interface layer in C++ that declares functions with <code>extern "C"</code>:</p> <pre><code>extern "C" int foo(char *bar) { return realFoo(std::string(bar)); } </code></pre> <p>Then, you will call <code>foo()</code> from your C module, which will pass ...
<p>you can mix C/C++ code. If your main() function in in C++, then you just need to make sure your c functions are declared </p> <pre><code>extern "C" </code></pre> <p>If your main is C, then you are probably OK except for static variables. Any constructors with your static variables are supposed to be called befo...
24,303
<p>The following code snippet (correctly) gives a warning in C and an error in C++ (using gcc &amp; g++ respectively, tested with versions 3.4.5 and 4.2.1; MSVC does not seem to care):</p> <pre><code>char **a; const char** b = a; </code></pre> <p>I can understand and accept this.<br> The C++ solution to this problem ...
<p>I had this same problem a few years ago and it irked me to no end.</p> <p>The rules in C are more simply stated (i.e. they don't list exceptions like converting <code>char**</code> to <code>const char*const*</code>). Consequenlty, it's just not allowed. With the C++ standard, they included more rules to allow cas...
<p>I'm not able to get an error when implicitly casting char** to const char * const *, at least on MSVC 14 (VS2k5) and g++ 3.3.3. GCC 3.3.3 issues a warning, which I'm not exactly sure if it is correct in doing.</p> <p>test.c:</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; void foo(const char * c...
10,357
<p>Is there any shorthand way of defining and using generic definitions without having to keep repeating a particular generic description such that if there is a change I don't have to change all definitions/usages though out the codebase for example is something like this possible:</p> <pre><code>Typedef myGenDef = &...
<p>There's the <a href="http://www.ibm.com/developerworks/java/library/j-jtp02216/index.html" rel="nofollow noreferrer">pseudo-typedef antipattern</a>... </p> <pre><code>class StringList extends ArrayList&lt;String&gt; { } </code></pre> <p>Good stuff, drink up! ;-)</p> <p>As the article notes, this technique has som...
<p>No. Though, groovy, a JVM language, is dynamically typed and would let you write:</p> <pre><code>def map = new HashMap&lt;complicated generic expression&gt;(); </code></pre>
5,900
<p>Let's say I have this code:</p> <pre><code>if (md5($_POST[$foo['bar']]) == $somemd5) { doSomethingWith(md5($_POST[$foo['bar']]); } </code></pre> <p>I could shorten that down by doing:</p> <pre><code>$value = md5($_POST[$foo['bar']]; if ($value == $somemd5) { doSomethingWith($value); } </code></pre> <p>But is...
<p>No, but since the assignment itself is an expression, you can use the assignment as the conditional expression for the if statement.</p> <pre> if (($value = md5(..)) == $somemd5) { ... } </pre> <p>In general, though, you'll want to avoid embedding assignments into conditional expressions:</p> <ul> <li>The code is...
<p>Since the if is just using the result of an expression, you can't access parts of it. Just store the results of the functions in a variable, like you wrote in your second snippet.</p>
12,725
<p>Currently I'm running several websites that have several (branded) duplicates each, in the same IIS. I wanted to have an easy overview of all the website groups so I used a naming convention like [siteName].[brandCode]. But lo and behold, IIS has its very own (seemingly random) way of ordering the entries in the "We...
<p>You'll need to edit the IIS Metabase to reorder those. I can't remember if theres a tool to do it in IIS6 but you can use <a href="http://support.microsoft.com/kb/240225/en-us" rel="nofollow noreferrer">MetaEdit</a> for IIS7 so that might be backwards compatible.</p> <p>If not, the metabase is just an XML file so y...
<p>I always click on the "Web Sites" folder in IIS Manager and sort the list in the right panel by description.</p> <p>I think there is no other option.</p>
30,561
<p>I cureently have a set up like below </p> <pre><code>Public ClassA property _classB as ClassB End Class Public ClassB property _someProperty as someProperty End Class </code></pre> <p>what I want to do is to databind object A to a gridview with one of the columns being databound to ClassB._someProperty. W...
<p>Ordinary databinding doesn't generally allow for expressions. Under the hood the datagrid is using reflection (rather the executing code the way DataBinder.Eval does on an ASP.NET page) to find the property that you specify to bind to a column. To do what you want it would need to evaluate the binding as an expressi...
<p>I found the way to do this is to use a template field and eval (see below)</p> <p>Set the datafield as property classB and then:</p> <pre><code>&lt;asp:TemplateField HeaderText="_someProperty"&gt; &lt;ItemTemplate&gt; &lt;%#Eval("classB._someProperty")%&gt; &lt;/ItemTemplate&gt; ...
22,006
<p>After a bind a method to an event of a Tkinter element is there a way to get the method back?</p> <pre><code>&gt;&gt;&gt; root = Tkinter.Tk() &gt;&gt;&gt; frame = Tkinter.Frame(root, width=100, height=100) &gt;&gt;&gt; frame.bind('&lt;Button-1&gt;', lambda e: pprint('Click')) # function needed &gt;&gt;&gt; frame.pa...
<p>The associated call to do that for the tk C API would be <a href="http://linux.about.com/library/cmd/blcmdl3_Tcl_GetCommandInfo.htm" rel="nofollow noreferrer">Get_GetCommandInfo</a> which</p> <blockquote> <p>places information about the command in the Tcl_CmdInfo structure pointed to by infoPtr</p> </blockquo...
<p>Doesn't appear to be... why not just save it yourself if you're going to need it, or use a non-anonymous function?</p> <p>Also, your code doesn't work as written: <code>lambda</code> functions can only contain expressions, not statements, so <code>print</code> is a no-go (this will change in Python 3.0 when <code>p...
16,694
<p>How can I determine if I have write permission on a remote machine in my intranet using C# in .Net?</p>
<p>The simple answer would be to try it and see. The Windows security APIs are not for the faint of heart, and may be possible you have write permission without having permission to view the permissions!</p>
<p>ScottKoon is write about checking the windows ACL permissions. You can also check the managed code permissions using CAS (Code Access Security). This is a .Net specific method of restricting permissions. Note, if the user doesn't have write permissions then the code will never have write permissions (even if CAS say...
16,577
<p>How could I get the Fault Detail sent by a SoapFaultClientException ? I use a WebServiceTemplate as shown below :</p> <pre><code>WebServiceTemplate ws = new WebServiceTemplate(); ws.setMarshaller(client.getMarshaller()); ws.setUnmarshaller(client.getUnMarshaller()); try { MyResponse resp = (MyResponse) = ws.mar...
<p>I also had the problem that getFaultDetail() returned null (for a SharePoint web service). I could get the detail element out by using a method similar to this:</p> <pre><code>private Element getDetail(SoapFaultClientException e) throws TransformerException { TransformerFactory transformerFactory = TransformerF...
<p>From the Javadocs for the <a href="http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/client/core/WebServiceOperations.html#marshalSendAndReceive%28java.lang.String,%20java.lang.Object%29" rel="nofollow noreferrer">marshalSendAndReceive method</a> it looks like the SoapFaultClientEx...
12,629
<p>I haven't used Visual Studio since VB 3 and am trying to give it a shot with ASP.NET. It seems that it should be able to connect to a website (via some sort of ftp like protocol I figure) and allow to edit without having to manually upload/download the files. Is this the way it is supposed to work or am I mis-unders...
<p>You really don't want to be working directly on a live web site, do you? That's just crazy. One little mistake and you've hosed the site.</p> <p>Visual Studio now has it's own built in web server. You use that for testing. If you really don't want to use that you can put IIS on your local machine or set up a De...
<p>I would develop your website locally and ftp it to your godaddy website after or use the publish website feature in VS</p>
12,843
<p>I'm thinking about buliding my own 3D printer from scratch. </p> <p>Is it better to buy a starter DIY kit and try to build your printer around it, or to order separate parts for printer, and then to combine a printer?</p>
<p>From a general point of view, there are a few things to consider.</p> <p><strong>If you buy a kit</strong>:</p> <p>Pros:</p> <ul> <li>You get some insurance that <em>you have all the parts that you need</em> to get a functional printer - all the electronics, structure, bolts, nuts, screws, washers, wires and so o...
<p>Three great answers have already been posted, and it has been extremely interesting to read them. I shall try not to repeated what has already been said.</p> <p>I have sourced the parts <em>separately</em> for three different printers:</p> <ul> <li>P3Steel (the frame was a kit, mind: <a href="https://3dprinting.stac...
172
<p>How do I write a regular expression to find all lines containing 665 and not having .pdf</p> <p>I can't seem to find how to do not in regex. This is for Notepad++ syntax if it matters.</p> <p>Thanks</p>
<p>If <code>.pdf</code> will only occur after <code>665</code>, the negative lookahead assertion <code>665(?!.*\.pdf)</code> should work fine. Otherwise, I prefer to use two regexs, one to match, one to fail. In Perl syntax that would be:</p> <pre><code>/665/ &amp;&amp; !/\.pdf/ </code></pre>
<p>The feature you'r looking for is look ahead patterns</p> <pre><code>665(?!.*\.pdf) </code></pre>
22,965
<p>It's fall of 2008, and I still hear developers say that you should not design a site that requires JavaScript.</p> <p>I understand that you should develop sites that degrade gracefully when JS is not present/on. But at what point do you not include funcitonality that can only be powered by JS? </p> <p>I guess th...
<p>Just as long as you're aware of the accessibility limitations you might be introducing, ie for users of screen-reading software, etc.</p> <p>It's one thing to exclude people because they choose to turn off JS or use a browser which doesn't support it, it's entirely another to exclude them because of a disability.</...
<p>It's the 21st century. People not permitting JavaScript need to exit the last millennium, posthaste. It's a mature, widely used, and very useful technology that is one of the foundations of the recent expansion in useful web services.</p>
8,827
<p>I'm stumped and feeling stupid. I've tried every search combination I can think of to figure this out. It seems simple, but being new to javascript I'm not seeing anything helpful in my search for examples or demos. I'm looking to use a script like I would a python or perl script to run a simple linux command. The i...
<p>For a ridiculously short value ( Ie: values &lt; 64 characters ), MD5 as a hash becomes ineffective due to rainbow table attacks, and as the value you're sending will be shared over the wire, all they have to do is brute force the shared secret ( and they have a known product to work with ) </p> <p>As such, thats ...
<p>Wow</p> <p>Pretty hard solutions 8). </p> <p>I implemented system like this once. Although it won`t work for every game out there...</p> <p>You should replay the game on server. When user play -- you store "state changes" and then simply feed it to you game in some kind of "replay" mode.</p>
38,964
<p>Before you start firing at me, I'm NOT looking to do this, but someone in <a href="https://stackoverflow.com/questions/154698/how-can-i-keep-a-class-from-being-inherited-in-c">another post</a> said it was possible. How is it possible? I've never heard of inheriting from anything using reflection. But I've seen some ...
<p>Without virtual functions to override, there's not much point in subclassing a sealed class.</p> <p>If you try write a sealed class with a virtual function in it, you get the following compiler error:</p> <pre><code>// error CS0549: 'Seal.GetName()' is a new virtual member in sealed class 'Seal' </code></pre> <p>...
<p>Create a new class called GenericKeyValueBase</p> <p>put this in it</p> <pre><code> public class GenericKeyValueBase&lt;TKey,TValue&gt; { public TKey Key; public TValue Value; public GenericKeyValueBase(TKey ItemKey, TValue ItemValue) { Key = ItemKey; V...
18,751
<p>Say instead of returning void a method you returned a reference to the class even if it didn't make any particular semantic sense. It seems to me like it would give you more options on how the methods are called, allowing you to use it in a fluent-interface-like style and I can't really think of any disadvantages s...
<p>I think as a general policy, it simply doesn't make sense. Method chaining in this manner works with a properly defined interface but it's only appropriate if it makes semantic sense. </p> <p>Your example is a prime one where it's not appropriate, because it makes no semantic sense.</p> <p>Similarly, your syntacti...
<p>At first sight it may look good, but for a consistent interface you will need that all methods return a reference to this (which has it own problems).</p> <p>Let say you have a class with two methods GetA which return this and GetB which return another object:</p> <p>Then you can call obj.GetA().GetB(), but not ob...
8,133
<p>To send a serial string character to the serial port. I would need to call WriteFile(handle, "A", strlen("A"), ...)</p> <p>However, what if I want to specify and send a hex or binary number? For example, I want to send WriteFile(handle, 0x41, sizeOf(0x41), ...) ?</p> <p>Is there a function that allow me to do th...
<p>If you just want to write one byte, it still needs to be in an array.</p> <p>So you would need:</p> <pre><code>int buffer[1024]; buffer[0] = 42; WriteFile(handle, buffer, 1); </code></pre> <p>See this: <a href="http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx" rel="nofollow noreferrer">http://msdn.mi...
<p>If you just want to write one byte, it still needs to be in an array.</p> <p>So you would need:</p> <pre><code>int buffer[1024]; buffer[0] = 42; WriteFile(handle, buffer, 1); </code></pre> <p>See this: <a href="http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx" rel="nofollow noreferrer">http://msdn.mi...
36,786
<p>I recently discovered the notify extension in Mercurial which allows me quickly send out emails whenever I push changes, but I'm pretty sure I'm still missing out on a lot of functionality which could make my life a lot easier. </p> <ul> <li>notify-extension: <a href="https://www.mercurial-scm.org/wiki/NotifyExtens...
<p>I really enjoy what I did with my custom hook. I have it post a message to my campfire account (campfire is a group based app). It worked out really well. Because I had my clients in there and it could show him my progress.</p>
<p>Take a look at the hgweb stuff. You can set up RSS feeds and see all the revisions, et cetera.</p>
8,894
<p>We are currently using MySQL for a product we are building, and are keen to move to PostgreSQL as soon as possible, primarily for licensing reasons.</p> <p>Has anyone else done such a move? Our database is the lifeblood of the application and will eventually be storing TBs of data, so I'm keen to hear about experie...
<p>Steve, I had to migrate my old application the way around, that is PgSQL->MySQL. I must say, you should consider yourself lucky ;-) Common gotchas are:</p> <ul> <li>SQL is actually pretty close to language standard, so you may suffer from MySQL's dialect you already know</li> <li>MySQL quietly truncates varchars th...
<p>We did a move from a MySQL3 to PostgreSQL 8.2 then 8.3. PostgreSQL has the basic of SQL and a lot more so if your MYSQL do not use fancy MySQL stuff you will be OK.</p> <p>From my experience, our MySQL database (version 3) doesn't have Foreign Key... PostgreSQL lets you have them, so we had to change that... and it...
3,829
<p>This could be the dumbest question ever asked but I think it is quite confusing for a Java newbie. </p> <ol> <li>Can somebody clarify what is meant by <em>immutable</em>? </li> <li>Why is a <code>String</code> immutable?</li> <li>What are the advantages/disadvantages of the immutable objects?</li> <li>Why should a ...
<p>Immutable means that once the constructor for an object has completed execution that instance can't be altered.</p> <p>This is useful as it means you can pass references to the object around, without worrying that someone else is going to change its contents. <em>Especially when dealing with concurrency, there are ...
<p>An immutable object is the one you cannot modify after you create it. A typical example are string literals.</p> <p>A D programming language, which becomes increasingly popular, has a notion of "immutability" through "invariant" keyword. Check this Dr.Dobb's article about it - <a href="http://dobbscodetalk.com/inde...
35,326
<p>I saw this question asked about C# I would like an answer for PHP. I have some old code that has 4 pages of foreach loops and conditions which just makes it hard to read and follow. How would I make this more OO? I was thinking of using SPL Functions but don't fully understand whats involved yet.</p>
<p>This code can probably be cleaned up significantly, and pushed far in the direction of OO, without touching SPL.</p> <p>SPL is only needed if you want to alter normal object behaviour in language constructs like foreach(), or in builtins like count(), or in array access funcitons (both operator [] and functions lik...
<p>Start slowly. refactor it a piece at a time.</p> <p>If you are looping over a lot of arrays, look at the array functions like <a href="http://php.net/array_map" rel="nofollow noreferrer"><code>array_map</code></a>, <a href="http://php.net/manual/en/function.array-walk.php" rel="nofollow noreferrer"><code>array_wal...
25,834
<p>Typing Ctrl+O twice in editor when a java type is selected pops-up an outline context dialog that displays the members &amp;&amp; inherited members. How can I have this in the main outline view?</p>
<p>Looks like you can't do it.</p> <p>Maybe you should file it as an improvement request.</p>
<p>There is a feature request already, but there are not enough votes for it...</p> <p><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=8625" rel="noreferrer">https://bugs.eclipse.org/bugs/show_bug.cgi?id=8625</a></p>
12,735
<p>I am currently a student and trying to design a Visual C++ application to allow me to visually insert an oriented graph in order to create a text file with the graph's matrix. At this point I have created an onClick event to create nodes and have used the form's Paint event to draw the nodes. I have also inserted t...
<p>The colon is there to declare the start of an indented block.</p> <p>Technically, it's not necessary; you could just indent and de-indent when the block is done. However, based on the <a href="http://www.python.org/dev/peps/pep-0020/" rel="noreferrer">Python koan</a> “explicit is better than implicit” (EIBTI), I be...
<p>The colon is a complete annoyance. If you need to indent after an 'if' or a 'for', then just look for the 'if' or the 'for'.</p> <p>Cmon', all this rationalization. The 'spin' language for the propeller chip easily overcomes this issue.</p> <p>PLEASE, let's make the colon optional, and get on with some logical pro...
26,497
<p>How would one create fancy UIs in .NET, with glossy buttons and smooth animations? You can point me to 3rd party frameworks, but I would like to understand the technical details also.</p>
<p>Maybe take a look at <a href="http://msdn.microsoft.com/en-us/library/ms754130.aspx" rel="nofollow noreferrer">WPF</a>.</p> <p>In terms of 3rd party libraries:</p> <ul> <li><a href="http://devexpress.com/" rel="nofollow noreferrer">DevExpress</a></li> <li><a href="http://www.telerik.com/" rel="nofollow noreferrer"...
<p>Silverlight 2.0</p>
34,558
<p>I have an application which uses a UDL file where the connection string specifies "Provider=SQLNCLI.1" which doesn't work on a specific machine because sqlncli.dll is not installed.</p> <p>Another .Net app however, where the connection string is in app.config and does not specifically show the provider does worrk. ...
<p>The SQL Server Native client is an independent data access API that was introduced in SQL Server 2005. </p> <p>From MSDN</p> <blockquote> <p>It also provides new functionality above and beyond that supplied by the Windows Data Access Components (Windows DAC, formerly Microsoft Data Access Components, or ...
<p>Microsoft Docs has a useful article about this: <a href="https://learn.microsoft.com/en-us/sql/relational-databases/native-client/when-to-use-sql-server-native-client?view=sql-server-2017" rel="nofollow noreferrer">When to Use SQL Server Native Client</a>.</p> <p>To quote:</p> <blockquote> <p><strong><em>For new...
24,546
<p>Is there any way to test what kind your filament is? There are no labels on the spools and I don't know whether they are ABS or PLA.</p> <p>I got the plastic with the printer, which is no longer sold (Solidoodle 2). Since I bought it on eBay that is probably why it has unprofessional filament. The plastic filament ...
<p>ABS dissolves in acetone, you could try clipping a small section and leave it in some acetone for a few minutes and if it begins to dissolve it's safe to assume that it's ABS, if not then you'll know that it's not.</p> <p>This won't confirm that it is PLA, only whether it's ABS or not.</p>
<p><a href="http://www.boedeker.com/burntest.htm" rel="nofollow noreferrer">Using The Burn Test to Identify Plastic Materials</a> is one way. From the link:</p> <blockquote> <p>To initially determine whether a material is thermoplastic (meltable) or thermoset (non-meltable) type, heat a metal or glass stirring rod unti...
545
<p>I want to split an arithmetic expression into tokens, to convert it into RPN.</p> <p>Java has the StringTokenizer, which can optionally keep the delimiters. That way, I could use the operators as delimiters. Unfortunately, I need to do this in PHP, which has strtok, but that throws away the delimiters, so I need to...
<p>This might help.</p> <p><a href="http://c7y.phparch.com/c/entry/1/art,practical_uses_tokenizer" rel="nofollow noreferrer">Practical Uses of Tokenizer</a></p>
<p>OK, thanks to PhiLho, my final code is this, should anyone need it. It's not even really dirty. :-)</p> <pre><code>static function rgTokenize($s) { $rg = array(); // remove whitespace $s = preg_replace("/\s+/", '', $s); // split at numbers, identifiers, function names and operators $rg = preg_...
17,825
<p>I am trying to call out to a legacy dll compiled from FORTRAN code. I am new to Interop, but I've read some articles on it and it seems like my case should be fairly straightforward. </p> <p>The method I really want to call has a complex method signature, but I can't even call this simple GetVersion method withou...
<p>OK, I got it to work, the problem was passing by ref. I'm not sure why, but this works:</p> <pre><code>[DllImport("GeoConvert.dll", EntryPoint="_get_version@4", CallingConvention=CallingConvention.StdCall)] public static extern void GetGeoConvertVersion([MarshalAs(UnmanagedTyp...
<p>Have you tried using a StringBuilder?</p> <p>Create your String as a StringBuilder and pass that into the dll function. </p> <p>Im unsure as to what Marashlling statement to use, perhapse the default might work.</p> <p>Have a look at: <a href="https://stackoverflow.com/questions/158628/marshal-c-string-class-in-c...
28,391
<p>I'm busy writing a class that monitors the status of RAS connections. I need to test to make sure that the connection is not only connected, but also that it can communicate with my web service. Since this class will be used in many future projects, I'd like a way to test the connection to the webservice without k...
<p>You are right that pinging the server isn't sufficient. The server can be up, but the web service unavailable due to a number of reasons.</p> <p>To monitor our web service connections, I created a IMonitoredService interface that has a method CheckService(). The wrapper class for each web service implements this me...
<p>How about opening a TCP/IP connection to the port used by the webservice? If the connection works, the RAS connection, the rest of the network and the host are all working. The webservice is almost certainly running too.</p>
42,813
<p>I've looked at several URL rewriters for ASP.Net and IIS and was wondering what everyone else uses, and why. </p> <p>Here are the ones that I have used or looked at:</p> <ul> <li><a href="http://www.codeproject.com/KB/aspnet/urlrewriter.aspx" rel="nofollow noreferrer">ThunderMain URLRewriter</a>: used in a previou...
<p>There's System.Web.Routing that was just released with .NET 3.5.</p> <p>You can just use Request.RewritePath() in a custom HttpModule</p> <p>I prefer using an IHttpHandlerFactory implementation and have full control over all incoming URLs and where they're mapped to.</p>
<p>+1 for UrlRewritingNet.UrlRewrite too but why do I always need to end my URL with .aspx? I think it should be improved better regular expression partern.</p> <p>Why do I always have to end with aspx in virtualURL localhost/Products/Beverages.aspx", "localhost/Products/Condiments.aspx". I just want to type localhost...
3,548
<p>I've been using a small class to emulate Enums in some Python projects. Is there a better way or does this make the most sense for some situations?</p> <p>Class code here:</p> <pre><code>class Enum(object): '''Simple Enum Class Example Usage: &gt;&gt;&gt; codes = Enum('FOO BAR BAZ') # codes.BAZ will be 2 and so on...
<p>Enums have been proposed for inclusion into the language before, but were rejected (see <a href="http://www.python.org/dev/peps/pep-0354/" rel="nofollow noreferrer" title="PEP 354">http://www.python.org/dev/peps/pep-0354/</a>), though there are existing packages you could use instead of writing your own implementati...
<p>I started with something that looks a lot like S.Lott's answer but I only overloaded 'str' and 'eq' (instead of the whole object class) so I could print and compare the enum's value.</p> <pre><code>class enumSeason(): Spring = 0 Summer = 1 Fall = 2 Winter = 3 def __init__(self, Type): se...
13,394
<p>Is there a cheap way to get the dimensions of an image (jpg, png, ...)? Preferably, I would like to achieve this using only the standard class library (because of hosting restrictions). I know that it should be relatively easy to read the image header and parse it myself, but it seems that something like this should...
<p>Your best bet as always is to find a well tested library. However, you said that is difficult, so here is some dodgy largely untested code that should work for a fair number of cases:</p> <pre><code>using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; namespace ...
<p>It's going to depend on the file format. Usually they will state it up in the early bytes of the file. And, usually, a good image-reading implementation will take that into account. I can't point you to one for .NET though.</p>
13,651
<p>I have a PDF file, which contains data that we need to import into a database. The files seem to be pdf scans of printed alphanumeric text. Looks like 10 pt. Times New Roman. </p> <p>Are there any tools or components that can will allow me to recognize and parse this text?</p>
<p>I've used <a href="http://pdftohtml.sourceforge.net/" rel="noreferrer">pdftohtml</a> to successfully strip tables out of PDF into CSV. It's based on <a href="http://www.foolabs.com/xpdf/portsntools.html" rel="noreferrer">Xpdf</a>, which is a more general purpose tool, that includes <a href="http://en.wikipedia.org/w...
<p>You can use a module like perl's <a href="http://search.cpan.org/~antro/PDF-111/PDF.pm" rel="nofollow noreferrer">PDF</a> to extract the text. And use another tool to import the pertinent info into the database.</p> <p>I am sure there are PDF components for .NET, but I have not tried any, so I don't know what is go...
19,165
<p>After doing a lot of research, I've decided I want to purchase a Creality CR-10S as my first 3D printer. I'm trying to locate a reputable, local seller. Other than Amazon, which seems to have a bit of a mark-up on price, I'm finding several websites that seem to be located outside of the US. Can anyone direct me to ...
<p>I’ve bought two printers (CR-10S and Ender 2)from Tiny Machines in Houston Texas. They unbox them from China and assemble them and make a test print. You get a checklist of the tests performed. They will also flash a bootloader and updated Marlin for $10.</p> <p>Yeah, you’ll pay more but if you spend any time in...
<p>My friend found an Ender 3, basically the same thing as a cr-10, at Best Buy. I wouldn't be surprised if you came across a cr-10s there as well. Keep in mind if you are going to buy one, to also get a warranty as printers can come damaged and break later. It is better to be safe rather than sorry.</p>
838
<p>How to make this work in Opera? I found this piece of code for Opera, but it doesn't work for me:</p> <pre><code> function AddToFavorites(title, url) { if (window.sidebar) { // Mozilla Firefox Bookmark window.sidebar.addPanel(title, url,""); return false; } else if( window.external ) {...
<p><em>If</em> you insist on it, then do it without dynamically generated redundant links:</p> <pre><code> &lt;a href="http://real.url.example.com" title="Bookmark me, pleaeease!" rel="sidebar" onclick="return !addToFav(this.href,this.title)"&gt; </code></pre> <p>but please, just don't do it.</p> <p>As Oper...
<p>The following code works in Opera 8.54. It does not work in 9.27 or 9.63 (the only two other versions I have available for testing). In 9.27 and 9.63 it simply navigates you to Yahoo!:</p> <pre><code>var url = 'http://www.yahoo.com/'; var title = 'Yahoo!'; var elem = document.createElement('a'); elem.setAttribute('...
48,977
<p>If have created a custom role within SqlServer which I added to the db__denydatareader and db__denydatawriter roles. I think went through the db and granted exec permission to all neccersary stored procedures. </p> <p>Everything works fine, calling those sps will run fine. The one exception is a stored procedure wh...
<p>You can create a new user just for your stored procedure that uses execute_sql, grant him the requires rights and then add to the procedure definition WITH EXECUTE AS 'MyUser'. <a href="http://msdn.microsoft.com/en-us/library/ms188354.aspx" rel="nofollow noreferrer">See MSDN.</a></p>
<p>Use using the following statement for that . It worked for me.</p> <p>sp_addlinkedserver [ @server= ] 'server' [ , [ @srvproduct= ] 'product_name' ] [ , [ @provider= ] 'provider_name' ]</p> <pre><code> [ , [ @datasrc= ] 'data_source' ] [ , [ @location= ] 'location' ] [ , [ @provstr= ] 'provider_string' ]...
44,608
<p><code>%AX = (%AH + %AL)</code></p> <p>So why not <code>%EAX = (%SOME_REGISTER + %AX)</code> for some register <code>%SOME_REGISTER</code>? </p>
<p>Just for some clarification. In the early microprocessor days of the 1970's, CPUs had only a small number of registers and a very limited instruction set. Typically, the arithmetic unit could only operate on a single CPU register, often referred to as the "accumulator". The accumulator on the 8 bit 8080 &amp; Z80 pr...
<p>In the old 8-bit days, there was the A register.</p> <p>In the 16-bit days, there was the 16 bit AX register, which was split into two 8 bit parts, AH and AL, for those times when you still wanted to work with 8 bit values.</p> <p>In the 32-bit days, the 32 bit EAX register was introduced, but the AX, AH, and AL r...
28,240
<p>I am maintaining an application that was written in Visual Basic 6.0 and makes use of the several OLE controls with <code>Excel.Sheet.8</code> class objects. Several users are getting the following error when they reach a point in code that attempts to manipulate the excel objects. </p> <blockquote> <p>Run-time e...
<p>I believe you can interact with Lotus Notes from .net and query it to get you the xyz@xyz.xyz addresses in the group. I'm not very familiar with it but you could start here:</p> <ul> <li><p><a href="http://www.codeproject.com/KB/cs/lotusnoteintegrator.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs...
<p>I have to assume here that if this was allowed <em>and</em> working in .Net 1.1 it was because either .Net or the OS were appending the domain onto the group name "WebDeveloppersGroup", which is probably "WebDeveloppersGroup@yourdomain.com". The group may not be displayed that way in Lotus, but to receive external ...
43,778
<p>I have upgraded a MS Visual Studio Application from VS 2003 to VS 2008 (Targeting .NET 2.0). As part of the conversion process the wizard said I needed to take the additional step of Converting my Project to a Website by Right-Clicking and blah blah blah...</p> <p>I didn't follow directions and the web application ...
<p>There are two types of web applications in ASP.NET: The Web Site and Web Application Project. The difference between the two are discussed here:</p> <p><a href="http://www.dotnetspider.com/resources/1520-Difference-between-web-site-web-application.aspx" rel="noreferrer">Difference between web site and web applicati...
<blockquote> <p>There are two types of web applications in ASP.NET: The Web Site and Web Application Project. Convert to Website allows you to convert a Web Application Project to a Web Site.</p> </blockquote> <p>As far as I can recall, Convert to a Website does not do this, the Web Application project is a regula...
6,465
<p>My web app writes to several folders (logs, uploads, etc), and I've always set these permissions manually through my hosting provider.</p> <p>I'd like to create a setup script that performs this on new installations. Is this possible under Medium trust?</p> <p>I can't even call File.GetAccessControl, let alone Fi...
<p>Ok assuming you are using IIS and asp.net in the usual fashion you must have an asp.net account under which the framework executes your application on your behalf.</p> <p>The web application runs under a single account and through authentication users are programmatically granted access to do things that your "mast...
<p>You need to edit a config file in %windir%\Microsoft.NET\Framework{Version}\</p> <p>see <a href="http://msdn.microsoft.com/en-us/library/ms998341.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms998341.aspx</a></p>
27,009
<p>I'm using an Xml field in my Sql Server database table. I'm trying to search a word using the XQuery <strong>contains</strong> method but it seems to search <strong>only</strong> in case sensitive mode. The lower method isn't implemented on Sql Server XQuery implementation also. ¿Is there a simple solution to this p...
<p>If you're using SQL Server 2005, I'm afraid you're out of luck.</p> <p>If you're using SQL Server 2008, you can use the upper-case function like this :</p> <pre><code>DECLARE @x xml = N'abcDEF!@4'; SELECT @x.value('fn:upper-case(/text()[1])', 'nvarchar(10)'); </code></pre> <p>Here's a link on MSDN for the upper-c...
<p><em><a href="http://www.google.ru/search?complete=1&amp;hl=en&amp;newwindow=1&amp;client=firefox-a&amp;rls=org.mozilla%3Aen-US%3Aofficial&amp;hs=MdF&amp;q=Sql+Server+contains+function+xquery+case-insensitive&amp;btnG=%CF%EE%E8%F1%EA&amp;lr=&amp;aq=f&amp;oq=" rel="nofollow noreferrer">First</a></em> link from google ...
9,742
<p>A colleague would like to query a table in an Oracle database using SQL Server 2000, Enterprise Manager.</p> <p>He knows how to do the whole DTS thing, but doesn't want to go down that route for add hoc queries.</p> <p>Is there another way?</p>
<p>Here's a step-by-step guide: <a href="http://www.sqlmag.com/Article/ArticleID/49687/sql_server_49687.html" rel="nofollow noreferrer">Setting up an Oracle Linked Server</a></p> <p>Note that the default Microsoft driver for Oracle RDBMS doesn't work, hence you need to install the Oracle client (or instant client)</p>...
<p>You should be able to add it as a Linked Server (under Security in Enterprise Manager). You can then query it in the following way:</p> <p>SELECT * FROM OracleServer.Database.dbo.Table</p> <p> - Never used Oracle actually, so not sure if the "dbo" bit will be correct, or if this is only a SQL Server thing.</p>
26,892
<p>I want to have an executable file that will call some other programs. The way I would do this in Linux is with a simple bash script that looks like this:</p> <pre><code>#!/bin/bash echo "running some-program" /home/murat/some-program arg1 arg2 </code></pre> <p>What's the best way to do this kind of thing under Win...
<p>Take a look at <a href="http://www.microsoft.com/downloads/details.aspx?familyid=C6EF4735-C7DE-46A2-997A-EA58FDFCBA63&amp;displaylang=en" rel="noreferrer">PowerShell</a>, which is the closest you will get to a true scripting language like you have in Unix. Other than that, for simple things such as simply runnning a...
<p>Generally, the windows command line (DOS) is considered rather impoverished compared to *nix. You could install something like Cygwin or PowerShell if you want a powerful command shell, or you could cause yourself great pain and suffering to try using DOS for all your needs. :)</p>
37,971
<p>I want to set something up so that if an Account within my app is disabled, I want all requests to be redirected to a "disabled" message.</p> <p>I've set this up in my ApplicationController:</p> <pre><code>class ApplicationController &lt; ActionController::Base before_filter :check_account def check_account ...
<p>You have several options.</p> <p>If your action method "disabled" is uniquely named in the scope of the application, you can add an exception to the before_filter call, like this:</p> <pre><code>before_filter :check_account, :except =&gt; :disabled </code></pre> <p>If you want to check specifically for the contro...
<p>If theres not too many overrides then just put the if in the redirect filter</p> <p>if action != disabled redirect() end</p>
11,504
<p>I'm creating a few web forms that have areas to them.</p> <p>Are fieldsets viable options for sectioning forms anymore?</p> <p>Should I just use a div with styles to be similar?</p>
<p>Fieldsets make more sense semantically. However, different browsers render them slightly differently, but you can achieve some pretty good <a href="http://www.456bereastreet.com/lab/styling-form-controls-revisited/fieldset/" rel="nofollow noreferrer">cross browser results</a>. I guess it boils down to how pixel-perf...
<p>The fieldset tag is still an acceptable control to use, I use it on occasion myself. However, personally I find that since it renders slighly differnt in the browsers that I prefer to use a styled div, so I can be assured of the display format.</p>
26,883
<p>I've seen a couple of font topics on SO and it seems a majority of people use monospace fonts for programming tasks. I have been using Verdana for programming for a couple of years and I really like the enhanced readability, without missing anything monospace related.</p> <p>Why do you use a monospace font?</p>
<p>In a monospace font:</p> <ul> <li>Equal-length string literals look equal. </li> <li>It's easier to see thin punctuation marks like : () {}</li> <li>Similar characters look more different: Il 0O vs <code>Il 0O</code></li> <li>You know whether or not a line will wrap on a window X characters wide. This means that yo...
<p>I think, just like the issue of tab characters, the complicating factor is when something is indented for the purposes of alignment, and someone else has different preferences. Things get misaligned.</p>
26,900
<p>What's the best way to merge 2 or more dictionaries (<code>Dictionary&lt;T1,T2&gt;</code>) in C#? (3.0 features like LINQ are fine).</p> <p>I'm thinking of a method signature along the lines of:</p> <pre><code>public static Dictionary&lt;TKey,TValue&gt; Merge&lt;TKey,TValue&gt;(Dictionary&lt;TKey,...
<p>This partly depends on what you want to happen if you run into duplicates. For instance, you could do:</p> <pre><code>var result = dictionaries.SelectMany(dict =&gt; dict) .ToDictionary(pair =&gt; pair.Key, pair =&gt; pair.Value); </code></pre> <p>That will throw an exception if you get any ...
<p>Based on all the answers on this post, here's the most generic solution I could came up with.</p> <p>I created 2 versions of the IDictionary.Merge() extension :</p> <ul> <li>Merge&lt;T, U&gt;(sourceLeft, sourceRight)</li> <li>Merge&lt;T, U&gt;(sourceLeft, sourceRight, Func&lt;U, U, U&gt; mergeExpression)</li> </ul> ...
37,546
<p>When using an IoC container, is it considered good design to inject other classes into them? i.e. a persistence class</p>
<p>Generally I advise against it. Entities are just that and should represent some identifiable and important part of your core domain. They should have one responsibility and be very, very good at doing it. If the entity requires additional services in order to complete a task (say persist itself) you're starting to l...
<p>Absolutely. That's how you don't tie the class to some specific persistence implementation. Sometimes I write mock DAO classes that "persist" to memory structures only, and I inject these when unit testing.</p>
12,412
<p>Is there a way to disable entering multi-line entries in a Text Box (i.e., I'd like to stop my users from doing ctrl-enter to get a newline)?</p>
<p>I was able to do it on using KeyPress event. Here's the code example:</p> <pre><code>Private Sub SingleLineTextBox_ KeyPress(ByRef KeyAscii As Integer) If KeyAscii = 10 _ or KeyAscii = 13 Then '10 -&gt; Ctrl-Enter. AKA ^J or ctrl-j '13 -&gt; Enter. AKA ^M or ctrl-m K...
<p>not entirely sure about that one, you should be able to remove the line breaks when you render the content though, or even run a vbscript to clear it out, you just need to check for chr(13) or vbCrLf.</p>
3,947
<p>Given a table X and a view Y (that has the same structure as X) is there a way to rename X to Z and Y to X atomically so that no query will ever see nothing named X? Renaming X and creating the view would also be valid.</p> <p>The point would be to, as part of a schema migration plan, replace the old tables with vi...
<p>This is trivial in postgres and impossible in mysql.</p> <p>mysql exempts schema modifications from transactions. I have a postgres background, so that's an obvious thing to do (begin a transaction, do some stuff, commit or rollback -- postgres isn't picky about what "do some stuff" is).</p> <p>You can find a few...
<p>The other answers are incorrect.</p> <p>You can rename a bunch of tables, atomically, by listing multiple tables in the rename statement. </p> <p>See documentation <a href="http://dev.mysql.com/doc/refman/5.5/en/rename-table.html" rel="nofollow noreferrer">here</a></p>
42,360
<p>During recent discussions at work, someone referred to a trampoline function.</p> <p>I have read the description at <a href="http://en.wikipedia.org/wiki/Trampoline_(computers)" rel="noreferrer">Wikipedia</a>. It is enough to give a general idea of the functionality, but I would like something a bit more concrete....
<p>There is also the LISP sense of 'trampoline' as described on Wikipedia:</p> <blockquote> <p>Used in some LISP implementations, a trampoline is a loop that iteratively invokes thunk-returning functions. A single trampoline is sufficient to express all control transfers of a program; a program so expresse...
<pre><code>typedef void* (*state_type)(void); void* state1(); void* state2(); void* state1() { return state2; } void* state2() { return state1; } // ... state_type state = state1; while (1) { state = state(); } // ... </code></pre>
23,014
<p>Trying to create a user account in a test. But getting a Object reference is not set to an instanve of an object error when running it.</p> <p>Here's my MemberShip provider class, it's in a class library MyCompany.MyApp.Domain.dll:</p> <pre><code>using System; using System.Collections.Generic; using System.Web.Sec...
<p>I'm quite sure you should call provider.Initialize(...) in your test code before calling CreateUser.</p>
<p>Is the error directly on provider.CreateUser or somewhere down the stack inside it - perhaps you could check for null before calling.</p> <p>Perhaps a dependancy is missing - have you got the relevant DB dll's on the path?</p>
22,657
<p>I am trying to fade in a <p> on mouseover and fade out on mouseout:</p> <pre><code> $("p.follow").mouseover(function(){ $(this).fadeTo("slow", 1.00); }) $("p.follow").mouseout(function(){ $(this).fadeTo("fast", 0.50); }) </code></pre> <p>If you go to ryancoughlin.com and on the right side, if you ...
<p>Try this:</p> <pre><code>$("p.follow").hover(function() { $(this).stop().fadeTo("slow", 1.00); }, function() { $(this).stop().fadeTo("fast", 0.50); }); </code></pre> <p>Two key differences: I use the jQuery <a href="http://docs.jquery.com/Events/hover" rel="nofollow noreferrer"><code>hov...
<p>A mouseover-event is fired every time your mouse moves over the element. Since effects are executed sequentially and a mouseover is fired pretty frequently, you get a lot of effects that have to be executed "slow".</p> <p>What you probably want is the hover-event, which is only executed once for each entry.</p>
40,339
<p>Let's say you have a variable in a makefile fragment like the following:</p> <pre><code>MY_LIST=a b c d </code></pre> <p>How do I then reverse the order of that list? I need:</p> <pre><code>$(warning MY_LIST=${MY_LIST}) </code></pre> <p>to show</p> <pre><code>MY_LIST=d c b a </code></pre> <p>Edit: the real ...
<p>A solution in pure GNU make:</p> <blockquote> <p>default: all</p> <p>foo = please reverse me</p> <p>reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))</p> <p>all : @echo $(call reverse,$(foo))</p> </blockquote> <p>Gives:</p> <blockquote> <p>$ make</p...
<p>Playing off of both <a href="https://stackoverflow.com/a/52722/309233">Ben Collins'</a> and <a href="https://stackoverflow.com/a/52697/309233">elmarco's</a> answers, here's a punt to bash which handles whitespace "properly"<sup>1</sup></p> <pre><code>reverse = $(shell printf "%s\n" $(strip $1) | tac) </code></pre> ...
7,592
<p>Does anyone know where I can find an example of how to determine if the Maximize and/or Minimize buttons on a window are available and/or disabled?</p> <p>The window will not be in the same process as my application. I have the hWnd and I have tried using GetMenuItemInfo, but I can't find any good samples for how ...
<pre><code>bool has_maximize_btn = (GetWindowLong(hWnd, GWL_STYLE) &amp; WS_MAXIMIZEBOX) != 0; bool has_minimize_btn = (GetWindowLong(hWnd, GWL_STYLE) &amp; WS_MINIMIZEBOX) != 0; </code></pre>
<p>Use the <a href="http://msdn.microsoft.com/en-us/library/ms633516(VS.85).aspx" rel="nofollow noreferrer">GetWindowInfo</a> function.</p> <p>Test the <a href="http://msdn.microsoft.com/en-us/library/ms632610(VS.85).aspx" rel="nofollow noreferrer">WINDOWINFO</a> structure's dwStyle field and see if the WS_MAXIMIZEBOX...
40,129
<p>Programming is learned by writing programs. But code reading is said to be another good way of learning. I would like to improve my unit-testing skills by reading, examining real-world code. Could you recommend any open source projects where the source is extensively tested with unit tests?</p> <p>I'm interested in...
<p>AFAIK C++ Boost libraries - <a href="http://boost.org/" rel="nofollow noreferrer">http://boost.org/</a> - have broadly covered code base, and a policy that every new piece of code must have unit tests with it. Might be worth checking.</p>
<p>I wouldn't call it extensively, but <a href="http://www.wxwidgets.org/" rel="nofollow noreferrer">wxWidgets</a> does some UnitTest with <a href="http://cppunit.sourceforge.net" rel="nofollow noreferrer">CppUnit</a>.</p>
29,223
<p>I've been working with some C# legacy code and I've been seeing a lot of @ symbols in front of variable names. What does this signify or do?</p> <p>Currently I'm seeing it a lot in front of variables with common names that aren't reserved. E.g.:</p> <pre><code>MyProcedure(@step.LoadInstanceId, @step.ResultCode, @s...
<p>It's just a way to allow declaring reserved keywords as vars.</p> <pre><code>void Foo(int @string) </code></pre>
<p>The original question asks for a reason why one would escape a not-reserved word. What comes to my mind is that if <code>step</code> would become a reserved word in future the code example would still compile. I guess it is also a valid option for code generators.</p>
31,769