instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Here's a problem I've been trying to solve at work. I'm not a database expert, so that perhaps this is a bit sophomoric. All apologies.</p>
<p>I have a given database D, which has been duplicated on another machine (in a perhaps dubious manner), resulting in database D'. It is my task to check that database D an... | <p>My first reaction is to suggest duplicating to the other machine again in a non-dubious manner.</p>
<p>If that is not an option, perhaps some of the tools available from <a href="http://www.red-gate.com/products/index.htm" rel="nofollow noreferrer">Red Gate</a> could do what you need.</p>
<p>(I am in no way afflia... | <p>Use the SQL Compare tools by <a href="http://www.red-gate.com/" rel="nofollow noreferrer">Red Gate</a>. It compares scheamas, and the SQL Data Compare tool compares data. I think that you can get a free trial for them, but you might as well buy them if this is a recurring problem. There may be open source or free... | 9,386 |
<p>I want to start using Nunit (finally), I am using Visual Studio 2008.</p>
<p>Is it as simple as importing Nunit into my test project?</p>
<p>I remember seeing a GUI for NUnit, does that do the exact same thing that a separate test project would do, except show you the pass/fail visually?</p>
| <p>I like to add a link to NUnit in my external tools.</p>
<p>Under Tools->External Tools add NUnit</p>
<pre><code>Title: &NUnit
Command: <path to nunit>
Arguments $(ProjectFileName) /run
Initial directory: $(ProjectDir)
</code></pre>
<p>After that you can quickly run it by compiling then hitting alt-t + n... | <p>The GUI is nice, but if you run your tests often, you'll probably abandon it for a faster/integrated runner.</p>
<p>In any case, you have some options on how to run your tests:</p>
<ul>
<li>NUnit.Gui.Exe -- you can run this & select your test project dll to run the tests. While it is open it will refresh when... | 40,678 |
<p>Is there a way to Deserialize Expressions in C#, I would like to store Expressions in a Database and load them at run time.</p>
| <p>I continued work on the library that was mentioned by <a href="https://stackoverflow.com/questions/217961/serializing-and-deserializing-expression-trees-in-c/1486253#1486253">Serializing and Deserializing Expression Trees in C#</a></p>
<p>It looks like the project was abandoned (2008) but I did some work on it and ... | <p>I was working on a project for serializing expressions. It's OK and you can use it.
<a href="http://www.codeproject.com/Articles/851187/ServicePredicateBuilder-for-creating-Serializable" rel="nofollow">http://www.codeproject.com/Articles/851187/ServicePredicateBuilder-for-creating-Serializable</a> </p>
| 26,803 |
<p>I'm planning on creating a social networking + MP3 lecture downloading / browsing / commenting / discovery website using Ruby on Rails. Partially for fun and also as a means to learn some Ruby on Rails. I'm looking for a social networking framework that I can use as a basis for my site. I don't want to re-invent the... | <p>It depends what your priorities are.</p>
<p>If you really want to learn RoR, <strong>do it all from scratch</strong>. Seriously. Roll your own. It's the best way to learn, far better than hacking through someone else's code. If you do that, sometimes you'll be learning Rails, but sometimes you'll just be learning t... | <p>One other positive to Community Engine is that it is using <a href="http://rails-engines.org/" rel="nofollow noreferrer">Engines</a> which is an advanced type of plugin that <a href="http://weblog.rubyonrails.org/2009/2/1/rails-2-3-0-rc1-templates-engines-rack-metal-much-more" rel="nofollow noreferrer">is becoming a... | 7,073 |
<p>I'm trying to avoid a composite control or using and ASCX by extending an existing control. However, I'm having trouble with getting the controls added to the inherited control and keep their view-state/post-back integrity. Whenever I add the controls during pre-render, the controls show up, but the post-back throws... | <p>Actually, microsoft says you should override the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.createchildcontrols.aspx" rel="nofollow noreferrer">CreateChildControls</a> method.</p>
<p>You can call the base class method before or after you add the controls, I'm not sure if there is a conve... | <p>You should add them in OnInit or in CreateChildControls. Anyway, to avoid having troubles with ViewState, read <a href="http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx" rel="nofollow noreferrer">this GREAT article</a>. Possibly, sample "4. Initializing child controls progr... | 37,927 |
<p>I'm using Java and I'm coding a chess engine.</p>
<p>I'm trying to find the index of the first 1 bit and the index of the last 1 bit in a byte.</p>
<p>I'm currently using Long.numberOfTrailingZeros() (or something like that) in Java, and would like to emulate that functionality, except with bytes.</p>
<p>Would it... | <p>use a lookup tabel with 256 entries.
to create it: </p>
<pre><code>unsigned int bitcount ( unsigned int i ) {
unsigned int r = 0;
while ( i ) { r+=i&1; i>>=1; } /* bit shift is >>> in java afair */
return r;
}
</code></pre>
<p>this of course does not need to be fast as you do it at most 256 ti... | <p>If you assume that <code>Long.numberOfTrailingZeros</code> is fast (i.e. JIT compiled/optimized to use a single ASM instructions when available), then why can't you simply do something like this:</p>
<pre><code>max(8,Long.numberOfTrailingZeros(val))
</code></pre>
<p>where val is your byte value converted to a Long... | 49,335 |
<p>REBOL has no built-in way to perform list comprehensions. However, REBOL has a powerful facility (known as <code>parse</code>) that can be used to create domain-specific languages (DSLs). I've used <code>parse</code> to create such a mini-DSL for list comprehensions. In order to interpret the expression, the block c... | <p>How about <code>select</code>?</p>
<p><code>select [(a * b) for a in 1x100 for b in 4x10 where (all [odd? a odd? b])]</code></p>
| <p><code>do</code> could be appropriate, as list comprehensions are just one instance of Monad comprehensions, and <code>do</code> is the keyword used in Haskell for sugared Monadic computations but I suspect it's too vague for a user library. I called my list comprehension function <code>comp</code>, but that's just a... | 24,961 |
<p>I am considering buying a 3D printer for work (scientific research). On paper, the Makerbot 5th generation seems to be the best option, because the price is right for my budget, and also because I'm generally pretty busy, so I want something that's as close to "plug and play" as reasonably possible. This will be my ... | <p>Makerbot claims the problems are fixed. I have heard from a number of resellers that the problems are fixed. Unfortunately, both of those are somewhat biased sources. It's surprisingly hard to get good info on the subject -- very few credible people are talking about recent experiences with the product line. </p>
<... | <p>I own a 5th gen printer and after teaching myself how to dismantle and clear the smart extruder of jammed filament I can attest to the machine working better than any other 3D printer I have used. I run the 3D printing section at Tampa Hakerspace and the MakerBot is much more reliable than the prusa or wanhao which ... | 196 |
<p>Always when I run java application it will display in Windows Task Manager is java.exe or javaw.exe. How to rename java.exe or javaw.exe process without wrapper by other programming languages.</p>
| <p>If you are confused by looking at process names that are all the same (<em>java.exe</em>), try to
use <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer"><em>Process Explorer</em></a> instead of <em>Task Manager</em>, and display the <em>command line</em> field. This way, you can... | <p>There are mainly 2 approaches: one is as others described: using Launch4j, WinRun4J to create native Windows launchers.</p>
<p>Another approach that seems better is to use Apache Procrun to wrap the java application as a Windows service. During the install service process, we can give the process an meaningful name... | 33,324 |
<p>I was wondering if there was any difference in the way the following code was compiled into assembly. I've heard that switch-case is more efficient than if else, but in this example I am not quite sure if that would be the case.</p>
<pre><code>if(x==1){
...
}else if(x==2){
...
}else{
...
}
</code></pre>
<p>and</p>... | <p>A compiler will sometimes turn a switch into a jump-table, if the entries are contiguous (or nearly so). Or it could theoretically use a binary search to find the case instead of a linear series of tests, which would be faster if you had a large number of cases.</p>
<p>On the other hand, there's nothing stopping th... | <p>In <em>this</em> specific case, the <code>switch</code> can be turned into a jump table. The <code>if</code> statement (if you write your <code>=</code> as <code>==</code> :-P) could still do the same thing if the compiler could tell that <code>x</code> isn't changing between the <code>if</code> clauses (which is us... | 23,792 |
<p>I'm getting an error whenever I load Management Studio or open a folder in the server explorer, etc. Additionally, If I try to create a new database it constantly is updating and does not finish. I have attached a screenshot of the error. Please let me know what I can do to fix this because it's really aggravating.<... | <p>From MSDN forum <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120476&SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120476&SiteID=1</a></p>
| <p>My first guess would be Client Tool corruption.</p>
<p>I've occasionally had to uninstall my client tools and reinstall them. Boot after uninstall.</p>
| 8,488 |
<p>In <code>tcsh</code>, I have the following script working:</p>
<pre><code>#!/bin/tcsh
setenv X_ROOT /some/specified/path
setenv XDB ${X_ROOT}/db
setenv PATH ${X_ROOT}/bin:${PATH}
xrun -d xdb1 -i $1 > $2
</code></pre>
<p>What is the equivalent to the <code>tcsh setenv</code> function in Bash? </p>
<p>Is ... | <p><code>export VAR=value</code> will set VAR to value. Enclose it in single quotes if you want spaces, like <code>export VAR='my val'</code>. If you want the variable to be interpolated, use double quotes, like <code>export VAR="$MY_OTHER_VAR"</code>.</p>
| <p>I think you're looking for <code>export</code> - though I could be wrong.. I've never played with tcsh before. Use the following syntax:</p>
<pre><code>export VARIABLE=value
</code></pre>
| 29,055 |
<p>Here is a scenario: Let's say I have site with two controllers responsible for displaying different type of content - Pages and Articles. I need to embed Partial View into my masterpage that will list pages and articles filtered with some criteria, and be displayed on each page. I cannot set Model on my masterpage (... | <p>How about creating an HtmlHelper extension method that allows you to call a partial view result on the an action on the controller.</p>
<p>Something like</p>
<pre><code> public static void RenderPartialAction<TController>(this HtmlHelper helper, Func<TController, PartialViewResult> actionToRender)
... | <p>The ViewData Model property should only be used for the content that you're viewing/editing on the main section of the UI.</p>
<p>Other parts of the view may need some data present in ViewData, so just add those to the dictionary.</p>
<p>I'd just pass data from the dictionary like this: ViewData["articles"] to th... | 7,125 |
<p>I'm building a RESTful web service which has multiple URIs for one of its resources, because there is more than one unique identifier. Should the server respond to a GET request for an alternate URI by returning the resource, or should I send an HTTP 3xx redirect to the canonical URI? Is <em>HTTP 303 (see also)</em>... | <p>I'd personally plump for returning the resource rather than faffing with a redirect, although I suspect that's only because my subcoscious is telling me redirects are slower.</p>
<p>However, if you were to decide to use a redirect I'd think a 302 or 307 might be more appropiate than a 303, although the <a href="htt... | <p>The answer from Ubiguchi had what I needed, except that I now think a redirect is the way to go, via the link to the HTTP 1.1 specifiction section on response codes. It turns out that I actually need a 301 redirect because the URI I'm redirecting to is more 'correct' and stable, and should therefore be used for futu... | 5,169 |
<p>How much less libraries are there for Mono than for Java?</p>
<p>I lack the overview over both alternatives but I have pretty much freedom of choice for my next project. I'm looking for hard technical facts in the areas of</p>
<ul>
<li>performance (for example, I'm told Java is good for threading, and I hear the r... | <p>Well....Java is actually more portable. Mono isn't implemented everywhere, and it lags behind the Microsoft implementation significantly. The Java SDK seems to stay in better sync across platforms (and it works on more platforms). </p>
<p>I'd also say Java has more tool availability across all those platforms, a... | <p>There are other language choices too. I've become quite fond of Python, which works well on Windows, Linux, and Mac, and has a rich set of libraries.</p>
| 8,680 |
<p>Or, actually establishing a build process when there isn't much of one in place to begin with.</p>
<p>Currently, that's pretty much the situation my group faces. We do web-app development primarily (but no desktop development at this time). Software deployments are ugly and unwieldy even with our modest apps, and... | <p>When taking on a project that has never had an automated build process, it is easier to take it in steps. Do not try to swallow to much at one time, otherwise it can feel overwhelming.</p>
<ol>
<li>First get your code compiling with one step using an automated build program (i.e. nant/msbuild). I am not going to ... | <p>Our build system is a makefile (or two). It has been rather fun getting it working as it needs to run on both windows (as a build task under VS) and under Linux (as a normal "make bla" task). The really fun thing is that the build gets the actual file list from a .csproj file, builds (another) makefile from that, an... | 3,568 |
<p>When should unions be used? Why do we need them?</p>
| <p>Unions are often used to convert between the binary representations of integers and floats:</p>
<pre><code>union
{
int i;
float f;
} u;
// Convert floating-point bits to integer:
u.f = 3.14159f;
printf("As integer: %08x\n", u.i);
</code></pre>
<p>Although this is technically undefined behavior according to th... | <p>Use a union when you have some function where you return a value that can be different depending on what the function did.</p>
| 31,464 |
<p>I'm using Microsoft AjaxControlToolkit for modal popup window.</p>
<p>And on a modal popup window, when a postback occurred, the window was closing. How do I prevent from the closing action of the modal popup?</p>
| <p>Put you controls inside the update panel. Please see my sample code, pnlControls is control that holds controls that will be displayed on popup:</p>
<pre><code><asp:Panel ID="pnlControls" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
... | <p>Like you prolly already know, the modal popup is clientside only, yeah you can gather informations in it during the postback, but if you do a postback he will hide 100% of the time. </p>
<p>Of course, like other proposed, you can do a .show during the postback, but it depends on what you need to do.</p>
<p>Actuall... | 6,320 |
<p>For example, in <a href="http://homepages.cwi.nl/~paulv/papers/algorithmicstatistics.pdf" rel="noreferrer">http://homepages.cwi.nl/~paulv/papers/algorithmicstatistics.pdf</a> at the bottom of page 5 and top of page 6, he uses a plus/equal symbol and a similar plus/lessthan symbol. I can't figure out how to make tha... | <p>Try <code>$\stackrel{top}{bottom}$</code></p>
<p>You'd want something like this:</p>
<pre><code>$X \stackrel{+}{=} Y$
</code></pre>
<p>This positions the plus sign above the equals sign. For example, the following code:</p>
<pre><code>$K(x,y|z) \stackrel{+}{=} K(x|z) \stackrel{+}{<} I(x:y|z)$
</code></pre>
<... | <p>Here's the list of <a href="http://web.ift.uib.no/Fysisk/Teori/KURS/WRK/TeX/symALL.html" rel="nofollow noreferrer">Latex Math Symbols</a>. I don't see the two from the PDF you linked to. Do you know what they mean? You might be able to find an equivalent in the Latex list.</p>
| 34,431 |
<ol>
<li><p>We currently just utilize soap webservices for all our communication but have been thinking about moving to WCF instead. What are the benefits of using it over an asmx service?</p></li>
<li><p>If we do go with a WCF service, can other languages still communicate with it? SOAP is standardized and all languag... | <ol>
<li><p>There's a bit of a learning curve with WCF, but once you learn it it's no harder to implement than an asmx web services. One advantage is you can easily switch protocols and serialization from binary remoting all the way to <a href="http://msdn.microsoft.com/en-us/library/ms730294.aspx" rel="noreferrer">web... | <p>WCF is not a replacement for SOAP, and indeed, SOAP can be used as the serialization format between endpoints for communication. SOAP the standard also doesn't really define what goes in the message body, so in the case of WCF-to-WCF communication, a SOAP envelope is used, but the content is binary, so there's your ... | 34,119 |
<p>i am planning to use 2 dedicated root servers rented at a hosting provider. those machines will run tomcat 6 in a cluster.
if i will add additional machines later on - it is unlikely that they will be accessible with multicast, because they will be located in different subnets.</p>
<p>is it possible to run tomcat w... | <p>With no control over the distance between both servers (they might be in two different datacenters) and no dedicated inter-server-communication line, I'd rather run them via round-robin DNS or a loadbalancer that redirects clients to either www1.yourdomain.xxx or www2.yourdomain.xxx and handle server-communication c... | <p>Just use <a href="http://code.google.com/p/memcached-session-manager/" rel="nofollow">http://code.google.com/p/memcached-session-manager/</a> . It works great. We are using it for years for this setup with 20 Tomcat servers sharing sessions. You can have one or two memcached servers to handle the session replication... | 18,512 |
<p>I decided to use <a href="http://logging.apache.org/log4net/index.html" rel="noreferrer">log4net</a> as a logger for a new webservice project. Everything is working fine, but I get a lot of messages like the one below, for every log4net tag I am using in my <code>web.config</code>:</p>
<blockquote>
<p>Could not f... | <p>You can bind in a schema to the <code>log4net</code> element. There are a few floating around, most do not fully provide for the various options available. I created the following xsd to provide as much verification as possible:
<a href="http://csharptest.net/downloads/schema/log4net.xsd" rel="noreferrer">http://c... | <p>Without modifying your Visual Studio installation, and to take into account proper versioning/etc. amongst the rest of your team, add the .xsd file to your solution (as a 'Solution Item'), or if you only want it for a particular project, just embed it there.</p>
| 21,025 |
<p>I've been reading a text about an extension to C# and at one point it says that "An attribute decoration X may only be applied to fields of type Y."</p>
<p>I haven't been able to find a definition for attribute decoration, and I'm not making much sense out of this by exchanging the two.</p>
| <p>I solved my own question. you have to pass in an array with the values.</p>
<pre><code>Dim A(0) as Int32
A(0) = 1
Tasks.Task.Create(AddressOf TransferData, A)
</code></pre>
| <p>Not necessarily the most helpful answer I know, but in C# you could do this with a closure:</p>
<pre><code>var T = Tasks.Task.Create( () => functionToDoWork(SomeParameter) )
</code></pre>
| 34,059 |
<p>I'm working on a project were we have number (5 at the moment) of servers spread across the world.
Clients connect to one of those servers through a centralized broker.
We know the originating country of the client but nothing else. We have full control of the servers so we can have all the info we need on those.
We... | <p>I think the term you need is "geographic load balancing". Most of the major load balancing vendors have a solution here - your broker could use of these.</p>
<p>Googling <a href="http://www.google.co.uk/search?hl=en&q=geographic+load+balancing" rel="nofollow noreferrer">geographic load balancing</a> gets some u... | <p>Pinging them and picking the one with the lowest latency sounds good, but I have a feeling it won't scale (what happens when you have 100, or 1000?) - so maybe another solution is better? There are lots of vendors out there with systems which do just this; DNS anycast is quite widely used too.</p>
<p>If you did jus... | 42,159 |
<p>I'm trying to redirect requests for a wildcard domain to a sub-directory.<br />
ie. <code>something.blah.example.com</code> --> <code>blah.example.com/something</code></p>
<p>I don't know how to get the subdomain name to use in the rewrite rule.</p>
<p><strong>Final Solution:</strong></p>
<pre><code>RewriteCond %... | <p>You should have a look at the <a href="http://httpd.apache.org/docs/2.2/rewrite/" rel="noreferrer" title="URL Rewriting Guide">URL Rewriting Guide</a> from the apache documentation.</p>
<p>The following is untested, but it should to the trick:</p>
<pre><code>RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.domain\.com$
Re... | <p>@Sam</p>
<p>your RewriteCond line is wrong. The expansion of the variable is triggered with %, not $.</p>
<pre><code>RewriteCond %{HTTP_HOST} ^([^\.]+)\.media\.xnet\.tk$
^
</code></pre>
<p>that should do the trick</p>
| 7,210 |
<p>At work we have 4 people working together on a few different projects. For each project we each have a local copy we work on and then there is a development, staging, and live deployment, along with any branches we have (we use subversion). Our database is MySQL.</p>
<p>So my question is, what is a good way to mana... | <p><a href="http://odetocode.com/Blogs/scott/archive/2008/01/30/11702.aspx" rel="nofollow noreferrer">http://odetocode.com/Blogs/scott/archive/2008/01/30/11702.aspx</a></p>
<p>The above blog brought us to our current database version control system. Simply put, no DB changes are made without an update script and all ... | <p><a href="http://odetocode.com/Blogs/scott/archive/2008/01/30/11702.aspx" rel="nofollow noreferrer">http://odetocode.com/Blogs/scott/archive/2008/01/30/11702.aspx</a></p>
<p>The above blog brought us to our current database version control system. Simply put, no DB changes are made without an update script and all ... | 18,880 |
<p>Into some view data i have put the result of an anonymous type:</p>
<pre><code> var projectData = from p in db.Projects
orderby p.title
select new
{
Title = p.title,
D... | <p>In your case it would be much simpler to create a model to hold your data rather than using an anonymous type. </p>
<p>The issue you're having is that your anonymous type is cast to an object when its stored within the ViewData. On the UI side, when you get that object out, the only way to access its properties i... | <p>The problem is not that it's an anonymous type. The problem is that it's merely a lazy-evaluated IQueryable<> object, and it hasn't been evaluated yet.</p>
<p>I can't answer for ASP.NET MVC, but in the very similar Monorail, you would have to convert it from an iterator into an actual collection:</p>
<pre><cod... | 36,115 |
<p>I have a SQL challenge that is wracking my brain. I am trying to reconcile two reports for licenses of an application. </p>
<p>The first report is an access database table. It has been created and maintained by hand by my predecessors. Whenever they installed or uninstalled the application they would manually up... | <p>Taking Kaboing's answer and the edited question, the solution seems to be:</p>
<pre><code>SELECT *
FROM report_1 r1
FULL OUTER JOIN report_2 r2
ON r1.SAMAccountName = r2.SAMAccountName
OR r1.NetbiosName = r2.NetbiosName
OR r1.DisplayName = r2.DisplayName
WHERE r2.NetbiosName IS NULL OR r1.NetbiosName ... | <p>Try the following:</p>
<pre><code>SELECT displayName, 'report_1' as type
FROM report_1 r1
LEFT OUTER JOIN report_2 r2 ON r1.SAMAccountName = r2.SAMAccountName
WHERE r2.SAMAccountName IS NULL
UNION
SELECT displayName, 'report_2' as type
FROM report_1 r1
RIGHT OUTER JOIN report_2 r2 ON r1.SAMAccountName = r2.SAMAcco... | 40,691 |
<p>Should be pretty simple: I have an InputStream where I want to peek at (not read) the first two bytes, i.e. I want the "current position" of the InputStream to stil be at 0 after my peeking. What is the best and safest way to do this?</p>
<p><strong>Answer</strong> - As I had suspected, the solution was to wrap it ... | <p>For a general InputStream, I would wrap it in a BufferedInputStream and do something like this:</p>
<pre><code>BufferedInputStream bis = new BufferedInputStream(inputStream);
bis.mark(2);
int byte1 = bis.read();
int byte2 = bis.read();
bis.reset();
// note: you must continue using the BufferedInputStream instead of... | <p>I found an implementation of a PeekableInputStream here:</p>
<p><a href="http://www.heatonresearch.com/articles/147/page2.html" rel="nofollow noreferrer">http://www.heatonresearch.com/articles/147/page2.html</a></p>
<p>The idea of the implementation shown in the article is that it keeps an array of "peeked" values... | 17,848 |
<p>I have a requirement to get the contents of every method in a cs file into a string. What I am looking for is when you have an input of a cs file, a dictionary is returned with the method name as the key and the method body as the value.</p>
<p>I have tried Regex and reflection with no success, can anyone help?</p>... | <p>I don't know if it's any use to you but Visual Studio Addins include a EnvDTE object, that gives you full access to the VB and C# language parsers.
See <a href="http://msdn.microsoft.com/en-us/library/ms228763(VS.80).aspx" rel="nofollow noreferrer">Discovering Code with the code Model</a></p>
<p>I touched on it tang... | <p>after you find the function headers, count the number of braces until you find the end of the function. </p>
| 32,740 |
<p>I am trying to use some AOP in my Python programming, but I do not have any experience of the various libraries that exist. </p>
<p>So my question are:</p>
<blockquote>
<p>What AOP support exists for Python? And what are the advantages of the differents libraries between them?</p>
</blockquote>
<hr>
<h3>Edit</... | <p>See S.Lott's link about Python decorators for some great examples, and see the <a href="http://www.python.org/dev/peps/pep-0318/" rel="nofollow noreferrer">defining PEP for decorators</a>.</p>
<p>Python had AOP since the beginning, it just didn't have an impressive name.
In Python 2.4 the decorator syntax was added... | <p>I'd start with the <a href="http://wiki.python.org/moin/PythonDecoratorLibrary" rel="nofollow noreferrer">Python Decorator Library</a>. Much of that is AOP kind of stuff. </p>
| 36,497 |
<p>I have a Perl script that sets up variables near the top for directories and files that it will use. It also requires a few variables to be set as command-line arguments.
Example:</p>
<pre><code>use Getopt::Long;
my ($mount_point, $sub_dir, $database_name, $database_schema);
# Populate variables from the command ... | <p>Here's another approach. It uses arrays of names and a hash to store the options. It makes all options truly optional, but validates the required ones unless you include "--debug" on the command line. Regardless of whether you use "--debug", you can override any of the others. </p>
<p>You could do more explicit... | <p>GetOptions can be called with an array as its input data. Read the <a href="http://perldoc.perl.org/Getopt/Long.html#Parsing-options-from-an-arbitrary-array" rel="nofollow noreferrer">documentation</a>.</p>
| 46,458 |
<p>Why is garbage collection required for tail call optimization? Is it because if you allocate memory in a function which you then want to do a tail call on, there'd be no way to do the tail call and regain that memory? (So the stack would have to be saved so that, after the tail call, the memory could be reclaimed.)<... | <p>Like most myths, there may be a grain of truth to this one. While GC isn't <em>required</em> for tail call optimization, it certainly <em>helps</em> in a few cases. Let's say you have something like this in C++:</p>
<pre><code>int foo(int arg) {
// Base case.
vector<double> bar(10);
// Populate... | <p>Garbage collection is not required for tail-call optimization.</p>
<p>Any variables allocated on the call stack will be reused in the recursive call, so there's no memory leak there.</p>
<p>Any local variables allocated on the heap and not freed before a tail call will leak memory whether or not tail-call optimiza... | 44,817 |
<p>I need to have a thread signal another if the user wishes to interrupt execution, however I'm unsure about how to implement the signaling/signal-checking mechanism. I wouldn't like to have a singleton in my project (like a global <code>bool</code>), but is there an alternative?</p>
<p>In <a href="https://stackoverf... | <p>Try out <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">BackgroundWorker</a>. It supports progress updates and cancellation of a running task.</p>
<p>If you want one thread to wait until another thread has finished doing its thing, then Monitor... | <p>Look at the System.Runtime.Remoting namespace.</p>
| 14,130 |
<p>My application links against libsamplerate.a. I am doing this to make distributing the final binary easier.</p>
<p>I am worried that perhaps the code inside the .a file depends on some other libraries I also will need to distribute.</p>
<p>But if it doesn't I am worried I am bloating up my application too much by ... | <p>A static library is just a collection of object files. When you compile a program against a static library, the object code for the functions used by your program is copied from the library into your executable. Linking against a static library will not cause any functions outside that library to be included in yo... | <p>Just the object code for libsamplerate. Statically linking against a single library doesn't make all libraries linked statically; that would be Bad.</p>
| 31,754 |
<p>I am running into the problem of the "hanging JFileChooser" as described in the following threads:</p>
<p><a href="http://forums.sun.com/thread.jspa?threadID=5309960" rel="noreferrer">http://forums.sun.com/thread.jspa?threadID=5309960</a></p>
<p><a href="http://forums.sun.com/thread.jspa?threadID=724817" rel="nore... | <p>There's a bug where if you a networked drive mapped on the desktop, it can sometimes hang on the JFileChooser. That or it might be a shortcut to a networked drive. Something along those lines...</p>
| <p>The .10 update is supposed to fix the zipfile related one.</p>
| 39,208 |
<p>I have a web-app-database 3 tier server setup. Web requests data from app, and app gets its data from the db then processes and returns it to web for display. Standard. </p>
<p>Currently all the data I serialize from app to web gets put into custom defined data structs that the web side then parses for display. In ... | <ul>
<li>Factor out format specific
serialization code into separate
classes using the <a href="http://en.wikipedia.org/wiki/Adapter_pattern" rel="nofollow noreferrer">Adapter
pattern</a>. Your problem domain
classes become backing store
neutral. </li>
<li>Use relational database specific adapter classes on the app ti... | <p>If I understand your question correctly, you want to serialize the data of your objects, but when they are re-hydrated, they should be so into a different type of object (With limited and/or different functionality)?</p>
<p>You can do this in different ways, depending on what protocol you prefer. For example, you c... | 32,417 |
<p>I have a .NET 3.5 (target framework) web application. I have some code that looks like this:</p>
<pre><code>public string LogPath { get; private set; }
public string ErrorMsg { get; private set; }
</code></pre>
<p>It's giving me this compilation error for these lines:</p>
<pre><code>"must declare a body because ... | <p>add to web.config</p>
<pre><code><system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="Co... | <p>It is, as long as you put <strong>abstract</strong> in front, or implement the methods.</p>
<pre><code>public abstract string LogPath { get; private set; }
public abstract string ErrorMsg { get; private set; }
</code></pre>
<p>See <a href="http://forums.asp.net/t/1031651.aspx" rel="nofollow noreferrer">http://foru... | 12,122 |
<p>I don't understand why one method would work and the other would throw a NoMethodError if they come from the same lib file.</p>
<pre><code># app/views/bunnies/show.html.erb
<% if logged_in? %>
<%= current_user.login %> |
<%= link_to 'Logout', logout_path %> |
<% if authorized? %>
&... | <p>I'm guessing you are not logged in when the error is thrown. The NoMethod is not referring to #authorized?. It is actually referring to the #login method of current_user. If you aren't logged in, then current_user is nil, resulting in NoMethod when current_user.login is called within #authorized?.</p>
<p>Any helper... | <p>Right, so I still don't understand why that wasn't working, but I have found an alternative solution.</p>
<p>(1) Leave authenticated_system.rb as is.</p>
<p>(2) Add a helper method to controllers/application.rb:</p>
<pre><code>helper_method :is_admin?
def is_admin?
if logged_in? && current_user.login =... | 38,385 |
<p>I know there's JScript.NET, but it isn't the same as the JavaScript we know from the web.</p>
<p>Does anyone know if there are any JavaScript based platforms/compilers for desktop development? Most specifically Windows desktop development.</p>
| <p>Yes, with <a href="http://www.adobe.com/products/air/" rel="noreferrer">Adobe AIR</a>. Adobe AIR lets you make desktop applications with Javascript, Flex, or Flash.</p>
| <p>Here are some JSOS (Javascript Operating Systems), sort-of still need a browser.</p>
<p><a href="http://fractalbrain.net/" rel="nofollow noreferrer">http://fractalbrain.net/</a> /* The Best. */</p>
<p><a href="http://cometdesktop.com/" rel="nofollow noreferrer">http://cometdesktop.com/</a> /* Alright. */</p>
<p><... | 13,468 |
<p>For general protocol message exchange, which can tolerate some packet loss. How much more efficient is UDP over TCP?</p>
| <p>UDP is faster than TCP, and the simple reason is because its non-existent acknowledge packet (ACK) that permits a continuous packet stream, instead of TCP that acknowledges a set of packets, calculated by using the TCP window size and round-trip time (RTT).</p>
<p>For more information, I recommend the simple, but v... | <p>The network setup is crucial for any measurements. It makes a huge difference, if you are communicating via sockets on your local machine or with the other end of the world. </p>
<p>Three things I want to add to the discussion:</p>
<ol>
<li>You can find <a href="http://gafferongames.com/networking-for-game-program... | 7,024 |
<p>I have a DTS job that is using the MSXML2.XMLHTTP3.0 object to generate a post request to an ASP.NET application. Under the covers, the ASP.NET application is using System.Reflection to acquire some assembly information and I receive the following exception:</p>
<blockquote>
<p>System.Web.HttpException Error Cod... | <p>Try this:
<a href="http://support.instantasp.co.uk/Topic4710-31-1.aspx" rel="nofollow noreferrer">http://support.instantasp.co.uk/Topic4710-31-1.aspx</a></p>
| <p>Judging by the exception message this does not look like an authentication problem to me.
Could it be that the invoked method tries to access the ASP.NET Session? That would explain the exception.</p>
| 33,068 |
<p>Does Server Core 2008 support asp.net? I see references online saying that it isn't supported, but they are all old references from CTPs.</p>
| <p>No.</p>
<p>Answer here:
<a href="http://www.microsoft.com/windowsserver2008/en/us/compare-core-installation.aspx" rel="nofollow noreferrer">http://www.microsoft.com/windowsserver2008/en/us/compare-core-installation.aspx</a></p>
<p>"ASP.NET is not available with Server Core installation option in any edition"</p>
| <p><a href="http://www.microsoft.com/windowsserver2008/en/us/compare-core-installation.aspx" rel="nofollow noreferrer">No</a></p>
| 9,102 |
<p>I'm in the process of developing a multi-tiered financial processing application in Java using EJB3 (Hibernate + Glassfish for the app and web services layer, Lift on Glassfish for the web UI) and I'm struggling with the question of where to put my business logic.</p>
<p>When this project started, our first notion ... | <p>I struggled with this while building a webapp using JPA, EJB3, and Wicket. Since hitting my database hard with repeated queries was more scalable than holding lots of large entities in memory, I decided to only pass around their ids and never the entity itself.</p>
<p>Wicket and its concept of models had a lot to ... | <p>Whenever you need many "system" services (injections, etc) use stateless bean.
Otherwise - POJOs. POJOs are much more flexible.</p>
<p>However simple (accessor?) methods (e.g. in webservices and beans) can just do some simple work and return the results.</p>
| 31,327 |
<p>I guess I'll illustrate with an example:
In <a href="http://www.kloonigames.com/blog/games/crayon" rel="nofollow noreferrer">this game</a> you are able to draw 2D shapes using the mouse and what you draw is rendered to the screen in real-time. I want to know what the best ways are to render this type of drawing usin... | <p>I love crayon physics (music gets me every time). Great game!</p>
<p>But back to the point... He has created brush sprites that follow your mouse position. He's created a few brushes that account for a little variation. Once the mouse goes down, I imagine he is adding these sprites to a data structure and sending... | <p>I'm pretty sure the second idea is the way to go. </p>
| 18,891 |
<p>I'm trying to optimize several bottlenecks on an application which is supposed to run on a really wide range of CPUs and architectures (some of them very close to embeded devices).</p>
<p>The results of my profiler, however, aren't really significant because of the speed of my CPU. Is there any way (preferably unde... | <p>This works well and supports multicore. <a href="http://www.cpukiller.com/" rel="nofollow noreferrer">http://www.cpukiller.com/</a></p>
| <p>There was an app on Downloadsquad.com recently. I dont remember the name of it but it did some fun stiff woth processors and task manager. It may have only been to manage what apps are on what cpu but maybe it would give you this. I will try to look for it this afternoon, and respond back if I find it.</p>
| 7,843 |
<p>Here's my problem at a high level:</p>
<p>We have two business applications. App1 inputs and stores a large set of data. We need something that will transfer data from App1 to App2 whenever any relevent data in App1 has changed. Essentially we want the data in App2 to be synchronized from App1, except that App2 ... | <p>Have you considered <a href="http://technet.microsoft.com/en-us/library/ms143241.aspx" rel="nofollow noreferrer">replication</a>?</p>
| <p>Are they in different physical locations? Why can't you use a single database and only allow app2 to access the subset of data that it is allowed to?</p>
| 38,898 |
<p>I have a table that records a sequence of actions with a field that records the sequence order:</p>
<pre><code>user data sequence
1 foo 0
1 bar 1
1 baz 2
2 foo 0
3 bar 0
3 foo 1
</code></pre>
<p>Selecting the first item for each user is easy enough ... | <p>This sql will return the record with the highest sequence value for each user:</p>
<pre><code>select a.user, a.data, a.sequence
from table as a
inner join (
select user, max(sequence) as 'last'
from table
group by user) as b
on a.user = b.user and
a.sequence = b.last
</code>... | <pre><code>select top 1
user
,data
,sequence
from table
order
by sequence
</code></pre>
| 21,035 |
<p>I want to build an executable to distribute to people without python installed on their machines. </p>
<p>Is there an add-on to Eclipse that allows this? I couldn't find one. </p>
<p>If not, do you have a builder that you recommend that would make it easy to go to my python project directory created in Eclipse, an... | <p><a href="https://stackoverflow.com/questions/2933/an-executable-python-app">See</a> <a href="https://stackoverflow.com/questions/106725/how-to-bundle-a-python-application-including-dependencies-for-windows">these</a> <a href="https://stackoverflow.com/questions/116657/how-do-you-create-an-osx-applicationdmg-from-a-p... | <p>There is also PyInstaller:
<a href="http://www.pyinstaller.org/" rel="nofollow">http://www.pyinstaller.org/</a></p>
| 14,903 |
<p>If I want to manipulate an HTML tag's properties on the server within an aspx page based on a master page i.e. </p>
<pre><code><a href="#" runat="server" ID="myLink">My Link</a>
</code></pre>
<p>For example to give the link a different class depending on the current page i.e.</p>
<pre><code>if (Path.G... | <p>AFAIK there is no way.</p>
<p>It shows the actual control tree, which is in this case masterpage-content-control.</p>
<p>However if you add an ID to the masterpage (this.ID = "whatever") then you will see "whatever" instead of ctl00 (which means control index 0).</p>
| <p>I don't think so. </p>
<p>However, you probably want to keep the original name so that you can manipulate the control with javascript.... if that's the case, you should look into ClientID; it will return the assigned ID at runtime.</p>
<p><strong>EDIT:</strong> </p>
<p>It looks like there is a way to do it, but ... | 13,969 |
<p>I have a form action that needs to have its value set from a variable. I need to set the variable once and it will be reflected many times throughout the DOM.</p>
<p>So:</p>
<p>variable = "somthing.html";
...
</p>
| <p>You can then change the form action to be equal to the variable name. Something like the following.</p>
<pre><code>var variableName = "myform.htm";
this.form.action = variableName;
</code></pre>
<p>Edit, you can also do this with other elements, just like you would with any other piece of javascript, using thing... | <p>i am not sure if this is what you are asking, but you could change the action of the document with this:</p>
<p>document.formname.action = "something.html";</p>
| 44,865 |
<p>According to <a href="http://groups.google.com/group/v8-users/browse_thread/thread/3f57f8d1c31806a5" rel="nofollow noreferrer">this discussion</a>, the iphone agreement says that it doesn't allow "loading of plugins or running interpreted code that has been downloaded".</p>
<p>Technically, I <strong>would</strong> ... | <p>I think your interpretation is correct - You would not be allowed to download and execute JavaScript code in v8.</p>
<p>If there were some way to run the code in an interpreter already on the iPhone (i.e. the javascript engine in MobileSafari) then that would be permitted I think.</p>
| <p>Well I embedded Lua into my application already and am programming most of the login in Lua and then downloading it to my iPhone for fast iteration, but this is only intended during development. Once I ship the scripts will be placed in the source and compiled into byte-code shipped along with the app just like any ... | 7,075 |
<p>I need to grant select permission for all tables owned by a specific user to another user. Can I do this with a single command along the lines of:</p>
<pre><code>Grant Select on OwningUser.* to ReceivingUser
</code></pre>
<p>Or do I have to generate the sql for each table with something along the lines of:</p>
<... | <p>Well, it's not a single statement, but it's about as close as you can get with oracle:</p>
<pre><code>BEGIN
FOR R IN (SELECT owner, table_name FROM all_tables WHERE owner='TheOwner') LOOP
EXECUTE IMMEDIATE 'grant select on '||R.owner||'.'||R.table_name||' to TheUser';
END LOOP;
END;
</code></pre>
| <p>From <a href="http://psoug.org/reference/roles.html" rel="nofollow noreferrer">http://psoug.org/reference/roles.html</a>, create a procedure on your database for your user to do it:</p>
<pre><code>CREATE OR REPLACE PROCEDURE GRANT_SELECT(to_user in varchar2) AS
CURSOR ut_cur IS SELECT table_name FROM user_tables... | 22,767 |
<p>I try to write KSH script for processing a file consisting of name-value pairs, several of them on each line.</p>
<p>Format is:</p>
<pre><code>NAME1 VALUE1,NAME2 VALUE2,NAME3 VALUE3, etc
</code></pre>
<p>Suppose I write:</p>
<pre><code>read l
IFS=","
set -A nvls $l
echo "$nvls[2]"
</code></pre>
<p>This will giv... | <p>As it often happens, I deviced an answer minutes after asking the question in public forum :(</p>
<p>I worked around the quoting/unquoting issue by piping the input file through the following sed script:</p>
<pre><code>sed -e 's/\([^\]\),/\1\
/g;s/$/\
/
</code></pre>
<p>It converted the input into:</p>
<pre><cod... | <p>As it often happens, I deviced an answer minutes after asking the question in public forum :(</p>
<p>I worked around the quoting/unquoting issue by piping the input file through the following sed script:</p>
<pre><code>sed -e 's/\([^\]\),/\1\
/g;s/$/\
/
</code></pre>
<p>It converted the input into:</p>
<pre><cod... | 20,722 |
<p>The default value for the first item in a drop down list is the name of the database field. I need to change it to a more user friendly name. How do I change the value?</p>
| <p>add a HTML Item onto the prompt page and add the following as an HTML item:</p>
<p>Example:
<code><script></code>
<code>document.formWarpRequest._oLstChoicesMyList[0].text = '--SELECT A CITY--';</code>
<code></script></code></p>
<p>Replace 'MyList' with the name of the component.</p>
<p>from: <a href... | <p>Within the dataitem in the query.. you could do a ..</p>
<p>IF ( [dataitemA] = 'some text' ) THEN
( 'new text' )
ELSE
( [dataitemA] )</p>
<p>i try to avoid using javascript and html items becuase they dont generally work in pdf or excel outputs.</p>
<p>just a thought..</p>
<p>cheers!</p>
| 27,402 |
<p>Recently I have started using a fairly large LCD resin printer. (Yidimu Falcon Pro)
It has a fairly large 260x160mm perforated and coated steel build plate and a decent dual rail Z axis with a ballscrew. It has a 10" LCD. It prints ChiTuBox files from a USB stick.</p>
<p>I have been having a mostly successful print... | <p>looks like you have done a lot of work to try to get it working.</p>
<p>considering you are having issues on one side of the build plate my thought is that it is a levelling issue or an issue with the plate itself. Try levelling it using the video <a href="https://www.youtube.com/watch?v=K4G6ExEtk70" rel="nofollow n... | <p>I had an issue with my Vat Bolts, one being cracked and leveling at a greater tension than the other. With the compressible feet of my Vat this caused a problem in the FEP. This was enough to cause failure on one side more than the other. Cause was verified by switching the left and right knobs, thus shifting the... | 1,677 |
<p>Is there a way to get the key (or id) value of a db.ReferenceProperty, without dereferencing the actual entity it points to? I have been digging around - it looks like the key is stored as the property name preceeded with an _, but I have been unable to get any code working. Examples would be much appreciated. Th... | <p>Actually, the way that you are advocating accessing the key for a ReferenceProperty might well not exist in the future. Attributes that begin with '_' in python are generally accepted to be "protected" in that things that are closely bound and intimate with its implementation can use them, but things that are updat... | <p>You're correct - the key is stored as the property name prefixed with '_'. You should just be able to access it directly on the model object. Can you demonstrate what you're trying? I've used this technique in the past with no problems.</p>
<p>Edit: Have you tried calling series_id() directly, or referencing _serie... | 17,161 |
<p>I didn't attend PDC 2008, but I heard some news that C# 4.0 is announced to support Generic covariance and contra-variance. That is, <code>List<string></code> can be assigned to <code>List<object></code>. How could that be?</p>
<p>In Jon Skeet's book <strong><em>C# in Depth</em></strong>, it is explaine... | <p>Variance will only be supported in a <em>safe</em> way - in fact, using the abilities that the CLR already has. So the examples I give in the book of trying to use a <code>List<Banana></code> as a <code>List<Fruit></code> (or whatever it was) still won't work - but a few other scenarios will.</p>
<p>Fir... | <p>Not that Jon hasn't already covered it, but here are some links to blogs and videos from Eric Lippert. He does a nice job of explaining it with examples.</p>
<p><a href="https://blogs.msdn.microsoft.com/ericlippert/2007/10/16/covariance-and-contravariance-in-c-part-one/" rel="nofollow noreferrer">https://blogs.msd... | 30,468 |
<p>I would like to be able to dictate into my Delphi application using Microsoft Vista's speech recognition. However when attempting to dictate into a TMemo, it simply does not work. I noticed that Firefox 3.0 has the same issue and after they contacted Microsoft about the problem, they <a href="https://bugzilla.mozill... | <p>I found out that there is a way to enable speech recognition in all programs, even those that don't support it, simply by going to the options of Windows Speech Recognition and selecting <strong>Enable dictation everywhere</strong>. However when you use this to dictate into an editbox that doesn't use the Text Servi... | <p><a href="https://stackoverflow.com/questions/207653/text-to-speech-in-vista">Text to speech in Vista</a></p>
<p>Just tested it with a button like the demo code on that page, works fine in Vista SP1/D2007. (funny, I clicked the 'Vista' tag-link and found it there...)</p>
| 34,546 |
<p>I'm using the GGeoXml object to overlay KML on an embedded Google Map. I need to customize the popup balloon for placemarks, so I'm trying to use the <a href="http://code.google.com/apis/kml/documentation/kmlreference.html#balloonstyle" rel="nofollow noreferrer"><code><BalloonStyle></code></a> element:</p>
<p... | <p>No, like you have mentioned, html in the description is the only way I know that you can control the style of balloons through kml/georss feed. </p>
| <p>Actually, the document referenced above (<a href="http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html" rel="nofollow noreferrer">http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html</a>) must have changed, b/c now it says:</p>
<blockquote>
<p><BalloonStyle> partially only... | 24,237 |
<p>How do I access the user R13 and R14 which are saved when supervisor mode is entered? I am using an ARM7TDMI. </p>
<p>I.E. I do not want to access supervisor R14 which now contains the return address to user mode, instead want the value of user mode's link register. This is part of a debugger I am writing.</p>
<p>... | <p>I'll describe the answer for your specific question but the same approach applies to other modes as well.</p>
<p>You'll need to change the processor mode by changing the mode bits in the CPSR to system mode. This will give you access to user mode's SP/LR (R13 & R14). Remember that system mode is privileged, b... | <p>I've discovered a better way: -</p>
<p>When doing a STM, if r15 isn't one of the operands then ^ gives access to user-mode registers. However, autoincrementing doesn't seem to work within the instruction, and a nop is required afterwards if you want to access the register bank.</p>
<p>Something like</p>
<pre><cod... | 42,050 |
<p>I have a map in Java. I would like to compare a source string against all items in the map and return the best match based on a levenshtein ratio algorithm. I am wondering what the optimal way to perform this check on every element in the list would be. </p>
<p>Thanks, Matt</p>
| <p>You won't be able to get better than O(n) performance with a standard Map - just use the naive approach of testing them sequentially.</p>
<p>There are far more efficient ways to do this, though. One of them is called a <a href="http://en.wikipedia.org/wiki/Bk-tree" rel="nofollow noreferrer">bk-tree</a>. Basically, ... | <p>Since the levenshtein ratio depends both on the source and on the target, the values will change for each source string. Unless there is a high probability that the source string might be repeated on subsequent searches, just iterate over the map elements. If speed is truly an issue, make sure you are using the late... | 16,429 |
<p>I need to generate a directory in my makefile and I would like to not get the "directory already exists error" over and over even though I can easily ignore it.</p>
<p>I mainly use mingw/msys but would like something that works across other shells/systems too.</p>
<p>I tried this but it didn't work, any ideas?</p... | <p>On UNIX Just use this:</p>
<pre><code>mkdir -p $(OBJDIR)
</code></pre>
<p>The -p option to mkdir prevents the error message if the directory exists.</p>
| <p>A little simpler than Lars' answer:</p>
<pre><code>something_needs_directory_xxx : xxx/..
</code></pre>
<p>and generic rule:</p>
<pre><code>%/.. : ;@mkdir -p $(@D)
</code></pre>
<p>No touch-files to clean up or make .PRECIOUS :-)</p>
<p>If you want to see another little generic gmake trick, or if you're interes... | 12,440 |
<p>Lately I've been having a lot of trouble with printing overhangs in TPU. The failures are very geometry/toolpath dependent, entirely reproducible in their location (same gcode gives same failures each time it's printed), and seem to occur where there is a convex (model-inward) curve over an overhang of more than 40°... | <p>The root cause was a badly worn nozzle.</p>
<p>The problem described in this question gradually became more and more severe and began affecting PLA and PET prints with thin layers too. Eventually I traced it to the CHT nozzle, by swapping in a 50¢ plain brass nozzle, and found someone with otherwise very similar ext... | <p>I fixed my overhangs by increasing the nozzle temp. You need to heat it up enough that the elasticity is lost which makes it misbehave on overhangs and curl up.</p>
| 2,174 |
<p>What is the best (or as good as possible) general SVN ignore pattern to use? </p>
<p>There are a number of different IDE, editor, compiler, plug-in, platform, etc. specific files and some file types that "overlap" (i.e. desirable for some types projects and not for others). </p>
<p><strong>There are however, a lar... | <p>I'll add my own two cents to this question:</p>
<p>I use the following SVN ignore pattern with TortoiseSVN and Subversion CLI for native C++, C#/VB.NET, and PERL projects on both Windows and Linux platforms. It works well for me! </p>
<p>Formatted for copy and paste:</p>
<pre>
*.o *.lo *.la #*# .*.rej *.rej .*~... | <p>The pattern depends on which operating system you're using.</p>
<p>On Linux, you'll want to block **.o*, **.so*, **.a*, and **.la* to begin with. You may also want to block **~* (backup file from editing) and #*# (emacs backup from a crash).</p>
<p>On Windows, you'll want **.obj*, **.lib*, and **.dll* at the very ... | 11,089 |
<p>With DWR it is possible to group together several service calls into one single HTTP request :<br>
<a href="http://directwebremoting.org/dwr/browser/engine/batch" rel="noreferrer">dwr batch feature</a><br><br>
This feature is very useful to reduce the latency of an ajax application.
Is there a way to do something s... | <p>Google's Ray Ryan did a presentation about <a href="http://code.google.com/events/io/sessions/GoogleWebToolkitBestPractices.html" rel="noreferrer">Best Practices For Architecting Your GWT App</a>, where he talked about using a command pattern. Sending asynchronous commands that happen to go over RPC is what you prob... | <p>GWT doesn't provide a one-step solution for batching several arbitrary RPCs. However, keep in mind that GWT's automatic serialization makes it quite easy to write both serial and batched versions of each of your RPC methods. For example, suppose you've defined this RPC:</p>
<pre><code>FooResponse callFoo(FooReque... | 29,300 |
<p>I have a long 8 mm smooth steel rod of about 55 cm long. This rods bend easily due to the length. If I replace them with 8mm solid carbon fiber rods, will the bending reduce? Will the bearings wear off the carbon fiber rod? I couldn't find too much information about this.</p>
| <p>Steel is the best material for a linear rod when you have a fixed cross-section. It will have the least flex of any rod (aside from some exotic metals) of the same size. </p>
<p>Carbon fiber's material properties might seem superior at first sight, but the stiffness is very anisotropic -- it's very stiff along the ... | <p>I agree that steel is the best material for rails but the info provided on carbon fiber is just wrong.</p>
<p>When making a carbon fiber part, whether a tube or any other shape, you lay the fabric in the orientation you need for the direction of the forces. If multi-directional strength and stiffness is needed then... | 242 |
<p>Running a ServiceHost with a single contract is working fine like this:</p>
<pre><code>servicehost = new ServiceHost(typeof(MyService1));
servicehost.AddServiceEndpoint(typeof(IMyService1), new NetTcpBinding(), "net.tcp://127.0.0.1:800/MyApp/MyService1");
servicehost.Open();
</code></pre>
<p>Now I'd like to add a ... | <p>You need to implement both services (interfaces) in the same class.</p>
<pre><code>servicehost = new ServiceHost(typeof(WcfEntryPoint));
servicehost.Open();
public class WcfEntryPoint : IMyService1, IMyService2
{
#region IMyService1
#endregion
#region IMyService2
#endregion
}
</code></pre>
<hr>
... | <p>Did I miss something, or is the simplest solution not mentioned here? The simplest solution is this: Don't use multiple interfaces for the Web Service.</p>
<p>But that doesn't mean you can still have your interfaces separated. This is why we have Interface inheritance.</p>
<pre><code>[ServiceContract]
public inter... | 43,370 |
<p>I've got some P/Invoke code that invokes DBGHELP.DLL. I'll add the signatures to pinvoke.net later.</p>
<p>The version of DBGHELP.DLL that ships with Windows 2003 is too old, and my code requires the version of DBGHELP.DLL that shipped with "Debugging Tools for Windows" version 6.9.</p>
<p>How do I do one of the f... | <p>P/Invoke a call to LoadLibrary with the explicit path of the DBGHELP that you want, that way when you go to make your actual P/Invoke call, the DLL will already be loaded.</p>
| <p>Wouldn't it be easier to import (but not call) a function that's only present in DbgHelp.DLL version 6.9 and higher?</p>
| 48,140 |
<p>I used to often find myself coping a piece of code from a website/Word document etc only to discover that when doing Paste I would end up with the desired code plus some extra HTML tags/text, basically extra formatting information.</p>
<p>To get rid of that extra ballast I would paste the text to the Notepad and th... | <p><strong>Just to summarize the available options:</strong></p>
<p><strong>Tools</strong></p>
<ul>
<li><a href="http://www.stevemiller.net/puretext/" rel="noreferrer">PureText</a> - free tool for Windows</li>
<li>Use <a href="http://www.autohotkey.com" rel="noreferrer">AutoHotkey</a> and write your own macro
as sugg... | <p>Look for a little clipboard icon that pops up at the end of the material you pasted. Click on this and choose "keep text only".</p>
| 14,890 |
<p>I've done <em>some</em> research on this matter however I cannot find any clear answers. </p>
<p>How does a SolidWorks CAD file get 'converted' into a file format suitable for 3D printing, in detail?</p>
| <p>Any and all CAD files can be converted to STL (Standard Triangle Language). In this file format, surfaces are parsed to be combinations of triangles. For example a flat rectangular surface gets represented as two triangles in the same plane. </p>
<p>As the complexity of the solid increases more triangles are requir... | <p>When you convert it to, let's say, a .stl (3d object file) file, I believe it converts the geometry of the parts into binary and saves the sets. These matrices can be used by the software of 3d printer in order to give the appropriate Trajectory for the extruder. And then the motion of the extruder is 'divided' amon... | 577 |
<p>I have a models <code>A</code> and <code>B</code>, that are like this:</p>
<pre><code>class A(models.Model):
title = models.CharField(max_length=20)
(...)
class B(models.Model):
date = models.DateTimeField(auto_now_add=True)
(...)
a = models.ForeignKey(A)
</code></pre>
<p>Now I have some <code>A</code> ... | <p>The question and selected answer are from 2008 and since then this functionality has been integrated into the django framework. Since this is a top google hit for "django filter foreign key count" I'd like to add an easier solution with a recent django version using <a href="https://docs.djangoproject.com/en/dev/to... | <p>I assume that joining or leaving the pool may not happen as often as listing (showing) the pools. I also believe that it would be more efficient for the users join/leave actions to update the pool display status. This way, listing & showing the pools would require less time as you would just run a single query f... | 32,243 |
<p>In ASP.NET MVC, you can mark up a controller method with <code>AuthorizeAttribute</code>, like this:</p>
<pre><code>[Authorize(Roles = "CanDeleteTags")]
public void Delete(string tagName)
{
// ...
}
</code></pre>
<p>This means that, if the currently logged-in user is not in the "CanDeleteTags" role, the contro... | <p>When it was first developed, System.Web.Mvc.AuthorizeAttribute was doing the right thing -
older revisions of the HTTP specification used status code 401 for both "unauthorized" and "unauthenticated". </p>
<p>From the original specification:</p>
<blockquote>
<p>If the request already included Authorization cred... | <p>Try this in your in the Application_EndRequest handler of your Global.ascx file</p>
<pre><code>if (HttpContext.Current.Response.Status.StartsWith("302") && HttpContext.Current.Request.Url.ToString().Contains("/<restricted_path>/"))
{
HttpContext.Current.Response.ClearContent();
Response.Redir... | 29,486 |
<p>I had to design and implement my own publish subscribe eventing to satisfy the requirements of a dynamic UI Winform design. Is there any .Net library that supports pub/sub out there that I can compare mine and improve?</p>
| <p>Why not start with this <a href="http://msdn.microsoft.com/en-us/library/ms752254.aspx" rel="nofollow noreferrer">list-based publish/subscribe pattern</a> (using WCF) on MSDN?</p>
| <p>Actually I went further than that. For example you can create a SystemEvent and publish it on a subject with a name of 'Application.UI.TreeInstance.[InstanceName].Node.Clicked' and if you register for anything like 'Application.<em>' or 'Aplication.UI.</em>' or 'Application.UI.TreeInstance.[InstanceName].Node.*' or ... | 49,608 |
<p>I'm starting developing with Flex on my Mac but i don't find good tools to ease the development (apart from Flex Builder).</p>
<p>What is your favourite choice for Flex development on Mac?</p>
| <p>TextMate + the <a href="http://blog.simongregory.com/10/textmate-actionscript-3-and-flex-bundles/" rel="nofollow noreferrer">Flex and ActionScript 3 bundles</a> is a great combo. Throw in <a href="http://ciaranwal.sh/2008/08/05/textmate-plug-in-projectplus" rel="nofollow noreferrer">ProjectPlus</a> and you have an a... | <p>TextMate is great, but if you're looking for something free, you can hack as3 onto XCode (I've used it, and it is fine, but some of the highlighting is off, and auto-completion is weak).</p>
<p>As for a debugging environment, I would recommend XTrace (<a href="http://mabblog.com/xtrace.html" rel="nofollow noreferre... | 4,737 |
<p>I just got a GeeeTech Rostock 301 mixer head delta printer and am having trouble honing in on why the extruder is struggling with my first spool of ABS.</p>
<p>Being the main parts of the printer came assembled I am unsure of where to start taking things apart. I have a read a multitude of possible causes and am ho... | <p>First you have to see if nothing jams the filament (blocked nozzle or anything in its path, PTFE tube not good, etc).</p>
<p>Second, the temp for ABS is about 225°C to 230°C. At least that worked for me.</p>
<p>If none of the above, then go for the motor. The problem could be from bad settings, low power or a moto... | <p>This is worth pointing out as it hasn't been said yet, make sure your stepper driver isn't overheating. If it overheats, it will cause the stepper to temporarily shut down, and it will click when it happens. This could be caused by inadequate power or by insufficient cooling. </p>
| 488 |
<p>If I have a property:</p>
<pre><code>public list<String> names { get; set; }
</code></pre>
<p>How can I generate and handle a custom Event for arguments sake called 'onNamesChanged' whenever a name gets added to the list?</p>
| <p>You should check out the <a href="http://msdn.microsoft.com/en-us/library/ms132680.aspx" rel="nofollow noreferrer">System.ComponentModel.BindingList</a>, specifically the <a href="http://msdn.microsoft.com/en-us/library/ms132742.aspx" rel="nofollow noreferrer">ListChanged event</a>.</p>
| <p>David Mohundro shows one approach; one other option is to inherit from Collection<T> and override the various methods:</p>
<pre><code>class Foo {}
class FooCollection : Collection<Foo>
{
protected override void InsertItem(int index, Foo item)
{
// your code...
base.InsertItem(ind... | 26,859 |
<p>I am taking my first steps programming in Lua and get this error when I run my script:</p>
<pre><code>attempt to index upvalue 'base' (a function value)
</code></pre>
<p>It's probably due to something very basic that I haven't grasped yet, but I can't find any good information about it when googling. Could someone... | <p>In this case it looks <code>base</code> is a function, but you're trying to index it like a table (eg. <code>base[5]</code> or <code>base.somefield</code>).</p>
<p>The 'upvalue' part is just telling you what kind of variable <code>base</code> is, in this case an upvalue (aka external local variable).</p>
| <h1>One "local" too many?</h1>
<p>As <a href="https://stackoverflow.com/a/195599/6286781">Mike F</a> explained, an "upvalue" is an external local variable. This error often occurs when a variable has been declared <code>local</code> in a forward declaration and then declared <code>local</code> <strong>again</strong> ... | 23,761 |
<p>I am planning on buying a cheap 3D printer to get into 3D printing, but the printer I'm planning to buy only takes 1.75 mm filament, I was wondering if it might be possible to change the hotend of that printer or something to take in 3.0 mm filament, the reason I want to use 3.0 mm filament is because it is cheaper ... | <p>First it really depends on your printer / extruder. That said generally 1.75 mm is cheaper and much more common.</p>
<p>If one were to change the hotend, likely you will need to replace most or all of the hot end. In the case of my personal hot ends, when I did this conversion I had to replace both the tube and the ... | <p>I had my printer Anycubic-Chiron converted from 1.75 mm filament to 3.00 mm, as it is big enough to handle bigger filament and the printer itself came with two sizes of the heatsink - the other fit to 3.00 mm filament.</p>
<p>In addition, I changed my extruder to a "Bulldog" extruder kit for 1.75 and 3 mm ... | 461 |
<p>Is there a way to tell MS SQL that a query is not too important and that it can (and should) take its time?</p>
<p>Likewise is there a way to tell MS SQL that it should give higher priority to a query?</p>
| <p>Not in versions below SQL 2008. In SQL Server 2008 there's the resource governor. Using that you can assign logins to groups based on properties of the login (login name, application name, etc). The groups can then be assigned to resource pools and limitations or restrictions i.t.o. resources can be applied to those... | <p>I'm not sure if this is what you're asking, but I had a situation where a single UI click added 10,000 records to an email queue (lots of data in the body). The email went out over the next several days so it didn't need to be a high priority, in fact it would bog the server every time it happened.</p>
<p>I split ... | 8,594 |
<p>I have a partial that renders a select box using the following method:</p>
<pre><code><%= collection_select 'type', 'id', @types, "id", "name",
{:prompt => true},
{:onchange =>
remote_function(
:loading => "Form.Element.disable('go_button')",
:url => '... | <p>As per your "UPDATE", creating a custom <code>DataGridViewCell</code> is the way this is done. I've done it, and it doesn't require that much modification from the example code available from the MSDN. In my case, I needed a bunch of custom editing controls, so I ended up inheriting from <code>DataGridViewTextBoxCel... | <p>Usually you should host controls in winfors forms datagridview cells as shown <a href="https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/how-to-host-controls-in-windows-forms-datagridview-cells?view=netframeworkdesktop-4.8&redirectedfrom=MSDN" rel="nofollow noreferrer">here</a></p>
<p>But if you... | 27,937 |
<p>I am currently working in a project with developers working on three sites. One of the sites is in Delhi, India while the other two are in Europe. The communication between the European offices and the office in Delhi has poor bandwidth and quite bad latency, and a CVS update from there often takes 5-10 minutes even... | <p>Not as reliably unique as the GUID itself, no.</p>
<p>Just to expand, you are reducing your uniqueness by a factor of 4, going from 16 bytes to 4 bytes of possible combinations.</p>
<p>As pointed out in the comments the hash size will make a difference. The 4 byte thing was an assumption, horrible at best I know, ... | <p>If you use cryptographic hash (MD5, SHA1, RIPEMD160), the hash will be unique (modulo collisions which are very improbable -- SHA1 is used e.g. for digital signatures, and MD5 is also collision-resistant on <em>random inputs</em>). Though, why do you want to hash a GUID?</p>
| 16,736 |
<p>I'm looking for success and failure stories of web applications rendering rich, 2D graphics via the HTML canvas element. I've seen some intriguing examples online but wanted to learn about some real-world, practical examples of development done using this approach. </p>
| <p>Maybe not exactly a what you are looking for but <a href="http://code.google.com/p/gwt-canvas/" rel="nofollow noreferrer">GWT-canvas</a> is worth of checking. At least it is a HTML Canvas project. </p>
| <p>For me the kicker is text. I need to render vector graphics <strong>AND</strong> text.</p>
<p>Thus I prefer SVG.</p>
<p>That said, for simple graphics, even complex ones, CANVAS is a great tool.</p>
| 24,169 |
<p>I need to print some items that will go in my car, which sits in direct sun a good portion of the day and almost certainly exceeds 50 °C inside during the summer months (I've had PLA prints sag quite visibly under their own weight and sliding parts weld together, and PETG prints show slight warpage after a couple we... | <p>The glass transition temperature is not always indicative of strength. Some polymers are solid well above that temperature, see <a href="https://omnexus.specialchem.com/polymer-properties/properties/glass-transition-temperature" rel="nofollow noreferrer">https://omnexus.specialchem.com/polymer-properties/properties/... | <p>If there isn't a TDS on the manufacturer's website, you could email them and ask for it. If they won't give it to you, you could ask for the SDS to see if it has any additives. Polymaker has a TDS for every filament they make on their website, so I would recommend their filament for your purposes. I would also sugge... | 1,994 |
<p>Trying to perform a single boolean NOT operation, it appears that under MS SQL Server 2005, the following block does not work</p>
<pre><code>DECLARE @MyBoolean bit;
SET @MyBoolean = 0;
SET @MyBoolean = NOT @MyBoolean;
SELECT @MyBoolean;
</code></pre>
<p>Instead, I am getting more successful with</p>
<pre><code>DE... | <p>Use the ~ operator:</p>
<pre><code>DECLARE @MyBoolean bit
SET @MyBoolean = 0
SET @MyBoolean = ~@MyBoolean
SELECT @MyBoolean
</code></pre>
| <p>Use <code>ABS</code> to get the absolute value (-1 becomes 1)...</p>
<pre><code>DECLARE @Trend AS BIT
SET @Trend = 0
SELECT @Trend, ABS(@Trend-1)
</code></pre>
| 21,422 |
<p>For work I have to code with an external company's API to deal with their proprietary database solution. Unfortunately the documentation they provide is more of an example guide then proper API docs, so it is very light on nitty gritty details like error codes, method returns, and exceptions. </p>
<p>So for instanc... | <p>A nasty scenario. I hate to suggest it, but maybe <a href="http://www.red-gate.com/products/reflector/" rel="noreferrer">reflector</a> is your friend if it isn't obfuscated. There may be some IP issues, but in this case reversing it seems the only viable way of finding out what the API is. However, I suspect (from m... | <p>Best tools that come to mind include phone and e-mail. Hopefully you can keep bugging people over there until they give you more useful info... :(</p>
| 26,047 |
<p>Is it possible to grab activedirectory credentials for the user on a client machine from within a web application?</p>
<p>To clarify, I am designing a web application which will be hosted on a client's intranet. </p>
<p>There is a requirement that the a user of the application not be prompted for credentials when... | <p>Absolutely. This is especially useful for intranet applications.</p>
<p>Since you did not specify your environment, I'll assume it is .NET, but that isn't the only way possible of course.</p>
<p>Active Directory can be queried easily using <a href="http://en.wikipedia.org/wiki/LDAP" rel="nofollow noreferrer">LDAP... | <p>No, of course not. Can you imagine the havoc that would result in random web apps being able to get your AD username and password?</p>
<p>Now, if you just want the username - that's in REMOTE_USER if you're using <a href="http://en.wikipedia.org/wiki/Integrated_Windows_Authentication" rel="nofollow noreferrer">inte... | 23,378 |
<p>I want to write a new application that will use a DBMS. In the design stages of this application and weighing the options I found out that the there will be a lot of database accessing which means many queries. My biggest concern with developing this system is the unwieldy nature of SQL select, update, and delete st... | <p>You might want to consider an ORM like <a href="http://www.hibernate.org/343.html" rel="nofollow noreferrer">nHibernate</a>, which would work with or without LINQ.</p>
| <p>if you're using c# you could use something like <a href="http://subsonicproject.com/" rel="nofollow noreferrer">Subsonic</a> for database access. It will handle your Data Access and in a lot of cases you'll be able to avoid writing SQL throughout your code.</p>
| 42,702 |
<p>I am trying to make the <a href="http://docs.jquery.com/Plugins/Validation" rel="nofollow noreferrer">Validation plugin</a> work. It works fine for individual fields, but when I try to include the demo code for the error container that contains all of the errors, I have an issue. The problem is that it shows the con... | <p>You will find the documentation for the meta option in <a href="http://docs.jquery.com/Plugins/Validation/validate#toptions" rel="noreferrer">http://docs.jquery.com/Plugins/Validation/validate#toptions</a></p>
<p>If you want to display the errors beside the inputs <strong>AND</strong> in a separate error container ... | <p>I don't know if the validation plugin provides an option for this, but you can probably use standard jQuery to achieve what you want. Make sure you're container is initially hidden, by setting the display style to none:</p>
<pre><code><div id="container" style="display:none;"></div>
</code></pre>
<p>Th... | 36,231 |
<p>I use a custom Matrix class in my application, and I frequently add multiple matrices:</p>
<pre><code>Matrix result = a + b + c + d; // a, b, c and d are also Matrices
</code></pre>
<p>However, this creates an intermediate matrix for each addition operation. Since this is simple addition, it is possible to avoid t... | <p>You could limit yourself to a single small intermediate by using lazy evaluation. Something like</p>
<pre><code>public class LazyMatrix
{
public static implicit operator Matrix(LazyMatrix l)
{
Matrix m = new Matrix();
foreach (Matrix x in l.Pending)
{
for (int i = 0; i &l... | <p>It is not possible, using operators.</p>
| 14,016 |
<p>The target machine is running Ububtu server 8.04.<br>
Here's the tramp output:</p>
<pre><code>tramp: Opening connection for nungu@ip.ip.ip.ip using nil...<br>
tramp: Waiting for prompts from remote shell<br>
tramp: Waiting 60s for prompt from remote shell<br>
tramp: Sending password<br>
tram... | <p>Same problem; and a fix</p>
<p>Working: NTEmacs-22.1 - Tramp Version: 2.0.55</p>
<p>Failing: NTEmacs-22.3.1 - Tramp Version: 2.0.58-pre</p>
<p>See comment - neither 2.0.* release worked on emacs-22.3.1</p>
<p>Upgraded to tramp 2.1.14 - emacs 22/3/1 works great</p>
<p>Recommend you try upgrading from <a href="ht... | <p>I don't know the technologies that you're talking about, but if Genehack says that your "regex isn't matching," then you need to test with a simpler Regex, or simplify your solution in some other way until you figure out the piece of the puzzle that does not work. You know, "it works with this simple regex, but not ... | 45,250 |
<p>I'm looking to hear others experiences with SVG + Javascript Frameworks. </p>
<p>Things that I'd like the framework to handle - DOM creation, event handling and minimal size.</p>
<p>Jquery SVG plugin - <a href="http://keith-wood.name/svg.html" rel="noreferrer">http://keith-wood.name/svg.html</a> seems to be the on... | <p><a href="http://dmitrybaranovskiy.github.io/raphael/" rel="nofollow noreferrer">Raphael</a> is a javascript framework for manipulating vector graphics, either with SVG or VML, depending on what the browser supports.</p>
| <p>I haven't used it yet, but i bookmarked <a href="http://www.liquidx.net/plotkit/" rel="nofollow noreferrer">PlotKit</a> some time ago because it's a javascript framework that generates svg</p>
| 8,861 |
<p>So I know it's considered somewhat good practice to always include curly braces for if, for, etc even though they're optional if there is only one following statement, for the reason that it's easier to accidentally do something like:</p>
<pre><code>if(something == true)
DoSomething();
DoSomethingElse();
</... | <p>When I come across a one-line if statement, I usually skip the curlys and keep everything on the same line:</p>
<pre><code>if (something == true) DoSomething();
</code></pre>
<p>It's quick, easy, and saves space.</p>
| <p>There's no problem there... in fact, Visual Studio won't put that code on it's own line if you try to auto-format it. So, if that's more readable to you... you're good.</p>
| 31,796 |
<p>I have a Java Swing application, developed on Mac OS X 10.5 using Java 1.5.</p>
<p>I'm trying to make a custom cursor appear when the user moves the mouse over some text in a dialog. The cursor never changes, though. </p>
<p>When I don't use a JFrame instead of a JDialog, the cursor does change. But then I'll have... | <p>Looks like it is a bug in Java 1.5: I first tried with Java 1.6.0_07 and it worked as expected (on Windows XP). Then I recompiled with Java 1.5.0_06 and indeed the cursor remains in default state.</p>
<p>Knowing the difficulties of Java 1.6 on MacOS, I see it will be hard to fix that...</p>
<p><a href="http://bugs... | <p>Thanks PhiLho, that Sun bug report gave me the solution. The owner (parent frame) must be non-null and showing. For the record, here's a modified version of my example code that <em>does</em> show a hand cursor.</p>
<pre><code>import javax.swing.*;
import java.awt.*;
public class CursorTest {
public static vo... | 40,483 |
<p>Sending a message from the Unix command line using <code>mail TO_ADDR</code> results in an email from <code>$USER@$HOSTNAME</code>. Is there a way to change the "From:" address inserted by <code>mail</code>?</p>
<p>For the record, I'm using GNU Mailutils 1.1/1.2 on Ubuntu (but I've seen the same behavior with Fedor... | <p>In my version of mail ( Debian linux 4.0 ) the following options work for controlling the source / reply addresses</p>
<ul>
<li>the <strong>-a</strong> switch, for additional headers to apply, supplying a From: header on the command line that will be appended to the outgoing mail header</li>
<li>the <strong>$REPLYT... | <p>The answers provided before didn't work for me on CentOS5. I installed mutt. It has a lot of options. With mutt you do this this way:</p>
<pre><code>export EMAIL=myfrom@example.com
export REPLYTO=myreplyto@example.com
mutt -s Testing chris@example.org
</code></pre>
| 7,832 |
<p>I've been putting a lot of thought into procedural generation of content for a while and I've never seen much experimentation with procedural music. We have fantastic techniques for generating models, animations, textures, but music is still either completely static or simply layered loops (e.g. Spore).</p>
<p>Bec... | <p>Cellular Automata - <a href="http://tones.wolfram.com/about/how-it-works/" rel="nofollow noreferrer">read</a>.</p>
<p>You can also try it out <a href="http://tones.wolfram.com/generate/" rel="nofollow noreferrer">here</a>.</p>
<p><strong>Edit:</strong></p>
<p>rakkarage has supplied another resource: <a href="http... | <p>Back in the late 90's, Microsoft created an ActiveX control called the "Interactive Music Control" which did exact what your looking for. Unfortunately, they seem to have abandon the project.</p>
| 21,819 |
<p>I've been having performance issues with a high traffic ASP.NET 2.0 site running on Windows 2000. While editing the web.config file I noticed that the authentication mode was set to 'Windows'. I changed it to 'None'. The only users this site has are anonymous and it gets 25,000+ page views at day. Could this hav... | <blockquote>
<p>But there's got to be some way in the IDE to do it... right?</p>
</blockquote>
<p>No. There are some plugins for the IDE, such as the <a href="http://www.mztools.com/" rel="nofollow noreferrer">MZ Tools</a> that <em>might</em> help. Otherwise, just use the <code>find</code> tool from the Windows comm... | <p>I have a large legacy code-base in VB6 which needs maintenance from time to time and I have used Microsoft Desktop Search on my local copy to help find variable and method names across the code files.</p>
<p>Also <a href="http://www.interlog.com/~tcharron/grep.html" rel="nofollow noreferrer">Grep</a> is available f... | 33,014 |
<p>How exactly does <code>NSInvocation</code> work? Is there a good introduction?</p>
<p>I’m specifically having issues understanding how the following code (from <em>Cocoa Programming for Mac OS X, 3rd Edition</em>) works, but then also be able to apply the concepts independently of the tutorial sample. The code:</p>... | <p>According to <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSInvocation_Class/Reference/Reference.html" rel="noreferrer">Apple's NSInvocation class reference</a>:</p>
<blockquote>
<p>An <code>NSInvocation</code> is an Objective-C message rendered static, that is, it is an ac... | <p>I build a simple example of calling various method types with NSInvocation.</p>
<p>I had problems calling multiple params using obj_msgSend</p>
<p><a href="https://github.com/clearbrian/NSInvocation_Runtime" rel="nofollow">https://github.com/clearbrian/NSInvocation_Runtime</a></p>
| 40,403 |
<p>Sometimes, my UIWebView will have a grey box over part or all of the content. I can't make heads or tails of why it's happening. It happens regularly for certain content.</p>
<p>Thanks!</p>
<p>--Update--</p>
<p>It seems to occur when the webview is not immediately viewable on the screen -- ie i've got a scrollvi... | <p>All UIViews have a size limit of 1024x1024 pixels. This is stated at the end of the Overview section of the UIView documentation.</p>
<p>If your web view must have more than 1024px of content, you will have to take it out of the parent scroll view and let it manage scrolling on its own.</p>
| <p>I have been dealing with this glitch as well, and have opened a bug report at apple.
I would have commented above, but I don't have the 50 rep yet.</p>
<p>For anyone else encountering this glitch, send them a report, I included a full project demonstrating it, with a few screenshots from another app I am working o... | 34,390 |
<p>I have small page which has label, DropDownList and a submit button.</p>
<pre><code><div>
<asp:label id="Message" runat="server"/>
<br />
Which city do you wish to look at on hotels for?<br /><br />
<asp:dropdownlist id="Dropdownli... | <p>It sounds like you may have EnableViewState disabled at the page level. Contrary to the other responses, you don't need to repopulate your lists on PostBack if ViewState is enabled.</p>
<p>Try adding the EnableViewState="true" attribute in your page header.</p>
<p>I think it is a bug. If EnableViewState="false" ... | <p>Maybe the page is being cached when in a virtual directory.</p>
<p>Try adding this to the Page_Load</p>
<pre><code>Response.Cache.SetCacheability(HttpCacheability.NoCache)
</code></pre>
<p>I think caching can be applied to directories using a config file. So may be this is the difference.</p>
| 24,188 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.