instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>There are two databases in SQL Server 2005: One called "A" and another one called "A_2".
"A" is a variable name to be entered by the user, the "_2" prefix for the second database is always known. (So databases could be "MyDB" and "MyDB_2", etc)<br><br>
How to access the other database from within a stored procedure ... | <p>You can try to use a new SQL Server 2005 feature, called synonyms.</p>
<p>You would need to <a href="http://msdn.microsoft.com/en-us/library/ms177544.aspx" rel="noreferrer">CREATE SYNONYM</a>, then compile and save the stored procedure using the synonym. This would leave you with the possibility to change the synon... | <p>I don't think that it is possible.</p>
<p>The name is a variable and you cannot use variables as database names.</p>
<p>So the only way is to put the whole command to a string and exec it, which you would like to avoid.</p>
<p>What is the purpose of the whole thing? What happens if you name your databases on your... | 32,682 |
<p>I have a couple of questions regarding VBScript and ASP Classic:</p>
<ol>
<li><p>What is the preferred way to access an MS SQL Server database in VBScript/ASP?</p></li>
<li><p>What are best practices in regards to separating model from view from controller?</p></li>
<li><p>Any other things I should know about eithe... | <p>ADO is an excellent way to access a database in VBScript/Classic ASP.</p>
<pre><code>Dim db: Set db = Server.CreateObject("ADODB.Connection")
db.Open "yourconnectionstring -> see connectionstrings.com"
Dim rs: Set rs = db.Execute("SELECT firstName from Employees")
While Not rs.EOF
Response.Write rs("firstNam... | <p>way way back in the day when VBScript/ASP were still ok
I worked in a utility company with a very mixed DB envrionment, I used to swear by this website: <a href="http://www.connectionstrings.com/" rel="nofollow noreferrer">http://www.connectionstrings.com/</a></p>
<p>@michealpryor got it right</p>
| 4,572 |
<p>Events are synchronous in C#. I have this application where my main form starts a thread with a loop in it that listens to a stream. When something comes along on the stream an event is fired from the loop to the main form. </p>
<p>If the main form is slow or shows a messagebox or something the loop will be suspend... | <p>Since you're using a form, the easier way is to use the <a href="https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.backgroundworker" rel="nofollow noreferrer">BackgroundWorker</a> component.</p>
<blockquote>
<p>The BackgroundWorker class allows you
to run an operation on a separate,
dedicated... | <p>You have a few options, as already detailed, but in my experience, you're better off leaving delegates and BeginInvoke, and using BackgroundWorker instead (v2.0+), as it is easier to use and also allows you to interact with the main form on the thread's completion. All in all a very weel implemented solution, I have... | 10,612 |
<p>Is there any way so that i can echo password when asked for in unix shell without use of external binaries ? Something like simple function triggered when password prompt is displayed</p>
| <pre><code>import socket
socket.gethostbyname(socket.gethostname())
</code></pre>
<p>This won't work always (returns <code>127.0.0.1</code> on machines having the hostname in <code>/etc/hosts</code> as <code>127.0.0.1</code>), a paliative would be what gimel shows, use <code>socket.getfqdn()</code> instead. Of course ... | <p>Simple yet sweet!</p>
<pre><code>def getip():
import socket
hostname= socket.gethostname()
ip=socket.gethostbyname(hostname)
return(ip)
</code></pre>
| 20,113 |
<p>I've got a save dialog box which pops up when i press a button. However i dont want to save a file at that point, i want to take the name and place it in the text box next to the button, for the name to be used later. </p>
<p>Can anybody tell me how to obtain the file path from the save dialog box to use it later?<... | <p>Here is a sample code I just wrote very fast... instead of Console.Write you can simply store the path in a variable and use it later.</p>
<pre><code>SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.InitialDirectory = Convert.ToString(Environment.SpecialFolder.MyDocuments);
saveFileDialog1.F... | <p>Try below code.</p>
<pre><code>saveFileDialog1.ShowDialog();
richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
</code></pre>
| 21,752 |
<p>I have written a small java application for which I need to obtain performance metrics such as memory usage, running time etc., Is there any simple to use performance measurement tool available? </p>
| <p><a href="http://yourkit.com/" rel="noreferrer">Yourkit</a> is pretty good (free 30 day trial). Eclipse also has built in <a href="http://www.eclipse.org/tptp/" rel="noreferrer">TPTP tools</a>.</p>
| <p>For runtime metrics, use any profiler such as <a href="https://visualvm.dev.java.net/" rel="nofollow noreferrer">VisualVM</a>, Netbeans Profiler, or the Eclipse TPTP Tools. A profiler usually gives you more fine-grained metrics such as the runtime for individual functions, hotspots, etc. </p>
<p>You might also chec... | 32,538 |
<p>This question might not seem programming related at first, but let me explain.</p>
<p>I'm stuck with using a keyboard that doesn't have <kbd>home</kbd> <kbd>end</kbd> <kbd>page up</kbd> and <kbd>page down</kbd> buttons. I need those functions for programming.</p>
<p>So the question is: what's a good/free utility t... | <p>AutoHotKey is the most configurable I know...</p>
<p><a href="http://www.autohotkey.com" rel="nofollow noreferrer">http://www.autohotkey.com</a></p>
<p>[EDIT]
Another neat utility is Microsoft Keyboard Layout creator</p>
<p><a href="http://www.microsoft.com/globaldev/tools/msklc.mspx" rel="nofollow noreferrer">ht... | <p>I have not used this personally, but I believe the Key Transformation application will help you out:</p>
<p><a href="http://softboy.net/key/index.htm" rel="nofollow noreferrer">http://softboy.net/key/index.htm</a></p>
| 18,273 |
<p>In Visual Studio if I define a class to implement an interface e.g.</p>
<pre><code>class MyObject : ISerializable {}
</code></pre>
<p>I am able to right click on ISerializable, select "<em>Implement Interface</em>" from the context menu and see the appropriate methods appear in my class definition.</p>
<pre><code... | <p>XCode currently does not support that kind of automation. But: an easy way to get your code bootstrapped with a protocol is to option-click the protocol name in your class declaration</p>
<pre><code>@interface FooAppDelegate : NSObject <NSApplicationDelegate,
NSTableViewDel... | <p><a href="http://forums.macrumors.com/showthread.php?p=6180803#post6180803" rel="nofollow noreferrer">Macrumors</a> had a discussion on this too. There is a link to some apple scripts. I haven't actually tried these.</p>
| 23,600 |
<p>I have a WinForms TreeView with one main node and several sub-nodes.</p>
<p>How can I hide the + (plus sign) in the main node?</p>
| <p>Treview Property: <strong><code>.ShowRootLines = false</code></strong></p>
<p>When <code>ShowRootLines</code> is false, the Plus/Minus sign will not be shown for the root node, but will still show when necessary on child nodes.</p>
<p>With the Plus/Minus sign hidden, you might consider executing the <code>Expand()... | <p>See the TreeView::ShowExpandCollapse property. Set it to false to disable the expand/collapse node indicators.</p>
| 19,504 |
<p>Let’s say I'm developing a helpdesk application that will be used by multiple departments. Every URL in the application will include a key indicating the specific department. The key will always be the first parameter of every action in the system. For example</p>
<pre><code>http://helpdesk/HR/Members
http://helpde... | <p>I have a similar scenario in one of my projects, and I'd tend to use a ModelBinder rather than using a separate inheritance hierarchy. You can make a ModelBinder attribute to fetch the entity/entites from the RouteData:</p>
<pre><code>public class HelpdeskDepartmentBinder : CustomModelBinderAttribute, IModelBinder ... | <p><em>Disclaimer: I'm currently running MVC Preview 5, so some of this may be new.</em></p>
<p>The best-practices way: Just implement a static utility class that provides a method that does the model look-up, taking the RouteData from the action as a parameter. Then, call this method from all actions that require th... | 9,373 |
<p>I'm using Test/Unit with a standard <strong>rails 2.1</strong> project. I would like to be able to test Partial Views in isolation from any particular controller / action.</p>
<p>It seemed as though <a href="http://zentest.rubyforge.org/" rel="noreferrer">ZenTest's Test::Rails::ViewTestCase</a> would help, but I co... | <p>We're using <a href="http://rspec.info" rel="noreferrer">RSpec</a> in our Rails 2.1 project, and we can do this sort of thing:</p>
<pre><code>describe "/posts/_form" do
before do
render :partial => "posts/form"
end
it "says hello" do
response.should match(/hello/i)
end
it "renders a form" do
... | <p>Testing a view without the controller code is a dangerous thing. Your tests might pass but your application might throw an error. Always test against real life situations not artificial ones.</p>
| 22,095 |
<p>I have been tasked with implementing a PKI library in C# for a company project, and have been unable to find a good implementation of it. There appear to be multiple libraries, and many broken links pointing to MSDN libraries that have been removed. I've seen people using Crypt32.dll, people building their own libra... | <p>Well, you did not mention that the built-in class doesn't cover your need, so how about <a href="https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.rsacryptoserviceprovider" rel="nofollow noreferrer"><strong>System.Security.Cryptography.RSACryptoServiceProvider</strong></a>?</p>
<p>It has a la... | <p>Yes, what's wrong with built-in classes?</p>
<p>And if you don't want to use Windows certificate store you can use something like this</p>
<pre><code>RSACryptoServiceProvider rscp = new RSACryptoServiceProvider();
rscp.FromXmlString("<RSAKeyValue><Modulus>key data gere</Modulus><Exponent>&l... | 14,612 |
<p>Is there an easy way to set the zoom level for a windows form in C#? In VBA there was a zoom property of the form.</p>
| <p>I had the same problem and I solved it this way in c#. Code goes on Form load</p>
<pre><code>float scaleX = ((float)Screen.PrimaryScreen.WorkingArea.Width / 1024);
float scaleY = ((float)Screen.PrimaryScreen.WorkingArea.Height / 768);
SizeF aSf = new SizeF(scaleX, scaleY);
this.Scale(aSf);
</code></pre>
<p>This "m... | <p>There is no way (that I know of) to do what you ask with typical WinForms.</p>
<p>If you're doing custom painting/drawing, you can zoom that by using a zoom transform, but so far as I know there is no "Zoom" property for the form in the entire world of .NET and native Windows/C++ APIs combined.</p>
<p>You could pr... | 5,605 |
<p>The way you would normally include a script is with "source"</p>
<p>eg:</p>
<p>main.sh:</p>
<pre><code>#!/bin/bash
source incl.sh
echo "The main script"
</code></pre>
<p>incl.sh:</p>
<pre><code>echo "The included script"
</code></pre>
<p>The output of executing "./main.sh" is:</p>
<pre><code>The included sc... | <p>I tend to make my scripts all be relative to one another.
That way I can use dirname:</p>
<pre><code>#!/bin/sh
my_dir="$(dirname "$0")"
"$my_dir/other_script.sh"
</code></pre>
| <p>You can also use:</p>
<pre><code>PWD=$(pwd)
source "$PWD/inc.sh"
</code></pre>
| 23,371 |
<p>I'd like to create a custom loading screen for a JavaFX application. Don't want the user to see the Java coffee cup icon, I want to put my own graphic there!</p>
<p>I've found out how to provide a static image, or even an animated GIF, but I'm more interested in a Flash-like screen where I can specify what the sta... | <p>For JavaFX2, you can set a custom preloader. You have complete control over then scene. I haven't used them personally, but this might be what you want.
<a href="http://docs.oracle.com/javafx/2/deployment/preloaders.htm" rel="noreferrer">http://docs.oracle.com/javafx/2/deployment/preloaders.htm</a></p>
| <p>For changing the coffee cup icon:</p>
<pre><code>stage.getIcons().add(new Image("images/myimage.png"));
</code></pre>
<p>and here is a reference for a very clear preloader screen out there and awesome css too:
<a href="http://docs.oracle.com/javafx/2/best_practices/jfxpub-best_practices.htm" rel="nofollow">http://... | 47,138 |
<p>I am using my own custom authentication with IIS, and I want the server on <i>every</i> page load (no matter what type of file) to first check the Application variable to see if the user is authenticated and authorized to see the site. In global.asax this could be:</p>
<pre><code>void Application_Start(Object Sende... | <h1>HttpModules are an alternative to global.asax</h1>
<p>(see also <a href="https://www.codeguru.com/csharp/.net/net_asp/article.php/c19389/HTTP-Handlers-and-HTTP-Modules-in-ASPNET.htm" rel="nofollow noreferrer">https://www.codeguru.com/csharp/.net/net_asp/article.php/c19389/HTTP-Handlers-and-HTTP-Modules-in-ASPNET.h... | <p>Actually I believe there's just one global.asax per asp.net application. If you want example.com/subsite1 to be a different application from example.com/subsite2 you can create two different applications in IIS. As a result they'll run in entirely different application domains (although they may be in the same proce... | 39,632 |
<p>I have an interesting problem and would appreciate your thoughts for the best solution.
I need to parse a set of logs. The logs are produced by a multi-threaded program and a single process cycle produces several lines of logs.</p>
<p>When parsing these logs I need to pull out specific pieces of information from ea... | <p>It sounds like there are some existing parser classes already in use that you wish to leverage. In this scenario, I would write a <a href="http://en.wikipedia.org/wiki/Decorator_pattern" rel="nofollow noreferrer">decorator</a> for the parser which strips out lines not associated with the process you are monitoring... | <p>You need to store lines temporarily in a queue where a single thread consumes them and passes them on once each set has been completed. If you have no way of knowing the if a set is complete or not by either the number of lines or the content of the lines, you could consider using a sliding window technique where yo... | 34,353 |
<p>Is it possible at runtime to programmatically check the name of the Thread that is holding the lock of a given object?</p>
| <p>You can only tell whether the current thread holds a normal lock (<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#holdsLock%28java.lang.Object%29" rel="noreferrer"><code>Thread.holdsLock(Object)</code></a>). You can't get a reference to the thread that has the lock without native code.</p>
<... | <p>You can use a variable to hold the current thread when you take the lock, then print it if someone else is trying to use it.</p>
<pre><code>Thread holderOfLock = null;
Object theLock = new Object();
public void doStuff()
{
if(holderOfLock != null)
{
//get and print name of holderOfLock-thread or get... | 7,335 |
<p>I have a Winform application built with C# and .Net 2.0. I have a textbox set with the MultiLine property.</p>
<p>The problem is when someone writes text with multiple lines (press few enters), presses the save button, and then closes and loads the form again, all the new lines disappear (the text is there at least... | <p>If I recall correctly, the textbox is really a string array.</p>
<p>I think you can do this:</p>
<pre><code>textBox1.Lines = foo.Split(new String[] {"\n"},StringSplitOptions.RemoveEmptyEntries);
</code></pre>
<p>Edit again: If you want to keep the blank lines, the change to StringSplitOptions.None</p>
| <p>In Windows forms all carriage returns are preserved in a multiline text box, so the problem likely lies in the way data is retrieved from your database. I've never used PostGres, but I'm guessing that the way you're retrieving the text from the db is replacing all whitespace with single spaces.</p>
| 22,895 |
<p>Our investigations have shown us that not all browsers respect the HTTP cache directives in a uniform manner.</p>
<p>For security reasons we do not want certain pages in our application to be cached, <strong>ever,</strong> by the web browser. This must work for at least the following browsers:</p>
<ul>
<li>Interne... | <h1>Introduction</h1>
<p>The correct minimum set of headers that works across all mentioned clients (and proxies):</p>
<pre><code>Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
</code></pre>
<p>The <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9" rel="noreferrer">... | <p>you can use location block for set individual file instead of whole app get caching in IIS </p>
<pre><code> <location path="index.html">
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="no-cache" />
</customH... | 7,215 |
<p>I have always wondered WHaT tHE <em>HecK?!?</em> is the difference between JScript and JavaScript.</p>
| <p>Just different names for what is really ECMAScript. John Resig has a <a href="http://ejohn.org/blog/versions-of-javascript/" rel="noreferrer">good explanation</a>.</p>
<p>Here's the full version breakdown:</p>
<ul>
<li>IE 6-7 support JScript 5 (which is equivalent to ECMAScript 3, JavaScript 1.5)</li>
<li>IE 8 sup... | <p><strong>JScript</strong> is <strong>Microsoft</strong>'s equivalent of <strong>JavaScript</strong>. <br/>
Java is an <strong>Oracle</strong> product and used to be a <strong>Sun</strong> product.</p>
<p><strong>Oracle</strong> bought <strong>Sun</strong>.</p>
<p><strong>JavaScript + Microsoft = JScript</strong></p... | 16,377 |
<p>I have a piece of code which sends e-mails using a third party e-mail sending component.</p>
<p>When the e-mails are delivered, the HTML which should be appearing in the body of the e-mail is <em>also</em> being added as an attachment with the filename ATT00001.</p>
<p>I <em>suspect</em> the attachment is being cr... | <p>When you forward an email, it can be "inline" - in the body of the new email, or as an "attachment" - attached as a file to the new email.</p>
<p>Now I am not sure about your question. You say "instead" in the title, and "also" in the main content. But I suspect that whatever issue is with the e-mail component you ... | <p>Only time I get this is when i set charset:unicode instead of charset:utf-8 somewhere but it may be completely unrelated. Telling us more about the external component would certainly allow for better answers.</p>
| 41,437 |
<p>I have a scenario wherein, for example, I need to repeat a list of US states and display a table of cities and city populations after the name of each state. The design requirement dictates that every outer repetition must be the name of a state followed by a table of cities, and that requirement cannot be changed a... | <p>If it were me, I'd reverse the question and ask why <em>I should</em> use a GridView, If you need a bunch of built-in features like paging and sorting, then the GridView might be a good fit. If you just want tabular data, I'd reconsider. Why? Because with GridView you're getting a whole bunch of stuff you won't ... | <p>In your above scenario, you'd be better off doing a master-detail style GridView, which will save you the overhead of all those GridView objects that get created.</p>
<p>There are various implementation of it (<a href="http://msdn.microsoft.com/en-us/library/aa479344.aspx" rel="nofollow noreferrer">using a drop dow... | 7,371 |
<p>I was told that decimal is implemented as user defined type and other c# types like int have specific opcodes devoted to them. What's the reasoning behind this?</p>
| <p><code>decimal</code> isn't alone here; <code>DateTime</code>, <code>TimeSpan</code>, <code>Guid</code>, etc are also custom types. I guess the main reason is that they don't map to CPU primatives. <code>float</code> (IEEE 754), <code>int</code>, etc are pretty ubiquitous here, but <code>decimal</code> is bespoke to ... | <blockquote>
<p>"What's the reasoning behind this?"</p>
</blockquote>
<p>Decimal math is handled in software versus hardware. Currently, many processors don't support native decimal (financial decimal versus float) math. That's changing though with the adoption of IEEE 754R.</p>
<p>See also:</p>
<ul>
<li><a href="... | 44,107 |
<p>I have a large array in <strong>C</strong> (not <strong>C++</strong> if that makes a difference). I want to initialize all members of the same value.</p>
<p>I could swear I once knew a simple way to do this. I could use <code>memset()</code> in my case, but isn't there a way to do this that is built right into the ... | <p>Unless that value is 0 (in which case you can omit some part of the initializer
and the corresponding elements will be initialized to 0), there's no easy way.</p>
<p>Don't overlook the obvious solution, though:</p>
<pre><code>int myArray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
</code></pre>
<p>Elements with missing ... | <p>I see no requirements in the question, so the solution must be generic: initialization of an unspecified possibly multidimensional array built from unspecified possibly structure elements with an initial member value:</p>
<pre><code>#include <string.h>
void array_init( void *start, size_t element_size, size_t ... | 24,552 |
<pre><code>#if SYMBOL
//code
#endif
</code></pre>
<p>what values does C# predefine for use?</p>
| <p>To add to what Nick said, the MSDN documentation does not list any pre-defined names. It would seem that all need to come from <code>#define</code> and <code>/define</code>.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/4y6tbswk.aspx" rel="nofollow noreferrer">#if on MSDN</a></p>
| <p>Well, that depends on the compiler you are using, and the command line options. Mono defines different names than Microsoft's compiler by default, and depending on what system you are you get different defines, etc.</p>
<p>If you provide a more specific system for which you are compiling, we might be able to come u... | 4,164 |
<p>I've got some curious marks on my heatbed.</p>
<p>It appears to be from my black Sunlu PLA+ (I can just feel it if I scrape my finger nail over it) but I can't scrape it off with the metal spatula.</p>
<p>When I try and print over it the filament won't stick.</p>
<p>Any suggestions as to what it is and how you ge... | <p>Prusa ships (or has shipped) with two types of PEI build plates. The original (and what I was shipped in February 2019) is a PEI sheet held in place with an adhesive. The marks I've gotten seem to be places where the adhesive has been displaced slightly from long term pressure by the object being printed.</p>
<p>... | <p>Edit: As Trish noted, apparently Prusa printers don't ship with Buildtak stickers like the other printers I've used, so this is probably a bad idea in your specific case. For others reading this, only do the sanding shenanigans with buildtak or other stickers that you can easily replace and don't mind wearing down o... | 1,331 |
<p>I am 90% sure I saw this answer on stackoverflow before, in fact I had never seen the "int?" syntax before seeing it here, but no matter how I search I can't find the previous post, and it's driving me crazy.</p>
<p>It's possible that I've been eating the funny mushrooms by accident, but if I'm not, can someone ple... | <p>int? is shorthand for <code>Nullable<int></code>.</p>
<p><a href="https://stackoverflow.com/questions/110229/how-do-nullable-types-work-in-c">This</a> may be the post you were looking for.</p>
| <p>you can use it when you expect a null value in your integer especially when you use CASTING
ex:</p>
<pre><code>x= (int)y;
</code></pre>
<p>if y = null then you will have an error.
you have to use: </p>
<pre><code>x = (int?)y;
</code></pre>
| 14,794 |
<p>I have a database issue that i currently cannot wrap my head around with an easy solution. In my db I have a table that stores event values.. 0's and 1's with a timestamp. Issue being that it is possible for there to be the same event to occur twice as a business rule. Like below</p>
<ul>
<li>'2008-09-22 16:28:14.1... | <p>(preface.......i've only done this in oracle, but I'm pretty sure if the db supports triggers it's all possible)</p>
<p>Have a before insert trigger that selects the row with the max timestamp value. If that row's value is the same as the one you wish to insert, ignore it.</p>
<p>This should keep them all in a co... | <p>Just so that I understand the problem.</p>
<p>You have, if you order the row set based on the timestamp, sometimes <em>duplicate</em> values occuring next to each other, like the above pair of 1's in the 2nd and 3rt item? and then you have double 0's in the 4th and 5th, is that it?</p>
<p>And you want the last of ... | 14,308 |
<p>I want to use the Django template engine in my (Python) code, but I'm not building a Django-based web site. How do I use it without having a settings.py file (and others) and having to set the DJANGO_SETTINGS_MODULE environment variable?</p>
<p>If I run the following code:</p>
<pre><code>>>> import djang... | <p>The solution is simple. It's actually <a href="http://docs.djangoproject.com/en/dev/ref/templates/api/#configuring-the-template-system-in-standalone-mode" rel="noreferrer">well documented</a>, but not too easy to find. (I had to dig around -- it didn't come up when I tried a few different Google searches.)</p>
<p>T... | <p>Google <code>AppEngine</code> uses the Django templating engine, have you taken a look at how they do it? You could possibly just use that.</p>
| 12,364 |
<p>My requirement is just to display a set of values retrieved from database on a spread. I am using jquery.</p>
| <p>Favor XML over JSON when any of these is true:</p>
<ul>
<li>You need message validation</li>
<li>You're using XSLT</li>
<li>Your messages include a lot of marked-up text</li>
<li>You need to interoperate with environments that don't support JSON</li>
</ul>
<p>Favor JSON over XML when all of these are true:</p>
<u... | <p>Most newer web technologies work using JSON, so definitively a good reason for using JSON. A great advantage is that in XML you can represent in multiple different ways the same information, which in JSON is more straightforward.</p>
<p>Also JSON IMHO is much clearer than XML, which makes it for me a clear advantag... | 42,090 |
<p>I'm working with an existing Java codebase which, while it can be invoked from an HTML page using an <APPLET> tag, does not actually subclass the Applet class. The same jars are also used in a non-browser context, so they did not subclass Applet.</p>
<p>Now I need to communicate some values from Java back to ... | <p>I think you're actually going to need to implement an applet in a jar file to handle the communication between your code and the browser itself. Perhaps just use the non-applet jar as a class lib and make the applet jar a simple wrapper that proxies your calls between the browser and the Java code.</p>
| <p>What's wrong with returning a value?</p>
<p>From Javascript You can access the Java-object by using getElementById("id-of-embed-tag").
Then you can invoke any public method on that object. The Java object returned by that method will be available to your Javascript code.</p>
| 36,620 |
<p>I just installed Java 1.6_07 so I could try profiling with VisualVM. It tells me that my app is spending 60% of its time in <code>sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run</code> </p>
<p>How do I find out what it was doing during that time? How much of the time was it waiting for something to call ... | <p>I don't have experience with VisualVM -- but JRockit's profiler <em>does</em> provide this information; you may consider using it instead.</p>
<p><strong>Update:</strong> a question with a list of java profilers can be found <a href="https://stackoverflow.com/questions/14762/please-recommend-a-java-profiler">here</... | <p>I have started using <a href="https://visualvm.dev.java.net/" rel="nofollow noreferrer">the new VisualVM 1.2</a>. It allows profiling CPU and drilling down using a call graph. Try it out.</p>
| 8,334 |
<p>I'm trying to print a RDLC file directly without showing Microsoft Report Viewer, I have followed the <a href="http://msdn.microsoft.com/en-us/library/ms252172.aspx" rel="noreferrer">MSDN's example</a> but now, every time I call the "Render" method of my instance of LocalReport class it throws the "One or more param... | <p>i just discovered if you pass parameter value as empty string like parameter = ""
it will give you that error</p>
<p>took me a while</p>
| <p>Another way this can happen is if you are using Shared Datasets and you include DataSets that your report is not using. Each report must define its own version of the parameters for each shared Dataset locally. So if you've included a Dataset as one of your data sources and you have not explicitly defined how this p... | 38,720 |
<p>In a J2EE application (like one running in WebSphere), when I use <code>System.out.println()</code>, my text goes to standard out, which is mapped to a file by the WebSphere admin console.</p>
<p>In an ASP.NET application (like one running in IIS), where does the output of <code>Console.WriteLine()</code> go? The ... | <p>If you use <code>System.Diagnostics.Debug.WriteLine(...)</code> instead of <code>Console.WriteLine()</code>, then you can see the results in the <strong>Output</strong> window of Visual Studio.</p>
| <p>In an ASP.NET application, I think it goes to the Output or Console window which is visible during debugging.</p>
| 16,649 |
<p>I have the concept of <code>NodeType</code>s and <code>Node</code>s. A <code>NodeType</code> is a bunch of meta-data which you can create <code>Node</code> instances from (a lot like the whole Class / Object relationship).</p>
<p>I have various <code>NodeType</code> implementations and various Node implementations.... | <p>You can just replace <code><T extends AbstractNode> T</code> with <code>AbstractNode</code> thanks to the magic of <a href="http://en.wikipedia.org/wiki/Covariant_return_type" rel="nofollow noreferrer">covariant returns</a>. <code>Java 5</code> added support, but it didn't receive the pub it deserved.</p>
| <p>Something like that should work:</p>
<pre><code>interface Node{
}
interface NodeType<T extends Node>{
T createInstance();
}
class Thing implements Node{}
class ThingType implements NodeType<Thing>{
public Thing createInstance() {
return new Thing();
}
}
class UberThing extends Thing{... | 10,746 |
<p>What is this "Execute Around" idiom (or similar) I've been hearing about?
Why might I use it, and why might I not want to use it?</p>
| <p>Basically it's the pattern where you write a method to do things which are always required, e.g. resource allocation and clean-up, and make the caller pass in "what we want to do with the resource". For example:</p>
<pre><code>public interface InputStreamAction
{
void useStream(InputStream stream) throws IOExce... | <p>If you want groovy idioms, here it is:</p>
<pre><code>//-- the target class
class Resource {
def open () { // sensitive operation }
def close () { // sensitive operation }
//-- target method
def doWork() { println "working";} }
//-- the execute around code
def static use (closure) {
def res = ... | 44,448 |
<p>Is anybody aware of a good Java Swing Timeline Widget with features comparable to the Janus Winforms timeline component?</p>
| <p>Finally I found a Java timeline widget which fulfills my requirements:</p>
<p><a href="http://jaret.de/timebars/index.html" rel="noreferrer">Jaret timebars component </a></p>
| <p>A pretty good component which comes close is the FlexGantt available at <a href="http://www.dlsc.com" rel="nofollow noreferrer">http://www.dlsc.com</a></p>
<p>I will give it a try</p>
| 43,423 |
<p>The Replace Temp with Query refactoring method is recommended quite widely now but
seems to be very inefficient for very little gain. </p>
<p>The method from the Martin Fowler's site gives the following example:</p>
<p>Extract the expression into a method. Replace all references to the temp with the expression. T... | <p>It's a refactoring that is important as it is a refactoring towards single responsibility, it's a resolution of DRY fail! </p>
<p>The main problem with temps (esp. in naive code using long methods, hundreds of lines long!) is that they are mutable, local state. The obvious risk (as discussed by Fowler?) is that s... | <p>It really seems to me that by doing this you are helping to make a single purpose to your original method; It no longer is responsible for calculating the basePrice and the discount price (or whatever it is that it is calculating). This is an example of sacrificing some CPU cycles to make the code more maintainable... | 41,521 |
<p>In c#, I have a handle to a window ( an IntPtr ), I want to change the background color of that window. How can I do this?</p>
<p>I can get the GDI graphics object for that handle like so:</p>
<p>Graphics graphics = Graphics.FromHwnd(theHandle);</p>
<p>So I should somehow be able to change the background color f... | <p>I don't think there's a way to do this directly with a native (C/C++) window (i.e. there is no native GDI analogue to Control.BackColor).</p>
<p>From looking in Reflector it appears that Control uses the BackColor property to respond to the various <a href="http://msdn.microsoft.com/en-us/library/bb432504.aspx" rel... | <p>Create a control class with the Control.FromHandle method and then set the property.</p>
<p>Something like...</p>
<pre>
Control someControl = Control.FromHandle(myHandle);
someControl.BackColor = SystemColors.Black;
</pre>
| 23,862 |
<p>I've just been learning about master pages in ASP.NET 2.0. </p>
<p>They sound great, but how well do they work in practice? </p>
<p>Does anybody have experience of using them for a large web site?</p>
| <p>I'm pretty sure I've only used master pages in the context of ASP.NET MVC so I'm not sure if it differs from web forms but in my experience they are not only excellent but I couldn't imagine not using them. Master pages are code inheritance to web pages.</p>
| <p>Master Pages have made building template-able websites easy.</p>
<p>I think the trickiest part in building a website using master pages is knowing when to put things into the master page and when to put things into the ContentPlaceHolder on the child page. Generally, dynamic stuff goes into the placeholder while st... | 2,844 |
<p>I am trying to set up JBoss 4.2.2 and JConsole for remote monitoring. As per many of the how-to's I have found on the web to do this you need to enable jmxremote by setting the following options in run.conf. (I realize the other two opts disable authentication)</p>
<pre><code>JAVA_OPTS="$JAVA_OPTS -Dcom.sun.manag... | <p>I have honestly never tried this remoting approach. But, if both your client machine and the server happen to both be linux boxes or similar *nixes with SSH, then you can <code>ssh -XCA</code> to the server and start JConsole <em>on the server</em> and have the GUI display on your client machine with X port forwardi... | <p>First thing I would do is to delete both /tmp and /work directories under JBoss /default and redeploy the WAR. If that doesn't, I would upgrade the JDK to use a more recent version of 1.6. 1.6.0_01 is pretty old. </p>
| 15,764 |
<p>In Oracle, is there an easy way to fully unwrap a view? eg: If I have a view which is made up of selects on more views, is there some way to unwrap it to just select directly on real tables?</p>
| <ol>
<li><p>Get the query text of your view.</p>
<pre><code>SELECT text FROM dba_views
WHERE owner = 'the-owner' AND view_name = 'the-view-name';
</code></pre></li>
<li><p>Parse. Search for view names within the query text.</p></li>
<li><p>Get the query text for each view name found. (see item 1.)</p></li>
<li><p>Re... | <p>Up until Oracle 12.1 the correct answer is no, there is no easy way. Now, in 12.1 there is DBMS_UTILITY.EXPAND_SQL_TEXT : Expand SQL References to Views in Oracle Database 12c Release 1 (12.1) does exactly this. See the <a href="http://docs.oracle.com/database/121/ARPLS/d_util.htm#ARPLS73973" rel="nofollow noreferre... | 16,631 |
<p>At my current gig, we use iBATIS through Java to CRUD our databases. I like the abstract qualities of the tool, especially when working with legacy databases, as it doesn't impose its own syntax on you.</p>
<p><strong>I'm looking for a Python analogue to this library</strong>, since the website only has Java/.NET/... | <p>iBatis sequesters the SQL DML (or the definitions of the SQL) in an XML file. It specifically focuses on the mapping between the SQL and some object model defined elsewhere.</p>
<p>SQL Alchemy can do this -- but it isn't really a very complete solution. Like iBatis, you can merely have SQL table definitions and a... | <p>Perhaps SQLAlchemy SQL Expression support is suitable. See the <a href="http://docs.sqlalchemy.org/en/latest/core/expression_api.html" rel="nofollow noreferrer">documentation</a>. </p>
| 10,320 |
<p>I am developing some school grading software and decided to use Github to host the project. After building some code on my Ubuntu box I pushed it to Github and then cloned it down to my MacBook Pro. After editing the code on the MBP I pushed it back to Github. The next morning I tried to update my repo on the Ubunt... | <p>I'll assume your problem was that the machine on which you first created the repo crapped out when you tried to issue the <code>git pull</code> command.</p>
<p>When you clone an existing git repository (like you did on your 2nd machine, the MacBook Pro), you're automatically set up to so your <code>git pull</code> ... | <p>You can also <a href="https://github.com/account" rel="noreferrer">add multiple SSH public keys</a>.</p>
| 39,341 |
<p>Does anyone know why Microsoft does not ship a numeric text box with its .NET framework e.g. a text box which would ensure that the characters entered are always a valid number? It's something which is commonly used across applications of different flavours and indeed something which most GUI libraries (well, those ... | <p>I second Garry Shutlers recommendation of using NumericUpDown. You might not like the up-down-controls, but that <em>is</em> the standard look of a numeric entry control in Windows, and you should think twice about using a different look.</p>
<p>If you end up coding your own implementation (or finding one on the we... | <p>You can also, derive the TextBox class and grab the keypad event and ensure nothing other than numbers is written. </p>
<p>If it were a Web page, the same would have been done to an html text box using Javascript. </p>
| 10,667 |
<p>My OctPrint and Monoprice Maker Select IIIP (A Wanhao i3 Duplicator Plus clone) were working fine, but suddenly today the hot end won't heat up anymore. I tried disconnecting the OctoPrint USB and resetting the printer power, and it still couldn't heat up the extruder, such as through the filament menu.</p>
<p>But t... | <p>This has nothing to do with OctoPrint itself, the cause is related to the printer itself, not the print server running the printer.</p>
<p>This is a pretty commonly seen issue (usually seen at heated beds), this is caused by faulty wires/cables or connectors. This usually happens after a vast period of usage. You sh... | <p>Measure your heater resistance of the heater in the heater block. Approximate heater resistances are 4.8 Ω for 12 V 30 W and 3.6 Ω for 12 V 40 W. See <a href="https://3dprinting.stackexchange.com/questions/10695/proper-hotend-heater-for-reprap-x400-pro-v3">Proper hotend heater for Reprap x400 Pro V3</a></p>
<p>No... | 2,023 |
<p>The Free MS Windows replacement operating system <a href="http://www.reactos.com" rel="noreferrer">ReactOS</a> has just released a new version. They have a large and active development team.</p>
<ul>
<li>Have you tried your software with it yet? </li>
<li>if so what is your recommendation? </li>
<li>Is it time to s... | <p>Targeting ReactOS specifically is a bit too narrow IMO -- perhaps a better focus is to target compatibility with <a href="http://www.winehq.org/" rel="noreferrer">WINE</a>. Because ReactOS shares so many of its <a href="http://www.reactos.org/en/about_userfaq.html#whynotnix" rel="noreferrer">usermode DLLs with WINE<... | <p>It is a useful replacement for Windows when it runs 'your' software without crashing. At the moment it is not a general purpose os as it is too unstable (being only alpha) but people have used ReactOS successfully in anger for specific tasks already. As a windows replacement it has multiple potential uses, sandbox s... | 35,653 |
<p>How do you tell if caps lock is on using JavaScript?</p>
<p>One caveat though: I did google it and the best solution I could find was to attach an <code>onkeypress</code> event to every input, then check each time if the letter pressed was uppercase, and if it was, then check if shift was also held down. If it wasn... | <p>You can give it a try.. Added a working example. When focus is on input, turning on caps lock makes the led go red otherwise green. (Haven't tested on mac/linux)</p>
<p>NOTE: Both versions are working for me. Thanks for constructive inputs in the comments.</p>
<p>OLD VERSION: <a href="https://jsbin.com/mahenes/... | <p>In <a href="http://jquery.com" rel="nofollow noreferrer">jQuery</a>:</p>
<pre><code>$('some_element').keypress(function(e){
if(e.keyCode == 20){
//caps lock was pressed
}
});
</code></pre>
<p><a href="https://stackoverflow.com/questions/348792/how-do-you-tell-if-caps-lock-is-on-using-jav... | 45,383 |
<p>In my Direct3D application, the camera can be moved using the mouse or arrow keys. But if I hard code (0,1,0) as the up direction vector in <code>LookAtLH</code>, the frame goes blank at some orientations of the camera.</p>
<p>I just learned the hard way that when looking along the Y-axis, (0,1,0) no longer works a... | <p>Assuming you can calculate a vector pointing forward (what you are looking at - your position) and a vector pointing right (always on the XZ-plane unless you can roll). Normalize both these vectors, then up is forward x right (where x is cross product).</p>
<p>In general, you can plug in your yaw, pitch and roll in... | <p>The graceful way to handle this is to use Unit Quaternions. A quaternion is a vector of 4 values that encodes an orientation in 3D space (not a rotation as some articles assert) and a unit quaternion is one where the vector length sqrt(x^2+y^2+z^2+w^2) is 1.0. There are a set of mathematical operations for working w... | 31,530 |
<p>I have defined tomcat:catalina:5.5.23 as a dependency to the cargo plugin, however I still get the following exception:</p>
<pre><code>java.lang.ClassNotFoundException: org.apache.catalina.Connector
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Metho... | <p>Side note:
You can start jetty which is similar to tomcat. (Servlets will be available at <a href="http://localhost:8080/" rel="nofollow noreferrer">http://localhost:8080/</a> artefact-name)</p>
<pre><code>mvn jetty6:run
</code></pre>
<p>You would have to add to your pom:</p>
<pre><code><project>
<bu... | <p>There is also a tomcat maven plugin:</p>
<p><a href="http://mojo.codehaus.org/tomcat-maven-plugin/introduction.html" rel="nofollow noreferrer">http://mojo.codehaus.org/tomcat-maven-plugin/introduction.html</a></p>
<pre><code><plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
... | 18,859 |
<p>I get the following error when trying to load an RSS feed:</p>
<blockquote>
<p>Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</p>
</blockquote>
<p>My code works fine from my local host, error only occurs when i upload it to my dedicated server!</p>
<p>Here... | <p>We had the same behaviour as Todd Smith mentions. After the upgrade to .Net 3.5 SP1 we got this error.</p>
<p>In our case the reason was the <strong>protection / obfuscation</strong> of our DLLs with Remotesoft Protector.</p>
<p>This is most likely only our problem and not a solution for anyone else. Nevertheless ... | <p>I'm not familiar with this error but have you verified that your security/permissions are set correctly on the dedicated server? </p>
<p>Also you might want to confirm that you can access the feed directly from a browser on the dedicated server.</p>
<p><a href="http://forums.asp.net/p/675515/675515.aspx" rel="nof... | 24,279 |
<p>Does anyone know if it possible to define the equivalent of a "java custom class loader" in .NET?</p>
<p><strong>To give a little background:</strong></p>
<p>I am in the process of developing a new programming language that targets the CLR, called "Liberty". One of the features of the language is its ability to de... | <p>The answer is yes, but the solution is a little tricky.</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.aspx" rel="noreferrer"><code>System.Reflection.Emit</code></a> namespace defines types that allows assemblies to be generated dynamically. They also allow the generated assembli... | <p>I think this is the type of thing the DLR is supposed to provide in C# 4.0. Kind of hard to come by information yet, but perhaps we'll learn more at PDC08. Eagerly waiting to see your C# 3 solution though... I'm guessing it uses anonymous types.</p>
| 22,479 |
<p>Some of my MS SQL stored procedures produce messages using the 'print' command. In my Delphi 2007 application, which connects to MS SQL using TADOConnection, how can I view the output of those 'print' commands?</p>
<p>Key requirements:
1) I can't run the query more than once; it might be updating things.
2) I need... | <p>That was an interesting one...<br>
<strong>The OnInfoMessage event from the ADOConnection works but the Devil is in the details!</strong></p>
<p><strong>Main points:</strong><br>
use CursorLocation = clUseServer instead of the default clUseClient.<br>
use Open and not ExecProc with your ADOStoredProc.<br>
use NextR... | <p>Some enhancements to Francois' code (as tested with DXE2) to cater for multiple print statements and the results from a variable number of selects. The changes are subtle.</p>
<pre><code>procedure TForm1.ADOConnection1InfoMessage(Connection: TADOConnection;
const Error: Error; var EventStatus: TEventStatus);
var
... | 31,748 |
<p>Help! I have an Axis web service that is being consumed by a C# application. Everything works great, except that arrays of long values always come across as [0,0,0,0] - the right length, but the values aren't deserialized. I have tried with other primitives (ints, doubles) and the same thing happens. What do I d... | <p>Here's what I ended up with. I have never found another solution out there for this, so if you have something better, by all means, contribute.</p>
<p>First, the long array definition in the wsdl:types area:</p>
<pre><code> <xsd:complexType name="ArrayOf_xsd_long">
<xsd:complexContent mixed="false"&... | <p>Found this link that may offer a better alternative: <a href="http://www.tomergabel.com/GettingWCFAndApacheAxisToBeFriendly.aspx" rel="nofollow noreferrer">http://www.tomergabel.com/GettingWCFAndApacheAxisToBeFriendly.aspx</a></p>
| 5,005 |
<p>I'm about to take on a project that requires a Firefox addon to issue call to COM dll's installed on the client Windows machine and I'm having a hard time estimating the complexity of this undertaking.</p>
<p>I have quite a bit of experience with COM, so I'm not frightened by it. I have less experience with Firefox... | <p>Create an <a href="http://www.mozilla.org/projects/xpcom/" rel="nofollow noreferrer">XPCOM</a> in C++ to talk to your COM objects as usual. The XPCOM extensions can then be made available to Javascript to do the rest of the extension (GUI mainly, I guess). However, that's about all I understand about it :-)</p>
| <p>If you do this you'll almost certainly need to use XPCOM. Take a look at Shanti Rao's <a href="http://www.jsdb.org" rel="nofollow noreferrer">JSDB</a>, which supports COM/ActiveX within Javascript. The ActiveX stuff is in a file called wrap_com.cpp. It supports most IDispatch interfaces; the Invoke method of IDispat... | 30,695 |
<p>Is there a way to retrieve the time zone choices in Windows Mobile in order to display them in a GUI? It would be much better not to have to show every 15 minutes just to be
able to display GMT+5:45 for Kathmandu.</p>
| <p>As per <a href="http://msdn.microsoft.com/en-us/library/aa458853.aspx" rel="nofollow noreferrer">MSDN:City List and Time Zone Data Files</a>, </p>
<blockquote>
<p>You can add or remove content to these
files. You can redistribute these
files as is or repackage this data by
including it in source code, a
d... | <p>Windows Mobile stores timezone info in a <a href="http://msdn.microsoft.com/en-us/library/aa458853.aspx" rel="nofollow noreferrer">file called Timezones.csv</a></p>
| 16,261 |
<p>I saw a question on reverse projecting 4 2D points to derive the corners of a rectangle in 3D space. I have a kind of more general version of the same problem:</p>
<p>Given either a focal length (which can be solved to produce arcseconds / pixel) or the intrinsic camera matrix (a 3x2 matrix that defines the proper... | <p>A friend of mine found the source code from a university for the camera matching in PhotoSynth. I'd Google around for it, if I were you.</p>
| <p>That's a good suggestion... and I will definitely look into it (photosynth kind of resparked my interest in this subject - but I've been working on it for months for robochamps) - but it's a sparse implementation - it looks for "good" features (points in the image that should be easily identifiable in other views of... | 10,234 |
<p>I’m trying to use a (VS 2008) Web Deployment project in a TFS solution to deploy the web site to the (TFS 2008) build server to run web based unit tests.
For some reason, that I can't yet figure out, it is failing to create the virtual directory:</p>
<p>Using "CreateVirtualDirectory" task from assembly "C:\Program... | <p>it has got to be permissions...did you try putting the TFSService in the same Groups you are in?</p>
| <p>You're sure that the build is running under the TFSService id and not under another id set up just for builds, and which may not be in the administrator's group? I haven't done more than just play with automated builds since I do mostly solo development, but I recall setting up a separate build id when I was lookin... | 19,822 |
<p>I have in my Form constructor, after the InitializeComponent the following code:</p>
<pre><code>using (WebClient client = new WebClient())
{
client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted);
client.DownloadDataAsync("http://example.com/version.txt");
}
</co... | <p>Now that we've got full code, I can say I'm definitely not seeing the problem - not quite as described, anyway.</p>
<p>I've got a bit of logging to indicate just before and after the DownloadDataAsync calls, and when the completed handler is fired. If I download a large file over 3G, there <em>is</em> a pause betwe... | <p>I've tried your code and it works fine.</p>
<p>Could you post your Main(Args[]) method and the value of a and b when this is run:</p>
<pre><code> int a, b;
ThreadPool.GetMaxThreads(out a, out b);
</code></pre>
<p>I tried it in .NET 3.5 and VS2008. I'm at a loss, but I am convinced it's to do with the setup... | 34,192 |
<p>It seems that C# 3 hit me without me even noticing, could you guys tell me about good in depth guides to C# 3? from lambda to linq to everything else that was introduced with the third version of the language.</p>
<p>Printed books would be nice, but online guides would be even better!</p>
| <p><a href="http://weblogs.asp.net/scottgu/default.aspx" rel="nofollow noreferrer">ScottGu</a> has some great posts on C# 3:</p>
<ul>
<li><a href="http://weblogs.asp.net/scottgu/archive/2007/09/20/the-new-c-null-coalescing-operator-and-using-it-with-linq.aspx" rel="nofollow noreferrer">The C# ?? null coalescing operat... | <p>I found <a href="https://rads.stackoverflow.com/amzn/click/com/1590597893" rel="nofollow noreferrer" rel="nofollow noreferrer">Pro LINQ: Language Integrated Query in C# 2008</a> to be very helpful for this. It has a chapter which covers all the new language features in 3, and of course the rest of the book goes int... | 20,598 |
<p>In one of my current side projects, I am scanning through some text looking at the frequency of word triplets. In my first go at it, I used the default dictionary three levels deep. In other words, <code>topDict[word1][word2][word3]</code> returns the number of times these words appear in the text, <code>topDict[w... | <p>Some measurements. I took 10MB of free e-book text and computed trigram frequencies, producing a 24MB file. Storing it in different simple Python data structures took this much space in kB, measured as RSS from running ps, where d is a dict, keys and freqs are lists, and a,b,c,freq are the fields of a trigram record... | <p>You could put all words in a dictionary.
key would be word, and value is number (index).</p>
<p>Then you use it like this:</p>
<pre><code>Word1=indexDict[word1]
Word2=indexDict[word2]
Word3=indexDict[word3]
topDictionary[Word1][Word2][Word3]
</code></pre>
<p>Insert in indexDict with:</p>
<pre><code>if word not ... | 42,400 |
<p>I have three tables in the many-to-many format. I.e, table A, B, and AB set up as you'd expect. </p>
<p>Given some set of A ids, I need to select only the rows in AB that match all of the ids. </p>
<p>Something like the following won't work:</p>
<p>"SELECT * FROM AB WHERE A_id = 1 AND A_id = 2 AND A_id = 3 AND ..... | <p>Your database doesn't appear to be normalized correctly. Your <code>AB</code> table should have a single <code>A_id</code> and a single <code>B_id</code> in each of its rows. If that were the case, your <code>OR</code>-version should work (although I would use <code>IN</code> myself).</p>
<p>Ignore the preceding ... | <p>Try this....It brings all people that is associated with all options.</p>
<p>In other words the query bring all people that there it doesnt exists an option that were not associated to it.</p>
<hr>
<pre><code>select
p.*
from
people p
where
not exists (
select
1
... | 42,726 |
<p>Other than Visual Studio, what tool have you found best to create, edit, maintain, and possibly debug your XSLT files?</p>
<p>I work on a fairly big project and we have tons of XSLT files and they have grown quite complex in their implementation.</p>
<p>The language seems so brittle. It would be nice to navigate a... | <p>I've had good results using <a href="http://www.oxygenxml.com/" rel="noreferrer">Oxygen</a> for XSLT debugging, XPath building, and general XML stuff. </p>
| <p>I also use Xselerator. As mentioned, one day it just disappeared from the internet. Luckily I licenced it before then.</p>
| 25,673 |
<p>I have some code like this:</p>
<pre><code>[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Save([Bind(Prefix="")]Person person)
{
String s = person.property;
/* ... */
}
</code></pre>
<p>But it throws the error: "Cannot use local variable 'person' before it is declared".</p>
<p>What simple thing am I mi... | <p>It is most likely that you are receiving this error because the same variable is being declared later in the same code block. </p>
<p>According to compiler rules, a variable reference will refer to default by a matching declaration withing the same block EVEN IF THE SAME DECLARATION EXISTS OUTSIDE OF THE BLOCK IN I... | <p>I had the same problem with a declared variable named endingYear.</p>
<p>Declared here:</p>
<pre><code> public ChartData(MetricInfo metricInfo, MetricItem[] metricItems) : this()
{
int endingYear = 0;
</code></pre>
<p>Further along in the method this was not a problem:</p>
<pre><code> ... | 35,360 |
<p>I'm downloading a web page (tag soup HTML) with XMLHttpRequest and I want to take the output and turn it into a DOM object that I can then run XPATH queries on. How do I convert from a string into DOM object?</p>
<p>It appears that the general solution is to create a hidden iframe and throw the contents of the strin... | <p>Ajaxian actually had a <a href="http://ajaxian.com/archives/introducing-html-into-an-iframe-and-getting-it-back" rel="noreferrer">post on inserting / retrieving html from an iframe</a> today. You can probably use the js snippet they have posted there.</p>
<p>As for handling closing of a browser / tab, you can attac... | <p>So you want to download a webpage as an XML object using javascript, but you don't want to use a webpage? Since you have no control over what the user will do (closing tabs or windows or whatnot) you would need to do this in like a OSX Dashboard widget or some separate application. A Firefox extension would also wor... | 2,592 |
<p>[Error] WARNING. Duplicate resource(s):
[Error] Type 2 (BITMAP), ID TWWDBRICHEDITMSWORD:
[Error] File C:\Borland\Delphi7\ip4000vcl7\LIB\wwrichsp.RES resource kept;
file C:\Borland\Delphi7\ip4000vcl7\LIB\wwrichsp.RES resource discarded.
I have searched the code for same named objects, like objects.
Can a... | <p>Two units both using the same resource file. Probably looks like this:</p>
<pre><code>{$R wwrichsp.RES}
</code></pre>
| <p>wwrichedspellxp, wwrichedspell2000; 这两个同时存在时就出错。Delete wwrichedspellxp 就OK</p>
| 30,187 |
<p>If I HTML encode any data entered by website users when I redisplay it, will this prevent CSS vulnerabilities? </p>
<p>Also, is there a tool/product available that will sanitize my user input for me, so that I don't have to write my own routines.</p>
| <p>There are various subtleties to this question, although the answer in general is yes.</p>
<ul>
<li><p>The safety of your website is highly dependent on where you put the data. If you put it as legit text, there is essentially no way for the attacker to execute XSS. If you put it in an attribute, if you forget to es... | <p>HtmlEncoding input gets you a good portion of the way by not allowing the HTML to render to the page.</p>
<p>Depending on your language items should exist there to sanitize the data. In .NET you can use Server.HtmlEncode(txtInput.Text) to input data from a textbox named txtInput.</p>
<p>As others have mentioned m... | 27,585 |
<pre><code>foreach($arrayOne as $value){
do function
}
</code></pre>
<p>In the above example, I'd like to pass $arrayOne into a loop, have a function operate that removes some elements of $arrayOne and then have the loop pass over the reduced $arrayOne on the elements that are left until the loop returns false.</p... | <p>Do you just need a function to remove some elements of an array?</p>
<p>If so, you can use <a href="http://uk.php.net/array_filter" rel="nofollow noreferrer">array_filter</a>.</p>
| <p>Thanks everyone for their help. The unset() function is, in the end, what is useful to me in today's specific need. Here's the short story of my use of unset():</p>
<pre><code>//array to be processed
$one=array('1','2','3');
//array of terms previously defined as a group to compare against
$against=array('1','2')... | 28,409 |
<p>I have a medium size Java file. Everytime I make a change to one of my files, BuildTable.java, Git reports it as a massive change, even if is only a line or two. BuildTable.java is about 200 lines and the change in this commit only changed a single line.</p>
<p>git-diff ouputs this:</p>
<pre><code>--- a/src/BuildT... | <p>Clearly, git does not like your mac-style line endings (CR only). Its diff algorithm uses LF as the line separator.</p>
<p>Fix your files to have windows-style (CR LF) or unix (LF only) line endings.</p>
| <pre><code>git diff -b
</code></pre>
<p>Ignores end of line changes when showing you the differences.</p>
| 30,336 |
<p>I am looking for good methods of manipulating HTML in PHP. For example, the problem I currently have is dealing with malformed HTML.</p>
<p>I am getting input that looks something like this:</p>
<pre><code><div>This is some <b>text
</code></pre>
<p>As you noticed, the HTML is missing closing tags. I c... | <p>PHP has <a href="http://php.net/tidy" rel="noreferrer">a PECL extension that gives you access to the features of HTML Tidy</a>. Tidy is a pretty powerful library that should be able to take code like that and close tags in an intelligent manner.</p>
<p>I use it to clean up malformed XML and HTML sent to me by a cl... | <p>For manipulating the DOM i think that what you're looking for is <a href="http://www.php.net/manual/en/intro.dom.php" rel="nofollow noreferrer">this</a>. I've used to parse HTML documents from the web and it worked fine for me.</p>
| 4,685 |
<p>I have the following script, where the first and third <code>document.writeline</code> are static and <strong>the second is generated</strong>:</p>
<pre><code><script language="javascript" type="text/javascript">
document.write("<script language='javascript' type='text/javascript' src='before.js'><\/... | <p>No, this is the behavior of Internet Explorer.</p>
<p>If you attach scripts dynamically, IE, Firefox, and Chrome will all download the scripts in an asynchronous manner.</p>
<p>Firefox and Chrome will wait till all of the async requests return and then will execute the scripts in the order that they are attached i... | <p>Code to provide:</p>
<pre><code><script language="javascript" type="text/javascript">
document.write("<script language='javascript' type='text/javascript'>function callGeneratedContent() { alert('during'); }<\x2Fscript>");
document.write("<script language='javascript' type='text/javascript' src... | 11,978 |
<p>I have several <code>std::vector</code>, all of the same length. I want to sort one of these vectors, and apply the same transformation to all of the other vectors. Is there a neat way of doing this? (preferably using the STL or Boost)? Some of the vectors hold <code>int</code>s and some of them <code>std::string<... | <p>friol's approach is good when coupled with yours. First, build a vector consisting of the numbers 1…<em>n</em>, along with the elements from the vector dictating the sorting order:</p>
<pre><code>typedef vector<int>::const_iterator myiter;
vector<pair<size_t, myiter> > order(Index.size());
size_... | <p>So many asked this question and nobody came up with a satisfactory answer. Here is a std::sort helper that enables to sort two vectors simultaneously, taking into account the values of only one vector. This solution is based on a custom RadomIt (random iterator), and operates directly on the original vector data, wi... | 29,226 |
<p><strong>Edit:</strong> This question was written in 2008, which was like 3 internet ages ago. If this question is still relevant to your environment, please accept my condolences. Everyone else should convert into a format <a href="https://videojs.com/html5-video-support/" rel="noreferrer">supported by your browsers... | <p>The following works for me in Firefox and Internet Explorer:</p>
<pre class="lang-html prettyprint-override"><code><object id="mediaplayer" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701" standby="loading mic... | <p>December 2020 :</p>
<ul>
<li>We have now Firefox 83.0 and Chrome 87.0</li>
<li>Internet Explorer is dead, it has been replaced by the new Chromium-based Edge 87.0</li>
<li>Silverlight is dead</li>
<li>Windows XP is dead</li>
<li>WMV is not a standard : <a href="https://www.w3schools.com/html/html_media.asp" rel="nof... | 2,263 |
<p>We have a fairly new Ultimaker 3 Extended.</p>
<p>When printing ABS with the AA0.8 nozzle and the recommended settings (up-to-date CURA) we receive a very poor wall quality that exposes some kind of pores. I've attached an image of those pores.</p>
<p>I assume those pores are dragged by the nozzle when it moves in... | <p>According to <a href="https://youtu.be/QnnPsoL5cHE?t=18" rel="nofollow noreferrer">Anycubic</a> this printer uses the E3D V5 type hotend as can be seen from the linked video of the AnyCubic Mega:</p>
<p><a href="https://i.stack.imgur.com/WSL8p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WSL8p... | <p>We select nozzles depending on what project we want to,do and it must match with the hot end as well.</p>
| 1,275 |
<p>What is the best way to graphically represent page flow, as applicable to an action oriented web application?</p>
<p>What model do you use to represent page flows (page flow diagrams) encompassing pages (views), user actions on those views (events) and processes?</p>
<p>These diagrams should act as a starting poin... | <p>I have always liked <a href="http://www.jjg.net/ia/visvocab/" rel="noreferrer">Jesse James Garret's</a> Visual Language.</p>
| <p>take a look at yuml.me as this is pretty easy to use and generates nice "scruffy" diagrams</p>
| 21,551 |
<p>Is it realistic or thought neccesary to develop a plugin/feature for this site, to automatically add a small info-box about a thingiverse link? An example of this is Apple's 3D touch technology. In theory, the plugin could recogize thingiverse links in questions and answers, replace the link with an image and the au... | <p>Typically, it's a better idea to wait before you try to get this kind of thing integrated.</p>
<p>Enthusiasm is great in a private beta, but for the early stages, direct that enthusiasm towards the Q&A. That's what'll get this site on its feet and into a successful public beta.</p>
<p>When the site's more stab... | <h3>Technological issues</h3>
<p>Stack Exchange works hard for its communities, but there is a limit. If thingiverse changes its API (which it can, and does, do at any time without notice) then anything we build on it has to be modified, and users will be very whiny until it's fixed.</p>
<p>If we choose to integrate ... | 6 |
<p>I have a stateless bean something like:</p>
<pre><code>@Stateless
public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote {
@PersistenceContext(unitName="myPC")
private EntityManager mgr;
@TransationAttribute(TransactionAttributeType.SUPPORTED)
public void processObjects(List<... | <p>Another way to do it is actually having both methods on the same bean - and having an <code>@EJB</code> reference to itself! Something like that:</p>
<pre><code>// supposing processObjects defined on MyStatelessRemote1 and process defined on MyStatelessLocal1
@Stateless
@TransationAttribute(TransactionAttributeType... | <p>I think has to do with the <em>@TransationAttribute(TransactionAttributeType.Never)</em> on method <strong>processObjects</strong>.</p>
<p><strong>TransactionAttributeType.Never</strong></p>
<p><a href="http://docs.sun.com/app/docs/doc/819-3669/6n5sg7cm3?a=view" rel="nofollow noreferrer">http://docs.sun.com/app/do... | 13,195 |
<p>What is the best unobtrusive CAPTCHA for web forms? One that does not involve a UI, rather a non-UI Turing test. I have seen a simple example of a non UI CAPTCHA like the <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/NoBot/NoBot.aspx" rel="noreferrer">Nobot</a> control from Microsoft. I am looking for... | <p>I think you might be alluding to an "invisible" captcha. Check out the Subkismet project for an invisible captcha implementation.</p>
<p><a href="http://www.codeplex.com/subkismet" rel="noreferrer">http://www.codeplex.com/subkismet</a></p>
| <p><a href="http://meyerweb.com" rel="nofollow noreferrer">Eric Meyer</a> implemented a very similar thing as a WordPress plugin called <a href="http://meyerweb.com/eric/tools/wordpress/wp-gatekeeper.html" rel="nofollow noreferrer">WP-GateKeeper</a> that asks human-readable questions like "What colour is an orange?". ... | 2,516 |
<p>I'm working on a script in PHP that needs to get some info from a SQL Server database. However, I am having trouble connecting to the database. When i use the mssql_connect() function, it gives me an error and says it cannot connect to the database. However, it gives no reason why. Is there any way to find out why i... | <p>Try to use pdo (<a href="http://php.net/pdo" rel="nofollow noreferrer">http://php.net/pdo</a>). the mssql-extension is a mess.</p>
<p>Instead of '' it returns ' ' for empty strings. It seems to be a bug in ntwdblib that has never been fixed. When I experienced the problem i nearly went crazy...</p>
<p>To get the c... | <p>Have you tried looking in the Windows Event Log? I am not sure if there will be enough info there, but it may help.</p>
| 44,895 |
<p>Presently I have a some legacy code, which generates the op code. If the code has more number of macros then the code generation takes so much of time (In terms of hours!!).
I have gone through the logic, they are handling the macro by searching for it and doing a replace of each variable in it some thing like inlin... | <p>You <strong>must</strong> tokenize your input before starting this kind of process. (I can't recommend the famous <a href="http://en.wikipedia.org/wiki/21st_Century_Compilers" rel="nofollow noreferrer">Dragon Book</a> highly enough - even the ancient edition stood the test of time, the updated 2006 version looks gre... | <p>I have an application which has its own grammer. It supports all types of datatypes that a typical compiler supports (Even macros). More precisely it is a type of compiler which generates the opcodes by taking a program (which is written using that grammer) as input.
For handling the macros, it uses the text replac... | 37,019 |
<p>I want to determine if a certain window is visible to the user or hidden/occluded. In Windows XP I would use the GetClipBox() function and check for a NULLREGION or empty RECT return value. This worked perfectly fine, but on Windows Vista it does not work if another window is occluding the window. In this case, GetC... | <p>The simple reason GetClipBox() is not returning NULLREGION with DWM enabled is because you are not being clipped! The whole point of the DWM is each window (that isn't a child, like buttons or edit boxes) gets it's own buffer to draw to, so foreground windows can be moved around without having to fill in the windows... | <p>Since you know what the output from GetClipRect is on both XP and Vista (with and without DWM enabled) you can create a function to determine this which takes different paths based on the OS. In psuedo-code:</p>
<pre><code>function bool IsWindowVisible()
{
bool isVisible = false;
if (OSVersion == "XP")
{
... | 33,135 |
<p>I'm just learning Perl.</p>
<p>When is it advisable to use OO Perl instead of non-OO Perl?</p>
<p>My tendency would be to always prefer OO unless the project is just a code snippet of < 10 lines.</p>
<p>TIA</p>
| <p><a href="http://www.perlmonks.org/?node_id=91080" rel="nofollow noreferrer">From Damian Conway</a>:</p>
<blockquote>
<h2>10 criteria for knowing when to use object-oriented design</h2>
<hr>
<ol>
<li><h3>Design is large, or is likely to become large</h3></li>
<li><h3>When data is aggregated into obvi... | <p><a href="http://search.cpan.org/~dconway/" rel="nofollow noreferrer">Damian Conway</a> has a passage in <a href="http://books.google.com/books?id=gJf9tI2mytIC&pg=PA365&lpg=PA365&dq=perl+best+practices+objects&source=bl&ots=Hk-hfJzBhs&sig=mEWiKgcOEeUqh_7rHX-6jGrsqu4&hl=en&sa=X&oi=b... | 38,354 |
<p>Let's say I have the following class:</p>
<pre><code>public class Test<E> {
public boolean sameClassAs(Object o) {
// TODO help!
}
}
</code></pre>
<p>How would I check that <code>o</code> is the same class as <code>E</code>?</p>
<pre><code>Test<String> test = new Test<String>();
... | <p>An instance of <code>Test</code> has no information as to what <code>E</code> is at runtime. So, you need to pass a <code>Class<E></code> to the constructor of Test.</p>
<pre><code>public class Test<E> {
private final Class<E> clazz;
public Test(Class<E> clazz) {
if (clazz ==... | <p>I was just trying to do the same thing, and one neat trick i just realized is that you can can try a cast, and if the cast fails, ClassCastException will be thrown. You can can catch that, and do whatever. </p>
<p>so your sameClassAs method should look like:</p>
<pre><code>public boolean sameClassAs(Object o) {
... | 7,471 |
<p>I am working on a project using rails 2.1.1. With the new release of 2.2.2 I want to migrate to the new version. Is there anything I need to change to migrate my 2.1.1 controllers, views, and models?</p>
| <p>Don't forget to run the update Rake task</p>
<pre><code>rake rails:update
</code></pre>
<p>That will go ahead and make sure it updates any scripts and configs to reflect 2.2.</p>
<p>Once you have 2.2 installed, issue:</p>
<pre><code>rake -T
</code></pre>
<p>to view the available tasks, double check it's there a... | <p>If you have any plugins that break, check GitHub. I had a bunch of plugins break with no official fixes. I searched GitHub and people had already patched them. Made the upgrade much better then it could have been.</p>
| 40,371 |
<p>What does the following mean?</p>
<pre><code>Class.Function(variable := 1 + 1)
</code></pre>
<p>What is this operator called, and what does it do? </p>
| <p>It is used to assign optional variables, without assigning the previous ones.</p>
<pre><code>sub test(optional a as string = "", optional b as string = "")
msgbox(a & b)
end sub
</code></pre>
<p>you can now do</p>
<pre><code>test(b:= "blaat")
'in stead of
test("", "blaat")
</code></pre>
| <p>It assigns the optional parameter "variable" the value 2.</p>
| 25,094 |
<p>Within emacs, what are the best options out there for navigating to a specific function whose name might show up across several different files? Within etags, you are only allowed to cycle through the tags one-at-a-time which could take a while if the function name you are looking for is popular.</p>
| <p><em>C-u M-.</em> cycles all locations of the same tag, but if you want to see a list of all tags that match your function name you can use the command <em>tags-apropos</em>.</p>
| <ol>
<li><p><a href="http://www.emacswiki.org/emacs/Icicles_-_Emacs_Tags_Enhancements" rel="nofollow">Icicles tag commands</a></p>
<p>In particular, use command <code>icicle-find-tag</code>, to do what all of these vanilla commands do:</p>
<ul>
<li><code>find-tag</code> (<kbd>M-.</kbd>) to find a tag</li>
<li><code>... | 22,264 |
<p>I have some problems comparing an array with Norwegian characters with a utf8 character.</p>
<p>All characters except the special Norwegian characters(æ, ø, å) works fine.</p>
<pre><code>function isNorwegianChar($Char)
{
$aNorwegianChars = array('a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', ... | <p>First of all, and I'll get to UTF-8 later if nobody else answers, iterating like you are is a very bad way to search through an array. PHP has built-in functions just for that:</p>
<p><a href="http://fr.php.net/array_search" rel="nofollow noreferrer">http://fr.php.net/array_search</a></p>
<p>So you might want to g... | <p>See if you have mbstring extension installed</p>
| 20,126 |
<p>I have the following code below in my Servlet, but when IE hits the page, it returns a blank html page. If I use the response.getOutputStream() directly in the StreamResult constructor, the page loads fine. What am I missing?</p>
<p><strong>response</strong> is an instance of HttpServletResponse and <strong>xsl</... | <p>I'm going to guess that you aren't closing the gzipOut stream and therefore it isn't sending the "footer" information.</p>
| <p>Turns out there is a .finish() on this stream that is required. It is similar to flush, but since it is a different call, the Transformer does not know to use it.</p>
| 30,228 |
<p>There seem to many ways to skin this particular cat - but which is the best and easiest to implement. It would seem that the ASP.net Membership Provider is the one that will save more time, so my questions are:</p>
<ol>
<li>What are the pros/cons of Membership?</li>
<li>How do you integrate the auto generated user... | <p>Membership is lightweight and easy to set up. You can also use the various providers to use Active Directory or some other member location. </p>
<p>You shouldn't need to integrate the databases, you can use one to authenticate users and then as long as they are valid, go query another database for the data. This ... | <p>Tutorials - there are a series of good tutorials on the <a href="http://www.asp.net/learn/security/" rel="nofollow noreferrer" title="Security tutorials">ASP.Net</a> site. We have used the membership provider facilities, and have it integrated with our database - we use the "user name" value as a foreign key to our... | 19,596 |
<p>I want to put beautiful charts in a report that is available via html and pdf.</p>
<p>I'd prefer to use just one API and that all processing occur server-side.</p>
<p>I want to embed Flash charts in the html version of reports. I want to embed a static image (preferably vector-based format) in the pdf version.</p>... | <p>Take a look at <a href="http://www.alivepdf.org/" rel="nofollow noreferrer">AlivePDF</a>. I believe it can do what you need. They have a demo where you can export and download a pdf of the swf you have just drawn into, very cool.</p>
<p>Alternatively here is a <a href="http://www.bytearray.org/?p=90" rel="nofollow ... | <p>You can grab the bitmap data of the chart straight from Flash using ActionScript. Unfortunately, I don't believe there is a way to export the vector data.</p>
| 14,696 |
<p>I might be missing something obvious but is there a reference somewhere about what exceptions are thrown by functions in .NET and why the exception might be thrown? </p>
<p>As an example, I was recently trying out Linq in Visual C# 2008 and I was loading an XML file into an XDocument. It was only through testing th... | <p>Nice question, you have 20/20 vision. C#/.NET does not implement the throws statement (i.e., checked exceptions). </p>
<p>Anyone coming from a language such as Java is likely to wonder about this.</p>
<p>Anders Hejlsberg, the father of C#, explains the rationale behind leaving checked exceptions out of C# in <a h... | <p>.NET does not implement anything like the 'throws' keyword in java, so your best bet is to check the online MSDN documentation.</p>
<p>EDIT: if you look at the Namespace doco (for <a href="http://msdn.microsoft.com/en-us/library/system.io.aspx" rel="nofollow noreferrer">System.IO</a> for instance) it lists possible... | 23,688 |
<p>It is advised to use override instead of new key word in C#. Why that rule?</p>
| <p>"new" means you've got two completely different methods as far as the CLR is concerned - they happen to have the same name, but they're unrelated in terms of inheritance. That means that if you run:</p>
<pre><code>Base b = new Derived();
Derived d = new Derived();
b.MyMethod(); // Calls Base.MyMethod
d.MyMethod(); ... | <p>This is actually <em>not</em> a <em>choice</em> you have. This is imposed upon you by however created the base class. If there exists a method with the same name and it is marked as "virtual" then you should use override unless you want to have some seriously funny bugs appearing down the road when people starts cas... | 44,248 |
<p>With respect to <a href="https://3dprinting.stackexchange.com/questions/7172/dual-extruder-clogging-problem#comment11340_7172">Himanshu's comment</a> about applying a lubricant to PLA filament, and then having read the Reddit thread, <a href="https://www.reddit.com/r/3Dprinting/comments/52xjcg/seasoning_allmetal_hot... | <p>I'm gonna go out on a limb here and say this is probably not a good idea in any capacity.</p>
<p>First off, if you take a look at <a href="https://en.wikipedia.org/wiki/Template:Smoke_point_of_cooking_oils" rel="noreferrer">this list</a> of cooking oils, you'll notice that pretty much all of them have smoke points ... | <p>W.R.T <a href="https://3dprinting.stackexchange.com/a/10247/4762">Nach0z's answer</a>:</p>
<blockquote>
<p>Third, the process of seasoning cast iron works because the surface of the cast iron should be smooth for minimal food sticking, and any kind of rusting causes pits and porosity in the metal.</p>
</blockquote>
... | 1,072 |
<p>I’m getting an intermittent false negative on the following line of code in an ASP.NET 2 <a href="http://www.BugTracker.net" rel="nofollow noreferrer">web site</a>:</p>
<pre><code>if (!System.IO.Directory.Exists(folder))
</code></pre>
<p>The folder clearly exists, and even contains a log file that is written to wh... | <p>Exists() returns false, rather than throwing an error, if any sort of IO error occurs. One thing to watch out for is security errors. Exists does not perform network authentication, so it requires being pre-authenticated if your accessing a network share, at least according to the docs. I haven't tried it myself.</p... | <p>What is the debug time value of the variable "folder"?
Is it a folder which exists outside of website directory?</p>
| 22,871 |
<p>I would like to know whether it is possible to force LWP::UserAgent to accept an expired SSL certificate for a single, well-known server. The issue is slightly complicated by the Squid proxy in between.</p>
<p>I went as far as to set up a debugging environment like:</p>
<pre><code>use warnings;
use strict;
use Car... | <p><strong>Updated to address comment</strong></p>
<p>To bypass <em>all</em> certificate checks you can set the <a href="http://search.cpan.org/~gaas/libwww-perl-6.05/lib/LWP/UserAgent.pm" rel="noreferrer">agent</a> up to not verify the certificate.</p>
<pre><code>$agent->ssl_opts(verify_hostname => 0);
</code>... | <p>Try overriding the SSL certificate validation with</p>
<pre><code>$agent->ssl_opts(verify_hostname => 0,
SSL_verify_mode => 0x00);
</code></pre>
<p>before you do the https request.</p>
| 43,657 |
<p>There are many different flavored HTML WYSIWYG editors from javascript to ASP.Net web controls, but all too often the features are the same. Does anyone have a favorite HTML editor they like to use in projects? Why?</p>
| <p>I'm partial to TinyMCE WYSIWYG editor due to the following reasons:</p>
<ol>
<li><p>Javascript - so it is broadly usable
regardless of the platform I'm
working in.</p></li>
<li><p>Easy to use - just a couple lines of
code and a textarea and the control is up and
running.</p></li>
<li><p>Easily themed - so I can qui... | <p>It completely depends on what you are using it for.</p>
<p>For instance, I use VS2008 for ASP.NET coding, and Notepad++ for looking at HTML source. It's all in what your end use for the editor will be. You won't care how well it renders a decent PHP development experience if all you are doing is modifying CSS files... | 9,146 |
<p>I have an application, built using MVC, that produces a view which delivers summary information across a number of models. Further to that, some calculations are performed across the different sets of data.</p>
<p>There's no clear single model (that maps to a table at least) that seems to make sense as the starting... | <p>As Brian said, you can create another model that marshals out the work that needs doing. There is <a href="http://railscasts.com/episodes/121-non-active-record-model" rel="nofollow noreferrer">a great Railscast</a> on how to do this type of thing.</p>
<p>HTH</p>
| <p>Controllers don't have to be <em>that</em> lightweight.</p>
<p>However if you have some calculations that only rely on the model/s then you probably just need some sort of model wrapper for the models to perform the calculation. You can then place that into the API for the view so the view gets the end result.</p>
| 4,644 |
<p>I'm using an UpdatePanel and want to put a CompareValidator on two text boxes, to verify that the user-entered password and confirmation are the same.</p>
<p>This is working fine (I have VS2008 and am using .NET 3.5) out of the box, with one minor problem:</p>
<p>The validation is firing as soon as the user clicks... | <p>Good question(s). I've never used TFS but all this certainly is possible with a number of tools. The biggest hurdle is the culture and mindset of the company and developers. </p>
<p>I am pro SVN. (But TFS would work I am sure)</p>
<p>I'd suggest very light intrusion on daily tasks. </p>
<p>Having sandboxes or... | <p>As much as people hate consultants, you might consider talking to a firm that does commercial svn support. If TFS is as expensive as you say, this may save you some money with the benefit of starting you off with a good setup. There are risks involved with this of course.</p>
| 37,130 |
<p>Trying to make a form wizard with <a href="http://docs.jquery.com/UI/Tabs" rel="nofollow noreferrer">jQuery tabs</a>.</p>
<p>Is it possible to have each step of the form in separate views, then load each via jQuery/AJAX tabs option? When I AJAX load the partial form, it has no way to access the js, css, etc.; as th... | <p>Unless the tabs are being loaded in iframes, they should have access to the js and css of the page loading them in. Can you do a test to confirm your suspicion that the JS and CSS aren't accessible?</p>
| <p>The problem I found with this was that most of my ajax data is being sent back as text/html NOT a URL? this means it does not show up and if I attach it to the 'target' then it does not load the tabs load event and so the binding to the submit button does not happen</p>
| 25,051 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.