instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Ok so I just did something boneheaded.</p>
<p>I'm setting up a subversion server for the first time ever that will be used by contractors. I did the 1 click setup, created my project and did my first check in of our application thinking that I'll go through later and remove the password information in the connecti... | <p>To delete the project repository, just delete the folder from the server, then do svnadmin create again.</p>
<p>Will is right, I didn't read the password sentence correctly. Checking out and deleting won't help with the security concerns. When in doubt, <a href="http://svnbook.red-bean.com/" rel="nofollow noreferre... | <p>Just deleting the files from the current revision and doing a commit won't help with security concerns. The password will still exist in an old revision of the repository for the now-deleted file. CMS's FAQ link should help as well.</p>
| 44,797 |
<p>What is the configuration setting for modifying the default homepage in a Grails application to no longer be appName/index.gsp? Of course you can set that page to be a redirect but there must be a better way.</p>
| <p>Add this in UrlMappings.groovy </p>
<pre>
"/" {
controller = "yourController"
action = "yourAction"
}
</pre>
<p>By configuring the URLMappings this way, the home-page of the app will be yourWebApp/yourController/yourAction.</p>
<p>(cut/pasted from <a href="http://blog.intelligrape.com/?p=18" rel="norefe... | <p>All the answers are correct!
But let's imagine a scenario: </p>
<p>I mapped path "/" with the controller: "Home" and action: "index", so when i access "/app-name/" the controller Home gets executed, but if i type the path "/app-name/home/index", it will still be executed! so there are 2 paths for one resources. it ... | 4,751 |
<p>How can I play two or more video files/streams in different windows with frame-level synchronism?</p>
<p>What tools, libraries or APIs could I use to do that?</p>
<p>By frame-level synchronism I mean that my solution must guarantee that each frame of each video file must be shown at the same time its corresponding... | <p>On windows it should be possible to create custom directshow filters/components to do this.
We use c# and directshow.net to achieve something similar, however we do not yet have "true" frame synchronization and I am in fact searching for a solution as well.
The caveat here is that you can not just use the default/p... | <p>On OS X, the <a href="http://developer.apple.com/documentation/GraphicsImaging/Conceptual/CoreVideo/CVProg_Intro/chapter_1_section_1.html" rel="nofollow noreferrer">Core Video</a> framework will do the job. Core Video's express purpose is to provide a link between QuickTime media (such as audio and video) and the Qu... | 32,929 |
<p>Here's the problem I'm having, I've got a set of logs that can grow fairly quickly. They're split into individual files every day, and the files can easily grow up to a gig in size. To help keep the size down, entries older than 30 days or so are cleared out.</p>
<p>The problem is when I want to search these files ... | <p><code>grep</code> usually works pretty well for me with big logs (sometimes 12G+). You can find a version for windows <a href="http://gnuwin32.sourceforge.net/packages/grep.htm" rel="nofollow noreferrer">here</a> as well.</p>
| <p><a href="http://www.splunk.com/" rel="nofollow noreferrer" title="Splunk">Splunk</a> is great for searching through lots of logs. May be overkill for your purpose. You pay according to the amount of data (size of the logs) you want to process. I'm pretty sure they have an API so you don't have to use their front-... | 19,801 |
<p>Sorry if this sounds like a really stupid question, but I need to make a link change colour when you are on the page it links to.</p>
<p>For example, when you are on the "Questions" page of StackOverflow, the link at the top changes colour. How do you do this?</p>
| <p>It's a server-side thing -- when rendering the page, add a class like "current-page" to the link. Then you can style it separately from the other links.</p>
<p>For example, StackOverflow renders the links with <code>class="youarehere"</code> when it points to the page you're already on.</p>
| <p>You need code on the server for this. A simplistic approach is to compare the URL of the current page to the URL in the link; however consider that there are many different URLs in stackoverflow which all result in the 'Questions' tab being highlighted.</p>
<p>A more sophisticated version can either put something i... | 21,824 |
<p>I would like to use Exchange e-mail groups as an authentication scheme for an internal app. IE, if a user is in a certain mailing group, they are allowed in.</p>
<p>Any pointers on where to look for information with talking with Exchange from .NET?</p>
<p>EDIT: Exchange 2003.</p>
| <p>You don't need to talk to Exchange itself. All of the data is stored in Active Directory which has very simple to use APIs within the .NET framework. Exchange e-mail groups are stored in AD as global distribution groups. All you need to do is ask if the user is a member of a specific group.</p>
| <p>If you have Exchange 2007 you could use the web service interface to talk to Exchange from .NET.</p>
<blockquote>
<p><a href="http://msdn.microsoft.com/en-us/library/bb408417.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb408417.aspx</a></p>
</blockquote>
<p>I haven't used this interfa... | 44,862 |
<p>I'm working on a method that accepts an expression tree as a parameter, along with a type (or instance) of a class.</p>
<p>The basic idea is that this method will add certain things to a collection that will be used for validation.</p>
<pre><code>public interface ITestInterface
{
//Specify stuff here.
}
private... | <p>Collecting PropertyInfo objects from Expression.Body seems similar to <a href="https://stackoverflow.com/questions/123088/possible-pitfalls-of-using-this-extension-method-based-shorthand#144982">my solution</a> to another question. </p>
| <p>I appreciate what you are trying to do with the property here. I have run into this conundrum. It always feels weird to write:</p>
<pre><code>DoSomething("MyProperty", new OtherClass());
</code></pre>
<p>If the property ever changes name, or the text is mistyped in the call, then there will be a problem. What I... | 18,845 |
<p>I have a micro-mini-search engine that highlights the search terms in my rails app. The search ignores accents and the highlight is case insensitive. Almost perfect.
But, for instance if I have a record with the text "pão de queijo" and searches for "pao de queijo" the record <strong>is</strong> returned but the iex... | <p>I've just submitted a patch to Rails thats solves this.</p>
<p><a href="http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3593-patch-support-for-highlighting-with-ignoring-special-chars" rel="nofollow noreferrer">http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3593-patch-support-... | <p>it sounds like you are using two different methods for deciding whether a match has occured or not: one for your search, and one for the hilight. Use the same method as your search for your highlighting and it should pick it up, no? </p>
| 17,141 |
<p>I'm doing a PHP site which displays code examples in various languages (C#, PHP, Perl, Ruby, etc.). Are there any PHP functions which add syntax coloring for these and other languages? </p>
<p>If not, I would at least like to find that one built-in PHP function which does syntax coloring for PHP code, can't find it... | <p>Why not do the syntax coloration in the client side?</p>
<p>Use <a href="http://code.google.com/p/google-code-prettify/" rel="nofollow noreferrer">prettify.js</a>, its really versatile, Google Code and StackOverflow use it!</p>
<p>Check the <a href="http://google-code-prettify.googlecode.com/svn/trunk/tests/pretti... | <p>As already mentioned Google prettify.js is really good, but if you want to do it on the server in PHP you could try looking at <a href="http://pear.php.net/package/Text_Highlighter" rel="nofollow noreferrer">Pear Text Highlighter</a></p>
| 39,531 |
<p>How can I get all items from a specific calendar (for a specific date).
Lets say for instance that I have a calendar with a recurring item every Monday evening. When I request all items like this:</p>
<pre><code>CalendarItems = CalendarFolder.Items;
CalendarItems.IncludeRecurrences = true;
</code></pre>
<p>I only... | <p>I believe that you must Restrict or Find in order to get recurring appointments, otherwise Outlook won't expand them. Also, you must Sort by Start <em>before</em> setting IncludeRecurrences.</p>
| <pre><code>calendarFolder =
mapiNamespace.GetDefaultFolder(
Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
</code></pre>
| 11,622 |
<p>What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, <code>['a', 'b', 'c']</code> to <code>'a,b,c'</code>? (The cases <code>['s']</code> and <code>[]</code> should be mapped to <code>'s'</code> a... | <pre><code>my_list = ['a', 'b', 'c', 'd']
my_string = ','.join(my_list)
</code></pre>
<pre><code>'a,b,c,d'
</code></pre>
<p>This won't work if the list contains integers</p>
<hr>
<p>And if the list contains non-string types (such as integers, floats, bools, None) then do:</p>
<pre><code>my_string = ','.join(map(st... | <p>My two cents. I like simpler an one-line code in python:</p>
<pre><code>>>> from itertools import imap, ifilter
>>> l = ['a', '', 'b', 1, None]
>>> ','.join(imap(str, ifilter(lambda x: x, l)))
a,b,1
>>> m = ['a', '', None]
>>> ','.join(imap(str, ifilter(lambda x: x, m)))... | 6,653 |
<p>I want to put my dependent files in the app directory.</p>
<p>I seem to remember that you can force VB6 to use the files in the local directory only.</p>
<p>Any hints?</p>
| <p>You may also want to try setting up <a href="http://msdn.microsoft.com/en-us/magazine/cc188708.aspx" rel="nofollow noreferrer">Reg-Free COM</a> for your project. There's a freeware called <a href="https://github.com/wqweto/UMMM" rel="nofollow noreferrer">Unattended Make My Manifest</a> that will do most of the work... | <p>Found it myself:</p>
<p>Windows does look in the App Directory first:
If SafeDllSearchMode is enabled, the search order is as follows:</p>
<ol>
<li>The directory from which the application loaded.</li>
<li>The system directory. Use the GetSystemDirectory function to get the path of this directory.</li>
<li>The 16-... | 44,900 |
<p>I want to add the ability to submit, moderate and display comments on an existing set of websites. Surely there's already a bunch of open source components that can handle the following:</p>
<ol>
<li>Comment submission </li>
<li>Markup validation</li>
<li>Private comment moderation</li>
<li>Threaded comment display... | <p>Check out <a href="http://code.google.com/p/demisauce/" rel="nofollow noreferrer">Demi Sauce</a>.</p>
<p>From the Google Code description:</p>
<blockquote>
<p>Demi Sauce is an application that
offers web services to other
applications. It operates as a server
in your environment that other
applications u... | <p>Well, I think the problem here is that to comment, one really needs to comment <em>on</em> Something, so pretty much any app your find will also include the Something (like a blog engine). </p>
<p>Further, without knowing what that Something is on your website, it's kind-a hard to write an app that will attach com... | 27,906 |
<p>I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer)</p>
| <p>The first and most dramatic performance problem that you can run into with NHibernate is if you are creating a new session factory for every session you create. Only one session factory instance should be created for each application execution and all sessions should be created by that factory.</p>
<p>Along those ... | <p>What lotsoffreetime said.</p>
<p>Read Chapter 19 of the documentation, "Improving Performance".<br>
NHibernate: <a href="http://nhibernate.info/doc/nhibernate-reference/performance.html" rel="nofollow noreferrer">http://nhibernate.info/doc/nhibernate-reference/performance.html</a><br>
Hibernate: <a href="http://doc... | 9,268 |
<p>i need to check whether the user clicking the browser Refresh button and redirect to error page. Can we do this in javascript or any server side methods in ASP.net</p>
| <p>If you give each link you present a unique ID (e.g. a GUID) in the URL as a parameter, then you can keep track of all the requests you've processed. (You could clear out "old" requests if you don't mind the mechanism not working if someone leaves a browser open for a few days and then hitting refresh.) The first tim... | <p>you can use client side hidden variable to store a counter or you can put counter in session. Well I would suggest you to expire the page on refresh there are ways you can achieve this disable cache etc [like all banks website do].</p>
| 37,515 |
<p>I know I can get the public static members of a class by doing something like:</p>
<p><code>obj.getClass().getFields()</code></p>
<p>but this doesn't get me the enums. I'd like to be able to get them from the Class object returned by the getClass method. Any ideas?</p>
| <p>(Turned into a community wiki as it looks like there's scope for a fair amount of expansion, e.g. to include tackline's comments. No sense in me just transcribing comments when everyone could be expanding it.)</p>
<p>Do you mean enums nested within a top-level class? If so, use <code><a href="http://java.sun.com/ja... | <p>obj.getClass().getEnumConstants()</p>
| 23,829 |
<p>I'm trying to get a regex that will match:</p>
<pre><code>somefile_1.txt
somefile_2.txt
somefile_{anything}.txt
</code></pre>
<p>but not match:</p>
<pre><code>somefile_16.txt
</code></pre>
<p>I tried</p>
<pre><code>somefile_[^(16)].txt
</code></pre>
<p>with no luck (it includes even the "16" record)</p>
| <p>Some regex libraries allow lookahead:</p>
<pre><code>somefile(?!16\.txt$).*?\.txt
</code></pre>
<p>Otherwise, you can still use multiple character classes:</p>
<pre><code>somefile([^1].|1[^6]|.|.{3,})\.txt
</code></pre>
<p>or, to achieve maximum portability:</p>
<pre><code>somefile([^1].|1[^6]|.|....*)\.txt
</c... | <p>Without using lookahead</p>
<pre><code>somefile_(|.|[^1].+|10|11|12|13|14|15|17|18|19|.{3,}).txt
</code></pre>
<p>Read it like: <code>somefile_</code> followed by either:</p>
<ol>
<li>nothing.</li>
<li>one character.</li>
<li>any one character except <code>1</code> and followed by any other characters.</li>
<li>t... | 40,606 |
<p>I'm trying to rebuild an old metronome application that was originally written using <code>MFC</code> in C++ to be written in <code>.NET</code> using <code>C#</code>. One of the issues I'm running into is playing the midi files that are used to represent the metronome "clicks".</p>
<p>I've found a few articles onli... | <p>I think you'll need to p/invoke out to the windows api to be able to play midi files from .net.</p>
<p>This codeproject article does a good job on explaining how to do this:
<a href="http://www.codeproject.com/KB/audio-video/vbnetSoundClass.aspx" rel="nofollow noreferrer">vb.net article to play midi files</a></p>
... | <p>System.Media.<strong>SoundPlayer</strong> is a good, simple way of playing WAV files. WAV files have some advantages over MIDI, one of them being that you can control precisely what each instrument sounds like (rather than relying on the computer's built-in synthesizer).</p>
| 3,027 |
<p>This concept is new to me, and a colleague suggested it. Sadly, I had no idea what he was talking about. Can someone enlighten me?</p>
| <p>You can find plenty of information about it <a href="http://msdn.microsoft.com/en-us/library/aa302338.aspx" rel="noreferrer">here</a>.</p>
<p>In a nutshell, a PIA is a signed interop assembly that provides the "official" definition of types in a COM library from the publisher of the COM library.</p>
<p>As to the b... | <p>Simply saying through an example,if you want to develop an application resembles like any other office tools(MS word,visio...) with extended functionality, you can use the functionality of office tools in your project using PIA.In my class diagram drawing app,use
visio panel for class diagram creation.</p>
| 25,081 |
<p>Is there a good test suite or tool set that can automate website navigation -- with Javascript support -- and collect the HTML from the pages?</p>
<p>Of course I can scrape straight HTML with BeautifulSoup. But this does me no good for sites that require Javascript. :)</p>
| <p>You could use <a href="http://selenium.dev/" rel="nofollow noreferrer">Selenium</a> or <a href="http://watir.com/" rel="nofollow noreferrer">Watir</a> to drive a real browser.</p>
<p>Ther are also some JavaScript-based headless browsers:</p>
<ul>
<li><a href="http://www.phantomjs.org/" rel="nofollow noreferrer">Phan... | <p>Keep in mind that and javascript fanciness is messing with the brower's internal DOM model of the page, and does nothing to the raw HTML.</p>
| 15,218 |
<p>I have a <strong>DLL</strong> with some <strong>COM objects</strong>. Sometimes, this objects <strong>crashes</strong> and register an error event in the Windows Event Log with lots of hexadecimal informations. I have no clue why this crashes happens. </p>
<p>So, How can I trace those COM objects exceptions?</p>
| <p>The first step is to lookup the Fail code's hex value (E.G. E_FAIL 0x80004005). I've had really good luck with posting that value in Google to get a sense of what the error code means. </p>
<p>Then, I just use trial and error to try to isolate the location in code that's failing, and the root cause of the failure... | <p>If you just want a really quick way to find out what the error code means, you could use the "Error Lookup" tool packaged with Visual Studio (details <a href="http://msdn.microsoft.com/en-us/library/akay62ya(VS.80).aspx" rel="nofollow noreferrer">here</a>). Enter the hex value, and it will give you the string descr... | 3,215 |
<p>I was looking at <a href="http://datamapper.org/" rel="noreferrer">DataMapper</a>, which appeared at first glance to use the ActiveRecord ORM pattern. Other people said that it uses the DataMapper and/or the Domain Object pattern. </p>
<p>What is the difference between those patterns? </p>
| <p>The main difference between the two patterns is this:</p>
<ul>
<li><p>In the ActiveRecord you have one domain object that both knows all the business logic and how to save/update itself in the database, user.getLinkToProfile() and User::find(1), User::save(user)</p></li>
<li><p>In the DataMapper pattern you have on... | <p>Active record is very heavy, data mapper and domain object are separating those concerns out so you have a more defined set of code doing various aspects for you "domain" or "entity" objects.</p>
<p>I personally prefer, not that you asked, going with the separation into domain object, data mapper, probably use an a... | 11,938 |
<p>I have a <code><button></code> with an accesskey assgined to it. The accesskey works fine as long as the button is visible, but when I set <code>display: none</code> or <code>visibility: hidden</code>, the accesskey no longer works.</p>
<p>Also tried without success:</p>
<ul>
<li>Use a different element type... | <p>The behavior you are seeing is correct, you cannot "access" an element that is not displayed. Sal's suggestion will almost certainly work, but may I ask what your purpose is in doing this? There is probably a better way to accomplish what you are trying to achieve. Have you considered using a keypress handler?</p... | <p>Instead of visibility or display attributes, position the button outside of the page</p>
<pre><code><button accesskey="a" style="position: absolute; top: -9999px">button</button>
</code></pre>
<p>Warning: using left instead of top causes a weird display bug in ie7</p>
| 30,251 |
<p>I know that the SLS 3D printer stands for selective laser sintering,where as DMLS stands for direct metal laser sintering.</p>
<p>I want to know that,can i convert SLS 3D printer to DMLS.</p>
<p>By just changing powder(or another way?)</p>
| <p>By just changing powder: No.<br>
Changing the powder, the laser and the chamber, maybe you can get something, but it's not recommended.<br>
DMLS machines use a sealed chamber with a flow of Argon, Nitrogen, or other gas to prevent oxidation of metal powder (and avoid fire or explosions).<br>
Laser power for metal ne... | <p>Totally agreed with the answer provided.To add to that answer, the use of DMLS lies on the thickness and material limitations of SLS method. So, regarding the amount of thickness, the <a href="http://www.atlanticprecision.com" rel="nofollow">original source</a> of sizing for both the methods vary drastically and hen... | 291 |
<p>Not storing left-over photopolymer resin back with pristine resin in its original shipping can seems to be a common recommendation.</p>
<p>What is the best practice here? Store in a separate bottle and pour this "once around the block" resin first for the next print?</p>
| <h2>Safety first</h2>
<p>I suggest the following handling of resins, some basic stuff first:</p>
<ul>
<li><strong>ALWAYS</strong> wear disposable, one-use gloves when handling resin.</li>
<li>Respirators are highly advised to be worn.</li>
<li>Work in a well-ventilated area.</li>
<li>Tools dedicated to resin handling a... | <p>Considerations for storing resin include using a light-tight bottle, preventing stray ultraviolet radiation from prematurely curing the resin.</p>
<p>You'll also note that users will filter the resin through a fine mesh filter. I've seen some videos in which the user pours through coffee filters to remove as many pa... | 1,752 |
<p>How can I get the filename from a file path in Ruby?</p>
<p>For example if I have a path of <code>"C:\projects\blah.dll"</code> and I just want the "blah".</p>
<p>Is there a <code>LastIndexOf</code> method in Ruby?</p>
| <p>Try <a href="http://ruby-doc.org/core-1.8.7/classes/File.html#M000803" rel="noreferrer"><code>File.basename</code></a></p>
<blockquote>
<p>Returns the last component of the filename given in file_name, which must be formed using forward slashes (``/’’) regardless of the separator used on the local file system. If su... | <p>You can get directory path to current script with:</p>
<pre><code>File.dirname __FILE__
</code></pre>
| 48,953 |
<p>I'm tring to build a library for simplifing late binding calls in C#, and I'm getting trouble tring with reference parameteres. I have the following method to add a parameter used in a method call</p>
<pre><code> public IInvoker AddParameter(ref object value)
{
//List<object> _parameters = new ... | <p>If the value is changing <em>inside the method</em>, you will need to declare a temp (<code>object</code>) variable to pass (<code>ref</code>) to the method, and unbox it yourself afterwards:</p>
<pre><code> int i = 3;
//...
object obj = i;
Foo(ref obj);
i = (int)obj;
</code></pre>
<p>Note that ... | <p>Ok, thanks to Jon Skeet corrections and Mark Gravell code, i've come up with this interface:</p>
<pre><code> //This will be created with a factory
IOperationInvoker invoker = new OperationInvoker(Activator.CreateInstance<MyLateBindingTestType>());
int param1 = 2;
object paramOb... | 35,947 |
<p>I am in a position where I could become a team leader of a team distributed over two countries. This team would be the tech. team for a start up company that we plan to bootstrap on limited funds. So I am trying to find out ways to minimize upfront expenses. Right now we are planning to use Java and will have a l... | <p>I am assuming you are talking about <em>continuous</em> integration.</p>
<p>You can run <a href="http://cruisecontrol.sourceforge.net/" rel="nofollow noreferrer">CruiseControl</a> on a virtual machine or an old machine, but if it needs to be up in the Internet, you can try virtual dedicated server hosting services.... | <p>I am assuming you are talking about <em>continuous</em> integration.</p>
<p>You can run <a href="http://cruisecontrol.sourceforge.net/" rel="nofollow noreferrer">CruiseControl</a> on a virtual machine or an old machine, but if it needs to be up in the Internet, you can try virtual dedicated server hosting services.... | 8,523 |
<p>See here <a href="http://www.hanselman.com/blog/InSearchOfThePerfectMonospacedProgrammersFontInconsolata.aspx" rel="nofollow noreferrer">http://www.hanselman.com/blog/InSearchOfThePerfectMonospacedProgrammersFontInconsolata.aspx</a> - for want of a better description - the statement block highlighting - eg in the pi... | <p>I use the latest version of ReSharper that is currently available — ReSharper 4.5 — but unfortunately I don't believe there is any feature for drawing a vertical line between matching braces, as in the screen-shots you referenced.</p>
<p>The feature I find useful, which Ben mentioned, is the matching brace highligh... | <p>Notepad ++ has a nice brace matching feature, with vertical lines matching the braces. It's not VS, so I only use it when I am faced with some confusing JS, cut and paste, figure out the braces and go back to VS. It would be GREAT if this sort of feature existed in VS, or R#. </p>
| 7,394 |
<p>I have recently started using Vim as my text editor and am currently working on my own customizations.</p>
<p>I suppose keyboard mappings can do pretty much anything, but for the time being I'm using them as a sort of snippets facility almost exclusively.</p>
<p>So, for example, if I type <code>def{TAB}</code> (<c... | <p>Snipmate - like texmate :)
<a href="http://www.vim.org/scripts/script.php?script_id=2540" rel="noreferrer">http://www.vim.org/scripts/script.php?script_id=2540</a></p>
<p>video:
<a href="http://vimeo.com/3535418" rel="noreferrer">http://vimeo.com/3535418</a></p>
<pre><code>snippet def
""" ${1:docstring} """
... | <p>As noted by MDCore, <a href="http://www.vim.org/scripts/script.php?script_id=1318" rel="nofollow noreferrer">SnippetsEmu</a> is a popular Vim script that does just that and more. If you need only expanding (without moving back the caret), you can use the standard <code>:ab[breviate]</code> command.</p>
<pre><code>:... | 3,615 |
<p>Here's a code snippet. . .</p>
<pre><code><form name="FinalAccept" method="get"><br>
<input type="radio" name="YesNo" value="Yes" onclick="/accept"> Yes<br>
<input type="radio" name="YesNo" value="No" onclick="/accept"> No<br>
</code></pre>
<p>Clearly, what I'm trying to do is... | <p>If you want to submit the entire form when the user clicks on a radio button, then try this:</p>
<pre><code><form name="FinalAccept" method="get" action="accept"><br>
<input type="radio" name="YesNo" value="Yes" onclick="this.form.submit();"> Yes<br>
<input type="radio" name="YesNo" value... | <p>Your onClick event is expecting some javascript code:</p>
<pre><code>onclick="SomeJavaScriptCode"
</code></pre>
<p>More here: <a href="http://www.w3schools.com/jsref/jsref_onClick.asp" rel="nofollow noreferrer">http://www.w3schools.com/jsref/jsref_onClick.asp</a></p>
<p>So, you should be doing something like this... | 43,121 |
<p>I need to be able to determine when <code>ContainsFocus</code> changes on a <code>Control</code> (specifically a windows form). Overriding <code>OnGotFocus</code> is not the answer. When I bring the form to the foreground, <code>ContainsFocus</code> is true and <code>Focused</code> is false. So is there an <code>OnG... | <p>Note: GotFocus events of the child controls are fired if you have a child control. Otherwise OnGotFocus of the form is called.</p>
<p>If I understood the question correctly, then this should work:</p>
<pre><code> bool lastNotificationWasGotFocus = false;
protected override void OnControlAdded(ControlEventA... | <p>Handling the GotFocus and LostFocus events should do it.</p>
<p>Another thing to note... the SDK says this about the ContainsFocus property:</p>
<blockquote>
<p>You can use this property to determine
whether a control or any of the
controls contained within it has the
input focus. To determine whether the
... | 44,907 |
<p>i noticed that paypal displays a very different favicon,
one that's not just a simple 16x16 icon and is lengthy?
anyone can teach me?</p>
| <p>I think you are refering to the green box that shows the PayPal logo followed by "PayPal, Inc. (US)". </p>
<p>If so, it is not a favicon, but a feature of Firefox 3 to show sites with extended validation (EV). See also <a href="http://news.cnet.com/8301-13554_3-9974672-33.html" rel="nofollow noreferrer">http://news... | <p>Its easy. Under the {title} tag, you put this code.
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="shortcut icon" type="image/png" href="images/favicon.png"&g... | 25,396 |
<p>I start to write a client - server application using .net (C#) for both client and server side.</p>
<p>Unfortunately, my company refuse to pay for Windows licence on server box meaning that I need to rewrite my code in Java, or go to the Mono way.</p>
<p>Is there any good way to translate C# code in Java ? The ser... | <p>I'd suggest building for Mono. You'll run into some gray area, but overall it's great. However, if you want to build for Java, you might check out <a href="http://dev.mainsoft.com/Default.aspx?tabid=130" rel="noreferrer">Grasshopper</a>. It's a commercial product, but it claims to be able to translate CIL (the outpu... | <p>I only know the other way. <a href="http://www.db4o.com/" rel="nofollow noreferrer">Dbo4</a> is developed in java and the c# version is generated from the java sources automaticaly.</p>
| 9,077 |
<p>A problem I've encountered a few time in my career is in a tiered service architecture a single downstream system can bring down the entire client application if it gets into a state where all its threads are consumed on a deadlock or some sort of infinite loop bug in that system. Under these conditions the server s... | <p>You are correct in that the MDB case is the normal solution, and it typically supports timeouts as well which will help keep from hanging requests. That being said, it may not really fix the problem but just shift the backup to your JMS queue without responses ever being sent back to the client. Of course if only ... | <p>We use MDBs where the queue is persisted in a database which has the benefit of messages not being lost if the system goes down.</p>
<p>You may also want to establish an asynchronous contract between the participating parties. What I mean by this is that a client will send you a message and rather than you doing a ... | 37,949 |
<p>using <code>register_shutdown_function</code> I can register code to execute at the end of a PHP script execution "no matter what".</p>
<p>Can I have more than one function registered?</p>
<p>This question arises since I may not know if someone has already registered one when I'm about to register my own.</p>
<p>... | <p>Nevermind, the answer is yes. Manual: </p>
<p><a href="http://ca3.php.net/register_shutdown_function" rel="nofollow noreferrer">http://ca3.php.net/register_shutdown_function</a></p>
| <p>Yes, each will be called in the order it was registered, per the <a href="http://us2.php.net/register_shutdown_function" rel="nofollow noreferrer">PHP documentation</a>.</p>
| 29,956 |
<p>I'm using the RESTful authentication Rails plugin for an app I'm developing.
I'm having a strange issue I can't get to the bottom of.
Essentially, the first time I log into the app after a period of inactivity (the app is deployed in production, but only being used by me), I will be brought to a 404 page, but if I g... | <p>Please check your routes.</p>
<p>Not all routes are created equally. Routes have priority defined by the order of appearance of the routes in the config/routes.rb file. The priority goes from top to bottom. The last route in that file is at the lowest priority and will be applied last. If no route matches, <strong>... | <p>I'm using a slightly modified version of that plugin so I'm not 100% sure that this will be the same for you, but for me the default is to redirect to the root path, or the page you were trying to get to if there is one. (check your lib/authenticated_system.rb to see your default) If you don't have map.root define... | 5,989 |
<p>I created a list of lists:</p>
<pre><code>xs = [[1] * 4] * 3
# xs == [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]
</code></pre>
<p>Then, I changed one of the innermost values:</p>
<pre><code>xs[0][0] = 5
# xs == [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]]
</code></pre>
<p>Why did every first element of each subli... | <p>When you write <code>[x]*3</code> you get, essentially, the list <code>[x, x, x]</code>. That is, a list with 3 references to the same <code>x</code>. When you then modify this single <code>x</code> it is visible via all three references to it:</p>
<pre><code>x = [1] * 4
xs = [x] * 3
print(f"id(x): {id(x)}"... | <p>I arrived here because I was looking to see how I could nest an arbitrary number of lists. There are a lot of explanations and specific examples above, but you can generalize N dimensional list of lists of lists of ... with the following recursive function:</p>
<pre class="lang-py prettyprint-override"><code>import ... | 29,729 |
<p>I have what seems like a typical usage scenario for users downloading, editing and uploading a document from a web page.</p>
<ol>
<li>User clicks a link to download a document</li>
<li>User edits downloaded file</li>
<li>User saves the file</li>
<li>User goes back to the web page and uploads the new file with the c... | <p>Actually, despite the fact that you have more flexibility with AJAX in developing application, the problem of uploading multiple files is not solved yet. </p>
<p>To the thoughts you've mentioned in your question:</p>
<ol>
<li><p><strong>Google Docs:</strong>
Online apps like Google docs are certainly appealing for... | <p>Clear instructions to save to their desktop is a start. Then clear instructions to go to the desktop to re-up it. I've not run across an online MSWord viewer/editor or whatever format the file is, but I'm sure they exist, now that Google Docs and a few other online versions of MSOffice exist.</p>
| 49,906 |
<p>I know I did something stupid. I just had to have a SLA 3d printer. The issue being I live in a one bedroom apartment. In the months of owning it I have made lots of amazing pieces, I also for the first time in my life have not only allergies, but sever allergies. I thought I had the flu, and has been most of the la... | <p>First things first: Resin is very aggressive. It can very easily make you hypersensitive, even to the fumes of it. So step 1 is easy:</p>
<h2>Limit exposure</h2>
<p>Wear gloves when working with resin. As you live with your printer in the same room, bottle up the resin right after use and only open it during use to ... | <p>One of the options you have would be to create a negative pressure in your working area. This would be accomplished by installing a fan with the flow direction to the outside. The inside portion of the fan should have ducting that terminates near your printer. You could place your printer in something elaborate, or ... | 1,265 |
<p>I have an array of different type objects and I use a BinaryWriter to convert each item to its binary equivalent so I can send the structure over the network.</p>
<p>I currently do something like </p>
<pre><code>for ( i=0;i<tmpArrayList.Count;i++)
{
object x=tmpArrayList[i];
if (x.GetType() == typeof(byt... | <p>No. The cast has to be known at compile-time, but the actual type is only known at execution time.</p>
<p>Note, however, that there's a better way of testing the type calling GetType. Instead of:</p>
<pre><code>if (x.GetType() == typeof(byte))
</code></pre>
<p>Use:</p>
<pre><code>if (x is byte)
</code></pre>
<p... | <p>This is a case of needing something called <a href="http://c2.com/cgi/wiki?DoubleDispatch" rel="nofollow noreferrer">Double Dispatch</a>.</p>
<p>I'm going to assume that the wrt object is one you wrote yourself (Let's say it is of type Writer). Here is what you could do:</p>
<pre><code>class Writer
{
void writ... | 46,994 |
<p>Does anyone know of any disadvantages of MARS (Multiple Active Result Sets)? Does anyone know of any reason why one should avoid using MARS, like cases where cursors are more useful then MARS.</p>
| <p>There are apparently at least two known (potential) drawbacks (from this (1) <a href="http://blogs.msdn.com/sqlnativeclient/archive/2006/09/27/774290.aspx" rel="nofollow noreferrer">Team blog</a>):</p>
<ol>
<li><p>Obviously this can cause potential problems for any legacy systems which weren't designed to run agains... | <p>depending on what? there are no real disadvantages.</p>
<p>they don't support Transaction savepoints. but i don't think of this as a disadvantage.</p>
| 48,970 |
<p>Is there a built in function equivalent to .NET's</p>
<pre><code>Guid.NewGuid();
</code></pre>
<p>in Cocoa?</p>
<p>My desire is to produce a string along the lines of <code>550e8400-e29b-41d4-a716-446655440000</code> which represents a unique identifier.</p>
| <p>UUIDs are handled in Core Foundation, by the CFUUID library. The function you are looking for is <a href="http://Developer.Apple.Com/documentation/CoreFoundation/Reference/CFUUIDRef/Reference/reference.html#//apple_ref/c/func/CFUUIDCreate" rel="noreferrer">CFUUIDCreate</a>.</p>
<p>FYI for further searches: these are... | <p>Check out the <a href="http://en.wikipedia.org/wiki/UUID" rel="nofollow noreferrer" title="GUID">Wikipedia</a> article and the <a href="http://en.wikipedia.org/wiki/Core_Foundation" rel="nofollow noreferrer" title="Wikipedia:Core Foundation">Core Foundation</a> page.</p>
| 37,233 |
<p>I have a web application using ASP.NET 2.0 and I want to know if I should be moving it to ASP.NET 3.5, particularly... what am I missing by not moving to ASP.NET 3.5?</p>
<p>I understand the disadvantages, but I don't understand the advantages.</p>
<p>What are the biggest benefits of migrating/rewriting? </p>
<p>... | <p>You will only miss access to the newer .NET 3.5 libraries, and cool syntax such as LINQ and lambda expressions. Performance wise they will run the same.</p>
<p>By the way, ASP.NET MVC is NOT included with .NET 3.5...yet.</p>
| <p>LINQ, dude. LINQ. Don't knock it 'till you've tried it. ORM is fun again!</p>
| 15,957 |
<p>I find the following things extremely useful in my daily work:</p>
<ul>
<li>ido</li>
<li>emacs muse</li>
<li>Cscope</li>
<li>desktop</li>
<li>tabbar</li>
</ul>
| <p>I've become a huge fan of <strong>org-mode</strong> and muse-mode. I use muse-mode, which I discovered before discovering org-mode to manage a local wiki where I keep mostly work-related notes. </p>
<p>I use org-mode to manage my tasks and use it to take notes. As a task manager I've found it unbeatable. I intend ... | <p>As a Drupal/PHP developer:</p>
<ul>
<li>emacs-starter-kit</li>
<li><strong>org-mode</strong></li>
<li>magit</li>
<li>nxhtml</li>
<li>geben</li>
<li>ECB</li>
</ul>
<p>And pianobar for good measure</p>
| 34,215 |
<p>Anyone come across this error when trying to import a WSDL in Flex builder 3?</p>
<p>Seems it only occurs when trying to import a WCF based service which has 'virtual' endpoints...</p>
<p>Some digging around makes me think Flex has trouble parsing the wsdl (however standard web services work fine).</p>
<p>A bug h... | <p>I am using Flex Builder 3 and the solution found here <a href="http://poradowski.com/fb/" rel="nofollow">http://poradowski.com/fb/</a> that was mentioned in the adobe bug base at FB-13542 worked for me. I just backed up the com.adobe.flexbuilder.axis2_3.0.214193.jar file and put the updated jar file in it's place. ... | <p>This generally happens when you are using the StAX API, and you do not have a StAX implementation in your classpath. See <a href="http://forums.java.net/jive/thread.jspa?messageID=117971" rel="nofollow noreferrer">http://forums.java.net/jive/thread.jspa?messageID=117971</a></p>
<p>I am not too familiar with Flex - ... | 43,081 |
<p>Is there any difference between having 4 .5GB memcache servers running or one 2GB instance? </p>
<p>Does running multiple instances offer any benifits?</p>
| <p>High availability is nice, and memcached will automatically distribute your cache across the 4 servers. If one of those servers dies for some reason, you can handle that error by either just continuing as if the cache was blank, redirecting to a different server, or any sort of custom error handling you want. If you... | <p>I would also add that theoretically, in case of several machines, it might save you some performance, as if you have a lot of frontends doing a lot of heavy reads, it's much better to split them into different machines: you know, network capabilities and processing power of one machine can become an upper bound for ... | 16,263 |
<p>I'm searching for UUIDs in blocks of text using a regex. Currently I'm relying on the assumption that all UUIDs will follow a patttern of 8-4-4-4-12 hexadecimal digits.</p>
<p>Can anyone think of a use case where this assumption would be invalid and would cause me to miss some UUIDs?</p>
| <p>The regex for uuid is:</p>
<pre><code>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
</code></pre>
<p>If you want to enforce the full string to match this regex, you will sometimes (your matcher API may have a method) need to surround above expression with <code>^...$</code>, that is</p>
<pre><code>^[0... | <p>Official <a href="https://www.npmjs.com/package/uuid" rel="nofollow noreferrer">uuid library</a> uses following regex:</p>
<pre><code>/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i
</code></pre>
<p>See <a href="https://github.com/uuidjs/uuid/blob... | 16,520 |
<p>For a new project I have to import the pre-existing data from MySql.</p>
<p>In <a href="http://www.connectionstrings.com/?carrier=mysql" rel="noreferrer">this site</a> I have found many options, some including the installation of drivers. What is the fastest & easiest way to do it?</p>
<p>Update: this would be... | <pre><code>-- Create Link Server
EXEC master.dbo.sp_addlinkedserver
@server = N'MYSQL',
@srvproduct=N'MySQL',
@provider=N'MSDASQL',
@provstr=N'DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost; _
DATABASE=tigerdb; USER=root; PASSWORD=hejsan; OPTION=3'
-- Import Data
SELECT * INTO testMySQL.dbo.shoutbox
FROM ... | <p>If you have access to phpMyAdmin you could run an export of the entire database. It will generate a long list of SQL commands to create all the schema and optionally insert all the data into their respective places.</p>
<p>It is also possible to perform all this from the command line.</p>
<p>If you have a lot of d... | 39,353 |
<p>I have modified my Prusa i3 MK2 printer so that the existing extruder motor has now been attached to a 5mm lead screw with a 1mm pitch. What is the easiest way to control the extruding of the printer now.</p>
<p>For example is it possible to change the settings in slic3er at all for the extruder? or would I have to... | <p>The firmware of the printer reads the g-code, in this instance, for z-axis movement. The g-code provides only (primarily) millimeters of movement and direction, along with speed.</p>
<p>The firmware reads those figures, figuratively speaking, and knows from the values stored in the firmware, how many steps to rotat... | <p>You can set the 'steps per mm' for the extruder (and the other axes) by sending GCODE to the printer, and store this in the internal memory. Re-flashing the firmware only affects the 'factory reset' configuration of the printer parameters.</p>
<p>To see how to calibrate your extruder, you're probably best looking f... | 835 |
<p>We have an intranet system that schedules routine tasks. We also have Fogbugz for bug tracking. When an urgent bug comes in, we track that task in the bugtracker. However, I need to write back to both the Intranet and our CMS. I'm thinking Biztalk as the middle piece, but am not sure the best way to go about it. Dat... | <p>I'm guessing that watching the database for changes would be the best way to do it. That way, you could post any changes you saw happen in the FogBugz database through other Biztalk adapters.</p>
<p>Please keep us updated with what you decide to do - I'd be interested to hear about it.</p>
| <p>Isn't FogBugz based on a SQL Server Database? Or do you use a hosted alternative? </p>
<p>If it's using a SQL Server you're controlling I'd just tie up two send ports to the process that read and handles the "FixBugMessage". One send port that uses the CMS Adapter and writes to the CMS and another that just uses th... | 10,032 |
<p>I have a simple 2-column layout with a footer that clears both the right and left div in my markup. My problem is that I can't get the footer to stay at the bottom of the page in all browsers. It works if the content pushes the footer down, but that's not always the case. </p>
| <p>To get a sticky footer:</p>
<ol>
<li><p>Have a <code><div></code> with <code>class="wrapper"</code> for your content.</p></li>
<li><p>Right <strong>before</strong> the closing <code></div></code> of the <code>wrapper</code> place the
<code><div class="push"></div></code>.</p></li>
<li><p>Rig... | <p>Try putting a container div (with overflow:auto) around the content and sidebar.</p>
<p>If that doesn't work, do you have any screenshots or example links where the footer isn't displayed properly?</p>
| 6,374 |
<p>Recently got a Creator 3 (v2) and single-colour prints are great, but dual colour Benchies are coming out quite bad. Initially, I thought it was X/Y calibration as when I printed a dual-colour cube, I could feel a slight bump as I ran my fingernail across the joins. I tweaked that and the cube now seems good (pics a... | <p>You have a problem with retraction or more broadly with what happens to the material in the inactive extruder while it's waiting to be used again. I'm not sure what your printer does, but there are various strategies for how to handle this, which can possibly be mixed:</p>
<ul>
<li>doing nothing and letting it make ... | <p>I've tracked down the cause of this, although I don't yet know a solution. It only occurs with dual-colour prints and I noticed the stringing is coming from when the nozzle moves <em>away</em> from the print, not from the new nozzle coming towards it.</p>
<p>After watching some prints, I realised what it is. After f... | 2,010 |
<p>I am reorganizing my source files into a single solution with a single project, due to various reasons:</p>
<ul>
<li>a paranoic configured antivirus software;</li>
<li><a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/12/08/advices-on-partitioning-code-through-net-assemblies.aspx" rel="nofollow nore... | <p>Yes - use folders.</p>
<p>If you create a folder within a project, new classes within that folder will automatically use the folder name as the basis for the namespace.</p>
<p>For instance, if you have a project with a default namespace of "Company.Project" and a folder "Foo" containing "Bar.cs" you'll end up with... | <p>100% agree with Jon Skeet.</p>
<p>To gain more overview at the folder level we're creating folders breaking the namespace structure by prefixing them with an underscore.</p>
| 45,886 |
<p>I have a few component MSI packages that need to installed together to form the end application. </p>
<p>The problem is: the components that make up the package can be updated and the component relaunched on the http file server. What approach should I take?</p>
<p>The installer that I am writing is the 'master' i... | <p>I've looked at similar problems, and I sympathize because there are no easy answers that I know of. If I understand correctly, you basically want a setup.exe that will detect the current versions of the pre-requisites on the target system, install them if they're missing, and upgrade them if they're out of date. <... | <p>By "components" do you refer to Installshield/MSI Components/Features? Or are you using this in your own terminology? You can't update a component without releasing an entirely new package version as far as I'm aware.</p>
<p>My suggestion would be to deploy a "web downloader" installer with <em>uncompressed</em> fi... | 37,665 |
<p>How are you managing your usage of <a href="http://dojotoolkit.org/projects/dojox" rel="nofollow noreferrer">DojoX</a> code or widgets in a production application?</p>
<p>The <a href="http://dojotoolkit.org/" rel="nofollow noreferrer">Dojo Toolkit</a> is comprised of Core, Dijit, and DojoX. As an incubator for new ... | <p>There are several ways to do it:</p>
<ul>
<li>Stick to one version of Dojo and use it consistently.</li>
<li>Move modified code to your own namespace and include it from there.
<ul>
<li>Effectively it is a forking of an existing DojoX module. All code syncing and back porting is your responsibility.</li>
<li>Pay a... | <p>This may be an obvious, but much more involved, solution ... but: Get involved! It actually is one of the best ways to familiarize yourself with the overall power of Dojo in one sitting, teaches a lot of good JS-foo, and ensures you have inside information as to the future of a particular module. Most of DojoX is co... | 37,347 |
<p>I can't create a NT account for everyone that need access to the reports.
Does anyone know or have a link to the info to allow anonymous access to reporting services reports ?</p>
<p>Thanks</p>
| <p>Thanks, I had tried it before but was failing, tried again and worked fine, must have missed something the first time around.</p>
<p>The steps are very simple:</p>
<ol>
<li>Standard install of SSRS 2005
(Integrated authentication) </li>
<li>In
IIS, duplicate the ReportingServices
virtual directory and name it Publ... | <p>If your server is on a windows domain you can grant access to a group eg. <code>Domain Users</code></p>
| 46,617 |
<p>I know a fair bit about the Windows Task Manager in XP, but I would like to understand it better in Vista. What is the difference between "Working Set (Memory)" and "Memory (Private Working Set)". What is the Paged Pool, what is the NP Pool (Non-Paged?). How do I use these to determine what is going on with memor... | <p><a href="http://blogs.msdn.com/salvapatuel/archive/2007/10/13/memory-working-set-explored.aspx" rel="nofollow noreferrer">This MSDN blog entry</a> might be informative on the first part of the question. A brief excerpt:</p>
<blockquote>
<p>Working set is the subset of virtual pages that are resident in physical m... | <p>Vista's SuperFetch considers free memory to be wasted memory. Better is using it like a cache. This is why you will often see scant free memory in the Task Manager. </p>
| 26,461 |
<p>I am trying to insert a new row into my table which holds the same data as the one I am trying to select from the same table but with a different <code>user_id</code> and without a fixed value for <code>auto_id</code> since that is an auto_increment field, and setting <code>ti</code> to NOW(). Below is my mockup que... | <p>I think you need to explicitly match the line terminators, as well as handle spaces better as others have suggested. Assuming the user can choose between \r and \n, try</p>
<pre><code>@"(?<select>\Aselect .+)[\n\r]" +
@"(?<from>\s*from .+)[\n\r]" +
@"(?<where>\s*where .+)[\n\r]" +
@"(?<groupBy... | <p>There may be a problem with the newline matching: is it LF (Unix standard), CR (MacOS), or CR LF (Windows)? If you don't know, perhaps you should match it with: <code>[\n\r]+</code></p>
<p><em>edit</em>: You included some whitespace in your test string, surrounding the newlines, that you don't account for in your ... | 37,370 |
<p>Are there conventions for function names when using the Perl Test::More or Test::Simple modules?</p>
<p>I'm specifically asking about the names of functions that are used to set up a test environment before the test and to tear down the environment after successful completion of the test(s).</p>
<p>cheers,</p>
<p... | <p>I dont think there are any such conventions out there.</p>
<p>The only way you can do it is perhaps use BEGIN/END blocks, if the resources are to be used over the whole file.</p>
<p>The general approach I take is to put related tests in one code block and then initialize the variables/resource etc there. You can p... | <p>First convention I'd suggest is ditching Test::More for Test::Most</p>
| 6,737 |
<p>I am starting my first independent for profit venture. I am having a hard time deciding what language to use. I want to write my app in Perl, but I don't think it will be simple enough to compile. If I don't write it in Perl I will write it in C++.</p>
<p>The application will have many features, including <a href="h... | <p>Go with C++. Timers, threading, audio, SDL, wxwidgets, these are all things that Perl can do, but doesn't really excel at. Also, PAR or perl2exe are clunky mechanisms for distribution. They work, but they're not ideal. Meanwhile, C++ (and I highly encourage you to look at using <a href="http://www.boost.org/" re... | <p>Write your core functionality in C++, then write the front-end for your application in the tool for the platform in question, i.e., Cocoa for Mac OS X, .NET/Delphi/MFC for Windows, etc.</p>
<p>This is my preferred way of developing cross-platform desktop applications. Of course, I know so very little about what you... | 22,482 |
<p>I would like to be able to do such things as</p>
<pre><code>var m1 = new UnitOfMeasureQuantityPair(123.00, UnitOfMeasure.Pounds);
var m2 = new UnitOfMeasureQuantityPair(123.00, UnitOfMeasure.Liters);
m1.ToKilograms();
m2.ToPounds(new Density(7.0, DensityType.PoundsPerGallon);
</code></pre>
<p>If there isn't somet... | <p>Check out the <a href="http://www.codeproject.com/KB/library/Measurement_Conversion.aspx" rel="nofollow noreferrer">Measurement Unit Conversion Library</a> on The Code Project.</p>
| <p>Unix <a href="http://linux.die.net/man/1/units" rel="nofollow">units</a> is imho brilliant; source must be on the web somewhere.<br>
(Under "bugs", the original doc said "do not base your financial plans on the currency conversions".)</p>
| 7,763 |
<p>As the title says. How would I create an instance of a class that is globally available(for example I have a functor for printing and i want to have a single global instance of this(though the possibility of creating more)).</p>
| <p>Going to all the effort of making a singleton object using the usual pattern isn't addressing the second part of your question - the ability to make more if needed. The singleton "pattern" is very restrictive and isn't anything more than a global variable by another name.</p>
<pre><code>// myclass.h
class MyClass ... | <p>the <a href="http://en.wikipedia.org/wiki/Singleton_pattern" rel="nofollow noreferrer">Singleton pattern</a> is what you're looking for.</p>
| 38,112 |
<p>I've been looking around the System.Xml namespace, but don't see anything that would support this. Does anyone know if it's built into .Net, or would I have to obtain a third party library to do it?</p>
<p>NOTE: I wish it were as simple as generating an xsd, but that won't do for my specific situation.</p>
| <p>It would be very easy to do, but very hard to make it useful.</p>
<p>DTD is a grammar. It is trivial to generate a grammar that generates just the given XML file and no other. This is of course useless in practice. What you probably need is to create a grammar that generates files "like this one", and this is a ha... | <p>I'm not sure about DTD but you can generate XSD files from an xml file using the <a href="http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.80).aspx" rel="nofollow noreferrer">Xsd.exe</a> tool. It usually lives in the following directory:</p>
<p>C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe</p>
| 26,669 |
<p>I've decided to get back into LISP (haven't used it since my AI classes) to get more comfortable with functional programming in general, so I downloaded Lisp In A Box (which we actually used in a previous class) which comes with CLISP and Emacs.</p>
<p>When I run it, it says:</p>
<blockquote>
<p>Connected on por... | <p>The purpose is so that Lisp will be running in parallel.</p>
<p>Slime connects to the session and then you can have the same environment, definitions, etc from many different windows (or machines even). This means that you can start up your application and debug it on the fly, for instance.</p>
<p>For further info... | <p>You get a REPL (read-evaluate-print-loop) running in parallel, so that you can compile and test code snippets on the fly from your editor. "Practical Common Lisp" (freely available on the web) has a good explanation for this, and it is a very good book for learning Lisp.</p>
| 39,865 |
<p>I often refactor code first by creating an inner class inside the class I'm working on--When I'm done, I move the entire thing into a new class file. This makes refactoring code into the new class extremely easy because A) I'm only dealing with a single file, and B) I don't create new files until I have a pretty go... | <p>I'm sorry I gave the wrong answer before. I rechecked, and it didn't do quite want you want. I did find a solution for you though, again, in 3.4.</p>
<p>Highlight the class, do a copy CTRL-C or cut CTRL-X, click on the package you want the class do go into, and do a paste, CTRL-V. Eclipse will auto generate the cla... | <p>Can be done in 2 refactorings :</p>
<blockquote>
<ol>
<li><p>Convert Member type to top level</p>
</li>
<li><p>Move</p>
</li>
</ol>
</blockquote>
| 12,356 |
<p>If one wants to paginate results from a data source that supports pagination we have to go to a process of:</p>
<ol>
<li>defining the page size - that is the number of results to show per page;</li>
<li>fetch each page requested by the user using an offset = page number (0 based) * page size</li>
<li>show the resul... | <p>There are a few schools of thought o this.</p>
<ol>
<li>data gets updated let it be</li>
<li>You could implement some sort of caching method that will hold the
entire result set (This might not be
an option if working with really
large Datasets)</li>
<li>You could do a comparison on each page operation and notify t... | <p>If the updates you are concerned with are primarily new insertions (for example, StackOverflow itself seems to suffer from this problem when paging through questions and new questions come in) one way to handle it is to capture a timestamp when you issue the first pagination query, and then limit the results of requ... | 11,013 |
<p>I'm writing a C/C++ application under Linux that reads data from a raw socket (for ICMP packets). Question: is there a way to discard all data that is still queued on the socket?</p>
<p>The problem is that after sleeping for a while, there is data queued up on the socket which I'm not interested in; so it would be ... | <p>During idle times, you can disable the socket by setting the Receive Buffer size to zero:</p>
<pre><code> int optval = 0; /* May need to be 1 on some platforms */
setsockopt(sockDesc, SOL_SOCKET, SO_RCVBUF, (char *)(&optval), sizeof(optval));
</code></pre>
<p>Re-enable by setting "optval" to a larger buffer ... | <p>I have not tried it, and it might be totally unwise for performance reasons (but if your app sleeps anyway, it might not be a problem), but: you might try setting the socket's receive buffer to some very small value before the sleep. I'm hoping this will cause the socket to not be able to buffer data that arrives wh... | 25,686 |
<p>Brief:</p>
<pre><code>convert ( -size 585x128 gradient: ) NewImage.png
</code></pre>
<p>How do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command.</p>
<hr>
<p>Details:</p>
<p>I'm trying to programatically create an image reflec... | <p>If you are calling it from C#, perhaps you could get retrieve the image dimensions in C#.
Then call the ImageMagick command with</p>
<pre><code>command = String.Format("convert bar %1x%2",img.Width,img.Height)
</code></pre>
| <p>May be this can help:
<a href="http://www.alleluia.ch/systeme-dexploitation/commande/107-reflexion-sous-une-image" rel="nofollow noreferrer">Reflection under an image</a></p>
<pre><code>#!/bin/sh
gamma=$1
source=$2
destination=$3
size=`identify -format "%wx%h" $source`
convert $source \
\( -size $size xc:none \... | 24,241 |
<p>I have implemented a SAX parser in Java by extending the default handler. The XML has a ñ in its content. When it hits this character it breaks. I print out the char array in the character method and it simply ends with the character before the ñ. The parser seems to stop after this as no other methods are called ev... | <p>What's the encoding on the file? Make sure the file's encoding decloration matches it. Your parser may be defaulting to ascii or ISO-8859-1. You can set the encoding like so</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
</code></pre>
<p>UTF-8 will cover that character, just make sure that's what the ... | <p>I faced this issue. XML stream you are feeding must me read as ascii, encode ascii to 'UTF-8' within code or change it to character stream and all will be fine. </p>
<p>something like this will help you:</p>
<pre><code>File F = new File(C://Location);
BuffeReader Readfile = new BufferReader(F);
InputSource Encode... | 33,808 |
<p>Some 3 mm filaments seem to actually be 3 mm - is there any way to shave off the excess and use it as 2.85 mm? </p>
| <p>I would not recommend you to try and somehow re-size the filament, since even the smallest of irregularities and error in diameter occurring from such a process would ruin your prints with sporadic over and under extrusion. Rather, if you have the tools available, you could grind the filament into pellets, and use a... | <p>you could put a 3 mm extruder on you're printer. or (if you're r brave) put route filament in the oven for 10 minutes and unroll it than stretch it out. if you do this outside you can attach one ent to a stride licht or something an pul on the other end, if it is hot anoth it should hold its new position. but don't ... | 263 |
<p>Does anyone know how to get the Video Ram of a PC from a WMI call?</p>
<p>I've seen calls to the Win32_VideoController management object's AdapterRAM property, but that only gives the system memory, and is not representative of the video RAM at all.</p>
| <p>Turns out it was the adapter RAM returned, and through an unfortunate coincidence, the wrong conversion was used and gave the system RAM...on two different systems. Thanks for pushing us to look again.</p>
<p>For what it's worth, in a C# WinForms app:</p>
<pre><code>int _ram = 0;
ManagementObjectSearcher searcher... | <p>We already went down the path of the AdapterRAM property, but that was only giving us the system memory, which has nothing to do with the Video Ram. Is there another way of getting the video ram?</p>
| 44,345 |
<p>I'm using the javax.mail system, and having problems with "Invalid Address" exceptions. Here's the basics of the code:</p>
<pre><code> // Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", m_sending_host);
// Get session
Sessio... | <p>--Update: problem with authentication.</p>
<p>Ok, here's what I've discovered was going on. When receiving e-mail, the code above correctly sets up authentication and the Authenticator.getPasswordAuthentication() callback is actually invoked.</p>
<p>Not so when sending e-mail. You have to do a bit more. Add this:<... | <p>This seems to me like a problem that happened at my work.
If the code you are showing is being concurrent, then using directly System.getProperties
could be a problem, because the host value you put on them can be overwritten by next request, while still keeping the user and password from the overwritten host.</p>
... | 29,727 |
<p>Given the following code snippet from inside a method; </p>
<pre><code>NSBezierPath * tempPath = [NSBezierPath bezierPathWithOvalInRect:pathRect];
[tempPath retain];
[path release];
[self setPath:tempPath];
</code></pre>
<p>Am I responsible for releasing <code>tempP... | <p>If <code>path</code> is the instance variable backing the <code>-setPath:</code> method then no, you absolutely should not be releasing it outside of your <code>-dealloc</code> method. You don't need to manually retain your <code>tempPath</code> object since you're using an accessor to save that object. Your accesso... | <p>You don't need to release tempPath.</p>
<p>You can also drop the <code>[tempPath retain]</code> and the <code>[path release]</code>. These are taken care of by synthesizing the set method.</p>
| 47,602 |
<p>i've got regex which was alright, but as it camed out doesn't work well in some situations </p>
<p><strong>Keep eye on message preview cause message editor do some tricky things with "\"</strong></p>
<blockquote>
<p>[\[]?[\^%#\$\*@\-;].*?[\^%#\$\*@\-;][\]]</p>
</blockquote>
<p>its task is to find pattern which ... | <pre>
\[([%#$*@;^-]).+?\1\]
</pre>
<p>applied to text:</p>
<pre>
Black fox [#sample1#] [%sample2%] - [#sample3#] [%sample4;] eats blocks.
</pre>
<p>matches</p>
<ul>
<li><code>[#sample1#]</code></li>
<li><code>[%sample2%]</code></li>
<li><code>[#sample3#]</code></li>
<li><em>but not</em> <code>[%sample4;]</code></li... | <p>Why the first "?" in "[[]?"</p>
<pre><code>\[[\^%#\$\*@\-;].*?[\^%#\$\*@\-;]\]
</code></pre>
<p>would detect your different strings just fine</p>
<p>To be more precise:</p>
<pre><code>\[([\^%#\$\*@\-;])([^\]]*?)(?=\1)([\^%#\$\*@\-;])\]
</code></pre>
<p>would detect [ABA]</p>
<pre><code>\[([\^%#\$\*@\-;])([^\]]... | 37,484 |
<pre><code>typedef struct {
nat id;
char *data;
} element_struct;
typedef element_struct * element;
void push(element e, queue s) {
nat lt = s->length;
if (lt == max_length - 1) {
printf("Error in push: Queue is full.\n");
return;
}
... | <p>How about:</p>
<pre><code>element elem = malloc(sizeof(element_struct));
if (elem == NULL) {
/* Handle error. */
}
elem->id = something;
elem->data = something_else;
push(elem, s);
</code></pre>
<p>Note that there's lots of memory management missing here...</p>
| <p>How about:</p>
<pre><code>element elem = malloc(sizeof(element_struct));
if (elem == NULL) {
/* Handle error. */
}
elem->id = something;
elem->data = something_else;
push(elem, s);
</code></pre>
<p>Note that there's lots of memory management missing here...</p>
| 36,347 |
<p>As a Java developer who is reading Apple's Objective-C 2.0 documentation: I wonder what "<em>sending a message to nil</em>" means - let alone how it is actually useful. Taking an excerpt from the documentation:</p>
<blockquote>
<p>There are several patterns in Cocoa
that take advantage of this fact. The
valu... | <p>Well, I think it can be described using a very contrived example. Let's say you have a method in Java which prints out all of the elements in an ArrayList:</p>
<pre><code>void foo(ArrayList list)
{
for(int i = 0; i < list.size(); ++i){
System.out.println(list.get(i).toString());
}
}
</code></pre>... | <p>C represents nothing as 0 for primitive values, and NULL for pointers (which is equivalent to 0 in a pointer context).</p>
<p>Objective-C builds on C's representation of nothing by adding nil. nil is an object pointer to nothing. Although semantically distinct from NULL, they are technically equivalent to one anoth... | 18,919 |
<p>So in my documentation it says:</p>
<blockquote>
<p>public event TreeViewPlusNodeCheckedEventHandler NodeChecked()</p>
<p>You can use this event to run cause a method to run whenever the
check-box for a node is checked on the tree.</p>
</blockquote>
<p>So how do I add a method to my code behind file that ... | <p>You need to assign a delegate to the event and have it run the method you want. Something like :</p>
<p>TreeViewControl.NodeChecked += new TreeViewPlusNodeCheckedEventHandler(TOCNodeCheckedServer)</p>
| <p>On your initialise method for the form add</p>
<pre><code>TOCTree.NodeChecked += new TreeViewPlusNodeCheckedEventHandler (TOCNodeCheckedServer);
</code></pre>
<p>This will tell your app to run TOCNodeCheckedServer when the TOCNode Fires the NodeChecked Event.</p>
<p>There are loads of resources on the web explain... | 16,364 |
<p>What is the C# optimised version of the following, without using .Net's Timespan or DateTime. How would I NUnit test it? </p>
<pre><code>TimeSpan ts = Date1 - Date2;
int numberOfDays = ts.Days;
</code></pre>
| <p>It has to do with demand-paging. Your app cannot be run directly from the SD-card, as SD is not executable media so it has to be pulled into RAM to run. Windows CE doesn't typically have a whole lot of RAM, so the loader doesn't pull your entire application into RAM to run. Sure, your heaps and stacks will be in R... | <p>Some device will crash your program if application is on sd-card. It happens while suspend-power-on device.</p>
| 43,768 |
<p>In our application (a game), in some cases it can't run fast enough. Obviously we'd like to speed it up, but in the mean-time when this happens it causes many problems (or if it's not causing them, the two are related).
The one which is least related to our own functionality is that the built in Alert.show() method ... | <p>All Flash content is executed frame-by-frame - Flash executes one frame's worth of code, then updates the screen, and then waits until the next frame update.</p>
<p>When Flash can't keep up with the specified framerate, all that happens is that instead of waiting between frame updates, Flash does them as fast as it... | <p>I'm not too sure if Flex has some additional performance handling of it's own. But for pure actionscript the only thing that would happen is the framerate would slow to a crawl, everything will happen normally just slower. If you stack very large amounts of transparent or masked objects you might get some weird beha... | 15,362 |
<p>I just installed Ubuntu 8.04 and I'm taking a course in Java so I figured why not install a IDE while I am installing it. So I pick my IDE of choice, Eclipse, and I make a very simple program, Hello World, to make sure everything is running smoothly. When I go to use Scanner for user input I get a very odd error:</p... | <p>The Scanner class is new in Java 5. I do not know what Hardy's default Java environment is, but it is not Sun's and therefore may be outdated.</p>
<p>I recommend installing the package sun-java6-jdk to get the most up-to-date version, then telling Eclipse to use it.</p>
| <p>If you are using a version of Java before 1.5, java.util.Scanner doesn't exist.</p>
<p>Which version of the JDK is your Eclipse project set up to use?</p>
<p>Have a look at Project, Properties, Java Build Path -- look for the 'JRE System Library' entry, which should have a version number next to it.</p>
| 10,495 |
<p>I'm trying to lightbox a page containing a SWF via the nifty AJAX feature in Facebox (for jQuery). The trouble is that the paths now work relative to the main index page, not the directory that houses the flash page. Here's a directory breakdown:</p>
<p>./<br />
- index.html (loads projects/projectName/... | <p>You don't want to use relative paths the way that you are, which work their way back up the folder tree. Try using paths that begin at the Web root, and instead work their way down the folder tree. So instead of this:</p>
<p><strong>../../images/image.gif</strong></p>
<p>Or this:</p>
<p><strong>./images/image.gif... | <p>I'm not sure I understand the question completly (do you have source code / url example).</p>
<p>The <a href="http://www.w3schools.com/TAGS/tag_base.asp" rel="nofollow noreferrer">Base HREF</a> tag can let you set the relative path start in your iFrame, and you should be able to use relative paths from there.</p>
| 20,632 |
<p>I'm not sure how this question will be recieved here but lets give it a shot...</p>
<p>It's time for me to get a new dev PC. What's the best choice these days?</p>
<p>I typically have 2-3 Visual Studios open along with mail and all that stuff. Ideally I would imagine 2+ GB of RAM would be nice as my current XP box... | <p>I just built a quad core - 8 GB of RAM and run Server 2008 with Hyper-V on it. I have VMs for my build server, dev platform, and deployment options (XP, Vista, Server 2003/2008) with snapshots at the various service pack levels. What's nice is you can spin up a VM whenever you need it, and re-allocate the resource... | <p>People are probably going to yell at me...but I've found that Vista 64 is mostly worth it. The main reason for me though is that I'm always maxing out my memory and having a 64bit OS allows me to go past the <4GB limit of 32bit.</p>
<p>But even if you don't get 64bit, just buy 2 2GB RAM cards anyways....you wil... | 3,635 |
<p>I'm wondering what good ways there would be make assertions about synchronization or something so that I could detect synchronization violations (while testing).</p>
<p>That would be used for example for the case that I'd have a class that is not thread-safe and that isn't going to be thread-safe. With some way I w... | <p>You are looking for the holy grail, I think. AFAIK it doesn't exist, and Java is not a language that allows such an approach to be easily created.</p>
<p>"Java Concurrency in Practice" has a section on testing for threading problems. It draws special attention to how hard it is to do.</p>
| <p>You can use <a href="http://profiler.netbeans.org/" rel="nofollow noreferrer">Netbeans profiler</a> or <a href="http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html" rel="nofollow noreferrer">JConsole</a> to check the threads status in depth</p>
| 38,278 |
<p>What are some resources for getting started writing a Firefox Addon? Is there an API guide somewhere? Is there a getting started tutorial somewhere? Is there a developer discussion board somewhere?</p>
| <p>We tried to make <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions</a> answer all those questions. The first three links in the documentation section are about getting started (that include... | <p>This has the best solutions:
<a href="https://developer.mozilla.org/en/Extensions" rel="nofollow">https://developer.mozilla.org/en/Extensions</a>
but you can try greasemonkey script compiler</p>
| 4,441 |
<p>I've seen conflicting advice on the correct printing temperature for Microcenter's house-brand Inland PLA+, particularly after a supplier change announced in April 2018.</p>
<p>There's an <a href="https://www.reddit.com/r/3Dprinting/comments/89grfm/psa_on_our_micro_center_inland_filament/" rel="nofollow noreferrer"... | <p>Even as PLA+ contains some additives, each printer is different. We usually never know what the actual temperature of the printhead is, but if your printer prints good at 205 °C, despite the manufacturer claiming you should use a little more temperature, use it. It might be the perfect combination of temperature and... | <p>A portion of information missing from the manufacturer's specifications and in the question is the print speed. You could have slower speeds than the manufacturer used to perform the tests, which requires lower temperatures to reduce the "flow rate" of the plastic to an acceptable level. </p>
<p>In some cases, I us... | 1,384 |
<p>I am writing a site that uses strongly typed datasets. </p>
<p>The DBA who created the table made gave a column a value that represents a negative. The column is 'Do_Not_Estimate_Flag' where the column can contain 'T' or 'F'. I can't change the underlying table or the logic that fills it. What I want to do is to ad... | <p>The DataBinder will see that you're binding to a DataRow and use its fields rather than any property you define. </p>
<p>You could create a method to do what you want, e.g.:</p>
<pre><code><%#FormatFlag(DataBinder.Eval(Container.DataItem, "Do_Not_Estimate_Flag" ))%>
</code></pre>
<p>where you have a method... | <p>If I recall, ST datasets datarows are implemented in partial classes. So you might add the functionality you need in the partial class off the main ST dataset row class. </p>
| 21,677 |
<p>I'm working on a game (using Ruby) and planning to have it available in several languages. I was wondering what's the best option for rendering text. In particular, whatever I use should be able to render complex fonts (Arabic and Persian in particular). </p>
<p>I've been looking around and have stumbled upon freet... | <p>If you're looking for a way to rasterise fonts into bitmaps, both Freetype and the Windows API will handle this nicely.</p>
<p>If you're looking for a way to draw text onscreen, go with Window's native APIs if you can; bidirectional text and accents and all that stuff are quite difficult and time-consuming to get r... | <p>Check out www.freetype.org
It handles non-left-to-right fonts.
It generates the glyphs for you, but you must render them to the device (OpenGL/DirectX, etc).</p>
| 18,724 |
<p>Is it possible to determine which property of an ActiveX control is the default property? For example, what is the default property of the VB6 control CommandButton and how would I found out any other controls default!</p>
<p><strong>/EDIT:</strong> Without having source to the object itself</p>
| <p>Use OLE/Com Object Viewer, which is distributed with Microsoft Visual Studio. </p>
<p>Go to type libraries and find the library the control is housed in, for example CommandButton is stored in <strong><em>Microsoft Forms 2.0 Object Library</em></strong>. Right click the library and select view. Find the coclass rep... | <blockquote>
<p>you have access to the code, look for</p>
</blockquote>
<p>Unfortunetly I don't have access to the code for most of the controls. However the link is useful for the Microsoft Controls, but I still would like a way to know for other controls.</p>
| 6,279 |
<p>I've got a text box bound to an object's property (in fact several text boxes) on a form. This for is an editor for an object. When i'm editing some objects and modify values in the one of the text boxes i can't exit from the text box (neither by tab nor clicking on another text box). However that's not always the c... | <p>Sounds like a data validation issue. Check if the controls on the form have their CausesValidation properties set to true or false.</p>
<p>Also check the AutoValidate property on the form. It is probably set to EnablePreventFocusChange (which is the default).</p>
<p>It may also be the case that the value being s... | <p>If your Form has AutoValidate==EnablePreventFocusChange, then you'll end up with the focus stuck in any field that fails validation.</p>
<p>Note that validation is considered to have failed if there is an exception when writing the value into the object.</p>
<p>Try setting a breakpoint at the entry point of the se... | 26,791 |
<p>Here is a sample code to retrieve data from a database using the yield keyword that I found in a few place while googling around :</p>
<pre><code>public IEnumerable<object> ExecuteSelect(string commandText)
{
using (IDbConnection connection = CreateConnection())
{
using (IDbCommand cmd = Creat... | <p>The Iterator that the compiler synthesises implements <code>IDisposable</code>, which <code>foreach</code> calls when the <code>foreach</code> loop is exited.</p>
<p>The Iterator's <code>Dispose()</code> method will clean up the <code>using</code> statements on early exit.</p>
<p>As long as you use the iterator in... | <p>Judging from <a href="http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx" rel="nofollow noreferrer">this technical explanation</a>, your code will not work as expected, but abort on the second item, because the connection was already closed when returning the first item.</p>
<p>@Joel Gauvreau : Yes, ... | 6,978 |
<p>Maybe I live in a bubble, or am just too new, but I was wondering if anyone else has noticed the heavy use of 'var' to declare variables instead of a specific type in many of the MVC examples by Microsoft? Is there a purpose for this, or is it the "in" thing to do now, or just personal style?</p>
| <p>Jared Parsons talked about this in his <a href="http://blogs.msdn.com/jaredpar/archive/2008/09/09/when-to-use-type-inference.aspx" rel="nofollow noreferrer">blog</a> I don't agree with his conclusions (as my comment there indicates), but this article should explain <strong>why</strong> it's used so much.</p>
| <p>All of the above.</p>
| 43,546 |
<p>Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide?</p>
<p>I'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types, I get eleven different flavors... | <p><code>-[NSPasteboard types]</code> will return all the available types for the data on the clipboard, but it should return them <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/Reference/Reference.html#//apple_ref/occ/instm/NSPasteboard/types" rel="nofollow ... | <p>You may be able to get some use out of <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/Reference/Reference.html#//apple_ref/occ/clm/NSPasteboard/typesFilterableTo:" rel="nofollow noreferrer"><code>+[NSPasteboard typesFilterableTo:]</code></a>. I'm picturing... | 7,837 |
<p>When using MediaWiki's markup language, the only thing that I hate is creating numbered lists. The only way I know to create a list is to do something like this:</p>
<pre><code>#Item1
#Item2
</code></pre>
<p>However, if I want to add spaces or some other text between those lines, the numbering gets lost. For examp... | <p>Like this:</p>
<pre><code>#Item1
#:Somestuff
#Item2
</code></pre>
| <p>You can do:</p>
<pre><code># one
# two<br />spanning more lines<br />doesn't break numbering
# three
## three point one
## three point two
</code></pre>
<p>Regular old <code><br></code> works as well but probably pisses off someone.</p>
<p>You can put additional HTML formatting in as well to do <co... | 9,766 |
<p>In ASP.net 2.0, the PreviousPage property of a web page does not have a ViewState collection. I want to use this collection to transfer information between pages.</p>
| <p>View State is exclusive to the page. </p>
<p>If you want to transfer items, </p>
<ul>
<li>you can persist the data in a database, file, forms auth ticket or other cookie (Dont use Session or HttpContext.Current.Cache if you can help it)</li>
<li>do a cross page post - from your first page, post back to the second ... | <p>You can't directly. (See <a href="http://msdn2.microsoft.com/en-us/library/ms178139(vs.80).aspx" rel="nofollow noreferrer">http://msdn2.microsoft.com/en-us/library/ms178139(vs.80).aspx</a></p>
<p>Here's what you can do -</p>
<p>Create public properties on the first page exposing the information you want to share. ... | 20,377 |
<p>ReSharper likes to point out multiple functions per ASP.NET page that could be made static. Does it help me if I do make them static? Should I make them static and move them to a utility class?</p>
| <p><strong>Static methods versus Instance methods</strong>
<br/>
<a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/classes#static-and-instance-members" rel="noreferrer">Static and instance members</a> of the C# Language Specification explains the difference. Generally, s... | <p>Just my tuppence: Adding all of the shared static methods to a utility class allows you to add </p>
<pre><code>using static className;
</code></pre>
<p>to your using statements, which makes the code faster to type and easier to read. For example, I have a large number of what would be called "global variables" in... | 20,447 |
<p>I understand the Android OS is based on Linux. Does that mean the G1 phone has a terminal emulator and you can open a console and use commands like <code>cd</code>, <code>ls</code>, etc? Or failing that, would it be possible to write a terminal emulator for it?</p>
<p>On a related note, would it be possible to run ... | <p>Actually, until recently <a href="http://blogs.zdnet.com/Burnette/?p=680" rel="noreferrer">everything you typed on the keyboard got echoed to a root shell</a>. Nasty bug.</p>
<p>That said, you want <a href="http://androidcommunity.com/forums/f28/how-to-pterminal-6485/" rel="noreferrer">PTerminal</a>, from the Andro... | <p>In case you don't know, it's worth pointing out that android has a fairly secure application sandbox. Each installed app runs as it's own user. Not many binaries on the phone are world-executable, and a lot of files aren't even world-readable.</p>
<p>However, I don't think anything is preventing you from copying ex... | 40,018 |
<p>I am working with a large bunch of sources written in Visual C++. The target is dll library. Linkage time consumes several minutes. How this time can be reduced?</p>
<p>Library depends on other dlls and libs, which are in the same solution. </p>
<p>The first thing which can be done is to split source into several ... | <p>Refactor!!! Split the large DLL into smaller modules, do this using layers of interfaces, create an architecture when you split "huge" DLL into smaller ones as opposed to taking the first 5 files etc. Map the DLL hierarchy carefully level 0 DLL's are standalone, level 1 DLL's may depend on 1 or more level 0, etc.</p... | <p>If you're not using incremental linking, you should look into this. It basically trades final object size against linking performance.</p>
<p>The global optimisation options also move compile time (i.e. code generation) from the compile phase to the link phase - you might find it better to lose them, so that indiv... | 42,630 |
<p>Is there a macro that does it? Which DTE objects to use?</p>
| <p>(This is not quite what you're asking for, but almost:)</p>
<p>You can put a breakpoint on <strong>every member function of a class</strong> in Visual Studio by bringing up the <em>New Breakpoint</em> dialog and entering:</p>
<pre><code>CMyClass::*
</code></pre>
<p>See <a href="http://blogs.msdn.com/b/habibh/arch... | <p>Put this at the top of the file:</p>
<pre><code>#define WANT_BREAK_IN_EVERY_FUNCTION
#ifdef WANT_BREAK_IN_EVERY_FUNCTION
#define DEBUG_BREAK DebugBreak();
#else
#define DEBUG_BREAK
#endif
</code></pre>
<p>then insert DEBUG_BREAK in the beginning of every function, like this: </p>
<pre><code>void function1()
{
... | 19,354 |
<p>I am going to install SVN for my personal projects. Is it better to install it on a spare machine(Win XP) or will I save myself grief if I install it on the machine I use for development(Vista). </p>
| <p>Installing your repository on a separate machine is probably a better idea, since at a minimum, it will allow your source code to survive a hard drive crash on your development machine.</p>
<p>If you're new to SVN, you can't beat the free e-book from Red-Bean and O'Reilly ... Check out "Version Control with Subvers... | <p>I'd prefer it on a different machine for flexibility (you could use a different system or get a new machine without impacting the repository) and for safety/security. By having it on a different machine, you eliminated the chance of losing everything if your machine dies.</p>
| 15,945 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.