instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I've been printing with my Ender 3 for a while now and it's been great. I've had very few problems - depending on my settings, these are my typical first layers:<a href="https://i.stack.imgur.com/GGhr1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GGhr1.jpg" alt="enter image description here"></... | <p>After watching it countless times, I found out that it was the magnetic mat on the bed that has worn out. It no longer adheres to the bed completely flat and some of the texture was worn down more than in other areas. It wasn't visually detectable - I found it by checking the nozzle height with various feeler gauges... | <p>When my printer suddenly started to underextrude, it was the fault of the extruder lever being broken and not pushing out enough material. Replacing the extruder for a metal version did fix it.</p>
<p>Another common issues that can result in bad adhesion is a greasy or destroyed build surface. Such is fixed with cl... | 1,514 |
<p>Say if I have a dropdown in a form and I have another nested class inside of this class .
Now what's the best way to access this dropdown from the nested class? </p>
| <p>Unlike Java, a nested class isn't a special "inner class" so you'd need to pass a reference. Raymond Chen has an example describing the differences here : <a href="https://devblogs.microsoft.com/oldnewthing/?p=30273" rel="noreferrer">C# nested classes are like C++ nested classes, not Java inner classes</a>.</p>
<p... | <p>there is a good answer above but I like to write sth.</p>
<p>c# nested class is by default private</p>
<p>private to containing class <strong>if your want to use it must be public</strong></p>
| 22,389 |
<p>In the past I've always gone and called my namespace for a particular project the same as the project (and principle class) e.g.:</p>
<pre><code>namespace KeepAlive
{
public partial class KeepAlive : ServiceBase
{...
</code></pre>
<p>Then from other projects whenever i've called that class its always been:... | <p>We have this simple scheme:</p>
<pre><code> CompanyName.ProductName
</code></pre>
<p>Then the application layer, e.g.</p>
<pre><code> CompanyName.ProductName.Data
CompanyName.ProductName.Web
</code></pre>
<p>etc.</p>
<p>And inside divided per module and/or functionality, which normally correspond to folders... | <p>I like the java package way: com.stackoverflow.Data (or whatwever the primary domain name of your company may be).<br>
That way your namespaces won't be ambiguous.</p>
| 36,916 |
<p>There is a store procedure that uses FREETEXTTABLE twice on two tables and then merges the results and returns the top 50. </p>
<p>The problem is if I do a search on "Women of Brewster", the results returns "Confession of an ex doofus motha" with a rank of 143 from table A and second "Women of Brewster Place" with ... | <p>The short answer:</p>
<blockquote>
<p>Freetext ranking is based on the OKAPI
BM25 ranking formula. Each term in the
query is ranked, and the values are
summed. Freetext queries will add
words to the query via inflectional
generation (stemmed forms of the
original query terms); these words are
treate... | <pre><code>USE AdventureWorks2012;
GO
SELECT FT_TBL.Description
,KEY_TBL.RANK
FROM Production.ProductDescription AS FT_TBL
INNER JOIN FREETEXTTABLE(Production.ProductDescription,
Description,
'high level of performance') AS KEY_TBL
ON FT_TBL.ProductDescriptionID = KEY_TBL.[KEY]
OR... | 25,787 |
<p>I want to let the user draw on an image in a browser. In other words, I need <em>both</em> bitmapped graphics and drawing capabilities, whether vector or bitmapped.</p>
<p>Canvas looks good, but is not supported by IE, and though there is ExCanvas, I wonder if ExCanvas is stable enough for consistent use in IE6 thr... | <p>Even though you said you'd like to avoid it I'd suggest Flash. You could easily use Flash 6 or 7 and these have a > 90% adoption rate. I'd be surprised if you could get that level of support with JavaScript. Flash is truly write once run anywhere, which will cut down on your development time.</p>
| <p>I'd add a little bit to Kieron's answer; Water Zorn's site has a very well featured vector graphics package. I've used it in a large application and it integrated beautifully with .NET and hand written javascript. I also used his drag and drop API to smooth dragging of html elements.</p>
| 39,181 |
<p>Here are some gems:</p>
<p>Literals:</p>
<pre><code>var obj = {}; // Object literal, equivalent to var obj = new Object();
var arr = []; // Array literal, equivalent to var arr = new Array();
var regex = /something/; // Regular expression literal, equivalent to var regex = new RegExp('something');
</code></pre>
<... | <p>Getting the current datetime as milliseconds:</p>
<pre><code>Date.now()
</code></pre>
<p>For example, to time the execution of a section of code:</p>
<pre><code>var start = Date.now();
// some code
alert((Date.now() - start) + " ms elapsed");
</code></pre>
| <p>int to string cast</p>
<pre><code>var i = 12;
var s = i+"";
</code></pre>
| 21,815 |
<p>I've created an instance of a SamlAssertion, and added the the authorization statement and attribute statments to it, and now I want to print out the XML so I can do an HTTP post, but not all of the assertion is being outputed. What am I missing (I'm sure it's something bone-headed)?</p>
<p>Here is the code I'm us... | <p>If I had one advice to give you in this case it would be: always use <code>using</code> statements when working with <a href="http://msdn.microsoft.com/en-us/library/system.idisposable.aspx" rel="nofollow noreferrer">IDisposable</a> objects such as streams. In addition to automatically flushing streams it would also... | <p>I am not sure if this is directly related to your case but this might be useful information related to re-serializing a SAML token</p>
<p><a href="http://blogs.msdn.com/govindr/archive/2006/10/24/re-serialize-saml-token.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/govindr/archive/2006/10/24/re-serialize-sa... | 38,953 |
<p>To use Google Analytics, you put some JavaScript code in your web page which will make an asynchronous request to Google when the page loads.</p>
<p>From what I have read, this shouldn't block or slow down page load times if you include it directly before the end of your HTML Body. To verify this, I want to make t... | <p><code>window.setTimeout(pageTracker._trackPageview(), 5000);</code> will call the code immediately - what you want is</p>
<p><code>window.setTimeout(function() { pageTracker._trackPageview(); }, 5000);</code></p>
| <p>That should do it. Put some quotes around the call:</p>
<pre><code>window.setTimeout("pageTracker._trackPageview()", 5000);
</code></pre>
<p>You can check this using Firebug if you want to see the request go through.</p>
| 27,458 |
<p>I have a <a href="https://www.alunar.net/m508-self-assembly-3d-printer.html" rel="nofollow noreferrer">Alunar M508 machine</a> that I am trying to get new firmware on. The firmware that was loaded on the machine wasn't very good. The x axis was mirrored and the home point was way off. I was looking into Marlin to pu... | <p>The Alunar firmware you linked is a fork from the main Marlin firmware. If the bed Y direction is reversed, usually the stepper is incorrectly placed (mirrored) this is seen frequently for the Anet A8 printer which is very similar to your printer. In your case the X direction is wrong, this is usually related to the... | <p><em>disclaimer</em>: I am the maintainer of the firmware that <a href="https://github.com/camalot/alunar-prusa-i3-marlin-i3-firmware" rel="nofollow noreferrer">you linked</a>. </p>
<hr>
<p>The firmware will not improve your print quality. well, it may to some extent, but for the most part, it wont. </p>
<p>There ... | 690 |
<p>Is the LAMP (Linux, Apache, MySQL, PHP / Ruby / Python) stack appropriate for Enterprise use? </p>
<p>To be clear, by "Enterprise", I mean a large or very large company, where security, robustness, availability of skill sets, Total Cost of Ownership (TCO), scalability, and availability of tools are key consideratio... | <p>"but where it's a core platform for systems like CRM and HR, as well as for internal and external websites"</p>
<p>First, find a LAMP CRM or HR application.</p>
<p>Then find a customer for the LAMP CRM or HR application.</p>
<p>Sadly, there aren't a lot of examples of item 1. Therefore, your case is proven. It ... | <p>If it's good enough for Google, trust me, it's good enough for you.</p>
| 45,537 |
<p>I am searching for an open source Java library to generate thumbnails for a given URL. I need to bundle this capability, rather than call out to external services, such as <a href="http://aws.amazon.com/ast/" rel="nofollow noreferrer">Amazon</a> or <a href="http://www.websnapr.com/" rel="nofollow noreferrer">websna... | <p>The first thing that comes to mind is using AWT to capture a screen grab (see code below). You could look at capturing the <a href="http://java.sun.com/javase/6/docs/api/javax/swing/JEditorPane.html" rel="noreferrer">JEditorPane</a>, the <a href="https://jdic.dev.java.net/" rel="noreferrer">JDIC</a> <a href="https:/... | <p>wasn't there a QA/test website/service which would let you specify a web page that you wanted to be rendered in a certain browser(IE, FIREFOX, SAFARI version x,y,z) and they would mail the snapshot back to you. '</p>
<p>I can't remember the service -- maybe other developers who frequent ajaxian might remember it ?<... | 20,471 |
<p>What is Dynamic Code Analysis?</p>
<p>How is it different from <a href="https://stackoverflow.com/questions/49716/what-is-static-code-analysis">Static Code Analysis</a> (ie, what can it catch that can't be caught in static)?</p>
<p>I've heard of bounds checking and memory analysis - what are these?</p>
<p>What ot... | <p>Simply put, static analysis collect information based on <strong>source code</strong> and dynamic analysis is based on the <strong>system execution</strong>, often using instrumentation.</p>
<h2>Advantages of dynamic analysis</h2>
<ul>
<li>Is able to detect dependencies that are not possible to detect in static anal... | <blockquote>
<p>Bounds checking</p>
</blockquote>
<p>This means runtime checks of array accesses. Contrary to C's laissez-faire approach to memory accesses and pointer arithmetic, other languages like Java or C# actually check whether or not a given array has the element one is trying to access.</p>
| 7,256 |
<p>I've always been a largely independent learner gleaning what I can from Wikipedia and various books. However, I fear that I may have biased my self-education by inadvertent omission of topics and concepts. My goal is to teach myself the equivalent of an undergraduate degree in Computer Science from a top university ... | <p>Biggest two omissions I see:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools" rel="noreferrer">The Dragon Book</a></li>
<li><a href="https://rads.stackoverflow.com/amzn/click/com/0130661023" rel="noreferrer" rel="nofollow noreferrer">Computer Networks</a></li>
</ul>
... | <p>Books on Professional Software Development covering how software projects work, different methodologies, and design patters are great.
Web-design knowledge is also very useful when it comes to employment.</p>
<p>I don't understand why you are trying to do this yourself though. Even a 'mediocre-at-best' university w... | 17,347 |
<p>How do I use GDB to debug a program which do not have debugging symbols on a 32-bit x86 processor? Inspecting the function arguments, local variables, resolving pointers would be useful to know how to do.
The intention is not really to use this for reverse engineering, as I'm sometimes just too lazy to install the d... | <p>To start out, you can do;</p>
<pre><code>gdb "whatever"
break __libc_start_main
r
</code></pre>
<p>that will setup a breakpoint in libc's crt0 code and allow you to break before main, even if the target binary is totally stripped.</p>
<p>That will get you to a running state at a breakpoint before most user code. ... | <p>All you can do is look at registers and the contents of the stack - you'll have to do everything by inferring what things are used for, as Draemon mentions.</p>
| 41,679 |
<p>I've been using Xcode for the usual C/C++/ObjC development. I'm wondering what are practical considerations, opinions of Xcode, Eclipse or NetBeans usage on a Mac for Java development? </p>
<p>Please don't include my current usage of Xcode in your analysis. </p>
| <p>I like <a href="http://netbeans.org/" rel="noreferrer">NetBeans</a> on OS X for Java.</p>
<p>It seems like I spend more time configuring eclipse to get a decent java programming environment. With NetBeans the setup time is less and I can get down to programming quicker...</p>
| <p>I'll suggest Eclipse because it has a zillions plugins and is almost a standard for Java development. But I've heard that NetBeans is really nice since their latest release specially if you want to do desktop application(Swing) .</p>
<p>I can't comment on Xcode since I haven't play with it.</p>
| 20,269 |
<p>How can you automatically import the latest build/revision number in subversion?</p>
<p>The goal would be to have that number visible on your webpage footer like SO does.</p>
| <pre><code>svn info <Repository-URL>
</code></pre>
<p>or</p>
<pre><code>svn info --xml <Repository-URL>
</code></pre>
<p>Then look at the result. For xml, parse /info/entry/@revision for the revision of the repository (151 in this example) or /info/entry/commit/@revision for the revision of the last comm... | <p>You want the Subversion <strong>info</strong> subcommand, as follows:</p>
<pre><code>$ svn info .
Path: .
URL: http://trac-hacks.org/svn/tracdeveloperplugin/trunk
Repository Root: http://trac-hacks.org/svn
Repository UUID: 7322e99d-02ea-0310-aa39-e9a107903beb
Revision: 4190
Node Kind: directory
Schedule: normal
Las... | 13,540 |
<p>I'm using Cura to slice my prints. I've noticed that when printing the bottom layer (and also the top layer, if it's flat), it first prints three walls, then fills in the middle by moving back and forth in straight lines.</p>
<p>I've noticed that for my parts, the walls look much nicer than the zig-zag pattern in t... | <p>I found the answer myself just after posting - I'm posting it because it might be helpful to other Cura novices.</p>
<p>There is a setting for this, it's just that it's not shown by default. In print settings, you have to click on the three lines next to the search box, and select "Show All Settings". Then you can ... | <p>The latest Cura that I have (4.2.1) includes "Ironing" in its options. When I enabled this, it prints the top layer twice. The first time with extrusion and the second time with just a little bit of extrusion (default is 10%) at 90 degrees to the first one. This effectively "irons out" the zig-zag pattern giving ... | 1,490 |
<p>I have the following entity class (in Groovy):</p>
<pre><code>import javax.persistence.Entity
import javax.persistence.Id
import javax.persistence.GeneratedValue
import javax.persistence.GenerationType
@Entity
public class ServerNode {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id
String fi... | <p>I don't know if leaving <code>hibernate</code> off the front makes a difference.</p>
<p>The <a href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-misc-properties" rel="noreferrer">reference</a> suggests it should be <code>hibernate.hbm2ddl.auto</code></p>
<p>A... | <p>In applicationContext.xml file:</p>
<pre><code><bean id="entityManagerFactoryBean" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- This makes /META-INF/persistence.xml is no longer necessary -->
<... | 39,467 |
<p>I'm switching between different Java SDKs (1.4.2, 1.5.0 and 1.6.0) for various projects. I would like to set the JAVA_HOME environment variable on my Windows XP machine without going through the tedious My Computer -> Advanced -> [Select System Variable] -> Edit -> Ok -> Ok</p>
<p>Is it possible to do this from th... | <p>From <a href="http://vlaurie.com/computers2/Articles/environment.htm" rel="nofollow noreferrer">http://vlaurie.com/computers2/Articles/environment.htm</a>:</p>
<blockquote>
<p>Using the add-on tool Setx.exe</p>
<p>It is not part of the standard Windows
XP setup but a command-line tool
called setx.exe is ... | <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&displaylang=en" rel="nofollow noreferrer">Service Pack 2 Support Tools</a> has a tool called "setx.exe" that can do what you are looking for. setx path "%PATH%;C:\New Folder"</p>
<p><a href="http://vlaurie.com... | 42,997 |
<p>I have a Win32 console application which is doing some computations, compiled in Compaq Visual Fortran (which probably doesn't matter). </p>
<p>I need to run a lot of them simultaneously.</p>
<p>In XP, they take around 90-100% CPU together, work very fast.
In Vista, no matter how many of them I run, they take no m... | <p>Have you tried redirecting the console output to a file?
If your applications are being held up writing to the console (this happens sometimes unfortunately) then redirecting the output should help, as it's much quicker to write to a simple file than write to the console.</p>
<p>You do this like so</p>
<pre><code>... | <p>Is it the same machine hardware on your Vista and XP? It might use just 10% of the Vista because it doesn't require more. Are you using Thread? I think it requires more information about your project to have a better idea. Have you try to use a profiler to see what's going on?</p>
| 37,914 |
<p>If I have a function that needs to work with a <code>shared_ptr</code>, wouldn't it be more efficient to pass it a reference to it (so to avoid copying the <code>shared_ptr</code> object)?
What are the possible bad side effects?
I envision two possible cases:</p>
<p>1) inside the function a copy is made of the argu... | <p>The point of a distinct <code>shared_ptr</code> instance is to guarantee (as far as possible) that as long as this <code>shared_ptr</code> is in scope, the object it points to will still exist, because its reference count will be at least 1.</p>
<pre><code>Class::only_work_with_sp(boost::shared_ptr<foo> sp)
{... | <p>In addition to what litb said, I'd like to point out that it's probably to pass by const reference in the second example, that way you are sure you don't accidentally modify it.</p>
| 42,453 |
<p>Obviously I could create a <code>Calendar</code> object with the date and use <code>get(DAY)</code> on it, but knowing Groovy, I would guess there is an easier, quicker way I just don't know about?</p>
<p><strong>Answer</strong></p>
<pre><code>(date1..date2).size() == 1 // true if two dates are on same calendar da... | <p>Quickly opened the Groovy In Action book and found the following sample that should help:</p>
<pre><code>def today = new Date()
def yesterday = today-1
assert (yesterday..today).size() == 2
</code></pre>
| <p>A bit shorter and more readable then the current top answer:</p>
<pre><code>date1 - date2 == 0 //true if two dates are on same calendar day
</code></pre>
| 26,964 |
<p>I am doing some TTF work for MOSA (the correlating body between all the C# operating systems). Me and Colin Burn are currently working on getting some TTF code working (less me these days :) - he made a lot of progress).</p>
<p>In any case, the TTF spec allows for an arbitrary amount of control points between the '... | <p>From the <a href="http://en.wikipedia.org/wiki/Bezier_curves" rel="nofollow noreferrer">Bezier article</a> in wikipedia, with some practical calculus knowledge, you can translate the formulas to a computer program like the following pseudo C# code listing. I'm doing it with quadratic spline, but it is easy to transl... | <p>Okay, it looks like TTF outlines are defined as quadratic b-splines.</p>
<p>There are two algorithms that you'll want to be familiar with. </p>
<p>The first is Bezier extraction via knot insertion. This will get you quadratic Bezier segments. Then you'll want to degree-elevate each Bezier segment to get cubics.... | 46,293 |
<p>What is the most efficient way in C# 2.0 to check each character in a string and return true if they are all valid hexadecimal characters and false otherwise?</p>
<h3>Example</h3>
<pre><code>void Test()
{
OnlyHexInString("123ABC"); // Returns true
OnlyHexInString("123def"); // Returns tru... | <pre><code>public bool OnlyHexInString(string test)
{
// For C-style hex notation (0xFF) you can use @"\A\b(0[xX])?[0-9a-fA-F]+\b\Z"
return System.Text.RegularExpressions.Regex.IsMatch(test, @"\A\b[0-9a-fA-F]+\b\Z");
}
</code></pre>
| <p>Now, only</p>
<pre><code>if (IsHex(text)) {
return true;
} else {
return false;
}
</code></pre>
| 27,646 |
<p>I am still trying to wrap my head around design patterns and for the second time I'm coming up against the same problem that seems to be crying out for a pattern solution. </p>
<p>I have an accounts system with multiple account types. We have restaurant, hotel, service_provider, and consumer account types. Im sure ... | <p>I'd suggest aggregation rather than inheritance here for the relationship between account and profile, but have an Account base class that is inherited into multiple account types.</p>
<p>The account contains a profile object, which can be set in the constructor of each polymorphic account type. </p>
<p>You could ... | <p>thanks for the examples; you may be trying to make this harder than it is. Would the following work?</p>
<pre><code>User <<--> Account
Account <<--> AccountType
Account <--> Profile
Profile <<--> ProfileType
</code></pre>
<p>I question the account-profile 1:1 relationship, it seems... | 23,240 |
<p>Are the string literals we use inside functions automatic variables? Or are they allocated in heap which we have to free manually?</p>
<p>I've a situation like the code shown below wherein I'm assigning a string literal to a private field of the class (marked as ONE in the code) and retrieving it much later in my p... | <p>String literals will be placed in the initialized data or text (code) segment of your binary by the compiler, rather than residing in (runtime allocated) memory or the stack. So you should be using a pointer, since you're going to be referencing the string literal that the compiler has already produced for you. No... | <p>Maybe the cause of the crash is that you did not 0-terminate the string?</p>
| 20,927 |
<p>I have a website about to launch with a forum facility. Should I put each thread into my <code>sitemap.xml</code> file, or will Google just find the links to each thread via the forum itself? Don't worry: it doesn't require registration to read the forum.</p>
<p>If yes, how best to keep it up to date? Doing it by h... | <p>If you have a good structure, Google will probably find your threads, but it's always good to put all of your pages into a XML sitemap as Google will, most of the time, crawl your site more frequent.</p>
<p>Regarding the method of generation, I would suggest a PHP-script that just fetches all thread, and then cache... | <p>Depends on the amount of sites. Too many entries in the sitemap.xml can be counter-productive. </p>
<p>If you have a huge forum, it might be better to do a selection and build your sitemap.xml dynamically. Rewriting .xml into .php and having a script deciding what to list in your sitemap sounds like a good way to h... | 49,833 |
<p>I've just done my <a href="https://www.thingiverse.com/thing:3709044" rel="nofollow noreferrer">first print</a> on an Ultimaker 3 Extended and I'm slightly disappointed with the results, so I'm trying to understand how I can do better next time.</p>
<h2>My first print</h2>
<p>Preparing for printing I naively just ... | <p>Owning the Ultimaker 3 Extended and having printed kilometers of filament on this printer I can tell you that printing with PVA, apart from the slicing problems you mention, is not easy as it looks. PVA clogs up very fast and is very hygroscopic. Moist PVA will make popping sounds on extrusion and is prone to failin... | <blockquote>
<p>What is the reason for the external scaffolding...?</p>
</blockquote>
<p>Reading through the <a href="https://ultimaker.com/en/resources/52663-support" rel="nofollow noreferrer">Ultimaker support page</a>, I discovered that there is a <em>Support horizontal expansion</em> option in the <em>Support</e... | 1,465 |
<p>When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the .exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll</p>
<p>The former can be included in the .exe using <a href="http://www.py2exe.org/index.c... | <p>Wouldn't it fail to launch, then? You want <code>msvcr71.dll</code> in the same directory as the exe, so that the library loader will be able to find and link it into the application's memory map. </p>
<p>It's needed for basic operation, so you can't just let <code>py2exe</code> unpack it with the rest of the DLLs.... | <p>py2exe can't do this. You can wrap py2exe (there is <a href="http://py2exe.org/index.cgi/SingleFileExecutable" rel="nofollow noreferrer">an example on the wiki</a> showing how to do that with NSIS); you could build your own wrapper if using NSIS or InnoSetup wasn't an option.</p>
<p>Alternatively, if you're positi... | 21,913 |
<p>Does anyone know of any software or a good way for developers to build up a knowledge base of business rules that are built in to the software for help desk to use?</p>
<p>We already have a helpdesk software but we are not looking to replace this.</p>
| <p>A wiki is definitely the way to go. Processes change, sometimes frequently, and in a fast-paced environment like a help desk a tool that allows quick, easy access and management of that type of content is extremely important to allow people to do their jobs effectively.</p>
<p>One of the greatest benefits I've fou... | <p>Can you be more specific?</p>
<p>This may fall under "policies and procedures" management software. Here are some:
<a href="http://www.softscout.com/software/Human-Resources/Policy-and-Procedures.html" rel="nofollow noreferrer">http://www.softscout.com/software/Human-Resources/Policy-and-Procedures.html</a></p>
<... | 10,653 |
<p>I am looking for a way to create an int\long representation of an arbitrary alpha-numeric String. Hash codes won't do it, because I can't afford hash collisions i.e. the representation must be unique and repeatable. </p>
<p>The numeric representation will be used to perform efficient (hopefully) compares. The creat... | <p>Unless your string is limited in length, you can't avoid collisions. </p>
<p>There are 4294967296 possible values for an integer (2^32). If you have a string of more than 4 ASCII characters, or more than two unicode characters, then there are more possible string values than possible integer values. You can't have ... | <p>How long are your strings? Unless you choose an int representation that's longer than the string, collisions will always be possible no matter what conversion you're using. So if you're using a 32 bit integer, you can only uniquely represent strings of up to 4 bytes.</p>
| 6,823 |
<p>How does an application perform a proximity search? For example, a user types in a postal code, then the application lists all the businesses within 20 miles ordered by proximity.</p>
<p>I want to build something like that in PHP and MySQL. Is this approach correct?</p>
<ol>
<li>Get the addresses for locations I'm... | <p>If there are enough records for speed to matter, here's a way to index them ahead of time.</p>
<p>Define a grid of bins about 20 miles on a side. Store the bin number with each store's record. At search time, compute the numbers of all bins that intersect a 20-mile radius from your search point. Then retrieve all s... | <p>We do this for about 1200 locations. I would just use the Haversine formula on the fly although depending on you application, it might be better to store it in PHP instead of SQL. (Our implementation is in .net so your milage may vary). </p>
<p>Really our biggest drawback with the way we implemented it, is that ... | 32,536 |
<p>i have a question about configuration fo search pages in sharepoint. There are two types of searches:</p>
<ol>
<li>contextual which searches just in current page or list (they are labelled like: This site: Name of site or This list: Name of list), they point to OSSSearchResults.aspx page</li>
<li>custom searches w... | <p>I wrote <a href="http://www.sharepointusecases.com/index.php/2008/11/configuring-scopes-dropdown/" rel="nofollow noreferrer">an article</a> that might help you configure this.</p>
| <p>In SharePOint 2013
- Go to site settings-> Seach settings -> Enter the search center url-> tick mark the -> Use the same results page settings as my parent. </p>
<ul>
<li><p>Configure Search Navigation:</p></li>
<li><p>Everything -> /sites/searchcenter/Pages/results.aspx</p></li>
</ul>
<p>Hope this helped</p>
| 42,198 |
<p>Does anyone know of a link to a reference on the web that contains a sample English dictionary word script, that can be used to populate a dictionary table in SQL Server?</p>
<p>I can handle a .txt or .csv file, or something similar.</p>
<p>Alternatively, I'm adding custom spellchecking functionality to my web app... | <p><a href="http://www.dicts.info/uddl.php" rel="noreferrer">Downloadable Dictionaries</a></p>
<p><a href="http://www.ibiblio.org/webster/" rel="noreferrer">GNU version of The Collaborative International Dictionary of English (XML)</a></p>
| <p>One dictionary you could use is the wordnet dictionary available from <a href="http://wordnet.princeton.edu/wordnet/download/" rel="nofollow noreferrer">http://wordnet.princeton.edu/wordnet/download/</a></p>
| 44,538 |
<p>I have been searching high and low for a way to get my silverlight application talking to the COM port on my local computer. Has anybody out there been able to get Silverlight to successfully connect to the COM port of you local computer? If so can you point me to the documentation.</p>
| <p>This can not be done with Silverlight.</p>
<p>Why not just use a standard .NET desktop app? If you need to easily deploy over the web, just use Click-Once for deployment.</p>
| <p>What if you want your application to run on Windows and Mac? Silverlight is a nice solution since it runs on both. If you have to write a WPF app or an ActiveX control, etc., this will bind you to Windows only again.</p>
| 28,109 |
<p>I've worked with designing databases for a loooong time, and these days I'm working in C# too. OO makes sense to me, but I don't feel that I have a good grounding in the deep theory of OO design.</p>
<p>In database land, there's a lot of theory around how to design the structure of a database, the main notion being... | <p>Be careful some of the design patterns literature.</p>
<p>There are are several broad species of class definitions. Classes for persistent objects (which are like rows in relational tables) and collections (which are like the tables themselves) are one thing.</p>
<p>Some of the "<a href="https://rads.stackoverflo... | <p>You should look at UML, which is an entire process given to OOD.</p>
<p>I'd recommend getting a book (or a couple), because the theory is quite large, most people pick and choose the techniques most appropriate for the project at hand. </p>
| 30,598 |
<p>I have an asp.net mvc app running on a local iis website that is failing to send mail using SmtpClient from System.Net.Mail. I am trying to send a mail to my hotmail address and I get a socket exception. Any idea what the problem might be?</p>
<pre><code>using(var message = new MailMessage())
{
... | <p>Based on your answers to my comments above Joe, you don't have SMTP enabled on your local machine. Vista does not come with SMTP. </p>
<p>As such, you'll either have to install a 3rd party SMTP app that will run on Vista, or use another app to send via, in this case, your Hotmail account may allow you to send out... | <p>Try explicitly setting the host of the SmtpClient.</p>
<p>Ex:<br>
SmtpClient mailClient = new SmtpClient();</p>
<p>mailClient.Host = "127.0.0.1";</p>
<p>mailClient.Send(message);</p>
| 42,345 |
<p>Had an interesting discussion with some colleagues about the best scheduling strategies for realtime tasks, but not everyone had a good understanding of the common or useful scheduling strategies.</p>
<p>For your answer, please choose one strategy and go over it in some detail, rather than giving a little info on s... | <p>As described in a paper titled <a href="http://www.ee.duke.edu/~krish/wip.pdf" rel="noreferrer">Real-Time Task Scheduling for Energy-Aware Embedded Systems</a>, Swaminathan and Chakrabarty describe the challenges of real-time task scheduling in low-power (embedded) devices with multiple processor speeds and power co... | <p>One common real-time scheduling scheme is to use priority-based preemptive multitasking.<br>
Each tasks is assigned a different priority level.<br>
The highest priority task on the ready queue will be the task that runs. It will run until it either gives up the CPU (i.e. delays, waits on a semaphore, etc...) or a h... | 7,258 |
<p>Anyone know a good book or post about how to start in EF? I have seen the DnrTV any other place?</p>
| <p>Mike Taulty's Blog: <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1024.aspx" rel="noreferrer">http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/category/1024.aspx</a></p>
<p>A great EF intro deck: <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_... | <p><a href="http://blogs.msdn.com/alexj/" rel="nofollow noreferrer">Alex James, Program Manager on the ADO.Net team</a> at microsoft also has the odd good post on EF especially around Metadata.</p>
| 6,442 |
<p>According to <em>Cocoa Programming for Mac OS X, 3rd Edition</em>, on page 245 (chapter 17), you will usually create views in Interface Builder. However, it is possible to create them in code, a la:</p>
<pre><code>NSView *superview = [window contentView];
NSRect frame = NSMakeRect(10, 10, 200, 100);
NSButton *but... | <p>You can wire them up using a simple assignment. To continue your code from above:</p>
<pre><code>[button setTarget: self];
[button setAction: @selector(myButtonWasHit:)];
</code></pre>
| <p>Swift:</p>
<pre><code>button.target = self
button.action = "myAction:"
</code></pre>
<p>And of course add myAction function to self:</p>
<pre><code>func myAction(sender: NSButton) {
println("click!")
}
</code></pre>
| 45,538 |
<p>My emacs (on Windows) always launches with a set size, which is rather small, and if I resize it, it's not "remembered" at next start-up. </p>
<p>I've been playing with the following:</p>
<pre><code>(set-frame-position (selected-frame) 200 2) ; pixels x y from upper left
(set-frame-size (selected-frame) 110 58) ;... | <p>Here's what I use in my <code>~/.emacs</code>:</p>
<pre><code>(add-to-list 'default-frame-alist '(left . 0))
(add-to-list 'default-frame-alist '(top . 0))
(add-to-list 'default-frame-alist '(height . 50))
(add-to-list 'default-frame-alist '(width . 155))
</code></pre>
| <p>For emacs on windows, I generally put it in the registry.</p>
<pre><code>HKCU\Software\GNU\Emacs\
Emacs.Geometry REG_SZ "245x74"
</code></pre>
<p>(This keeps machine-local settings out of my .emacs file, which I share with many other machines...)</p>
| 43,513 |
<p>I would like to do some condition formatting of strings. I know that you can do some conditional formatting of integers and floats as follows:</p>
<pre><code>Int32 i = 0;
i.ToString("$#,##0.00;($#,##0.00);Zero");
</code></pre>
<p>The above code would result in one of three formats if the variable is positive, neg... | <p>Well, you can simplify it a bit with the conditional operator:</p>
<pre><code>string formatString = items.Count > 0 ? "Items: {0}; Values: {1}" : "Values: {1}";
return string.Format(formatString, itemList, valueList);
</code></pre>
<p>Or even include it in the same statement:</p>
<pre><code>return string.Forma... | <p>I hoped this could do it:</p>
<pre><code>return String.Format(items.ToString(itemList + " ;;") + "Values: {0}", valueList);
</code></pre>
<p>Unfortunately, it seems that the .ToString() method doesn't like the blank negative and zero options or not having a # or 0 anywhere. I'll leave it up here in case it points... | 18,670 |
<p>I'm currently working on a project where a section of the code looks like this:</p>
<pre><code>Select Case oReader.Name
Case "NameExample1"
Me.Elements.NameExample1.Value = oReader.ReadString
' ...
Case "NameExampleN"
Me.Elements.NameExampleN.Value = oReader.ReadSt... | <p>Others have answered perfectly reasonably, but just in case this is a performance-sensitive piece of code, you might want to compile the reflective calls into delegates.</p>
<p>I've got a <a href="http://codeblog.jonskeet.uk/2008/08/09/making-reflection-fly-and-exploring-delegates" rel="nofollow noreferrer">blog en... | <p>Yes, CallByName is the best solution for you. Here's instruction of doing it: </p>
<pre><code>CallByName(yourClassOrObjectName,"NameExample1",CallType.Set,oReader.ReadString)
</code></pre>
<p>You can write "NameExample" in place of "NameExample1".<br>
Mention, that third parameter lets you 'Get', 'Let' that param... | 29,805 |
<p>I want to create a Java program that can be extended with plugins. How can I do that and where should I look for?</p>
<p>I have a set of interfaces that the plugin must implement, and it should be in a jar. The program should watch for new jars in a relative (to the program) folder and registered them somehow.</p>
... | <p>I've done this for software I've written in the past, it's very handy. I did it by first creating an Interface that all my 'plugin' classes needed to implement. I then used the Java <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html" rel="noreferrer">ClassLoader</a> to load those classes an... | <p>Have you considered building on top of Eclipse's Rich Client Platform, and then exposing the Eclipse extension framework?</p>
<p>Also, depending on your needs, the Spring Framework might help with that and other things you might want to do: <a href="http://www.springframework.org/" rel="nofollow noreferrer">http:/... | 4,506 |
<p>I use CruiseControl.NET to automatically build my .NET 3.5 web applications, which works a treat. However, is there any way to automatically create a ZIP file of these builds, and put the ZIP's into a separate directory?</p>
<p>I have seen this is possible using NAnt but cannot find an example of how to get this w... | <p>I've just added such a Nant task to our CC machine.</p>
<p>See <a href="http://nant.sourceforge.net/release/latest/help/tasks/zip.html" rel="nofollow noreferrer">http://nant.sourceforge.net/release/latest/help/tasks/zip.html</a></p>
<p>Note when initially viewing the zip archive, it may appear as if all the files ... | <p>We are zipping the sources of a CruiseControl.NET project</p>
<p>but we are using ant</p>
<pre><code><target name="zipProject">
<mkdir dir="output"/>
<zip destfile="output\sources.zip" basedir="C:\project\src" />
</target>
</code></pre>
<p>i don't know about nant but i would expect i... | 33,706 |
<p>I really love the philosophy of chaining methods, like <a href="http://www.jquery.com" rel="nofollow noreferrer">jQuery</a> emphasys in its library. I found it quite elegant and clear.</p>
<p>Being primarily Java developper, I've always wondering myself why this practice was not more used in this language. For exam... | <p>IMO it is painful to debug as you tend to have no intermediary variables for inspection.</p>
| <p>JavaScript is (more or less) a functional language, with functions as first-class citizens.<br>
Adding/removing methods to objects, passing functions as parameters, all this is natural for this language.</p>
<p>On the other hand, Java is strictly OO, a function cannot exist outside of a class. Using inheritance, co... | 17,889 |
<p>How can I authenticate a user with LDAP using CGI/TCL stack?</p>
<p>Please provide a sample code-snippet if possible.</p>
<hr>
<p>I am using an Apache Web Server on RHEL 5.0; AD exists on a remote Win2003 server.</p>
| <p>I think you should not consider any specific parser implementation. <a href="http://en.wikipedia.org/wiki/JAXP" rel="noreferrer">Java API for XML Processing</a> lets you use any conforming parser implementation in a standard way. The code should be much more portable, and when you realise that a specific parser has ... | <p>If you care less about performance, I'm a big fan of Apache Digester, since it essentially lets you map directly from XML to Java Beans.</p>
<p>Otherwise, you have to first parse, and then construct your objects. </p>
| 48,885 |
<p>If I'm writing an application that wants to communicate some information through the use of color, how can I change the background and foreground colors of a given widget? I would like to know how to do this in glade if it's possible, as well as programmatically (to a computed color).</p>
<p>I want to know how to ... | <p>Example program:</p>
<pre><code>#include <gtk/gtk.h>
static void on_destroy(GtkWidget* widget, gpointer data)
{
gtk_main_quit ();
}
int main (int argc, char* argv[])
{
GtkWidget* window;
GtkWidget* button;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_W... | <p>You can always use <a href="https://developer.gnome.org/gtk3/3.4/GtkWidget.html#gtk-widget-override-color" rel="nofollow">gtk_widget_override_color ()</a> and <a href="https://developer.gnome.org/gtk3/3.4/GtkWidget.html#gtk-widget-override-background-color" rel="nofollow">gtk_widget_override_background_color ()</a>.... | 12,469 |
<p>I have seen the <a href="https://stackoverflow.com/questions/184869/are-guid-collisions-possible">GUID Collisons</a>
discussions but just wanted your thoughts on whether there could be a GUID collision if both clients accessed the same web page that generates the GUID at exactly the same time (- probably down to the... | <p>It's theoretically possible, but highly unlikely.</p>
| <p><a href="http://en.wikipedia.org/wiki/Globally_Unique_Identifier" rel="nofollow noreferrer">From Wikipedia, the free encyclopedia</a></p>
<p>A Globally Unique Identifier or GUID (pronounced /ˈguːɪd/ or /ˈgwɪd/) is a special type of identifier used in software applications in order <strong>to provide a reference num... | 34,254 |
<p>Everyone is talking about TDD (BDD) in Rails (and not just Rails) development world today. It's easy to find plenty of good general information about it, there are quite a few tools you can use for this purpose and there are many (good) examples of how to use them. </p>
<p>Now, I'm already on the train. I like the ... | <p>I'm using RSpec instead of shoulda, (although I believe that shoulda can be used with RSpec) and the biggest improvement to my workflow has come from using Autotest and then RSpactor.</p>
<p>These tools automatically monitor your source tree for changes and execute the relevant tests if update either the test or im... | <p>I totally agree that there is a significant gap in the rails BDD documentaion. Lots of little examples but no big ones giving an overall picture of how to do it. Even the books that have chapters on testing are guilt of this. The only full examples I have seen are peepcode's three part screencast on rspec and a v... | 28,009 |
<p>Several Linq.Enumerable functions take an <code>IEqualityComparer<T></code>. Is there a convenient wrapper class that adapts a <code>delegate(T,T)=>bool</code> to implement <code>IEqualityComparer<T></code>? It's easy enough to write one (if your ignore problems with defining a correct hashcode), but ... | <p>When you want to customize equality checking, 99% of the time you're interested in defining the keys to compare by, not the comparison itself.</p>
<p>This could be an elegant solution (concept from Python's <a href="http://wiki.python.org/moin/HowTo/Sorting#Sortingbykeys" rel="noreferrer">list sort method</a>).</p>... | <p>I don't know of an existing class but something like:</p>
<pre><code>public class MyComparer<T> : IEqualityComparer<T>
{
private Func<T, T, bool> _compare;
MyComparer(Func<T, T, bool> compare)
{
_compare = compare;
}
public bool Equals(T x, Ty)
{
return _compare(x, y);
... | 12,351 |
<p>I need to impersonate myself as a domain user in a ASP.NET application running on VMWare machine. Since the VMWare machine is not itself in the domain, ASP.NET is unable to resolve the user token (specified in web.config). Is there a way to do that?</p>
<p>Thanks in advance,
Petr</p>
| <p>I use this class I wrote all the time and it works like a charm!</p>
<pre><code>using System;
using System.Security.Principal;
/// <summary>
/// Changes the security context the application runs under.
/// </summary>
public class ImpersonateHelper : IDisposable
{
[System.Runtime.InteropServices.Dll... | <p>This may be the dumb obvious answer, but you could add your VMWare machine to the domain.</p>
| 35,117 |
<p>Is there any way I can vary caching by a controller action parameter using the <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.outputcacheattribute(v=vs.108).aspx" rel="nofollow noreferrer">outputcache</a> attribute? We have <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.outputcachea... | <p>Caching works this way by default. Different URLs give different cache locations. Perhaps there is something missing from your question, but, as stated, it already works this way.</p>
| <p>Its also important to realize in a Action method that 'VaryByParam' does not mean 'Vary by the parameters being passed into that action method'. it means 'vary by the parameters being passed into that action method that originate as HTTP parameters'.</p>
<pre><code>[OutputCache(CacheProfile = "ContentPage", VaryByP... | 47,147 |
<p>I basically have an xml column, and I need to find and replace one tag value in each record.</p>
| <p>For anything real, I'd go with xpaths, but sometimes you just need a quick and dirty solution:</p>
<p>You can use CAST to turn that xml column into a regular varchar, and then do your normal replace. </p>
<p><code>UPDATE xmlTable SET xmlCol = REPLACE( CAST( xmlCol as varchar(max) ), '[search]', '[replace]')</code... | <pre><code>update my_table
set xml_column = replace(xml_column, "old value", "new value")
</code></pre>
| 20,667 |
<p>How do I get my C# program to sleep (pause execution) for 50 milliseconds?</p>
| <pre><code>System.Threading.Thread.Sleep(50);
</code></pre>
<p>Remember though, that doing this in the main GUI thread will block your GUI from updating (it will feel "sluggish")</p>
<p>Just remove the <code>;</code> to make it work for VB.net as well.</p>
| <p>Best of both worlds:</p>
<pre><code>using System.Runtime.InteropServices;
[DllImport("winmm.dll", EntryPoint = "timeBeginPeriod", SetLastError = true)]
private static extern uint TimeBeginPeriod(uint uMilliseconds);
[DllImport("winmm.dll", EntryPoint = "timeEndPeriod", SetLastError = true)]
privat... | 11,639 |
<p>Greetings all,</p>
<p>I'm trying to localize a .NET/C# project. I'm using string resource files and setting the "Localizable" property on all my forms to 'True'. The assembly culture is empty. The resx/resource files are successfully passed through Lingobit, resgen, and al. </p>
<p>When running the localized ex... | <p>When you open the form in Visual Studio, if you change the Language property of the Form to the language you are localizing to, does the same problem exist there? Could it be possible that the non-localized forms/buttons still have the English text set even in the localized resources?</p>
| <p>Yeah, I'd go with Andy on this and be suspicious of the contents of the resource files. We dabbled with localisation for a time, and encountered a number of issues, but this certainly wasn't one of them.</p>
<p>If that isn't it, then how are you testing your app? If you haven't tried this already I'd suggest firing... | 15,572 |
<p>I have a Singleton/Factory object that I'd like to write a JUnit test for. The Factory method decides which implementing class to instantiate based upon a classname in a properties file on the classpath. If no properties file is found, or the properties file does not contain the classname key, then the class will in... | <p>This question might be old but since this was the nearest answer I found when I had this problem I though I'd describe my solution.</p>
<p><strong>Using JUnit 4</strong></p>
<p>Split your tests up so that there is one test method per class (this solution only changes classloaders between classes, not between metho... | <p>Below you can find a sample that does not need a separate JUnit test runner and works also with classloading tricks such as Mockito.</p>
<pre><code>package com.mycompany.app;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.... | 6,348 |
<p>Documentation is severely lacking on anything to do with stored procedures in mysql with PHP. I currently have a stored procedure that I call via PHP, how can I get the value of an out parameter?</p>
| <p>it looks like it's answered in this post:</p>
<p><a href="http://forums.mysql.com/read.php?52,198596,198717#msg-198717" rel="noreferrer">http://forums.mysql.com/read.php?52,198596,198717#msg-198717</a></p>
<p>With mysqli PHP API: </p>
<p>Assume sproc myproc( IN i int, OUT j int ): </p>
<pre><code>$mysqli = new m... | <p>Here's an example of how to do this with mysql, mysqli, and pdo:</p>
<p><a href="http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/" rel="noreferrer">http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/</a></p>
| 7,050 |
<p>In my WPF application, I have a number of databound TextBoxes. The <code>UpdateSourceTrigger</code> for these bindings is <code>LostFocus</code>. The object is saved using the File menu. The problem I have is that it is possible to enter a new value into a TextBox, select Save from the File menu, and never persist t... | <p>I found that removing the menu items that are scope depended from the FocusScope of the menu causes the textbox to lose focus correctly. I wouldn't think this applies to ALL items in Menu, but certainly for a save or validate action.</p>
<pre><code><Menu FocusManager.IsFocusScope="False" >
</code></pre>
| <p>The easiest way is to <em>set the focus somewhere</em>.<br>
You can set the focus back immediately, but setting the focus anywhere will trigger the LostFocus-Event on <strong>any type of control</strong> and make it update its stuff:</p>
<pre><code>IInputElement x = System.Windows.Input.Keyboard.FocusedElement;
Dum... | 8,175 |
<p>Recently I have started playing with jQuery, and have been following a couple of tutorials. Now I feel slightly competent with using it (it's pretty easy), and I thought it would be cool if I were able to make a 'console' on my webpage (as in, you press the ` key like you do in <a href="http://en.wiktionary.org/wiki... | <p>Why would you want to convert key strokes to text? Add a button that sends the text inside the textarea to the server when clicked. You can get the text using the value attribute as the poster before has pointed out, or using jQuery's API:</p>
<pre><code>$('input#mybutton').click(function() {
var text = $('text... | <p>Read textarea value and code-char conversion:</p>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function keys(e) {
msg.innerHTML = `last key: ${Str... | 17,466 |
<p>I want to rename a database, but keep getting the error that 'couldn't get exclusive lock' on the database, which implies there is some connection(s) still active.</p>
<p>How can I kill all the connections to the database so that I can rename it?</p>
| <p>The reason that the approach that <a href="https://stackoverflow.com/questions/11620/how-do-you-kill-all-current-connections-to-a-sql-server-2005-database/11627#11627">Adam suggested</a> won't work is that during the time that you are looping over the active connections new one can be established, and you'll miss th... | <p>You can Use SP_Who command and kill all process that use your database and then rename your database.</p>
| 3,271 |
<p>I'm looking for a way to upload a file to s3. I am using django. I am currently using amazon's python library for uploading along with the following code: </p>
<p>View:</p>
<pre><code>def submitpicture(request):
fuser = request.session["login"]
copied_data = request.POST.copy()
copied_data.update(requ... | <p>You will have to provide the enctype attribute to the FORM element (I've been bitten by this before). For example, your FORM tag should look like: </p>
<pre><code><form action="/submitpicture/" method="POST" enctype="multipart/form-data" >
</code></pre>
<p>Without the enctype, you will find yourself with an ... | <p>Adding enctype="multipart/form-data" seems like something that's worth mentioning in the "File Uploads" section of the django docs (<a href="http://docs.djangoproject.com/en/dev/topics/http/file-uploads/" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/topics/http/file-uploads/</a>). Thoughts?</p>
| 41,374 |
<p>I have been working my way through Scott Guthrie's excellent post on <a href="http://weblogs.asp.net/scottgu/archive/2008/10/16/asp-net-mvc-beta-released.aspx" rel="noreferrer">ASP.NET MVC Beta 1</a>. In it he shows the improvements made to the UpdateModel method and how they improve unit testing. I have recreated... | <p>I don't think it can be done since TryUpdateModel, which UpdateModel uses, references the ControllerContext which is null when invoked from a unit test. I use RhinoMocks to mock or stub the various components needed by the controller.</p>
<pre><code>var routeData = new RouteData();
var httpContext = MockRepository... | <p>Or you can create form data proxy, like </p>
<pre><code>public class CountryEdit {
public String Name { get; set; }
public String Iso3166 { get; set; }
}
</code></pre>
<ul>
<li>Plus. Easy create unit tests</li>
<li>Plus. Define white list of fields update from post</li>
<li>Plus. Easy setup validation rules, e... | 43,016 |
<p>Do these two keywords have exactly the same effect, or is there something I should be aware of?</p>
| <p>According to this site: <a href="http://en.csharp-online.net/CSharp_FAQ:_What_is_the_difference_between_CSharp_lock_and_Java_synchronized" rel="noreferrer">http://en.csharp-online.net/CSharp_FAQ:_What_is_the_difference_between_CSharp_lock_and_Java_synchronized</a>, C# <code>lock</code> and Java <code>synchronized</c... | <p>I java you don't have to worry about locking public types that you own. </p>
<p>In .NET, you <a href="http://www.bluebytesoftware.com/blog/PermaLink.aspx?guid=f9a1d4c8-553b-4cc1-b1d6-0a8c395d8e9c" rel="nofollow noreferrer">have to</a></p>
<p>Updated: this is for types that you own. Locking on public types that you... | 26,751 |
<p>I am having an issue where several prints I downloaded from thingiverse causing my printer to freeze in the first minute of the print. The print head stops, pushes out a small amount of PLA and then does nothing. The control board continues to show the print progress bar continuing.</p>
<p>One thing that could be p... | <p>If you go to the Monoprice website you will find a dedicated page for <a href="https://www.mpselectmini.com/slicers/cura" rel="nofollow noreferrer">Ultimaker Cura</a>. </p>
<p>From the page you can read that:</p>
<blockquote>
<p>Cura now includes profiles for the MP Select Mini V1 and V2. Go to
“Settings”, “Pr... | <p>The source of the files (thingiverse) is irrelevant -- what matters is what the slicing software creates for gcode. Since you're using Cura,go to <a href="https://www.mpselectmini.com/slicers/cura" rel="nofollow noreferrer">monoprice</a> for their advice.</p>
<p>There are a number of Cura + monoprice instructional... | 1,112 |
<p>In Ruby on Rails, I'm attempting to update the <code>innerHTML</code> of a div tag using the <code>form_remote_tag</code> helper. This update happens whenever an associated select tag receives an onchange event. The problem is, <code><select onchange="this.form.submit();"></code>; doesn't work. Nor does <co... | <p>I realize this question is kind of old, but what the heck are you doing eval for?</p>
<pre><code>document.getElementById('formId').onsubmit();
document.getElementById('formId').submit();
</code></pre>
<p>or</p>
<pre><code>document.formName.onsubmit();
document.formName.submit();
</code></pre>
<p>When the DOM of ... | <p>If you didn't actually want to submit the form, but just invoke whatever code happened to be in the onsubmit, you could possibly do this: (untested)</p>
<pre><code>var code = document.getElementById('formId').getAttribute('onsubmit');
eval(code);
</code></pre>
| 5,399 |
<p>I bought a new Vista PC recently but was having lots of problems getting everything to work on it, so I continued doing most of my work (development and other) on a slow XP machine that I've had for years.</p>
<p>Until now, that is - I used VMware Convertor to take an image of my old XP machine, and now I'm running... | <p>I have an Ubuntu Linux box at home which has three VMs, all totally self-contained.</p>
<p>The first is for my wife's business, she needs access to all the MS Office stuff and MYOB.</p>
<p>The second is for work, they're too tight to buy me a laptop and I'm not going to let them install their hideous security and ... | <p>As others have pointed out, it is time to think about changing your host OS to one you are comfortable with and can get your work done on. Depending on what you do on a day to day basis on your machine, I can bet Vista is going to be anything more than a big hurdle. Why tax your work and yourself by running VMware o... | 46,817 |
<p>I'd love to use WPF for a consumer app. However, some real world tests are not very encouraging. On several high-end computers I've tested, the .NET 3.5 installation has taken 15-20 mins to complete. I've seen reports online mentioning 50 mins.</p>
<p>When Vista marketshare is at 70%, this subject will be moot. Unt... | <p>The .Net framework installs a lot of files on the PC and if you're using the online version, many of those files are downloaded from the Internet. What you should do is provide the FULL .Net framework installer with your program. If you're distributing it on a CD the 197 MB file shouldn't be a big problem. </p>
<p>... | <ol>
<li>Its big.</li>
<li>Using the MS supplied web install is the best cause it only installs what it needs (but thats still big)</li>
</ol>
<p>Only option is to only detect its not there and warn the user and ask them to install it. Only the first 3.5 app is affected. All others will be speedy.</p>
<p>Apparently... | 36,328 |
<p>It is mentioned on the <a href="http://en.wikipedia.org/wiki/Systems_Development_Life_Cycle" rel="noreferrer">Systems Development Life Cycle page on Wikipedia</a>:</p>
<blockquote>
<p>To manage this, a number of system development life cycle (SDLC) models have been created: waterfall, fountain, spiral, build and ... | <p>Waterfall is a model that enforces control and avoids parallelism; every requirement for a task has to be fulfilled before starting the task. Fountain says that a new task can be started before all requirements are met, because not all requirements are necessary at the start of the task.</p>
<p>Think of this: Super... | <p>As I understand it, they essentially contain the same steps but a fountain approach is much more iterative, with less focus on initial design and more on analysis.</p>
<p>You basically bodge your way through things. See what needs to happen, and improve it. See what needs to happen. Improve it.</p>
<p>It's more ag... | 15,400 |
<p>Anybody know how to get gmail's OpenID working? All I find is this <a href="http://openid-provider.appspot.com/" rel="noreferrer">http://openid-provider.appspot.com/</a>, which gives 302 moved followed by GET not supported on this URL.</p>
<p>I'm assuming this one is broken. Any others?</p>
| <p>Update: this no-longer works.</p>
<hr>
<p>This works as an OpenID: <strike><a href="https://www.google.com/accounts/o8/id" rel="nofollow noreferrer">https://www.google.com/accounts/o8/id</a></strike> (worked in 2008, 404s in 2016)</p>
<p>It went live on October 30th, 12 days after the question was asked.</p>
<p>... | <p>To clarify:</p>
<p>gmail now provides an OpenID to allow gmail account holders to connect to sites that accept OpenID</p>
<p>as far as I know, it is not yet possible to connect to gmail/google accounts as a result of a non-gmail OpenID;</p>
<p>I've put in an edit of the question as it's clearer for people who dis... | 26,453 |
<p>I have 2 handlers using the same form. How do I remove the handlers before adding the new one (C#)?</p>
| <p>If you are working in the form itself, you should be able to do something like:</p>
<p>PseudoCode:</p>
<pre><code>Delegate[] events = Form1.SomeEvent.GetInvokationList();
foreach (Delegate d in events)
{
Form1.SomeEvent -= d;
}
</code></pre>
<p>From outside of the form, your SOL.</p>
| <p>I realize this question is rather old, but hopefully it will help someone out. You can unregister all the event handlers for any class with a little reflection.</p>
<pre><code>public static void UnregisterAllEvents(object objectWithEvents)
{
Type theType = objectWithEvents.GetType();
//Even though the eve... | 36,603 |
<p>Okay, I am sure this is simple but it is driving me nuts. I recently went to work on a program where I have had to step back in time a bit and use Redhat 9. When I'm typing on the command line from a standard xterm running KornShell (ksh), and I reach the end of the line the screen slides to the right (cutting off t... | <p>Did you do <code>man ksh</code>?</p>
<p>You want to do a <code>set -o multiline</code>.</p>
<p>Excerpt from <code>man ksh</code>:</p>
<blockquote>
<p>multiline: </p>
<blockquote>
<p>The built-in editors will use multiple lines on the screen for
lines that are longer than the width of the sc... | <p>I don't know of a way of forcing the shell to wrap, but I would ask why you'd be writing lines that long. With awk scripts, I simply wrap the script in single quotes, and then break the lines where I want. It only gets tricky if you need single quotes in the script -- and diabolical if you need both single and dou... | 17,138 |
<p>I am looking at nServiceBus and came over this interface</p>
<pre><code>namespace NServiceBus
{
public interface IMessage
{
}
}
</code></pre>
<p>What is the use of an empty interface?</p>
| <p>Usually it's to signal usage of a class. You can implement IMessage to signal that your class is a message. Other code can then use reflection to see if your objects are meant to be used as messages and act accordingly.</p>
<p>This is something that was used in Java a lot before they had annotations. In .Net it's c... | <p>I'd say its used for "future" reference or if you want to share some objects, meaning you could have 10 classes each implementing this interface.</p>
<p>And have them sent to a function for work on them, but if the interface is empty, I'd say its just "pre"-work.</p>
| 49,886 |
<p>I would to change the menuitems in the default context menu provided in the Web Browser Control. I have already tried: webbrowser.contextmenu = mycontextmenu.
Nothing changed. Is there a way to do this?</p>
| <p>The short answer is yes.</p>
<p>See <a href="http://www.codeproject.com/KB/books/0764549146_8.aspx" rel="nofollow noreferrer">this article on codeproject</a>.</p>
<p><a href="http://www.codeproject.com/KB/cs/advhost.aspx" rel="nofollow noreferrer">Here is another (shorter) article on codeproject</a></p>
| <p>The short answer is no. See <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7c283faf-16c8-4b4e-a362-f292e3032abb/" rel="nofollow noreferrer">this thread</a> for more details.</p>
| 29,539 |
<p>You're probably a lot to be subscribers to various mailing list, some more updated than others.</p>
<ul>
<li>What are your best practices to follow all information going by these lists?</li>
<li>What are the best clients you've used to managed that?</li>
</ul>
<p>I'm sure I'm not the only one trying to get the bes... | <p>I like gmail because of the way it groups messages by conversation so I can just page down through a thread.</p>
| <p>Using KDE Ia m using Kontact for my mail and RSS feeds. That gives me a nice command center.</p>
| 45,734 |
<p>How do you correct use frame on a asp.net page, so I have a left frame and a right frame, when I click the links on the page presented in the left frame, it loads the according page in the right frame? On top of this, I need to have a master page on all the right frame's pages.</p>
<p>How do I do this? or is ther... | <p>Yup. Frames are evil. You shouldn't really use them. </p>
<p>They cause problems, but in a (very)few edge cases they can be useful and cheaper in terms of development time, they still show up in generated api documentation quite a lot. </p>
<p>But anyway, seeing as how you asked how to use them, here we go </p>... | <p>The short and sweet answer?</p>
<p>Frames and framesets are no longer necessary or useful in web development, and they create many more problems than they solve.</p>
<p>In more detail: </p>
<p>There's three things that you're probably using frames to help with:</p>
<p><strong>1)</strong> You want to have a navig... | 47,592 |
<p>Is there any such thing as a virtual Lineprinter.I mean a software emulation of a printer, that outputs to screen.</p>
<p>I have a project to change the output of print job. My past experience with a lineprinter was tedious rounds of</p>
<pre><code>loop:
print
walk down two flights
check the output
wal... | <p>If you're working with an x64 server, keep in mind that there are different ODBC settings for x86 and x64 applications. The "Data Sources (ODBC)" tool in the Administrative Tools list takes you to the x64 version. To view/edit the x86 ODBC settings, you'll need to run that version of the tool manually:</p>
<pre><co... | <p>Perform the following steps:</p>
<ol>
<li>Start the Registry Editor by typing <code>regedit</code> in the Run window.</li>
<li>Select the following key in the registry: <code>HKEY_LOCAL_MACHINE\SOFTWARE\ODBC</code>.</li>
<li>In the Security menu, click Permissions.</li>
<li>Grant Full Permission to the account whic... | 35,934 |
<p>How does the Chinese GB18030 code set differ from Unicode?</p>
<p>What special techniques are required for handling GB18030?</p>
<p>Are there any (open source) libraries for handling GB18030?</p>
| <p>As per the <a href="http://en.wikipedia.org/wiki/GB_18030" rel="noreferrer">Wikipedia article on GB18030</a>, "GB18030 can be be considered a Unicode Transformation Format (i.e. an encoding of all Unicode code points) that maintains compatibility with a legacy character set." That is, all Unicode characters can be e... | <blockquote>
<p>What special techniques are required for handling GB18030?</p>
</blockquote>
<p>The biggest thing to be aware of is that, unlike UTF-8, GB18030 allows ASCII bytes to occur within the encoding of a multi-byte character. (For example, 'ß' is encoded as the bytes 81 <strong>30</strong> 89 <strong>38</s... | 27,581 |
<p>Does anyone know why there are question marks (with a number) after the images and css files (when looking at the html code)? And how can I turn them off?</p>
| <p>From <a href="http://api.rubyonrails.com/classes/ActionView/Helpers/AssetTagHelper.html" rel="nofollow noreferrer">Rails API documentation</a>:</p>
<blockquote>
<p>By default, Rails will append all
asset paths with that asset‘s
timestamp. This allows you to set a
cache-expiration date for the asset
far in... | <p>It is to be able to cache the file on the client and still making sure the client receive the newest version when there is a change. So each file modification results in a new timestamp which the client will do a new request to the server to receive the modified file.</p>
<p>If you do not want to use (though I cann... | 48,925 |
<p>I've long been a fan of Stored Procedure Keyboard Accelerators, as described in <a href="http://blogs.msdn.com/irenak/archive/2006/10/27/sysk-228-get-table-columns-or-rows-with-single-key-press.aspx" rel="nofollow noreferrer">this article</a>. When we moved from SQL 2000 to 2005, though, and from Query Analyzer to ... | <p>I had never tried this until I read your question and then read the article you referenced, so take this with a grain of salt. </p>
<p>That said, I am able to get the process to work on my computer using SSMS, and I am also able to duplicate the error you described. </p>
<p>To get this to work as expected I creat... | <p>I am using SSMS version 9.00.3042.00 as well, which probably explains why it is working on my machine. </p>
| 11,074 |
<p>I would like to write a small program in C# which goes through my jpeg photos and, for example, sorts them into dated folders (using MY dating conventions, dammit...). </p>
<p>Does anyone know a relatively easy way to get at the EXIF data such as Date And Time or Exposure programatically?
Thanks!</p>
| <p>Check out this <a href="https://www.drewnoakes.com/code/exif/" rel="noreferrer">metadata extractor</a>. <strike>It is written in Java but has also been ported to C#.</strike> I have used the Java version to write a small utility to rename my jpeg files based on the date and model tags. Very easy to use.</p>
<hr>
<... | <p>Recently, I used this <a href="https://products.groupdocs.com/metadata/net" rel="nofollow noreferrer">.NET Metadata API</a>. I have also written a <a href="https://blog.groupdocs.com/2020/05/13/manage-exif-data-in-csharp-net-for-jpeg-png-tiff-webp-images/" rel="nofollow noreferrer">blog post</a> about it, that shows... | 8,307 |
<p>In a mysqli prepared statement, a NULL gets turned into '' (in the case of a string) or 0 (in the case of an integer). I would like to store it as a true NULL. Is there any way of doing this?</p>
| <p>It's possible to bind a true NULL value to the prepared statements (read <a href="http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148" rel="noreferrer">this</a>).</p>
<blockquote>
<p>You can, in fact, use mysqli_bind_parameter to pass a NULL value to the database. simply create a variable and store the NUL... | <p>I store all parameters in an array and pass them in <code>bind_param</code> function using <code>array_shift($myArray)</code>. NULL is accepted like that.</p>
| 48,573 |
<p>The people writing the user manual are not necessarily programmers, and they need a visual editor. A major issue is the internal format of the authoring tool; it should be readable text/html, so it's easy to compare versions of individual pages checked into version control.</p>
| <h2>DocBook</h2>
<p><a href="http://www.docbook.org/" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/945K6.png" alt="alt text"></a><br>
<sub>(source: <a href="http://www.docbook.org/graphics/banner.png" rel="nofollow noreferrer">docbook.org</a>)</sub> </p>
| <p>We are using <a href="http://maven.apache.org/doxia/references/apt-format.html" rel="nofollow noreferrer">APT</a>. It integrates well with the CI (standard build artifact) and is more alive than for instance word document. It is also possible to generate PDFs and other formats when needed.</p>
| 18,363 |
<p>Is there a way to get MVEL 2.0 ( <a href="http://mvel.codehaus.org/" rel="nofollow noreferrer">http://mvel.codehaus.org/</a> ) to work with functions with optional parameters?</p>
<p>I would like to be able to eval this:</p>
<p>trunc('blahblah',2)</p>
<p>but also</p>
<p>trunc('blahblah',2,'[...]');</p>
<p>Now i... | <p>In java you can declare multiple methods with the same name, but a different arguments.
That way you can support (in a limited way) optional parameters.
Eg.:</p>
<pre><code>private void method(Object obj1) {
Object obj2 = new Object("Default");
method(obj1, obj2);
}
private void method(Object obj1, Object ... | <p>MVEL has a bug where it accepts methods with varargs, but only executes the method with non-varargs. So you should have both a varargs and non-varargs method. Do a lookup on the varargs method, but only the non-varargs will get called.</p>
<pre><code>parserContext = new ParserContext();
parserContext.addImport("col... | 40,505 |
<p>I'm writing a web app (Java) which allows users to select contacts. The contacts details can be downloaded (currently in CSV format) and used to perform a mail merge in Word 2007.</p>
<p>I would like to use a format which is a bit more 'robust' than CSV. Those of you in non-English areas will know the comma/semicol... | <p>I prefer TSV (Tab Separated Values) for this sort of task. I have never encountered a dataset containing literal tabs that were desired in the output.</p>
| <p>Not having much experience in "non-English" mail merges, what's wrong with exporting the contacts in xlsx format and using that as your datasource?</p>
| 41,023 |
<p>I'm creating a rather "dirty" business connector of my own here, and I'm having trouble finding those "custom fields" that have been created. </p>
<p>They show up in AX - but in the SQL-database, they are not mentioned at all... I have a hunch that all custom fields are stored somewhere else in the database, so tha... | <p>To disable caching for your extension go to your piX/class.tx_XXX_piX.php file and remove the following line (below your class declaration):</p>
<pre><code>var $pi_checkCHash = true;
</code></pre>
<p>You also need to add the following line in the main method (below $this->pi_loadLL();):</p>
<pre><code>$this->p... | <p>When you have created your extension with Kickstarter you also have to go to the file [yourextension]/ext_localconf.php and change this line</p>
<pre><code>t3lib_extMgm::addPItoST43($_EXTKEY,'piX/class.tx_yourextension_piX.php','_piX','list_type',0);
</code></pre>
<p>to this:</p>
<pre><code>t3lib_extMgm::addPIto... | 37,397 |
<p>I have a helper class pulling a string from an XML file. That string is a file path (so it has backslashes in it). I need to use that string as it is... How can I use it like I would with the literal command?</p>
<p>Instead of this:</p>
<pre><code>string filePath = @"C:\somepath\file.txt";
</code></pre>
<p>I want... | <p>I don't think you have to worry about it if you already have the value. The @ operator is for when you're specifying the string (like in your first code snippet).</p>
<p>What are you attempting to do with the path string that isn't working?</p>
| <p>You've got it backwards. The @-operator is for turning literals into strings, while keeping all funky characters. Your path is already a string - you don't need to do anything at all to it. Just lose the @.</p>
<pre><code>string filePath = helper.getFilePath();
</code></pre>
| 14,684 |
<p>Is there a way short of writing a seperate batch file or adding a system call to pause or getch or a breakpoint right before the end of the main function to keep a command window open after a command line application has finished running?</p>
<p>Put differently, is there a way in the project properties to run anoth... | <p>As you may know, at least in the C# project system, pressing Ctrl-F5 will add a "press any key to continue" to the end. But this doesn't run under the debugger, so I endorse the prior answer that said 'put a breakpoint at the end of main'.</p>
| <p>In C++</p>
<pre><code>#include <conio.h>
// .. Your code
int main()
{
// More of your code
// Tell the user to press a key
getch(); // Get one character from the user (i.e a keypress)
return 0;
}
</code></pre>
<p>If you are in a batch file, the command "pause" outputs "Press any key to con... | 34,919 |
<p>I have the following code:</p>
<pre><code>abstract class AbstractParent {
function __construct($param) { print_r($param); }
public static function test() { return new self(1234); }
}
class SpecificClass extends AbstractParent {}
</code></pre>
<p>When I invoke <code>SpecificClass::test()</code>, I am getting an ... | <p>You can do it in PHP 5.3, which is still in alpha. What you're looking for is called Late-Static-Binding. You want the parent class to refer to the child class in a static method. You can't do it yet, but it's coming...</p>
<p>Edit: You can find more info here - <a href="http://www.php.net/manual/en/language.oop5.l... | <p>You can do it in PHP 5.3, which is still in alpha. What you're looking for is called Late-Static-Binding. You want the parent class to refer to the child class in a static method. You can't do it yet, but it's coming...</p>
<p>Edit: You can find more info here - <a href="http://www.php.net/manual/en/language.oop5.l... | 47,946 |
<p>I need to create a request for a web page delivered to our web sites, but I need to be able to set the host header information too. I have tried this using HttpWebRequest, but the Header information is read only (Or at least the Host part of it is). I need to do this because we want to perform the initial request ... | <p>I have managed to find out a more long winded route by using sockets. I found the answer in the MSDN page for IPEndPoint:</p>
<pre><code>string getString = "GET /path/mypage.htm HTTP/1.1\r\nHost: www.mysite.mobi\r\nConnection: Close\r\n\r\n";
Encoding ASCII = Encoding.ASCII;
Byte[] byteGetString = ASCII.GetBytes(g... | <p>Alright, little bit of research turns up this:</p>
<p><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=384456" rel="nofollow noreferrer">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=384456</a></p>
<p>Seems MS <em>may</em> do something abo... | 46,823 |
<p>The Windows Indexing Service pauses itself when it detects the "user is active." Is there a registry entry or something to make it continue indexing regardless of user activity?</p>
<p><strong>Clarification:</strong> in Windows XP</p>
| <p>Microsoft Indexing service indexing optimization is controlled by a set of registry entries in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex</p>
<p>Follow these steps to easily tune the performance of Indexing Service to index documents immediately:</p>
<ol>
<li>Open the Computer Management cont... | <p>Right-click on the Index service icon in the system tray (the magnifying glass), and click "Index Now." I know it sounds like an action that will only happen once, but this is in fact a toggle that, when turned on, does exactly what you are asking.</p>
| 33,874 |
<p>In the following one to many</p>
<pre><code>CREATE TABLE source(id int, name varchar(10), PRIMARY KEY(id));
CREATE TABLE params(id int, source int, value int);
</code></pre>
<p>where params.source is a foreign key to source.id</p>
<pre><code>INSERT INTO source values(1, 'yes');
INSERT INTO source values(2, 'no');... | <p><strong>Edit</strong> Modified to handle case where there can be multiple occurances of the value for a given source.</p>
<p>Try this:</p>
<pre><code>SELECT
*
FROM
source
WHERE
(
SELECT COUNT(DISTINCT value)
FROM params
WHERE params.source = source.id
AND params.value ... | <p><strong>Edit</strong> Modified to handle case where there can be multiple occurances of the value for a given source.</p>
<p>Try this:</p>
<pre><code>SELECT
*
FROM
source
WHERE
(
SELECT COUNT(DISTINCT value)
FROM params
WHERE params.source = source.id
AND params.value ... | 25,749 |
<p>Hi all I've just started a new project using Visual Web Developer 2008 Express and all my code behinds are not in any namespace. How can I set the default namespace for the project?</p>
<p>In VisualStudioPro it used to be in project properties, the website properties in Visual Web Developer 2008 Express seem very ... | <p>Visual Web Developer (prior to 2008 SP1) does not support Web Application projects. Default namespace is only available in Web Application projects.</p>
<p>If you really want to add your classes to a namespace, you should do it manually (the namespace surround with code snippet can prove pretty useful) by enclosing... | <p>Do Find and Replace to find your namespace and replace it with what you want.</p>
| 45,059 |
<p>Can anyone recommend a reliable and cost effective TTS engine for use in a telephony application?</p>
<p>Requirements are:</p>
<ul>
<li>Must support the Windows platform</li>
<li>Must have rich language support including support for accents (ie US English vs GB English)</li>
</ul>
<p>Nice to have:</p>
<ul>
<li>I... | <p>I can't vote up the last answer yet (low reputation I suppose). We use ATT Audrey for a UK voice and ATT Crystal for a US voice in our application. We are also cost sensitive and found this to be the best bang for the buck. </p>
<p>Also <a href="http://www.neospeech.com" rel="nofollow noreferrer">neospeech</a> stil... | <p>AT&T NaturalVoices is also very good and comes with any accents</p>
<p><a href="http://www.research.att.com/~ttsweb/tts/demo.php" rel="nofollow noreferrer">Demo</a></p>
<p><a href="http://www.naturalvoices.att.com/" rel="nofollow noreferrer">AT&T NaturalVoices</a></p>
| 21,662 |
<p>I have a friend who is finishing up his masters degree in aerospace engineering. For his final project, he is on a small team tasked with writing a program for tracking weather balloons, rockets and satellites. The program receives input from a GPS device, does calculations with the data, and uses the results of tho... | <p>splitting should do the trick. Here's a good way to extract the data, as well:</p>
<pre><code>>>> line = "$GPRMC,199304.973,3248.7780,N,11355.7832,W,1,06,02.2,25722.5,M,,,*00"
>>> line = line.split(",")
>>> neededData = (float(line[2]), line[3], float(line[4]), line[5], float(line[9]))
&g... | <p>I suggest a small fix in your code because if used to parse data from the previous century the date looks like sometime in the future (for instance 2094 instead of 1994)</p>
<p>My fix is not fully accurate, but I take the stand that prior to the 70's no GPS data existed.</p>
<p>In the def parse function for RMC se... | 40,177 |
<p>I know that MAC OS X 10.5 comes with Apache installed but I would like to install the latest Apache without touching the OS Defaults incase it causes problems in the future with other udpates. So I have used the details located at: <a href="http://diymacserver.com/installing-apache/compiling-apache-on-leopard/" rel=... | <p>Add this to your ~/.bash_profile which means that your architecture is 64-bit ant you’d like to compile Universal binaries.</p>
<pre><code>export CFLAGS="-arch x86_64"
</code></pre>
| <p><a href="http://www.mail-archive.com/dev@httpd.apache.org/msg38674.html" rel="nofollow noreferrer">This page</a> claims that a flag for gcc (<code>maix64</code>) should do the trick. Give it a whirl, and if you need any more help, post back here.</p>
| 4,544 |
<p>I have an expression tree I have created by parsing an Xml using the expression class in C#. <a href="https://stackoverflow.com/questions/344741/how-do-i-create-an-expression-tree-by-parsing-xml-in-c">See this question</a>.</p>
<p>I only have Add, Subtract, Divide, Multiply, Parameters, And and Or in my Expression ... | <p>You need to create a lambda - i.e.</p>
<pre><code>var lambda = Expression.Lambda<Func<float,int>>(body, param);
Func<float,int> method = lambda.Compile();
int v = method(1.0); // test
</code></pre>
<p>where "body" is your expression tree (taking a float, returning an int) involving the <code>Para... | <p>You need to create a lambda - i.e.</p>
<pre><code>var lambda = Expression.Lambda<Func<float,int>>(body, param);
Func<float,int> method = lambda.Compile();
int v = method(1.0); // test
</code></pre>
<p>where "body" is your expression tree (taking a float, returning an int) involving the <code>Para... | 45,086 |
<p>How can I tell from the assembly name, or assembly class (or others like it), whether an assembly is part of the <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> framework (that is, <code>System.windows.Forms</code>)?</p>
<p>So far I've considered the PublicKeyToken, and CodeBase prop... | <p>No, it doesn't begin with "System". You could check "WindowsBase" which is a framework assembly.</p>
<p>You can't also check the PublicKeyToken, because there are other Microsoft assemblies signed with the "default" keys, but they are not part of the .NET Framework (Visual Studio assemblies).</p>
<p>The best way o... | <p>You could use reflection to look at the publisher of the assembly, and coordinate that with the assembly's path. If you find an assembly whose publisher is Microsoft, and which exists somewhere below <code>C:\Windows\Microsoft.NET\Framework</code> it's a safe bet it's part of the runtime.</p>
<p>On second thought, ... | 7,538 |
<p>I am looking to export a few files into Excel from MS Access based on querying a table.</p>
<p>It's like this the query will be </p>
<pre><code>select * from table where field = 0
</code></pre>
<p>I would like to loop the query till field is 9 and I want to save each
result in a different name like field... | <p>I finally got it done this way</p>
<pre><code>For i = 1 To 9
CurrentDb.QueryDefs("MyQuery").SQL = "Select * from table Where field = " & i
DoCmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel9, _
"MyQuery", _
... | <p>Speicify the sheet name in the "Range" field of the TransferSpreadsheet Command.</p>
<pre><code>DoCmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel9, _
"tablename", _
"filename.xls", _
True, _
... | 49,023 |
<p>I have an authentication script (<strong><code>CheckLogin.aspx</code></strong>), and if any of the credentials do not match my application will redirect (via <strong><code>Server.Transfer</code></strong>) to the access denied page (<strong><code>forbidden.aspx</code></strong>). Each time my script runs,it gets an <... | <p>Sometimes you have to precede the page path with a tilde to indicate the root directory:</p>
<pre><code>'~/forbidden.aspx'
</code></pre>
| <p>Are you using "~/..." to make sure all your paths are relative? </p>
<p>By the way, you should just set up page access via Web.config, by using the <code><location></code> tags. That way you can have some sort of role-based access, without much custom code.</p>
| 35,098 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.