instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Any ideas how to display a PDF file in a WPF Windows Application? </p>
<hr>
<p>I am using the following code to run the browser but the <code>Browser.Navigate</code> method does not do anything!</p>
<pre><code>WebBrowser browser = new WebBrowser();
browser.Navigate("http://www.google.com");
this.AddChild(browser)... | <p>You could simply host a Web Browser control on the form and use it to open the PDF.</p>
<p>There's a new native WPF "WebBrowser" control in .NET 3.51, or you could host the Windows.Forms browser in your WPF app.</p>
| <p>Check this out: <a href="http://itextsharp.sourceforge.net/" rel="nofollow noreferrer">http://itextsharp.sourceforge.net/</a>
You may have to use a WindowsFormsHost, but since it is open source, you might be able to make it a little more elegant in WPF.</p>
| 7,879 |
<p>I have a GIF image that has an alpha set, and when my site loads in Firefox 3.0, it acts transparently on the parts of the image that should. However, when I try to load the GIF image in IE7, it comes back as a solid block. Actually, it is like the color from the image bled into the transparent area.</p>
<p>Do an... | <p>I don't recall ever having a problem with transparent gifs in IE (any version).</p>
<p>First off try loading the image on its own - this will tell you if it's the image or some CSS rules going awry.</p>
<p>If it's still wrong, try re-saving it with a different program. The gimp will do.</p>
<p>Edit: It's at the ... | <p>This is <strong>weird</strong> -- I found the problem in what I thought was commented out statements in the CSS file:</p>
<pre><code>//margin-top: 46px;
//background-color: #377696;
</code></pre>
<p>which was in the element that contained both images.</p>
<p>I upvoted each answer. Thanks!</p>
| 30,817 |
<p>If I define a constant in a Perl module, how do I use that constant in my main program? (Or how do I call that constant in the main program?)</p>
| <p>Constants can be exported just like other package symbols. Using the standard <a href="http://search.cpan.org/~ferreira/Exporter-5.63/lib/Exporter.pm" rel="noreferrer">Exporter</a> module, you can export constants from a package like this:</p>
<pre><code>package Foo;
use strict;
use warnings;
use base 'Exporter';
... | <pre><code>package Foo;
use Readonly;
Readonly my $C1 => 'const1';
Readonly our $C2 => 'const2';
sub get_c1 { return $C1 }
1;
perl -MFoo -e 'print "$_\n" for Foo->get_c1, $Foo::C2'
</code></pre>
| 23,461 |
<p>What's the difference between "Layers" and "Tiers"?</p>
| <blockquote>
<p>Logical <strong>layers</strong> are merely a way of
organizing your code. Typical layers
include Presentation, Business and
Data – the same as the traditional
3-tier model. But when we’re talking
about layers, we’re only talking about
logical organization of code. In no
way is it implied that these laye... | <p>Layers are conceptual entities, and are used to separate the functionality of software system from a logical point of view; when you implement the system you organize these layers using different methods; in this condition we refer to them not as layers but as tiers.</p>
| 14,645 |
<p>We have many projects that use a common base of shared components (dlls).
Currently the development build for each project links against dlls built from the trunk of the components. (ie trunk builds use the dlls from other trunk builds)</p>
<p>When we do a release build, we have a script that goes through the proj... | <p>Hmm, I may be in a minority here, but this comes down to release management.</p>
<p>Developing against the <code>trunk</code> of a set of shared components means, by definition, that the components are a "moving target" -- a developer using those shared components won't necessarily know if a newly found defect or f... | <p>We are using the scons building system, and have our own file in the root directory which specifies what version of each library we're going to use when building the application.</p>
<p>That reduces the need to change version names in several locations like you mentioned.</p>
| 48,135 |
<p>I have a table and an associated chart contained within a 'list' object in SSRS 2005. I am using an expression to determine the visibility of the table and chart, however when the table and chart are not visible an ugly large blank space (where they would otherwise have been rendered) appears in the report.</p>
<p... | <p>Im not sure i completely understand the problem, but, why don't you filter the results rather than change their visibility?. I had similar problem, my solution was redo the report, i found that the visibility is quite problematic than useful.</p>
| <p>To my knowledge List height automatically grows and shrinks based on the visibility of the controls in it. Make sure that you are setting the visibility to entire control if it is a table or chart.</p>
| 33,049 |
<p>A site I'm working on has Flash headers (using <a href="http://code.google.com/p/swfobject/" rel="noreferrer">swfobject</a> to embed them). Now I'm required to code in a bit of HTML that's supposed to overlap the Flash movie.</p>
<p>I've tried setting z-index on the Flash element's container and the (absolutely pos... | <p>Make sure the FlashVar "wmode" is set to "transparent" or "opaque," but NOT the default, "windowed"... then you should be able to use CSS z-index</p>
| <p>Set
this flash variable like this </p>
<pre><code>s1.addParam("wmode","transparent");
</code></pre>
<p>then
in the div tag use this style</p>
<pre><code>style="z-index:inherit;
</code></pre>
<p>The problem will be solved.</p>
| 15,027 |
<p>I have a webservice that that uses message layer security with X.509 certificates in WSE 3.0. The service uses a X509v3 policy to sign various elements in the soapheader.</p>
<p>I need to do some custom checks on the certificates so I've tried to implement a custom X509SecurityTokenManager and added a section in we... | <p>The problem was located elsewhere. My serverproject was an web-app and some options wasn't available for web-apps just for web-sites. So I made a small web-site project and compared web.configs and noticed that some lines diffed.</p>
<p>These lines was in the website web.config but not in my other projekt</p>
<pre... | <p>Not particular constructive advice I know, but if I was you I'd get off WSE3.0 as soon as possible. We did some work with trying to get it to interoperate with WCF and a Java client earlier this year and it was an obsolute KNIGHTMARE.</p>
<p>WCF on the other hand is practically sane and the documentation on areas l... | 10,692 |
<p>I am trying to code TDD style in PHP and one of my biggest stumbling blocks (other than lack of a decent IDE) is that I have to make my own hacked together IoC container just to inject all my mock objects properly.</p>
<p>Has anyone used an Ioc container in PHP? All I've been able to find is <a href="http://www.ph... | <p>I played with some DI Frameworks for PHP, but I haven't used one in production. Have some links:</p>
<ol>
<li><a href="http://www.stubbles.net" rel="noreferrer">http://www.stubbles.net/</a> which
I think is the oldest I tried</li>
<li><a href="http://php.xjconf.net/" rel="noreferrer">http://php.xjconf.net/</a></li>... | <p>Laravel 4 has the best IoC and DI framework. if you dont mind using a framework the Laravel 4 is the way to go</p>
| 7,530 |
<p>Pretty much what the question says. What's the difference between the two classes of roots? The differences between the certificates signed by such roots? What uses would a class 1 signed certificate have that a class 3 doesn't, and vice versa?</p>
| <p>The class 3 root certificate is the high-security subset of the CAcert
class 1 root certificate.</p>
<p>Class 1 is the 'normal' and older root certificate of CAcert. It
includes both, low security and high security certificates. As it might
not be possible to get the class 1 certificate included into some
browsers ... | <p>The class 3 root certificate is the high-security subset of the CAcert
class 1 root certificate.</p>
<p>Class 1 is the 'normal' and older root certificate of CAcert. It
includes both, low security and high security certificates. As it might
not be possible to get the class 1 certificate included into some
browsers ... | 45,004 |
<h2>Setup</h2>
<p>Have you ever had the experience of going into a piece of code to make a seemingly simple change and then realizing that you've just stepped into a wasteland that deserves some serious attention? This usually gets followed up with an official <strong>FREAK OUT</strong> moment, where the overwhelming f... | <p>I'm a big fan of making lists!</p>
<p>As soon as the urge takes you to re-write something - spend 10 minutes making a list of the things that need re-writing. Follow all of the alleys that take you further into the code that needs attention and list those, too.</p>
<p>Hopefully within a relatively short space of ... | <p>Refactor only if your boss/company actually encourages it, otherwise you'll end up doing frequent extra time to bring up code to perfection... Until someone less dedicated touches it again.</p>
| 42,004 |
<p>We generate dynamic reports in all of our business web applications written for .Net and J2EE. On the server side we use ActiveReports.Net and JasperReports to generate the reports. We then export them to PDF to send down to the browser.</p>
<p>Our clients all use Adobe Reader. We have endless problems with the ... | <p>I've used SQL Reporting Services for this purpose. You can design a report template in Visual Studio or generate the XML for the report on the fly in code. You can then have SSRS export the report to about 10 different formats and send to the client including pdf, excel, html, etc. You can also write your own plugin... | <p>I've always had the most success using PDFs to accomplish this. I can't think of a more universally acceptable format that does what you are trying to do. Rather than looking for another format, perhaps it would be better to try to understand how to overcome the problems that you are experiencing with Acrobat on t... | 6,817 |
<p>We have a toy with some broken parts, an Executivity Gear Master. I don't think it's made anymore. Some tiny parts were easy to break and we'd like to 3d print some replacement parts. We don't have CAD or any other 3D drawings file, just a few of the unbroken parts. What's the best way to get some of these printed? ... | <p>I had the same problem with ABS, but printing different test objects I found out that the distance between the wavy structures depends on the cross sectional area of the object. Printing the testcube in 70.1% (1/sqrt(2) times of the original size) takes half the time per layer and the distance between two grooves do... | <p>Looks like something is catching on the z axis. A bent peice would likely cause much smaller deformations unless it was very obviously bent. Something could be loose, allowing the vertical play, perhaps the motor mounts.</p>
<p>More likely I think is a level-difference between the z-axis worm gears, possibly caused... | 515 |
<p>what is the easiest way to remove the "T" from the result?</p>
<p>I want the result to be "YYYY/MM/DD HH/MM/SS"</p>
<p>the vb.net code is really straight forward</p>
<pre><code> xmlDoc = New Xml.XmlDataDocument(data_set)
xslTran = New Xml.Xsl.XslCompiledTransform
xslTran.Load(strXslFile)
... | <p>Both the status and country tables are so small that they are going to be memory resident in practice, whether formally stated as such or not. Indeed, except that a foreign key normally requires an index on the referenced primary key field, you might be tempted not to bother with any indexes on the tables.</p>
<p>... | <p>If 'status' is (and will always be?) a binary active/deleted field why bother with the table at all. It seems like normalization taken to an impractical extreme.</p>
<p>It would <em>certainly</em> be quicker, not to mention easier, to simply use a tinyint(1) field and record the active/deleted state as a 1 or 0.</p... | 41,982 |
<p>This is really only easy to explain with an example, so to remove the intersection of a list from within a dict I usually do something like this:</p>
<pre><code>a = {1:'', 2:'', 3:'', 4:''}
exclusion = [3, 4, 5]
# have to build up a new list or the iteration breaks
toRemove = []
for var in a.iterkeys():
if var... | <p>Consider <a href="http://docs.python.org/library/stdtypes.html#dict.pop" rel="noreferrer">dict.pop</a>:</p>
<pre><code>for key in exclusion:
a.pop(key, None)
</code></pre>
<p>The <code>None</code> keeps pop from raising an exception when <code>key</code> isn't a key.</p>
| <p>Why not just use the <code>keys</code> method, instead of <code>iterkeys</code>? That way you can do it in one loop because it returns a list, not an iterator.</p>
| 20,183 |
<p>for e.g from command prompt I need to launch the exe with some switch flags under debugger. How do I do it? </p>
<p>This is an exe from c/c++ and built using VS2005 environment that I need debug. I pass some flags to this exe to perform some stuff.</p>
| <p>You'll need to give more information about your development environment to get a specific answer.</p>
<p>For example, with a C# project in Visual Studio, you can right-click the project->Properties and then fill out the "Command line arguments" field in the "Debug" tab.</p>
| <p>I think I have it worked. Right click on the project->Properties and then fill out the "Command line arguments" field in the "Debug" tab. bkane solution worked. thx.</p>
| 13,155 |
<p>Is there any way to (unit) test my own HtmlHelpers? In case when I'd like to have custom control (rendered by HtmlHelper) and I know requierements for that control how could I write tests first - and then write code? Is there a specific (nice) way to do that? </p>
<p>Is it worth?</p>
| <p>The main problem is that you have to mock the HtmlHelper because you may be using methods of the helper to get routes or values or returning the result of another extension method. The HtmlHelper class has quite a lot of properties and some of them quite complex like the ViewContext or the current Controller.</p>
<... | <p>I'm creating a custom helper, and this is the code i'm using to mock the httphelper with Moq and ASP MVC 2. I'm also passing as a parameter a mock of the HttpRequestBase. You can remove that if you don't need it</p>
<pre>
public static HtmlHelper CreateHtmlHelper(ViewDataDictionary viewData, Mock requestMock)
... | 34,177 |
<p>Being new to 3D printing, I started using Cura (which came with my Ender 3v2) to slice models I found on Thingiverse. I know that there are other slicers and have heard positive things about PrusaSlicer.</p>
<p>I know that settings will have different names, but I am asking more about the setup. What things, setting... | <p>Basically all slicers work very similarly, it is a matter of preference, being accustomed, or wanting to use a certain (set of) features. Their job is to prepare the object to be sliced in layers to be executed by the printer you use. For every slicer to work properly, you need to configure the printer settings corr... | <p>PrusaSlicer already has pre-tuned profiles for the Ender 3 v2 in the Configuration Assistant. It also has tuned print settings from SUPERDETAIL (0.08 mm layer height) to SUPERDRAFT (0.28 mm layer height) so it shouldn't be too hard to set up.</p>
| 1,897 |
<p>I'm trying to come up with a Java regex that will match a filename only if it has a valid extension. For example it should match "foo.bar" and "foo.b", but neither "foo." nor "foo".</p>
<p>I've written the following test program</p>
<pre><code>public static void main(String[] args) {
Pattern fileExtensionPattern... | <p>The <a href="http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html#matches()" rel="noreferrer">Matcher.matches()</a> function tries to match the pattern against the entire input. Thus, you have to add <code>.*</code> to the beginning of your regex (and the <code>\\Z</code> at the end is superfluous, to... | <pre><code>package regularexpression;
import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegularFile {
public static void main(String[] args) {
new RegularFile();
}
public RegularFile() {
String fileName = null;
boolean bName = false... | 28,995 |
<p>How does your employer limit/prevent pirating of its products?</p>
<p>Some have the view that piracy can be good because of the market share and exposure it gives. Sure these are benefits but they come at a cost.</p>
<p>Do you use any anti-piracy software or methods to protect your products and why/why not?</p>
| <p>I think you need to weigh up a number of factors in deciding on software protection, and how invasive or inconvenient the measures will be.</p>
<p>The most invasive (and expensive to implement) measure is the hardware dongle. I doubt this is used much any more because of the huge cost and inconvenience. You need to... | <p>In my company, we don't use it. We operate in a niche market with a small number (10-20) of customers, so there is a high transparency. Our management believes that we would find out if some customers used unlicensed copies.</p>
<p>In order to decide if you want invest into a protection (either your time by develop... | 44,596 |
<p>I am trying to store more than 1 data item at a single index in my linked-list. All of the examples in my textbook seem to illustrate adding only 1 piece of data per index. I'm assuming it is possible to add more?</p>
<p>For example, using the Collections API to store an integer I would do the following:</p>
<pr... | <p>There seems to be a little confusion about how linked lists work. Essentially, a linked list is composed of nodes, each of which contains one datum (an object, which itself can contain several member variables, to be precise), and a link to the next node in the list (or a null pointer if there is no such next node)... | <p>Here's a complete code sample that shows the use of adding a structure to a linked list:</p>
<pre><code>import java.util.LinkedList;
class Node {
int num1;
int num2;
int num3;
int num4;
public Node(int a, int b, int c, int d) {
num1 = a; num2 = b; num3 = c; num4 = d;
}
}
public class... | 23,103 |
<p>What are the consequences of running a Java class file compiled in JDK 1.4.2 on JRE 1.6 or 1.5?</p>
| <p>The <a href="http://java.sun.com/javase/6/webnotes/compatibility.html" rel="nofollow noreferrer">Java SE 6 Compatibility</a> page lists the compatibility of Jave SE 6 to Java SE 5.0. Furthermore, there is a link to <a href="http://java.sun.com/j2se/1.5.0/compatibility.html" rel="nofollow noreferrer">Incompatibilitie... | <p>It should work. I don't remember encountering any problems with it, except when parts of the Java API are deprecated, in which case it'll explain what they are anyway and you can hopefully write a workaround.
Of course, running a class file compiled with JDK 1.6 in JRE 1.5 would cause a problem - even a JRE only min... | 13,975 |
<p>Given a list of urls, I would like to check that each url:</p>
<ul>
<li>Returns a 200 OK status code</li>
<li>Returns a response within X amount of time</li>
</ul>
<p>The end goal is a system that is capable of flagging urls as potentially broken so that an administrator can review them.</p>
<p>The script will be... | <p>Use the PHP cURL extension. Unlike fopen() it can also make HTTP HEAD requests which are sufficient to check the availability of a URL and save you a ton of bandwith as you don't have to download the entire body of the page to check.</p>
<p>As a starting point you could use some function like this:</p>
<pre><code>... | <p>One potential problem you will undoubtably run into is when the box this script is running on looses access to the Internet... you'll get 1000 false positives.</p>
<p>It would probably be better for your script to keep some type of history and only report a failure after 5 days of failure.</p>
<p>Also, the script... | 30,323 |
<p>I've been trying this a few different ways, but I'm reaching the conclusion that it can't be done. It's a language feature I've enjoyed from other languages in the past. Is it just something I should just write off?</p>
| <p>No, static indexers aren't supported in C#. Unlike other answers, however, I see how there could easily be point in having them. Consider:</p>
<pre><code>Encoding x = Encoding[28591]; // Equivalent to Encoding.GetEncoding(28591)
Encoding y = Encoding["Foo"]; // Equivalent to Encoding.GetEncoding("Foo")
</code></pre... | <p>No, but it is possible to create a static field that holds an instance of a class that uses an indexer...</p>
<pre><code>namespace MyExample {
public class Memory {
public static readonly MemoryRegister Register = new MemoryRegister();
public class MemoryRegister {
private int[] _values = ... | 18,672 |
<p>I need to write a Java Comparator class that compares Strings, however with one twist. If the two strings it is comparing are the same at the beginning and end of the string are the same, and the middle part that differs is an integer, then compare based on the numeric values of those integers. For example, I want... | <p><a href="https://web.archive.org/web/20210803201519/http://www.davekoelle.com/alphanum.html" rel="nofollow noreferrer">The Alphanum Algorithm</a></p>
<p>From the website</p>
<p>"People sort strings with numbers differently than software. Most sorting algorithms compare ASCII values, which produces an ordering t... | <p>In your given example, the numbers you want to compare have spaces around them while the other numbers do not, so why would a regular expression not work?</p>
<p>bbb <strong>12</strong> ccc</p>
<p>vs.</p>
<p>eee 12 ddd <strong>jpeg2000</strong> eee</p>
| 13,021 |
<p>I'm tearing my hair out with this one. If I start a block comment <code>/*</code> in VS.NET 2005+ then carriage return, Visual Studio insists that I have another asterisk <code>*</code>. I know there's an option to turn this off but I just can't find it. Anyone know how to turn this feature off?</p>
| <p><strong>Update: this setting was changed in VS 2015 update 2. See <a href="https://stackoverflow.com/a/36319097/4294399">this answer</a>.</strong></p>
<p><a href="http://forums.msdn.microsoft.com/en-US/csharpide/thread/a41e3652-efe2-4f81-ad3e-94994974fcb2/" rel="nofollow noreferrer">This post</a> addresses your ques... | <p>Try this:</p>
<pre><code>#if false
whatever you want here
and here
#endif
</code></pre>
| 7,415 |
<p>I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would help.</p>
<pre><code>int ret;
ret = ... | <p>The code you wrote works for me in a simple test program that does nothing else. Remember, when you call execl, the process retains all of the old file handles. So whatever stdout was when you call execl, it will be the same when the new binary is loaded. If you just want the output to go to the terminal, just make ... | <p>doing<br> </p>
<pre><code>int fd = 1;
dup(fd);
close(fd);
</code></pre>
<p>gets the output to the screen.</p>
| 17,676 |
<p>I'm wondering whether something like this is possible (and relatively easy to do), and if so, how I could do it?</p>
<p>I would like to do band filtering on a wave file I'm reproducing. Something similar to the "Equalizer" you see in most Winamp-like applications.<br>
My idea is, however, not to equalize the sound,... | <p>I don't know if DirectSound offers this functionality, I'd assume it doesn't since DSP is fairly complicated and often varies a great deal from situation to situation. What you want to do is typically called "filtering" in DSP (digital signal processing). Many times this involves using a FIR (finite impulse response... | <p>DirectSound might not support this directly, but DirectShow should. Could you use that API instead?</p>
| 32,289 |
<p>I have a bunch of ASP.NET web pages (that have a standard layout) that are product documentation. I want to create some sort of combination page that will pull all of the other page content in and concatenate them into one long page.</p>
<p>IFrames won't work because I don't know the size of each page. I could ha... | <p>Are your "Documentation Pages" static html or .aspx's also...</p>
<p>if its just static content, you could do the following</p>
<pre><code>//assume that the array of page names has come from the DB.
protected void Page_Load(object sender, EventArgs e)
{
string[] pages = new string [] { "~/Default.html",
... | <p>What does your pages look like?</p>
<p>I assume it's just plain HTMLs and have a consistent pattern across all pages, no? Like, it has proper HTML markup along with HEAD and BODY and such?</p>
<p>In which case you can just read it like you'd read normal text files and do some string parsing on them to extract the ... | 29,297 |
<p>What do you usually use to connect to a Web Service when you are developing a Java project?</p>
<p>There are different API-s that can do the job.
From different books and tutorials I have read about: JAX-WS, JAXB, JAXM, JAXR, JAX-RPC, Axis ans so on.</p>
<p>I'm interested in what exactly are you using and how much... | <p>To answer your question, we first need to differentiate between the tools you listed.</p>
<p>JAX-WS, JAXB, JAXM, JAXR, JAX-RPC are XML and Web service related APIs while Axis 1 and 2 are implementations of zero, one, or more of these APIs depending on the version.</p>
<p>JAX-B 1 and 2 are XML to object binding APIs,... | <p>For POX+HTTP or RESTful web services, <a href="http://www.restlet.org/" rel="nofollow noreferrer">Restlet</a> or a decent <a href="http://www.google.com/search?q=java+http+client" rel="nofollow noreferrer">HTTP client implementation</a> are completely sufficient. </p>
| 30,541 |
<p>What are the differences from a developer point of view between Safari for Mac and Safari for Windows?</p>
<p>I think it boils down to evaluate differences between (if I missed something, please correct):
<br />- Layout rendering
<br />- Javascript behavior</p>
<p>The final decision to be made being:
<br />Can de... | <p>As far as rendering and JavaScript are concerned, there is no difference. What is different is underlaying UI library used for browser itself, but page render is the same.</p>
| <p>I had an issue with the popup blocker in Safari in Windows XP. I guess the blocker didn't accept that the user clicked a link an Flash that then triggered a JavaScript that opened the Window. The did work in the other major browsers and Safari in OS X, though. Chrome also blocked my window in XP, but not in OS X or ... | 39,711 |
<p>I am thinking it is a best practice to declare them as static, as it makes them invisible outside of the module.</p>
<p>What are your thoughts on this?</p>
| <p>For C++, a better than static is to put it in an unnamed (anonymous) namespace. This is the preferred way to prevent pollution of the Global namespace.</p>
<pre><code>namespace {
void myLocalFunction() {
// stuff
}
}
</code></pre>
| <p>If by 'module' you just mean a CPP file, you could just place the declaration and the definition right in the CPP file.</p>
| 40,598 |
<p>Given my current .htaccess file, how would I modify it to check for an additional URL path like '/src/pub/<em>' and rewrite it to '/</em>' without affecting the current rewrite?</p>
<p>Here's the original .htaccess file:</p>
<pre><code>RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FIL... | <p>I'm guessing that the problem is that the URL is being rewritten by the first rule, and then rewritten again by the second.</p>
<p>The solution to that is to add the "last" flag to the first rule, like this:</p>
<pre><code>RewriteRule ^/src/pub/(.*)$ /$1 [R,L]
</code></pre>
| <p>within a .htaccess file, use this instead:</p>
<pre><code>RewriteRule ^src/pub/(.*)$ /$1 [R]
</code></pre>
<p>the leading "/" <strong>will not</strong> match within .htaccess, only within <code>httpd.conf</code> (<a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule" rel="nofollow noreferrer">... | 36,224 |
<p>I have a simple website I'm testing. It's running on localhost and I can access it in my web browser. The index page is simply the word "running". <code>urllib.urlopen</code> will successfully read the page but <code>urllib2.urlopen</code> will not. Here's a script which demonstrates the problem (this is the act... | <p>Sounds like you have proxy settings defined that urllib2 is picking up on. When it tries to proxy "127.0.0.01/", the proxy gives up and returns a 504 error.</p>
<p>From <a href="http://kember.net/articles/obscure-python-urllib2-proxy-gotcha" rel="nofollow noreferrer">Obscure python urllib2 proxy gotcha</a>:</p>
<p... | <p>Does calling urlib2.open first followed by urllib.open have the same results? Just wondering if the first call to open is causing the http server to get busy causing the timeout?</p>
| 24,606 |
<p>I know I'll get a thousand "Depends on what you're trying to do" answers, but seriously, there really is no solid information about this online yet. Here are my assumptions - I think they're similar for alot of people right now:</p>
<ol>
<li>It is now October 2008. I want to start writing an application for Janua... | <p><strong>Django!</strong></p>
<p>Look up the DjangoCon talks on Google/Youtube - Especially "Reusable Apps" (www.youtube.com/watch?v=A-S0tqpPga4)</p>
<p>I've been using Django for some time, after starting with Ruby/Rails. I found the Django Community easier to get into (nicer), the language documented with <em>exc... | <p>My experience with various new technologies over the last ten years leads me to recommend that you make stability of the platform a serious criterion. It's all well and good developing with the latest and greatest framework, but when you find it's moved forward a point version and suddenly the way you have done ever... | 22,256 |
<p>What would be the most efficient data type to store a UUID/GUID in databases that do not have a native UUID/GUID data type? 2 BIGINTs?</p>
<p>And what would be the most efficient code (C# preferred) to convert to and from a GUID to that type?</p>
<p>Thanks.</p>
| <p>It's hard to say what would be the most efficient without knowing the database you are using.</p>
<p>My first inclination would be to use a <code>binary(16)</code> column.</p>
<p>As for using that value in C#, the <code>System.Guid</code> type has a constructor that accepts a <code>byte[]</code> array, and a metho... | <p>Looking at the <a href="http://msdn.microsoft.com/en-us/library/system.guid.guid.aspx" rel="nofollow noreferrer">.NET guid class</a>, there are a couple ways to initialize a guid:</p>
<p>Guid(Int32, Int16, Int16, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte)
Guid(string)</p>
<p>While it may be more efficient, in... | 27,177 |
<p>What is "missing" in the Visual Studio 2008 Express Editions?</p>
<p>In particular,</p>
<ul>
<li>what functionality is not available?</li>
<li>what restrictions are there on its use?</li>
</ul>
| <p>The major areas where Visual Studio Express lacks features compared to Visual Studio Professional:</p>
<ul>
<li>No add-ins/macros</li>
<li>Some Win32 tools missing</li>
<li>No Team Explorer support</li>
<li>Limited refactoring support</li>
<li>Debugging is much more limited (particularly problematic for server deve... | <p>You can't create <a href="http://en.wikipedia.org/wiki/Windows_service" rel="nofollow noreferrer">Windows services</a> for one.</p>
| 11,211 |
<p>I have a method in my Python code that returns a tuple - a row from a SQL query. Let's say it has three fields: (jobId, label, username)</p>
<p>For ease of passing it around between functions, I've been passing the entire tuple as a variable called 'job'. Eventually, however, I want to get at the bits, so I've been... | <p>I'd say that a dictionary is definitely the best way to do it. It's easily extensible, allows you to give each value a sensible name, and Python has a lot of built-in language features for using and manipulating dictionaries. If you need to add more fields later, all you need to change is the code that converts th... | <p>How about this:</p>
<pre><code>class TypedTuple:
def __init__(self, fieldlist, items):
self.fieldlist = fieldlist
self.items = items
def __getattr__(self, field):
return self.items[self.fieldlist.index(field)]
</code></pre>
<p>You could then do:</p>
<pre><code>j = TypedTuple(["jobid",... | 6,308 |
<p>(sorry for my English)
For example, in my DAL,I have an AuthorDB object, that has a Name
and a BookDB object, that has a Title and an IdAuthor. </p>
<p>Now, if I want to show all the books with their corresponding author's name, I have to get a collection of all the Books, and for each of them, with the IdAuthor a... | <p>Don't write something buggy, inefficient, and specialized ... when reliable, efficient, and generic tools are available. For free.</p>
<p>Pick an ORM. NHibernate, ActiveRecord, SubSonic, NPersist, LinqToEF, LinqToSQL, LLBLGenPro, DB4O, CSLA, etc.</p>
| <p>You can create a View in the database that has the join built into it and bind an an object to that, e.g. AuthorBooksDB. It doesn't create too bad a maintenance headache since the view can hide any underlying changes and remains static.</p>
| 23,617 |
<p>I know there is no such thing as a dumb question but this is: Can you serve contextual based ads via adsense or others on a site that is entirely behind https?</p>
| <p><strong>Update:</strong></p>
<blockquote>
<p>We’ve updated the AdSense ad code so that it now supports secure ad serving through Secure Sockets Layer (SSL) on Hypertext Transfer Protocol Secure (HTTPS) web pages. This means that publishers with secure sites, i.e., sites that are served over the HTTPS protocol, ca... | <p>You can but visitors will receive a message that your site contains secure and none secure data in internet explorer. Most other browsers have a way to communicate this state aswell. </p>
| 38,121 |
<p>I want to dynamically create variables with dynamic names for later use in my transform, but to do this I'd need to dynamically generate XSL and then run it in the same script.</p>
<p>This is just a rough pseudo code example of what I'm looking for.</p>
<pre><code> <xsl:for-each select="//constants/constan... | <p><strong>XSLT has a special built-in feature that supports generating output, which is XSLT</strong> itself.</p>
<p>This is the <strong><code><xsl:namespace-alias></code></strong> XSLT directive.</p>
<p><strong>As explaiened by</strong> <a href="http://www.w3.org/TR/xslt#literal-result-element" rel="noreferre... | <p>What you want is not possible at present in pure XSLT (1.0 or 2.0).</p>
<p>If you are useing the <a href="http://www.saxonica.com/" rel="nofollow noreferrer"><strong>Saxon 9.x XSLT processor</strong></a>, there is a couple of extension functions that implement this: <a href="http://www.saxonica.com/documentation/ex... | 46,640 |
<p>I'm trying to fix some JavaScript bugs. Firebug makes debugging these issues a lot easier when working in Firefox, but what do you do when the code works fine on Firefox but IE is complaining?</p>
| <p>you can also check out the <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=95e06cbe-4940-4218-b75d-b8856fced535" rel="noreferrer">IE Developer Toolbar</a> which isn't a debugger but will help you analyze the contents of your code.</p>
<p><a href="http://weblogs.asp.net/scottgu/archive/2007/07/1... | <p>The IE8 beta comes with what I think is the IE Developer toolbar, but it seems to be a lot more powerful than the last time I tried the toolbar on IE7</p>
| 2,978 |
<p>I'm trying to do a simple rotation in OpenGL but must be missing the point.
I'm not looking for a specific fix so much as a quick explanation or link that explains OpenGL rotation more generally.</p>
<p>At the moment I have code like this:</p>
<pre><code>glPushMatrix();
glRotatef(90.0, 0.0, 1.0, 0.0);
glBegin(... | <p>Do you get a 1 unit straight line? It seems that 90deg rot. around Y is going to have you looking at the side of a triangle with no depth.</p>
<p>You should try rotating around the Z axis instead and see if you get something that makes more sense. </p>
<p>OpenGL has two matrices related to the display of geometry,... | <p>When I had a first look at OpenGL, the <a href="http://nehe.gamedev.net/" rel="nofollow noreferrer">NeHe tutorials</a> (see the left menu) were invaluable.</p>
| 4,371 |
<p>I'm doing a personal, just for fun, project that is using screen scraping to give me a System Tray notification in case another line on an HTML table is added, modified or deleted.</p>
<p>Having done this before I thought: well let's go with the regular expression thing and that's it, but being a curious person, ma... | <p>See <a href="https://stackoverflow.com/questions/2861/options-for-html-scraping">Options for HTML Scraping</a></p>
| <p>If you can convert the source into valid XHTML/XML using something like <a href="http://wiki.developer.mindtouch.com/Community/SgmlReader" rel="nofollow noreferrer">SgmlReader</a> or <a href="http://tidy.sourceforge.net/" rel="nofollow noreferrer">HtmlTidy</a> then you could use XSLT. Simply create a XSL template f... | 10,641 |
<p>I have a web application that is becoming rather large. I want to separate it into smaller more logical projects, but the smaller projects are still going to need to access some of the classes in the app_code of the main project. What are some good methods to accomplish this?</p>
| <p>Add a class library project with the common classes and add a reference to this project to each of the new projects.</p>
<p>So you'll have the following Solution layout</p>
<pre><code>/webapp1
/default.aspx
/....
/webapp2
/default.aspx
/....
/lib
/Utils.cs
</code></pre>
| <p>In CVS & Subversion, you can setup what I think are referred to as "aliases" (or maybe it's "modules"). Anyway, you can use them to checkout part(s) of your source control tree. For example, you could create an alias called "views" that checks out all your HTML, javascript, and css, but none of your php/java/.NE... | 14,755 |
<p>What is your way of passing data to Master Page (using ASP.NET MVC) without breaking MVC rules?</p>
<p>Personally, I prefer to code abstract controller (base controller) or base class which is passed to all views.</p>
| <p>If you prefer your views to have strongly typed view data classes this might work for you. Other solutions are probably more <em>correct</em> but this is a nice balance between design and practicality IMHO.</p>
<p>The master page takes a strongly typed view data class containing only information relevant to it:</p... | <p>The Request.Params object is mutable. It's pretty easy to add scalar values to it as part of the request processing cycle. From the view's perspective, that information could have been provided in the QueryString or FORM POST. hth</p>
| 10,399 |
<p>I want to allocate a 2 D Array in Java Script. </p>
<p>I want do some thing similar to this in JavaScript</p>
<pre><code>typedef struct
{
int itemA,
int itemB,
string testC
} myStruc;
myStruct MyArray [100];
</code></pre>
<p>How to do this ? </p>
| <pre><code>var arr = []
arr[0] = { "itemA": "A", "itemB": "B", "itemC": "C" }
arr[1] = { "itemA": "A", "itemB": "B", "itemC": "C" }
</code></pre>
<p>I think you are trying to apply static language constructs to the dynamic and different world of Javascript. Javascript doesn't really have the notion of arrays in the s... | <p>There are a few ways of creating arrays in Javascript, the method closest to what you want to do should be:</p>
<pre><code>var myArray = new Array("someString1", "someString2", "someString3", ...);
</code></pre>
<p>You can replace <code>"someString1"</code> with actual objects.</p>
<p>You can also use the Array ... | 21,177 |
<p>I have a .net 3.5 WinForms application that runs fine on my machine, but on another machine it immediately crashes with a system.io.fileloadexception. Unfortunately, there are absolutely no details on which file failed to load, so I do not know where the problem actually is.</p>
<p>I believe I know which one it cou... | <p>Turn on <a href="http://blogs.msdn.com/suzcook/archive/2003/05/29/57120.aspx" rel="noreferrer">fusion logging</a>?</p>
<p><a href="http://bradwilson.typepad.com/blog/2007/12/we-were-crashin.html" rel="noreferrer">This blog entry</a> from Brad Wilson gives information on what to do if that fails...</p>
| <p>Grab the Microsoft Debugging Tools SDK, and use either windbg or cordbg to attach and run your application. This should give you at least a clue where the problem is, if not pinpoint the problem.</p>
| 37,788 |
<p>One of my co-workers claims that even though the execution path is cached, there is no way parameterized SQL generated from an ORM is as quick as a stored procedure. Any help with this stubborn developer?</p>
| <p>I would start by reading this article:</p>
<p><a href="http://decipherinfosys.wordpress.com/2007/03/27/using-stored-procedures-vs-dynamic-sql-generated-by-orm/" rel="nofollow noreferrer">http://decipherinfosys.wordpress.com/2007/03/27/using-stored-procedures-vs-dynamic-sql-generated-by-orm/</a></p>
<p>Here is a sp... | <p>Measure it. </p>
<p>Really, any discussion on this topic is probably futile until you've measured it.</p>
| 7,312 |
<p>Imagine the following REBOL code:</p>
<pre>foo: context [bar: 3]</pre>
<p>I now have a context <code>foo</code> in which <code>'bar</code> is defined. How can I dynamically inject a new word into this context? Is it possible?</p>
<p>I've tried:</p>
<pre>set/any in foo 'baz 3</pre>
<p>But that doesn't work becau... | <p>You can achieve the same by using the existing object as a prototype to create a new object. </p>
<pre><code>>> foo: make object! [bar: 3]
>> foo: make foo [baz: 3]
>> probe foo
make object! [
bar: 3
baz: 3
]
</code></pre>
| <p>Said in REBOL/Core User Guide:
"Many blocks contain other blocks and strings. When such a block is copied, its
sub-series are not copied. The sub-series are referred to directly and are the same
series data as the original block."</p>
| 32,978 |
<p>I am building a public website using ASP.NET, as part of the deliverable I need to do an Admin Site for data entry of the stuff shown in the public site, I was wondering what techniques or procedures are people using to validate entries using ASP.NET MVC.</p>
| <p>Take a look at the <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="noreferrer">JQuery Validation plugin</a> this plugin is amazing,it's clean to implement and has all the features you could ever need, including remote validation via AJAX.</p>
<p>Also a sample MVC controller method can ... | <p>My favorite way it perform both client and server validation using model-based attributes. I wrote a short post about this and released the source code as well, that will basically allow you to create a class like this</p>
<pre><code>
class User {
[Required]
public string Name{get;set;}
[Email][Requ... | 3,743 |
<p>I have a login page where I authenticate the user. When the authentication pass, I then redirect the user to another page via Response.Redirect with the url defined in login control's destinationpageurl.</p>
<p>It work fine in firefox but when i test it with IE. It just redirect the user back to the login page.</p>... | <p>I read an interesting article recently in Visual Studio Magazine that discussed the different between Methods and Properties.</p>
<p>Properties are supposed to return a value and the same value each time unless something else is called in between. </p>
<p>A Method on the other hand is typically expected to do some... | <p>My view is that if you look at the words - "property" compared to "method". The word "property" implies "this is some value inherent in the object, like color, size, owner... calling a property would imply a relatively simple operation to return that value. Or, if it isn't a read-only property, setting the propert... | 31,772 |
<p>I’m using the gcc in MinGW that comes with Strawberry Perl, on Windows XP. I’d like to have <a href="http://www.gnu.org/software/ddd/" rel="nofollow noreferrer">ddd</a> (the Data Display Debugger) as well but apparently on Windows the simplest way to get ddd is by running Cygwin. So what's the bare minimum of Cygwin... | <p>As far as I can tell so far, only the following (with Cygwin DLL release version 1.5.25-15), and allowing setup to install any other packages to meet dependencies.<br>
Base: base-files, grep<br>
Develop: ddd, gdb<br>
Math: gnuplot<br></p>
| <p>If you're going for minimalism, you might want a smaller X server than <A HREF="http://x.cygwin.com/" rel="nofollow noreferrer">cygwin-x11</A> (though it's what I use, and I'm quite fond of it). <A HREF="http://www.starnet.com/products/xwin32/" rel="nofollow noreferrer">Starwin X-Win32</A> is actively maintained (th... | 24,146 |
<p>I'm a little confused by some PHP syntax I've come across. Here is an example:</p>
<pre><code>$k = $this->_tbl_key;
if( $this->$k)
{
$ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
}
else
{
$ret = $this->_db->insertObject( $this->_tbl, $this,... | <p>It'll look up whatever the value of "k" is, and treat it as a variable name. These two samples are the same:</p>
<pre><code>echo ($obj->myvar);
####
$k = "myvar";
echo ($obj->$k);
</code></pre>
| <p>I believe that is a case of <a href="http://us.php.net/language.variables.variable" rel="nofollow noreferrer">variable variables</a>.</p>
| 26,743 |
<p>I'm using jQuery to add an additional row to a table as the last row.</p>
<p>I have done it this way:</p>
<pre><code>$('#myTable').append('<tr><td>my data</td><td>more data</td></tr>');
</code></pre>
<p>Are there limitations to what you can add to a table like this (such as inputs... | <p>The approach you suggest is not guaranteed to give you the result you're looking for - what if you had a <code>tbody</code> for example:</p>
<pre><code><table id="myTable">
<tbody>
<tr>...</tr>
<tr>...</tr>
</tbody>
</table>
</code></pre>
<p>You would end... | <p><strong>TIP:</strong> Inserting rows in <code>html table</code> via <code>innerHTML or .html()</code> is not valid in some browsers (similar <code>IE9</code>), and using <code>.append("<tr></tr>")</code> is not good suggestion in any browser. <strong>best</strong> and <strong>fastest</strong> way is usin... | 20,628 |
<p>How do you get an instance of the actionscript class <code>Class</code> from an instance of that class?</p>
<p>In Python, this would be <code>x.__class__</code>; in Java, <code>x.getClass();</code>.</p>
<p>I'm aware that <a href="http://actionscript.org/forums/showthread.php3?t=120135#td_post_545693" rel="noreferr... | <p>You can get it through the 'constructor' property of the base Object class. i.e.:</p>
<pre><code>var myClass:Class = Object(myObj).constructor;
</code></pre>
| <p>Any reason you couldn't do this?</p>
<pre><code>var s:Sprite = new flash.display.Sprite();
var className:String = flash.utils.getQualifiedClassName( s );
var myClass:Class = flash.utils.getDefinitionByName( className ) as Class;
trace(className ); // flash.display::Sprite
trace(myClass); // [class Sprite]
var s2... | 24,951 |
<p>I want to disable "Alert window" that I get from login page of one HTTPS site with "untrusted certificate".</p>
<p>ServicePointManager is used for WebRequest/WebResponse:</p>
<blockquote>
<pre><code>> public static bool
> ValidateServerCertificate(object
> sender, X509Certificate certificate,
> X509Cha... | <p>The ServicePointManager is for managed code; WebBrowser is a wrapper around shdocvw, so will almost certainly have a very different programming model.</p>
<p><em>if</em> you can automate this (and I'm not sure that you can), I would expect to have to reference the COM version to get the full API (see: AxWebBrowser)... | <p>As noted by Marc Gravell, I don't believe that it is possible to use ServicePointManager or ServicePoint classes in the WebBrowser Control, nor do you need to though.</p>
<p>See my answer to your other post where you asked your original question.</p>
| 21,967 |
<p>What’s the difference between the <code>System.Array.CopyTo()</code> and <code>System.Array.Clone()</code>?</p>
| <p>The <strong><a href="http://msdn.microsoft.com/en-us/library/system.array.clone.aspx" rel="noreferrer">Clone()</a></strong> method returns a new array (a shallow copy) object containing all the elements in the original array. The <strong><a href="http://msdn.microsoft.com/en-us/library/system.array.copyto.aspx" rel... | <p><code>Clone()</code> is used to copy only structure of data/array it doesn't copy the actual data.</p>
<p><code>CopyTo()</code> copies the structure as well as actual data.</p>
| 24,182 |
<p>I'm trying to do this (which produces an unexpected T_VARIABLE error):</p>
<pre><code>public function createShipment($startZip, $endZip, $weight =
$this->getDefaultWeight()){}
</code></pre>
<p>I don't want to put a magic number in there for weight since the object I am using has a <code>"defaultWeight"</code> ... | <p>This isn't much better:</p>
<pre><code>public function createShipment($startZip, $endZip, $weight=null){
$weight = !$weight ? $this->getDefaultWeight() : $weight;
}
// or...
public function createShipment($startZip, $endZip, $weight=null){
if ( !$weight )
$weight = $this->getDefaultWeight();... | <p>Improving upon Kevin's answer if you are using PHP 7 you may do:</p>
<pre><code>public function createShipment($startZip, $endZip, $weight=null){
$weight = $weight ?: $this->getDefaultWeight();
}
</code></pre>
| 2,383 |
<p>I am trying to get a text to wrap around a <code>div</code> in my XHTML. My XHTML looks like so....</p>
<pre><code><div id="cont-content">
<p>content</p>
<p>more content</p>
<div id="content-sidebar">
BLALALALALLAAL
</div>
</div>
</code></pre>
<p>And my CS... | <p>Yep you got it. The #content-sidebar should be before all the texts which are supposed to wrap it. Like this:</p>
<pre><code><div id="cont-content">
<div id="content-sidebar">
BLALALALALLAAL
</div>
<p>content</p>
<p>more content</p>
</div>
</code></pre>
| <ol>
<li><p>Cut your image into relevant slices and crop away the part where you want your text to flow. The more slices you make, the prettier your wrap will be.</p></li>
<li><p>put these slices in your HTML. Give them a class called 'wrap', like so:</p>
<pre><code><img src="slice1.png" width="181" class="wrap">... | 49,824 |
<p>I have been using PRETTY_FUNCTION to output the current function name, however I have reimplemented some functions and would like to find out which functions are calling them.</p>
<p>In C++ how can I get the function name of the calling routine?</p>
| <p>Here are two options:</p>
<ol>
<li><p>You can get a full stacktrace (including the name, module, and offset of the calling function) with recent versions of glibc with the <a href="http://www.gnu.org/software/libc/manual/html_node/Backtraces.html" rel="noreferrer">GNU backtrace functions</a>. See <a href="https://... | <p><strong>Cflow</strong> can be used to get the call graph of the source code written in C/C++. You can parse this call graph to get what you want.</p>
| 45,996 |
<p>Greetings,</p>
<p>Here's the problem I'm having. I have a page which redirects directly to another page the first time it is visited. If the user clicks 'back', though, the page behaves differently and instead displays content (tracking session IDs to make sure this is the second time the page has been loaded). T... | <p>I think the Mozilla team takes a step into the right direction by breaking this particularly annoying pattern. Finding a way around it somehow defies the purpose, doesn't it?</p>
<p>Instead of redirecting on first encounter, you could simply make your page render differently when a user hits it the first time. Shou... | <p>Its possibly in aide to eliminate repeated actions. </p>
<p>A lot of ways people do things is </p>
<p>page 1 -> [Action] -> page 2 -> redirect to page 2 without the action parameters. </p>
<p>Now if you were permitted to click the back button in this situation and visit the page without the redirect, the action ... | 34,152 |
<p>I have started to play a little with Qt 4. And then I have come across a problem with the <strong>Qt Designer</strong>.<br>
In the <strong>Signal/Slots editor</strong> I can only setup the connections that are listed there, and not all the slots are listed.</p>
<p>If I try to add it manualy in the .ui file, the con... | <p>By default not all signals/slots are shown. You could try checking the "show signals and slots inheritied from ...." checkbox in the lower left hand corder of the "Configure Connection" dialog that comes up when you try to create a signal.</p>
<p>Beyond that, you can either do what Marcin said and use <a href="http... | <p>You might try to use uic's <a href="http://doc.trolltech.com/4.0/designer-using-a-component.html#a-dialog-with-auto-connect" rel="nofollow noreferrer">autoconnecting</a> feature.</p>
<p>However you won't be able to see all available slots but if you use the same name in both Designer and code - they should automati... | 45,941 |
<p>I need to purchase SQL Server 2008 Standard edition, because it's features fit what I need. On the features page, it says it can handle 32,767 user connections, but how does that connect with CALs?</p>
<p>What are CALs and how can they affect a project?</p>
| <p>A CAL is a client access license. </p>
<p>SQL Server 2008 has 3 licensing models (explained <a href="http://www.microsoft.com/Sqlserver/2005/en/us/licensing.aspx" rel="nofollow noreferrer">here</a>):</p>
<ul>
<li>Processor Licensing Model</li>
<li>Server Plus Device CALs Licensing Model </li>
<li>Server Plus User ... | <p>just to add that Microsoft does not make any enforcement on CAL License. This is purely on paper restriction. </p>
<p>However, In "Per Server" licensing, there is a licensing windows service which allows usage enforcement but this service can be stopped</p>
<p>I wonder why they don't enforce this....</p>
| 38,736 |
<p>How do I enable external access to MySQL Server? I can connect locally but I cannot connect from another box on the network.</p>
<p>I just tried</p>
<pre><code>grant all privileges on *.* to root@'%' identified by '*****' with grant option;
</code></pre>
<p>And restarted MySQL Server with no success.</p>
| <p>You probably have to edit the configuration file (usually my.cnf) to listen in the external interface instead of on localhost only.</p>
<p>Change the <code>bind-address</code> parameter to your machine's IP address.</p>
<p>If this is an old MySQL installation, you should comment out the skip-networking parameter.<... | <p>Command and syntax looks fine. Have you checked the server is listening on an interface other than 127.0.0.1? By default Im pretty sure it only listens on the localhost address (127.0.0.1)</p>
| 7,697 |
<p>I have the following HTML node structure:</p>
<pre><code><div id="foo">
<div id="bar"></div>
<div id="baz">
<div id="biz"></div>
</div>
<span></span>
</div>
</code></pre>
<p>How do I count the number of immediate children of <code>foo</code>, ... | <pre><code>$("#foo > div").length
</code></pre>
<p>Direct children of the element with the id 'foo' which are divs. Then retrieving the size of the wrapped set produced.</p>
| <p>Try this for immediate child elements of type div</p>
<pre><code>$("#foo > div")[0].children.length
</code></pre>
| 31,197 |
<p>If you have a particular line of C code in mind to examine in the machine output, how would you locate it in objdump output. Here is an example</p>
<pre><code>if (cond)
foo;
bar();
</code></pre>
<p>and I want to see if bar was inlined as I'd like.
Or would you use some alternative tool instead of objdump?</... | <p>You can start objdump using the <code>-S</code> option (like <code>"objdump -Sd a.out"</code>). It will display the sourcecode intermixxed with the assembler code, if the source-files the code was compiled from are available.</p>
<p>Alternatively, you can use the following way:</p>
<pre><code>int main(void) {
... | <p>Function calls are detected in the assembly by the common function prolog.</p>
<p>With i386 it is </p>
<pre><code> 55 push %ebp
89 e5 mov %esp, %ebp
...
c9 leave # optional
c3 ret
</code></pre>
<p>with amd64/x86_64 is is similar (just the quad prefix <code>48</code>):</p>
<pre><code> 5... | 35,841 |
<p>I have a java applet that is embedded in html using the <code>object-comment-embed</code> method. I would like to resize the applet whenever the browser window is resized. I have found solutions around the internet, but they all work based on the deprecated <code>applet</code> tag.</p>
<p>Also, when trying a <code>... | <p>Try replacing these lines:</p>
<pre><code>document.getElementById('MyApplet1').setSize(applet_width, applet_height);
document.getElementById('MyApplet2').setSize(applet_width, applet_height);
</code></pre>
<p>with:</p>
<pre><code>document.getElementById('MyApplet1').style.height = applet_height + "px";
document.g... | <p>Why don't you use percentage width and height. I usually use the following code for my applets:</p>
<pre><code><applet codebase="http://localhost:89" archive="npaxet?version=0.0.1.28" code="main.NPaxet.class" width=100% height=90%>\
<PARAM NAME="thumbnailUrl" VALUE="http://localhost:89/thumbnail?seriesid=%... | 49,100 |
<p>I am building a site that uses a simple AJAX Servlet to talk JMS (ActiveMQ) and when a message arrives from the topic to update the site.</p>
<p>I have Javascript that creates an XMLHttpRequest for data. The Servlet processes the Get Request and sends back JSON. However I have no idea how to connect my Servlet into... | <p>The problem with having a servlet implement MessageListener is that servlets are synchronous and MessageListeners are asynchronous. Instead you should create some other object to act as the MessageListener and update some state somewhere (possibly a database or a JMX MBean or a Stateful Session EJB) when messages c... | <p>You probably need to get a JMS connection from JNDI, like this:</p>
<pre><code>Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL,
"tcp://hostname:61616");
javax.naming.Cont... | 9,049 |
<p>I wish to use xml and xsl to generate controls on an asp.net page.</p>
<p>I currently have a asp.net content page that contains a xml control. When the page is loaded, an xml file is loaded and the required element is extracted and set as the xml control's DocumentContent and the xml control's TransformSource is se... | <p>The generated output of transform is not parsed to be added to the page as set of controls. Rather the generated output is sent to the response. Therefore you cannot apply a transform to an XML control that will generate new controls.</p>
<p>There may be a way to create the transform result and invoke some parsin... | <p>I don't know of any <em>easy</em> way to do it, but there are a few systems out there which generate the aspnet markup on the fly then send it to the aspnet runtime from a memory stream (or similar).</p>
<p>I think umbraco uses a system something like that, but the initial builder mechanism is probably a little mor... | 23,729 |
<p>I have a Dynamic Data website built in Visual Studio 2008 using .NET 3.5 SP1. The site works OK on my Vista machine, but I get the following error when running it on a Windows XP machine:</p>
<blockquote>
<p>Server Error in '/FlixManagerWeb'
Application.
------------------------------------------------------... | <p>In order to have HSQLDB register itself, you need to access its jdbcDriver class. You can do this the same way as in this <a href="http://hsqldb.org/doc/guide/running-chapt.html#rgc_connecting_db" rel="noreferrer">example</a>.</p>
<pre><code>Class.forName("org.hsqldb.jdbcDriver");
</code></pre>
<p>It triggers stat... | <p>It might be that </p>
<blockquote>
<p>hsql://localhost</p>
</blockquote>
<p>can't be resolved to a file. Look at the sample program here:</p>
<p><a href="http://hsqldb.org/doc/guide/apb.html" rel="nofollow noreferrer">Sample HSQLDB program</a></p>
<p>See if you can get that working first, and then see if you ... | 19,418 |
<p>In wxWidgets, how can you find the pixels per inch on a wxDC? I'd like to be able to scale things by a real world number like inches. That often makes it easier to use the same code for printing to the screen and the printer.</p>
| <p>Just Copy and paste following code into your project to get fully implemented functionality.</p>
<p>where <strong>takePhoto</strong> and <strong>chooseFromLibrary</strong> are my own method names which will be called on button touch.</p>
<p>Make sure to reference outlets of appropriate buttons to these methods. ... | <p>Here is my code that i used to take picture for my app</p>
<pre><code>- (IBAction)takephoto:(id)sender {
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
[picker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentViewController:picker animated:YES completio... | 15,024 |
<p>I have a form with a DIV, 3 INPUTS, each INPUT sits within a LABEL element. I would like to change the background image of the DIV element when focusing on each INPUT.</p>
<p>I can't move back up the DOM to fix this with CSS, so could someone suggest a few lines of jQuery please?</p>
<p>Thanks</p>
| <pre><code>$('div input').focus(function(){
$(this).parents('div:eq(0)').addClass('specialCSSclass');
}).blur(function(){
$(this).parents('div:eq(0)').removeClass('specialCSSclass');
});
</code></pre>
<p>You would need to create a class in your CSS and then replace "specialCSSclass" with it. </p>
| <p>jQuery closest is also an option.</p>
<pre><code>closest( selector )
.closest( selector )
.closest( selector, [ context ] )
closest( selectors, [ context ] )
.closest( selectors, [ context ] )
</code></pre>
<p>Per the description.. Get the first ancestor element that matches the selector, beginning at ... | 38,728 |
<p>I've been looking at ways people test their apps in order decide where to do caching or apply some extra engineering effort, and so far httperf and a simple sesslog have been quite helpful.</p>
<p>What tools and tricks did you apply on your projects?</p>
| <p>I use httperf for a high level view of performance.</p>
<p>Rails has a performance script built in, that uses the ruby-prof gem to analyse calls deep within the Rails stack. There is an awesome <a href="http://railscasts.com/" rel="nofollow noreferrer">Railscast</a> on <a href="http://railscasts.com/episodes/98-req... | <p>A colleague of mine has also posted some <a href="http://www.dcmanges.com/blog/rails-performance-tuning-workflow" rel="nofollow noreferrer">interesting thoughts</a> on this.</p>
| 11,431 |
<p>It seems that a Bowden extruder is the most used in all cheap 3D printers by far compared to Direct Drive that is very rare under 500 USD machines. But I haven't understood the reason, since in terms of hardware a direct drive doesn't seem to have any impact on price more than Bowden (correct me if I'm wrong).</p>
<... | <p>As I understand it, there's really no good reason for this except "momentum". At some point in the not too distant past, a Bowden extruder was seen as an "upgrade" over direct drive, which required a bulky toolhead that was seen as limiting speeds.</p>
<p>(This perception was at best accurate onl... | <p>Using a bowden extruder allows the manufacturer to place heavy components lower down on the printer frame. This lowers the center of gravity and reduces the amount of movement that the hot end creates when it tracks across the bed.</p>
<p>This allows the hot end to move\print faster without having to reinforce the p... | 2,080 |
<p>Where can I get some decent looking free ASP.Net or CSS themes?</p>
| <p>I wouldn't bother looking for ASP.NET stuff specifically (probably won't find any anyways). Finding a good CSS theme easily can be used in ASP.NET. </p>
<p>Here's some sites that I love for CSS goodness:</p>
<p><a href="http://www.freecsstemplates.org/" rel="noreferrer">http://www.freecsstemplates.org/</a><br>
<... | <p>As always, <a href="http://www.csszengarden.com/" rel="nofollow noreferrer">http://www.csszengarden.com/</a>. Note that the images aren't public domain.</p>
| 4,329 |
<p>There are pages scattered around the web that describe POSIX AIO facilities in varying amounts of detail. None of them are terribly recent. It's not clear what, exactly, they're describing. For example, the "official" (?) <a href="http://lse.sourceforge.net/io/aio.html" rel="noreferrer">web site for Linux kernel ... | <p>Network I/O is not a priority for AIO because everyone writing POSIX network servers uses an event based, non-blocking approach. The old-style Java "billions of blocking threads" approach sucks horribly.</p>
<p>Disk write I/O is already buffered and disk read I/O can be prefetched into buffer using functions like ... | <p>There is aio_write - implemented in glibc; first call of the aio_read or aio_write function spawns a number of user mode threads, aio_write or aio_read post requests to that thread, the thread does pread/pwrite and when it is finished the answer is posted back to the blocked calling thread.</p>
<p>Ther is also 'rea... | 11,351 |
<p>Is releasing objects on a programs exit/close needed?</p>
<p>In other words, let us say for the sake of argument, you have a button that closes your application, but right before you close you display an image, and then you close the application.</p>
<p>Do you need to release that image view before you close the a... | <p>It's not necessary. But if you're using <code>valgrind</code> or a similar tool, you'll soon discover that leaving all of your memory dangling swamps you with false warnings.</p>
<p>On the Linux side of things, the heap is grown using the <code>sbrk</code> system call. This grows the overall processor memory spac... | <p>Releasing can help you find bugs. More often than not dynamic memory problems trigger at release time (e.g., you attempt to release an invalid object). Always releasing can help you identify bugs that would otherwise be hard to find.</p>
| 45,194 |
<p>How can I find out which column and value is violating the constraint? The exception message isn't helpful at all:</p>
<blockquote>
<p>Failed to enable constraints. One or
more rows contain values violating
non-null, unique, or foreign-key
constraints.</p>
</blockquote>
| <p>There is a property called RowError you can check.</p>
<p>See <a href="http://dotnetdebug.net/2006/07/16/constraintexception-a-helpful-tip/" rel="noreferrer">http://dotnetdebug.net/2006/07/16/constraintexception-a-helpful-tip/</a></p>
<p>Edited to add this link showing iteration of rows to see which had errors.</p... | <p>I added some code that I've found to be useful in debugging ConstraintException occurrences <a href="https://stackoverflow.com/questions/37936/handling-xsd-dataset-constraintexceptions#37951">here</a></p>
<p>Hope this helps.</p>
| 16,961 |
<p>I woud like to create a cross-platform drawing program. The one requirement for writing my app is that I have pixel level precision over the canvas. For instance, I want to write my own line drawing algorithm rather than rely on someone elses. I do not want any form of anti-aliasing (again, pixel level control is re... | <p>I just this week put together some slides and demo code for doing 2d graphics using OpenGL from python using the library pyglet. Here's a representative post: <a href="https://www.tartley.com/posts/pyglet-week-2-better-vertex-throughput/" rel="nofollow noreferrer">Pyglet week 2, better vertex throughput</a> (or <a h... | <p>QT's Canvas an QPainter are very good for this job if you'd like to use C++. and it is cross platform.</p>
<p>There is a python binding for QT but I've never used it.</p>
<p>As for Java, using SWT, pixel level manipulation of a canvas is somewhat difficult and slow so I would not recommend it. On the other hand Sw... | 9,256 |
<p>I have a class property exposing an internal IList<> through</p>
<pre><code>System.Collections.ObjectModel.ReadOnlyCollection<>
</code></pre>
<p>How can I pass a part of this <code>ReadOnlyCollection<></code> without copying elements into a new array (I need a live view, and the target device is sho... | <p>Try a method that returns an enumeration using yield:</p>
<pre><code>IEnumerable<T> FilterCollection<T>( ReadOnlyCollection<T> input ) {
foreach ( T item in input )
if ( /* criterion is met */ )
yield return item;
}
</code></pre>
| <p>How do the filtered elements need to be accessed? If it's through an Iterator then maybe you could write a custom iterator that skips the elements you don't want publicly visible?</p>
<p>If you need to provide a Collection then you might need to write your own Collection class, which just proxies to the underlying... | 6,049 |
<p><b>Duplicate: <a href="https://stackoverflow.com/questions/30251/tables-instead-of-divs#30271"><a href="https://stackoverflow.com/questions/30251/tables-instead-of-divs#30271">Tables instead of DIVs</a></a> and
<a href="https://stackoverflow.com/questions/83073/div-vs-table#83121"><a href="https://stackoverflow.com... | <p>Yes, it matters. The most convincing argument that I've used in favor of CSS over tables is that screen readers (for the visually impaired) trip over tabular layout. That's a good argument by itself, but it gets a whole lot better when you take into account the fact that <em>Google reads your web site just like a ... | <p>Yes if your application UI needs to be of high standards. No, if you are just learning to master some adhoc concept or coming up with a quick prototype. Benefits of CSS vs. Tables are well discussed. With CSS, a web site become more agile and accessible, have a look at CSSZen garden.</p>
<p>On a side note, HTML DOC... | 48,632 |
<p>Using .Net how do I use the Sort method to sort an Array in reverse i.e. Z to A?</p>
| <p>Provide an appropriate element comparer. What C# version do you use? 3 lets you do this:</p>
<pre><code>Array.Sort(myarray, (a, b) => b.CompareTo(a));
</code></pre>
| <p>if you use a different comparitor that is the reverse of the standard that would do it.</p>
<p>Alternatively sort it normally and then reverse it...</p>
| 31,403 |
<p>My question: Is the MIPS programming language that beneficial to know?</p>
<p>I'm a CS student and am taking an assembly class which focuses on MIPS. I'm very comfortable writing in high level languages, but MIPS has me a little bit down.</p>
<p>Is MIPS something that I should really focus on and try to completely g... | <p>At one point (in the 90s) MIPS-derived processors were the best selling processors in the world, dwarfing sales of Intel x86 processors. This was because of their huge presence in the embedded market. I think now ARM-based processors may have taken over that title, but there are still tons of embedded systems out th... | <p>I think it depends what area in CS you want to shoot towards after graduation. If computer architecture is what you want to do, then in my opinion I say it is. I think a good software engineer walks away with the general concept of how an assembly language works + bypassing and forwarding and finally how your code c... | 12,438 |
<p>I need to render JSON data in my JSPs for some AJAX requests. I'd like to know what's the best way to do it in terms of easy to use and stability.</p>
| <p>Assuming you want to generate the JSON from one or more Java objects, the following is a fairly straightforward approach:</p>
<ul>
<li>Set the Java object(s) as attributes in request/session scope</li>
<li>Convert the objects to JSON using a tag library such as <a href="http://json-taglib.sourceforge.net/index.html... | <p>Assuming you want to generate the JSON from one or more Java objects, the following is a fairly straightforward approach:</p>
<ul>
<li>Set the Java object(s) as attributes in request/session scope</li>
<li>Convert the objects to JSON using a tag library such as <a href="http://json-taglib.sourceforge.net/index.html... | 35,222 |
<p>what's the best practice for creating test persistence layers when doing an ASP.NET site (eg. ASP.NET MVC site)?</p>
<p>Many examples I've seen use Moq (or another mocking framework) in the unit test project, but I want to, like .. moq out my persistence layer so that my website shows data and stuff, but it's not c... | <p>Assuming you're using the Repository pattern from Rob Conery's MVC Store Front:</p>
<p><a href="http://blog.wekeroad.com/mvc-storefront/mvc-storefront-part-1/" rel="nofollow noreferrer">http://blog.wekeroad.com/mvc-storefront/mvc-storefront-part-1/</a></p>
<p>I followed Rob Conery's tutorial but ran into the same ... | <p>Boring or not, I think you're on the right track. I assume you're creating a fakeRepository that is a concrete implementation of your IRepository which in turn is injected into your service layer. This is nice because at some point in the future when you're happy with the shape of your entities and the behavior of... | 36,484 |
<p>I am trying to use the actual numerical value for the month on a sql query to pull results. Is there any way to do this without having a function to change the numbers to actual month names, then back to month numbers? The following code works for Names, what works for numbers?</p>
<blockquote>
<p>datename(mont... | <p>month,(convert(datetime,DTSTAMP)) should do it, but why on earth are you not storing the data correctly as a datetime to begin with? All that additional conversion stuff to use the dates adds unnecessary load to your server and slows down your application.</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/aa258265(SQL.80).aspx" rel="nofollow noreferrer">Datepart</a> is an alternative to the month command and it is more flexable as you can extract other parts of the date. </p>
<pre><code>DATEPART(mm, convert(datetime,DTSTAMP))
</code></pre>
| 49,074 |
<p>I was able to connect my terminal program (Putty) to my 3D Printer (Creality Ender 3 Pro) and was able to send G-code commands to my printer and it obeys.</p>
<p>Now suppose I sent long command like</p>
<pre><code>G29 ; auto bed leveling
</code></pre>
<p>and it is still executing. Printer writes me</p>
<pre><code>ec... | <p>Photo interpretation: I understand that the image on the right presents the actual error: it happens on many layers, following the red "Starting Point" line (so above it on the photo). Interesting issue. Btw. which side of the print is the bottom (zero layer)? - I believe the left side, and the right side ... | <p>Photo interpretation: I understand that the image on the right presents the actual error: it happens on many layers, following the red "Starting Point" line (so above it on the photo). Interesting issue. Btw. which side of the print is the bottom (zero layer)? - I believe the left side, and the right side ... | 1,820 |
<p>I dont want the part cooling fan on during preheat, especially when I'm only heating the bed, it is just unnecessarily loud and serves no purpose at that time.</p>
<p>However when I set <code>PREHEAT_1_FAN_SPEED</code> to 0 it has no effect, the fan still spins at full speed as soon as I preheat either the hotend o... | <p>Apparently, I forgot a critical step:</p>
<p>While I have completely reconfigured the LCD menus, setup custom 25-point mesh leveling, changed a bunch of other numerical values, and flashed the firmware dozens of times, certain values will never be updated unless you remember to <strong>initialize the EEPROM</strong... | <p><em>This answer is now obsolete now that the OP has updated the question with additional information. It is left here as a possible solution for those who have tinkered with there firmware.</em></p>
<hr>
<p>Part cooling fan speed during preheat (from menu) is controlled by the setting </p>
<pre><code>#define PREH... | 1,161 |
<p>I'm looking for a way to display multiple colors in a single C#/.NET label. E.g the label is displaying a series of csv separated values that each take on a color depending on a bucket they fall into. I would prefer not to use multiple labels, as the values are variable length and I don't want to play with dynamic... | <p>There is no native control in .NET that does this. Your best bet is to write your own UserControl (call it RainbowLabel or something). Normally you would have a custom label control inherit directly from Label, but since you can't get multi-colored text in one label, you would just inherit from UserControl.</p>
<... | <p>There is no native support for this; you will either have to use multiple labels or find a 3rd-party control that will provide this functionality.</p>
| 34,768 |
<p>I've got a generic dictionary <code>Dictionary<string, T></code> that I would like to essentially make a Clone() of ..any suggestions. </p>
| <p>Okay, the .NET 2.0 answers:</p>
<p>If you don't need to clone the values, you can use the constructor overload to Dictionary which takes an existing IDictionary. (You can specify the comparer as the existing dictionary's comparer, too.)</p>
<p>If you <em>do</em> need to clone the values, you can use something like... | <p>Try this if key/values are ICloneable:</p>
<pre><code> public static Dictionary<K,V> CloneDictionary<K,V>(Dictionary<K,V> dict) where K : ICloneable where V : ICloneable
{
Dictionary<K, V> newDict = null;
if (dict != null)
{
// If the key and value... | 16,883 |
<p>I have a database in ISO-8859-2 format, but I need to create XML in UTF-8. This means that I must encode the database before prinitng in UTF-8. I know very little about ASP.Net, so I'm hoping someone can help.</p>
<p>In PHP I would do something like this:</p>
<pre><code>db_connect();
mysql_query("SET NAMES 'UTF8'... | <p>Assuming you have a value string in <code>str</code>, this is the pure-.NET way of doing this.</p>
<pre><code>var encoding = System.Text.Encoding.GetEncoding("iso-8859-2");
var bytes = System.Text.Encoding.Convert(encoding, System.Text.Encoding.Default, encoding.GetBytes(str));
var newString = System.Text.Encodin... | <p>The .NET Framework's internal string type is UTF-16. All database access will convert to UTF-16 so that you can view the data appropriately: the database, or the OLE DB provider, will convert to UTF-16.</p>
<p>The XML writer classes (you <em>are</em> using XmlDocument or XmlWriter, right?) will then convert to UTF-... | 9,710 |
<p>We are supposed to instantiate our entities through a factory since they are set up differently on the client and server. I want to make sure this is the case but cant quite get it to work.</p>
<pre><code>public interface IEntityFactory
{
TEntity Create<TEntity>() where TEntity : new();
}
public abstract... | <p>Is possible to address this structurally instead of at runtime? Can you segregate your entities and the factory in a different assembly, then give the entity constructors <code>internal</code> scoping so that only the factory is able to invoke them?</p>
| <p>The problem is that the factory method type is resolved at runtime, so the method is considered an "open" one. In that case, the generic argument type will return TEntity, as you are seeing.</p>
<p>Unfortunately, (unless I am missing something), the only way to get what type of TEntity is if a closed method is fir... | 37,294 |
<p><a href="http://www.ruby-lang.org" rel="noreferrer">Ruby</a> is truly memory-hungry - but also worth every single bit. </p>
<p>What do you do to keep the memory usage low? Do you avoid big strings and use smaller arrays/hashes instead or is it no problem to concern about for you and let the garbage collector do the... | <ol>
<li>Choose date structures that are efficient representations, scale well, and do what you need.</li>
<li>Use algorithms that work using efficient data structures rather than bloated, but easier ones.</li>
<li>Look else where. Ruby has a C bridge and its much easier to be memory conscious in C than in Ruby.</li>
<... | <p>I try to keep arrays & lists & datasets as small as possible. The individual object do not matter much, as creation and garbage collection is pretty fast in most modern languages.</p>
<p>In the cases you have to read some sort of huge dataset from the database, make sure to read in a forward/only manner and... | 17,432 |
<p>Given an <a href="http://en.wikipedia.org/wiki/Multiple_Listing_Service" rel="noreferrer">MLS</a>#, I'd like to get an XML document with details about the listing, like address, price and such. Not a NAR or CREA member. Mostly interested in North American rental property listing data.</p>
| <p>If you're an NAR member, you can utilize their Internet Data Exchange (IDX) system, but it isn't available to non-members.</p>
| <p><strong>Multiple Listing Service (MLS)</strong> - a system in the USA and Canada for real estate</p>
<p>For mls.ca (Canadian system), here's an interesting perspective (<em>posted 2008-08-21</em>) on it's <em>availability</em> to the public:</p>
<p><a href="http://www.guydavis.ca/log/view.jsp?id=1066" rel="nofollo... | 15,807 |
<p>I've recently purchased an Elegoo Mars Pro 3d printer, and I was wondering when printing large pieces that need to be printed in different steps: is there some kind of post-processing to make it more suitable for gluing them?</p>
<p>I know of joints and so on, but sometimes pieces are big but not thick enough to be ... | <p>You can definitely use glue - however you can also brush some of the liquid resin along the edges of the two pieces, push them together and cure them, this will fuse them together.</p>
<p>You don't need much, and you need to watch for drip out while curing (don't your fingers in it)</p>
| <p>You can definitely use glue - however you can also brush some of the liquid resin along the edges of the two pieces, push them together and cure them, this will fuse them together.</p>
<p>You don't need much, and you need to watch for drip out while curing (don't your fingers in it)</p>
| 1,729 |
<p>Given a 3D boolean array representing voxels, how can it be converted to a 3D-printer-ready file?</p>
<p>The end-goal I would like to achieve is to print the 3D shape that the numpy array represents (<code>True</code> coding for <em>fill this voxel</em>, <code>False</code> for <em>leave it empty</em>).</p>
<p>For ... | <p>I agree with the use of OpenSCAD, but since it is difficult to program in OpenSCAD, I would use <a href="https://github.com/SolidCode/SolidPython" rel="nofollow noreferrer">SolidPython</a>, which is a front end for OpenSCAD with the full programming capability of Python.</p>
<p>In the alternative, you could use any... | <p>Try voxelfuse.</p>
<pre><code> from voxelfuse.voxel_model import VoxelModel
from voxelfuse.mesh import Mesh
from voxelfuse.primitives import generateMaterials
if __name__=='__main__':
sponge = [
[
[1, 1, 1],
[1, 0, 1],
[1, 1, 1]
],
[... | 1,343 |
<p>We have a high security application and we want to allow users to enter URLs that other users will see.</p>
<p>This introduces a high risk of XSS hacks - a user could potentially enter javascript that another user ends up executing. Since we hold sensitive data it's essential that this never happens.</p>
<p>What a... | <p>If you think URLs can't contain code, think again!</p>
<p><a href="https://owasp.org/www-community/xss-filter-evasion-cheatsheet" rel="noreferrer">https://owasp.org/www-community/xss-filter-evasion-cheatsheet</a></p>
<p>Read that, and weep.</p>
<p>Here's how we do it on Stack Overflow:</p>
<pre><code>/// <summary... | <p>Allowing a URL and allowing JavaScript are 2 different things.</p>
| 25,229 |
<p>Glass is always level, easy to clean, easy to work with.</p>
<p>Aluminium allows for the addition of automatic bed leveling with an inductive sensor and distributes heat a little more evenly.</p>
<p>When printing mostly ABS and PLA, which one is better?</p>
| <p>I believe printing directly on aluminium is unwise, simply because it will expand when heated, typically giving the bed a concave or convex shape. Glass, on the other hand, does not (at least not significantly).</p>
<p>As pointed out in the comments below, the heat expansion of aluminium could potentially be mitiga... | <p>you could always slightly slot the holes on your aluminum bed so its not corner constrained and forced to bow in the middle..</p>
<p>My advice is use both and hairspray
currently testing the effectiveness of insulation on the bottom of the plate</p>
| 186 |
<p>This is not strictly programming related, but I hope still relevant.</p>
<p>I'm working on a project which is written in Java and intended for use on PCs and Macs. It will be distributed on CD (and perhaps DVD, eventually). Our intended audience is decidedly non-technical and, as such, it's important the CD "just... | <p>There are a lot of tools that can burn CDs or create CD images thats readable natively on both Mac and PC.</p>
<p>Try <a href="http://www.macdisk.com/macimgen.php3" rel="nofollow noreferrer">MacImage</a> for example</p>
| <p>You can use mkisofs or mkhybrid to crate a "hybrid" CD image.</p>
| 28,406 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.