instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>In Ruby-on-Rails, this is called a "polymorphic association."</p>
<p>I have several <code>Commentable</code> things in my application, the tables for each are below:</p>
<pre><code>Post
id | title | text | author (FK:Person.id) | ...
Person
id | name | ...
Photo
id | title | owner (FK:Person.id) | path | ...
</c... | <p>This technique is known colloquially in the SQL world as 'subclassing'. For a worked example (SQL Server syntax but is easily adapted for MS Access), see <a href="http://web.archive.org/web/20100309034643/http://consultingblogs.emc.com/davidportas/archive/2007/01/08/Distributed-Keys-and-Disjoint-Subtypes.aspx" rel="... | <p>I believe many people make meta-tables for that sort of thing. Pretty much exactly as you described it.</p>
| 18,633 |
<p>When an ASP.NET application errors out and generates the yellow-screen display, I'd like to create some kind of link from the error page which would jump directly to the correct line of code in Visual Studio.</p>
<p>I'm not sure how to approach this, or if there are any tools already in existence which accomplish i... | <p>You would probably need to embed an ActiveX control in the page for something like that to be possible.</p>
| <p>The easiest, laziest thing I could think of would be to have the process happen thusly:</p>
<ol>
<li>The yellow screen is modified so the line is source code is clickable. When clicked it delivers a small text file with the source file name and line number.</li>
<li>A small program on the PC is tied to the extensi... | 4,090 |
<p>I have a dropdownlist with the autopostback set to true. I want the
user to confirm if they really want to change the value,
which on post back fires a server side event (selectedindexchanged).</p>
<p>I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") b... | <p>Have you tried to set the onChange event to a javascript function and then inside the function display the javascript alert and utilize the __doPostback function if it passes?</p>
<p>i.e.</p>
<pre><code>
drpControl.Attributes("onChange") = "DisplayConfirmation();"
function DisplayConfirmation() {
if (confirm... | <p>Make sure your event is wired:</p>
<pre><code>dropDown.SelectedIndexChanged += new EventHandler(dropDown_SelectedIndexChanged);
</code></pre>
<p>You can also apply a client-side attribute to return the confirmation. Set the index accordingly if cancelled.</p>
<pre><code>dropDown.Attributes.Add("onchange", "javasc... | 9,946 |
<p>I have a C++ STL set with a custom ordering defined.</p>
<p>The idea was that when items get added to the set, they're naturally ordered as I want them.</p>
<p>However, what I've just realised is that the ordering predicate can change as time goes by.</p>
<p>Presumably, the items in the set will then no longer be... | <p><code>set</code> uses the ordering to lookup items. If you would insert N items according to ordering1 and insert an item according to ordering2, the set cannot find out if the item is already in.</p>
<p>It will violate the class invariant that every item is in there only once.</p>
<p>So it <em>does</em> harm.</p... | <p>1) Harmful - no. Result in crashes - no. The worst is indeed a non-sorted set.</p>
<p>2) "Refreshing" would be the same as re-adding anyway!</p>
| 29,650 |
<p>We have an application that use MSSQL, when we move to 2005, basically we recommend to our client to apply the backward compatibility package and that’s it, but somebody ask me what to do to be 100% compatible on 2005.
I was thinking on
1. Compatibility level: SQL Server 2005 (90)
2. Remove any DMO reference, and re... | <p>Actually you are talking about two different things.</p>
<p>One is to update the database to SQL 2005 level, to be able to use the functions only available there. It can be done easily by setting the compatibility level. However in this case SQL 2000 clients can have problems with it.</p>
<p>Second is to upgrade y... | <p>If you have any DTS packages they will need to be converted to SSIS packages to be fully compatible. </p>
<p>If you really want to make sure that you are fully compatible, check out in the documentation which features are being deprecated and if you are using any of them, go ahead and fix them now.</p>
<p>YOu migh... | 30,076 |
<p>In its enthusiasm to <a href="http://www.postgresql.org/docs/current/interactive/textsearch-intro.html" rel="nofollow noreferrer">stemm tokens into lexemes</a>, PostgreSQL Full Text Search engine also reduce proper nouns. For instance:</p>
<pre><code>essais=> select to_tsquery('english', 'bortzmeyer');
to_tsquer... | <p>The point of stemming algorithms is <em>not</em> to reduce every word to its proper stem; the goal is to reduce words that are alike to a common stemmed form. The goal is generally not to get a word that can be presented to the user: even if 'balling' and 'ball' would both produce 'kjebnkkekaa' the algorithm is corr... | <p>To reduce stemming you can use the <a href="https://www.postgresql.org/docs/11/textsearch-dictionaries.html#TEXTSEARCH-SIMPLE-DICTIONARY" rel="nofollow noreferrer">simple dictionary</a> instead of <code>english</code>.</p>
<pre class="lang-sql prettyprint-override"><code>SELECT to_tsquery('simple', 'bortzmeyer');
</... | 46,134 |
<p>How do I get the complete request URL (including query string) in my controller? Is it a matter of concatenating my URL and form parameters or is there a better way.</p>
<p>I checked <a href="https://stackoverflow.com/questions/40680/how-do-i-get-the-full-url-of-the-page-i-am-on-in-c">this</a> question, but it seem... | <p>You can use <a href="https://msdn.microsoft.com/en-us/library/system.uri.pathandquery(v=vs.110).aspx" rel="noreferrer"><code>Request.Url.PathAndQuery</code></a>.</p>
<p>MVC5: use <strong>Request.RequestUri.PathAndQuery</strong></p>
| <p>Within the controller, you can access <code>Request.RawUrl</code>.</p>
| 32,670 |
<p>Suppose I have a simple XHTML document that uses a custom namespace for attributes:</p>
<pre><code><html xmlns="..." xmlns:custom="http://www.example.com/ns">
...
<div class="foo" custom:attr="bla"/>
...
</html>
</code></pre>
<p>How do I match each element that has a certain custom at... | <p><a href="https://jquery.com/" rel="nofollow noreferrer">jQuery</a> does not support custom namespaces directly, but you can find the divs you are looking for by using filter function.</p>
<pre><code>// find all divs that have custom:attr
$('div').filter(function() { return $(this).attr('custom:attr'); }).each(funct... | <p>You should use <code>$('div').attr('custom:attr')</code>.</p>
| 11,694 |
<p>This error just started popping up all over our site.</p>
<p><strong><em>Permission denied to call method to Location.toString</em></strong></p>
<p>I'm seeing google posts that suggest that this is related to flash and our crossdomain.xml. What caused this to occur and how do you fix?</p>
| <p>Are you using javascript to communicate between frames/iframes which point to different domains? This is not permitted by the JS "same origin/domain" security policy. Ie, if you have</p>
<pre><code><iframe name="foo" src="foo.com/script.js">
<iframe name="bar" src="bar.com/script.js">
</code></pre>
<p>... | <p>This <a href="http://willperone.net/Code/as3error.php" rel="nofollow noreferrer">post</a> suggests that there is one line that needs to be added to the crossdomain.xml file.</p>
<pre><code><allow-http-request-headers-from domain="*" headers="*"/>
</code></pre>
| 5,042 |
<p>I recently (a few days ago) installed .NET 3.5 SP1 and subsequently an aspnet_client folder with a bunch of Crystal Reports support code has been injected into my .net web apps.</p>
<p>Anybody else experienced this?
Am I correct in saying that this is a side effect of SP1?
What is this?</p>
| <p>No it is a side effect of Crystal Reports. If you don't need it, remove it from your computer it is nothing but a headache. It is safe to delete the aspnet_client folder.</p>
| <p>What do you need to remove? It keeps on adding that folder back to the project that I'm working on...</p>
| 3,447 |
<p>In my <a href="https://stackoverflow.com/questions/39371/database-exception-handling-best-practices">previous question</a>, most commenters agreed that having validation logic both at client & server sides is a good thing.</p>
<p>However there is a problem - you need to keep your validation rules in sync between... | <p>As mentioned in one of the answers to the other post, if you are going to keep your layers separated, there is no good way to avoid duplicating the validation logic in each layer. If you use something to automatically tie them together, you have introduced a sort of coupling between the layers that might hinder you... | <p>If you're using ASP.Net there are a number of validation controls you can use. These controls are written in a very generic way, such that most of them automatically duplicate your validation logic between the client and server, even though you only set options for the control in one place. </p>
<p>You are also f... | 6,072 |
<p>I want to write a C# application where it connects to a telnet server and communicates to the server. I was wondering how a telnet server sends information to the client. I have looked (skimmed) over the <a href="http://www.faqs.org/rfcs/rfc854.html" rel="nofollow noreferrer">Telnet RFC</a> and looked at the incomin... | <p>Moving the cursor and changing the color isn't done by the telnet protocol.</p>
<p>Your telnet client is emulating a <a href="http://en.wikipedia.org/wiki/Computer_terminal" rel="nofollow noreferrer">terminal</a>, most probably a VT-100 variant. To move the cursor and change the color, the server sends escape seque... | <p>A <a href="http://www.google.com/search?q=c%23+telnet+client&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a" rel="nofollow noreferrer">simple Google search</a> reveals many open source Telnet (and other network protocol) clients written in C#. You could just download the ... | 29,005 |
<p>I've been utilizing <code>NHibernate 2.0.1.4000</code> on all current .NET 3.5 SP1 projects and have had no problems with any other queries (utilizing either the Query or Criteria APIs), until some new business logic dictated the necessity of a new query in this particular project against the application's database ... | <p>First, you should really return a reference from your operator+=, since you can later use them to implement operator+, operator- and so on. I will change that accordingly.</p>
<p>Also, your do_for_each has to be a template, since it has to know the precise type of the function object, as binary function objects are... | <p>I think litb is on the correct track and answered the exact question.<br>
But I think this is the wrong solution.</p>
<p>I would rather not use the do_for_each() but rather use the std::transform() directly:</p>
<pre><code>template<class T, unsigned int D>
class Vector
{
public:
Vector& operator ... | 37,452 |
<p>So, I understand <i>that</i> the following doesn't work, but <i>why</i> doesn't it work?</p>
<pre><code>interface Adapter<E> {}
class Adaptulator<I> {
<E, A extends I & Adapter<E>> void add(Class<E> extl, Class<A> intl) {
addAdapterFactory(new AdapterFactory<E... | <p>I'm also not sure why the restriction is there. You could try sending a friendly e-mail to the designers of Java 5 Generics (chiefly Gilad Bracha and Neal Gafter).</p>
<p>My guess is that they wanted to support only an absolute minimum of <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.9... | <p>I had the same problem, and found a working solution:</p>
<pre><code> interface Adapter<E>
{}
interface Adaptulator<I>
{
void add(Container<?, ? extends I> container);
}
static final class Container<E, I extends Adapter<E>>
{
public final Cla... | 23,983 |
<p>I need to implement version control, even for just the developing I do at home. I have read about how great subversion is for the past couple of years and was about to dedicate myself to learning this on the side until I heard about Git being the up and coming version control system.</p>
<p>Given the situation, sho... | <p>The most important thing about version control is:</p>
<p><em><strong>JUST START USING IT</strong></em></p>
<p>Not using version control is a horrible idea. If you are not using version control, stop reading right now and start using it.</p>
<p>It is very easy to convert from</p>
<pre><code>cvs<->svn<->g... | <p>Short answer: Subversion if you're the only one coding it or you're on site with everyone you work with. GIT if you're working with people in different sites and your code base is huge.</p>
<p>Subversion is really, really easy to setup and get using. It is also nice because you can do relatively complicated things ... | 2,477 |
<p>I have created a windows installer for a windows forms app as an MSI.
I have published this and put it in a zip file and sent it to the client.
When they try to run the installer they get the message
'The publisher could not be verified. Are you sure you want to run this software?’</p>
<p>Is there a setting or som... | <p>Is this a certificate issue? I haven't had to do this with msi (I usually use ClickOnce, which makes this very easy), but a quick search shows things like <a href="http://www.advancedinstaller.com/digital-signatures.html" rel="nofollow noreferrer">this</a> or on MSDN <a href="http://msdn.microsoft.com/en-us/library/... | <p>1) Digitally sign MSI before shipping as others have suggested (we use a Verisign Code Signing Cert here)</p>
<p>2) If customer was editing, advise them to use Orca to create a transform rather than editing the MSI directly. This way the original signature will still be valid</p>
<p>3) If your guys were editing, s... | 38,703 |
<p>In IE6 the paragraph following the empty paragraph is displayed with the background color of the empty paragraph, which I'm guessing is wrong! It works correctly in Firefox, but I haven't checked IE7.</p>
<p>Is there a CSS solution to this problem, or do I have to remove the empty element?</p>
<p>(I would rather ... | <p>An empty paragraph is meaningless - which means you're probably writing the wrong HTML.</p>
<p>Also, your example doesn't have a DOCTYPE - a valid DOCTYPE is essential for getting browsers to correctly interpret your code, without one you'll be stuck in quirks mode.</p>
<p>But anyway, the simplest workaround for t... | <p>One strange workaround I found was to add position:relative to the potentially empty paragraphs like this:</p>
<pre><code><p style='background-color:red;position:relative'></p>
<p>Unstyled background fine because previous element is 'relative'</p>
</code></pre>
| 36,838 |
<p>How do you generate a X.509 public and private key pair and a signing request (CSR file) to be sent to a CA for signing in C#?</p>
| <p>CountIf can count values equal to one chosen. Unfortunately it seems that there is no good candidate for such function. Alternatively you can use additional column with If to display 1 or 0 if the value fits in range or not accordingly:</p>
<pre><code>=If(AND({list_cell}>=MinVal; {list_cell}<=MaxVal); 1; 0)
<... | <p>Assuming:</p>
<ul>
<li>your range is A1:A10</li>
<li>your lower bound is at B1</li>
<li>your upper bound is at B2</li>
</ul>
<p>then what you want can be achieved by:</p>
<pre><code>=COUNTIFS(A1:A10, ">" & B1, A1:A10, "<" & B2)
</code></pre>
<p>(you might need to change commas into ... | 21,918 |
<p>I'm developing an iPhone app. A simple image is the background of the main view.
I've set an UIImageView in the background and set an image in, using IB.</p>
<p>the image is a 160dpi PNG image. It appears like CRAP in IB. When running in the simulator it is ok, crisp.</p>
<p>How am I supposed to work and place my ... | <p>IB is not a tool for designing a UI, it is a tool for implementing one. It is designed to perform well rather than display well (this is more important in complex desktop UI design than mobile but the tool is the same for both). The best advice is perhaps to take a cue from the publishing world (where this is a comm... | <p>I don't see anything like this when I work with images in IB. Maybe there's something special about your PNG file? You say that it's 160 dpi, which is fairly irrelevant. More important are what its pixel diomensions are, and how they compare to the screen size.</p>
<p>Maybe the UIImageView is having trouble renderi... | 39,866 |
<p>At the moment I have a set of divs, generated dynamically by php and all having their ids starting with 'itembox', with a count number appended. I have a droppable garbage bin area on the page so that the user can delete an individual itembox by fdragging and dropping on to the bin.</p>
<p>My problem is that the dr... | <p>I guess the problem must lie in the accept option of your droppable initializer. Just try the following:</p>
<pre><code>$('#mydroppable').droppable(
{
accept: function() { return true; },
drop: function () { alert("Dropped!"); }
});
</code></pre>
<p>Now this will accept everything, so you should probably i... | <p>You can also try the below solution.</p>
<pre><code><script type="text/javascript">
$(document).ready(function(){
$('.srcfield').draggable({
revert: true
});
$('#trash').droppable({
accept : ".srcfield",
over: function(){
$(this).removeClass('out').addClass... | 35,920 |
<p>I'm trying to run an ASP.NET 2.0 application on an XP machine. As far as I know, everything is configured correctly. However, I receive the following message:</p>
<blockquote>
<p>Server Application Unavailable</p>
</blockquote>
<p>And two events appear in the Application event log each time:</p>
<blockquote>
... | <p>You might also find <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="nofollow noreferrer">Process Monitor</a> useful for troubleshooting these types of problems. If you set-up a filter to show all activity containing aspnet_wp.exe, it should show you which files it's attempting to access... | <p>We used to have this problem with ASP.NET because when Visual Studio created its temporary copy of the assemblies the indexing service would start scanning them for viruses, and this would occasionally cause an 'access denied' message because the debugger would be trying to open a shared file. Telling the indexing s... | 24,532 |
<p>I'd like to implement a way to display a list of stored addresses sorted by proximity to a given address.</p>
<p>Addresses in the list will be stored in a database table. Separate parts have separate fields (we have fields for postal code, city name, etc.) so it is not just a giant <code>varchar</code>. These are... | <p><a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding" rel="noreferrer">Google</a> and <a href="http://developer.yahoo.com/maps/rest/V1/geocode.html" rel="noreferrer">Yahoo!</a> both provide geocoding services for free. You can calculate distance using the <a href="http://en.wikipedia.org/... | <p>I'd suggest investigating the google maps API.</p>
<p>It would require you to have an external connection (and for it to be alright to shunt the data over it to a web service) but it provides what you require, namely the distance by asking for a route between 2 points and getting the distance from it.</p>
<p><a hr... | 14,122 |
<p>We are using Hibernate 3.1 with Spring MVC 2.0. Our problem occurs when data is updated on the database directly (not in the application). We use a Filter to filter a collection of results by whether the orders are opened or closed. If we change an order on the DB to be closed, the filter returns the correct list... | <p>The Session always has a "first-level" cache, so if you're using one Session everything you read through it is going to be cached. Hibernate will execute the query against the database, but then as it's building the objects it checks the Session cache to avoid building a new object, so any columns changed in the dat... | <p>You can't really expect Hibernate to properly manage the "dirty" state of its cached objects when you have processes "going behind its back". If you're using annotations, I'd suggest marking the status (if that's the field's name) as @Transient, so that Hibernate knows it has to get this value from the database eve... | 21,664 |
<p>I have a page on which I must load controls dynamically based on the user selection.
Let's say that I have something like this:</p>
<pre><code>public static readonly Dictionary<string, string> DynamicControls = new Dictionary<string, string>
{
{ "UserCtrl1", "~/Controls/UserCtrl1.as... | <p>You don't need to cast the result from LoadControl.</p>
<p>This should do:</p>
<pre><code>private Control GetControl()
{
string dynamicCtrl = CurrentItem.DynamicControl;
string path = SomeClass.DynamicControls[dynamicCtrl];
Control ctrl = LoadControl(path);
return ctrl;
}
</code></pre>
| <p>Can you not just use foreach on your dictionary and do your test and LoadControl in there?</p>
| 35,464 |
<p>Could anyone explain with some examples when it is better to call functions by reference and when it is better to call by address?</p>
| <p>Pass your arguments to function using reference whenever possible.
Passing arguments by reference eliminate the chance of them being NULL.
If you want it to be possible to pass NULL value to a function then use pointer.</p>
| <p>This has already been discussed. See <a href="https://stackoverflow.com/questions/114180/pointer-vs-reference">Pointer vs. Reference</a>.</p>
| 17,349 |
<p>I'm having trouble understanding why a WSDL would be so beneficial, when the truth is that the service definition is not that human-readable, and most developers will use automated tools to consume it to generate objects in the application. Why isn't it easier for a service provider to define a simple XML schema, an... | <p>At one time, WSDL was popular and I'm sure for internal tools for many companies (and large SOA systems), WSDL is still in use. But you're correct, the adoption of REST has taken WSDL off the map a bit once it "hit the scene".</p>
<p>Take for example Amazon S3. They offer a WSDL along with the REST API. I had re... | <p>WSDL is XML representation file and a communication standard for any external system to communicate with your webservice regardless its implementation technologies or platforms. FYI, RESTful services can use a definition language file called WADL to describe the service as well. So, it's not about webservices only.<... | 28,446 |
<p>I have a very specific problem using C# and a Windows MDI Form application. I want to display two (or more) images to the user, a 'left' and a 'right' image. The names of the images are concealed from the user, and then the user selects which image they prefer (this is part of a study involving medical image quali... | <p>Why are you using an MDI interface? Surely a single window with a TableLayoutPanel or similar providing layout would be more suitable. The only reason you'd want to use a MDI layout is to allow the users to move the windows, which as far as I can tell from your description of the problem isn't desirable anyway?</p>
| <p>Could you avoid this problem by (before displaying the images) you:</p>
<ol>
<li><p>Put the image references in a structure (array or similar).</p></li>
<li><p>Have a recursive function build a reverse order structure (or reorder the original).</p></li>
<li><p>Use the new reversed order structure to build your chil... | 8,950 |
<p>Everything I have read says that when making a managed stored procedure, to right click in Visual Studio and choose deploy. That works fine, but what if I want to deploy it outside of Visual Studio to a number of different locations? I tried creating the assembly with the dll the project built in SQL, and while it d... | <p>Copy your assembly DLL file to the local drive on your various servers. Then register your assembly with the database:</p>
<pre><code>create assembly [YOUR_ASSEMBLY]
from '(PATH_TO_DLL)'
</code></pre>
<p>...then you create a function referencing the appropriate public method in the DLL:</p>
<pre><code>create pro... | <p>For add some more detail/clarification to @kcrumley's anwser above:</p>
<p>[NAME_SPACE] is the fully qualified <strong>type name</strong> and not just the namespace<br>
- i.e. if your class is called <code>StoredProcedures</code> in a namespace of <code>My.Name.Space</code>, you must use <code>[My.Name.Space.Store... | 15,120 |
<p>How can I detect in C# whether two files are absolutely identical (size, content, etc.)?</p>
| <p>Here's a simple solution, which just reads both files and compares the data. It should be no slower than the hash method, since both methods will have to read the entire file. <strong>EDIT</strong> As noted by others, this implementation is actually somewhat slower than the hash method, because of its simplicity. Se... | <p>Or you can compare the two files byte-for-byte....</p>
| 25,912 |
<p>I'm working on a forums system. I'm trying to allow users to see the posts they've made. In order for this link to work, I'd need to jump to the <strong>page</strong> on the particular topic they posted in that contained their post, so the bookmarks could work, etc. Since this is a new feature on an old forum, I'd ... | <p>hmm this solution makes a few assumptions, but i think it should work for what you're trying to do if i understand it correctly:</p>
<pre><code>SELECT count(post_id) FROM posts
WHERE thread_id = '{$thread_id}' AND date_posted <= '{$date_posted}'
</code></pre>
<p>this will get you the number of rows in a parti... | <p>The thing about databases is that there is no real "order" to them. You can use the SCOPE_IDENTITY operator to return the unique ID of the inserted record, then write some sort of function to paginate until that record is found.</p>
| 26,186 |
<p>Is there a way to execute a full ASPX source file where the page source is from a string/database/resource and not a file on the file system? It's straightfoward to render dynamic content/images/etc using HTTP Handlers and Modules and writing to the Response, but there doesn't seem to be a way to execute/compile AS... | <p>Perhaps you need a <a href="http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx" rel="noreferrer">virtual path provider</a>. It allows you to store the ASPX and codebehind in different media - RDBMS, xml file etc.</p>
| <p>I knew that SharePoint Server used to keep the ASPX pages in the database and not on the file system. Details, however, I do not hold.</p>
| 18,621 |
<p>I've been trying to figure this out for about two weeks. I'm able to create email items in people's folders, read the folders, all that stuff but for the life of me I can not get anything to work with the calendars.</p>
<p>I can provide examples of the XML I'm sending to WebDav but hoping someone out there has done... | <p>I did this in a Java program a few years back, and the way I did it was to PUT a VCALENDAR document into the folder. One quirk is that the VCALENDAR had to be enclosed within an RFC822 message. It's a bizarre combination of WebDAV, email, and iCAL/VCAL, but it worked at the time on Exchange 2003 hosted at Link2Exc... | <p>have a look at this
<a href="http://golemlab.wordpress.com/2009/09/13/php-owa-2003-calendar-fun/" rel="nofollow noreferrer">http://golemlab.wordpress.com/2009/09/13/php-owa-2003-calendar-fun/</a></p>
| 11,387 |
<p>I need a nice JSP editor plugin for Eclipse. What are my choices?</p>
| <p>As well as Amateras you could try <a href="http://www.eclipse.org/webtools/" rel="nofollow noreferrer">Web Tools Project</a> or <a href="http://www.aptana.com/" rel="nofollow noreferrer">Aptana</a>. Although they will both give you way more than just a jsp editor.</p>
<p><strong>Edit 2010/10/26 (comment from <a hr... | <p><a href="http://www.oracle.com/technology/products/workshop/index.html" rel="nofollow noreferrer">Oracle Workshop for Weblogic</a> is supposed to have a pretty nice jsp editor but I've never used it. You needn't be using Weblogic to use it.</p>
| 26,041 |
<p>I'd like to create a utility in C# to allow someone to easily create a Certificate Authority (CA) in Windows. Any ideas/suggestions?</p>
<p>I know I can use OpenSSL to do this. In the end, I'll want this utility to do more than just generate a CA. I'd also like to avoid requiring the installation of OpenSSL in or... | <p>Since OpenSSL is Apache-licensed (i.e. BSD-style), you can simply distribute it as a DLL along with your application. (Maybe build it yourself to have only the features you need and all in a single DLL.) Then use p/invoke calls to talk with this DLL.</p>
<p>(Maybe you can even link the native code straight into you... | <p>Take a look at BouncyCastle <a href="http://www.bouncycastle.org/csharp/" rel="nofollow noreferrer">http://www.bouncycastle.org/csharp/</a></p>
| 10,527 |
<p>I'm having trouble with events in Internet Explorer 7.</p>
<p>When I have a form with <strong>two or more</strong> <code>input[type=text]</code> and I press enter, the events occurs in this order:</p>
<ol>
<li>submit button (<code>onClick</code>)</li>
<li>form (<code>onSubmit</code>)</li>
</ol>
<p>Sample code:</p... | <p>The button's onclick should (I think) only fire if the button is actually clicked (or when the focus is on it and the user clicks enter), unless you've added logic to change that.</p>
<p>Is the addition of the extra textbox possibly changing the tab order of your elements (perhaps making the button the default cont... | <p>You might want to include a dummy hidden input element to recreate the situation where you had two input elements... that way, you'll get both of the events fired</p>
<pre><code><FORM onSubmit="{alert('form::onSubmit'); return false;}">
<INPUT TYPE="text">
<input type="hidden" name="dummy">... | 3,071 |
<p>Is it possible to create Windows CE 5.0 images (ie: nk.bin) from VS2005/VS2008 without using Platform Builder? If so, how? Can a vendor BSP for WinCE 5 be loaded into VS2005/2008? Are there the parts to do this available for download from Microsoft (ie: the SDK), or must you buy the special bits (a la PB) from a ... | <p>No it is not possible to build an actual operating system image from Visual Studio. </p>
<p>You can build it from the command line without actually running the Platform Builder IDE, but you still need to have it installed.</p>
<p>Simply said the Platform Builder installation contains all of the public/driver sourc... | <p>I am afraid not.</p>
<p>Yes, you can build applications, static and dynamic libraries, Activex controls using Visual Studio.</p>
<p>But for building the bootable image you should use Platform Builder.
Oh..Thats why they call it so ;)</p>
<p>And it is not possible to upgrade or use addon to have platform builder f... | 15,299 |
<p>So you've created a ruby library.</p>
<p>How do you create and publish your rubygem? And what common pitfalls and gotchas are there pertaining to creating and publishing rubygems?</p>
| <p>There are several tools to help you build your own gems. <a href="http://seattlerb.rubyforge.org/hoe/" rel="noreferrer">hoe</a> and <a href="http://newgem.rubyforge.org/" rel="noreferrer">newgem</a> are the best-known, and have a lot of good qualities. However, hoe adds itself as a dependency to your gem, and newgem... | <p>I actually wrote a tutorial on exactly this, and I wrote it as I was learning. It's more focused on the game I'd written than a library. Also, it assumes you want to build the gem via rake rather than on your own:</p>
<ul>
<li><a href="http://kuidev.blogspot.com/2008/04/day-89-gemification.html" rel="nofollow nor... | 14,619 |
<p>In VS2008 I have written a C# service, an installer, and have created a setup package to install it. The service needs to load an xml file to operate. Where is the best place to put this file in the various filesystem folders offered by the VS setup project, and how do I then refer to these paths from my code?</p>
<... | <p>I am not sure which place is better to store the XML file. I don't think it will matter alot. But if you need to get special folder path in the system you can use Environment class to do so. The following line of code get the path of the Program Files:</p>
<pre><code>string path = Environment.GetFolderPath(Environm... | <p>You could always use the registry.</p>
| 26,484 |
<p>What is the shortcut key for <em>Run to cursor</em> in Visual Studio 2008?</p>
| <p>The shortcut key is <kbd>CTRL</kbd>+<kbd>F10</kbd>.</p>
| <p>You can first hit</p>
<pre><code>Ctrl + Shift + P
</code></pre>
<p>Then type "<code>> Run to Cursor</code>"</p>
<p>if you click on "gear" icon on the right, you can double click and set the shortcut at your convenience.</p>
<p>Also you can c/p: <code>@command:editor.debug.action.runToCursor</c... | 6,969 |
<p>I am working in Visual Studio 2005. I have multiple splitters on the screen. I have set the splitters IsFixed and I have also set fixed panel sizes. In addition to this I have locked the control. For some reason, when I switch into debug mode the splitter distance value is changing entirely on its own. These changes... | <p>The settings will stick to either mode you are in. But sometimes plugins or parts of VS does mess it up :(</p>
<p>I recall seeing a plugin written to save 'views', but when I tried it, it didnt work.</p>
| <p>I couldn't tell you what is causing this. The way that the windows forms splitter works is through the Docking property. There should be no need to lock the controls. All of the controls on the form should be docked. (Including the splitter)</p>
<p>For example, if you want to split vertically, you have your fir... | 25,722 |
<p>In a follow-up to a <a href="https://stackoverflow.com/questions/54789/what-is-the-correct-net-exception-to-throw-when-try-to-insert-a-duplicate-objec">previous question</a> regarding exceptions, what are best practices for creating a custom exception in .NET? </p>
<p>More specifically should you inherit from Syst... | <p>Inherit from <code>System.Exception</code>. <code>System.ApplicationException</code> is useless and the design guidelines say "<strong>Do not</strong> throw or derive from <code>System.ApplicationException</code>." </p>
<p>See <a href="http://blogs.msdn.com/kcwalina/archive/2006/06/23/644822.aspx" rel="nofollow nor... | <p>I think the single most important thing to remember when dealing with exceptions at any level (making custom, throwing, catching) is that exceptions are only for exceptional conditions.</p>
| 7,848 |
<p>I have assembly A with class Z that inherits from class X in assembly B. Now in a completely different solution, I have assembly C, which uses class Z.</p>
<p>The compiler complains unless assembly C has a reference to both assembly A & B. Even though assembly C does not use class Z directly in anyway.</p>
<p>... | <p>Yes, that's expected.</p>
<p>Think about it - how can assembly C know what it can do with Z unless it knows what the base class is? How could it know about any public members exposed by X?</p>
| <p>expected behavior; all assemblies up the chain must be referenced</p>
<p>[i don't like this, but that's the way it seems to be]</p>
| 33,488 |
<p>Is it possible to embed an audio object (mp3, wma, whatever) in a web-enabled InfoPath form ? </p>
<p>If it is, how do you do it ?</p>
| <p>It looks like you can't embed <code><object></code> tags in a richtext field. I'm getting nothing when I do it. </p>
| <p>Edit: My apologies, I missed that the question was about Web forms - for which the below does not work. Must learn to read the question fully!</p>
<ol>
<li>Go to menu View</li>
<li>Click on Design Tasks</li>
<li>Select Controls in the 'Design Tasks' Task pane</li>
<li>Click on the 'add or remove custom controls' ... | 5,507 |
<p>I have a report that I built for a client where I need to plot x 0-100, y 0-100. Let's imagine I have these points:</p>
<pre><code> 0, 0
2, 24
50, 70
100, 100
</code></pre>
<p>I need to represent these as a smoothed line chart, as the application of it is a dot gain graph for printing presses.</p>
<p>Here... | <p><a href="http://img140.imageshack.us/img140/1279/smoothlinebezierxl0.jpg" rel="nofollow noreferrer">alt text http://img140.imageshack.us/img140/1279/smoothlinebezierxl0.jpg</a></p>
<p>(Providing a picture of the behaviour to help you get a better answer).</p>
<p>For those with a theory, you can try this out in Exc... | <p>You could try using a cosine interpolation for the points in-between.</p>
| 13,475 |
<p>I am on a committee that would benefit from an online application that allows the members to collaborate w/ members.</p>
<p>I would want the ability to post messages and upload documents.</p>
<p>Is there any free, easy to install on your server apps that you would suggest?</p>
| <p>If you really want something similar to BaseCamp, you should try out <a href="http://www.projectpier.org/" rel="nofollow noreferrer">ProjectPier</a>.</p>
<p>If you think you'll need more community features than a project management tool can offer, I would suggest jumping into <a href="http://drupal.org/" rel="nofol... | <p>With such broad requirements there are going to be 1000's of packages to choose from. Something like <a href="http://info.tikiwiki.org/tiki-index.php" rel="nofollow noreferrer">TikiWiki</a> would probably do the job (it might even be overkill depending on your needs).</p>
| 22,856 |
<p>This is the unabashed attempt of a similar <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c">C#</a> question.</p>
<p>So what are your favorite F# hidden (or not) features?</p>
<p>Most of the features I've used so far aren't exactly hidden but have been quite refreshing. Like how trivial it is... | <p>User defined numeric literals can be defined by providing a module whose name starts with <code>NumericLiteral</code> and which defines certain methods (<code>FromZero</code>, <code>FromOne</code>, etc.).</p>
<p>In particular, you can use this to provide a much more readable syntax for calling <code>LanguagePrimiti... | <p>There are no hidden features, because F# is in design mode. All what we have is a Technical Preview, which changes every two month.</p>
<p>see <a href="http://research.microsoft.com/fsharp/" rel="nofollow noreferrer">http://research.microsoft.com/fsharp/</a></p>
| 21,924 |
<p><strong>Is there a way to utilise the GCC compiler whilst still being able to develop via the Visual Studio IDE?</strong></p>
<p>Our project is cross-platform, and I quite frequently get into trouble from my <a href="https://stackoverflow.com/users/912/jkp">colleague</a> because I'm checking in code that's not stan... | <p>What I am about to suggest would still require a makefile, so I am partially repeating the advice from an earlier reply. Or, as was also mentioned earlier, maybe you already have a makefile, in which case you will have even fewer steps in order to accomplish what I am about to describe.</p>
<p>Once you know your s... | <p>I had to maintain separate makefiles for compiling with gcc. There's an upfront cost associated with learning make, but you'll benefit from the intimate knowledge of your code and the differences between VS C++ and gcc. When I did this, I was using VC 6, so there may be a better way now with VS 2005.</p>
| 8,841 |
<p>I really like the Flex framework, however I routinely deal with SWF files that are ~ 500KB. </p>
<p>I don't know at what point a file considered to be "too big" to be served on the internet, but I would assume that a 500KB download just to use a web application would certainly annoy some users.</p>
<p>Are there an... | <p>This might help you:
<a href="http://www.onflex.org/ted/2008/01/flex-3-framework-caching.php" rel="nofollow noreferrer">http://www.onflex.org/ted/2008/01/flex-3-framework-caching.php</a></p>
<p>Chances are the user has already encountered the packaged framework before, so it would be cached. At the very least they ... | <p>This answer is a little more general than you're probably looking for (it applies to all web apps, whether Flash/Flex-based or HTML/CSS/JS based or whatever), but... </p>
<p>It depends a lot on the use case for your application. Is it an application that will be loaded all day and pull in updates as necessary (like... | 33,421 |
<p>I am writing a footer div that displays info from the database. The footer has a different background color than the rest of the page, and will have a height that depends on how much content the database throws to it. When I generate the content with php and call for a border around the footer div, the content app... | <p>Check your footer CSS... if you have overflow set to anything but auto/scroll, then the DIV won't grow.</p>
<p>If not try using something other than DL/DT since DT's are inline elements, they won't push your div to fit content.*</p>
<p>e.g. just try using a DIV instead, if the footer grows, you have your answer.</... | <p>The browser doesn't care if your content is generated by PHP or comes from a static HTML file.</p>
<p>The issue will most likely be in your CSS. Either the content you put in the footer has positioning properties (like float:left or position:absolute) that place them "outside" the div or the div has a fixed size an... | 32,058 |
<p>A two parter:</p>
<p>1) Say you're designing a new type of application and you're in the process of coming up with new algorithms to express the concepts and content -- does it make sense to attempt to <strong>actively</strong> not consider optimisation techniques at that stage, even if in the back of your mind you... | <p>I say all the following not because I think you don't already know it, but to provide moral support while you suppress your inner critic :-)</p>
<p>The key is to retain sanity. </p>
<p>If you find yourself writing a Theta(N!) algorithm which is expected to scale, then you're crazy. You'll have to throw it away, so... | <p>If I'm concerned about the codes ability to handle data growth, before I get too far along I try to set up sample data sets in large chunk increments to test it with like:</p>
<p>1000 records<br>
10000 records<br>
100000 records<br>
1000000 records </p>
<p>and see where it breaks or becomes un-usable. Then you c... | 13,777 |
<p>How would I go about converting an address or city to a latitude/longitude? Are there commercial outfits I can "rent" this service from? This would be used in a commercial desktop application on a Windows PC with fulltime internet access.</p>
| <p>Google has a geocoding API which seems to work pretty well for most of the locations that they have Google Maps data for.</p>
<p><a href="http://googlemapsapi.blogspot.com/2006/06/geocoding-at-last.html" rel="noreferrer">http://googlemapsapi.blogspot.com/2006/06/geocoding-at-last.html</a></p>
<p>They provide onlin... | <p>The <a href="https://webgis.usc.edu" rel="nofollow noreferrer">USC WebGIS Geocoder</a> is free and offers several API's, or you can upload a database for online batch processing.</p>
| 12,383 |
<p>I've worked on a number of database systems in the past where moving entries between databases would have been made a lot easier if all the database keys had been <a href="http://en.wikipedia.org/wiki/Globally_Unique_Identifier" rel="noreferrer">GUID / UUID</a> values. I've considered going down this path a few time... | <p>Advantages:</p>
<ul>
<li>Can generate them offline.</li>
<li>Makes replication trivial (as opposed to int's, which makes it REALLY hard)</li>
<li>ORM's usually like them</li>
<li>Unique across applications. So We can use the PK's from our CMS (guid) in our app (also guid) and know we are NEVER going to get a clash.<... | <p>One thing not mentioned so far: UUIDs make it much harder to profile data</p>
<p>For web apps at least, it's common to access a resource with the id in the url, like <code>stackoverflow.com/questions/45399</code>. If the id is an integer, this both</p>
<ul>
<li>provides information about the number of questions (ie ... | 6,724 |
<p>Has anyone configured BLTouch with Marlin firmware?</p>
<p>I could only find videos about older firmware version. I followed <a href="https://docs.wixstatic.com/ugd/f5a1c8_77c6538efc934dbeab2f6e06e175ec35.pdf" rel="nofollow noreferrer">this document</a>. To avoid causing any damage to the printer, I removed all con... | <p>For security reasons, you cannot move Z until home position is applied to X, Y and Z.</p>
<p>With the level sensor attached, we need to home X and Y, and then Z will be homed in the middle of the bed (as configured). Execute <code>G28</code> to home all axis and then you shall be able to run 'Z'.</p>
<p>To test th... | <p><strong>Edit:</strong> <em>The answer below reflected the original question and upload of the configuration that was incorrectly configured. The value of this answer can be found in checking your configuration thoroughly before you post a question. It also answers the question whether pull-up resistors need to be se... | 924 |
<p>It's <a href="http://www.codeproject.com/KB/cs/csharpcasts.aspx" rel="noreferrer">shown</a> that 'as' casting is much faster than prefix casting, but what about 'is' reflection? How bad is it? As you can imagine, searching for 'is' on Google isn't terribly effective.</p>
| <p>There are a few options:</p>
<ol>
<li>The <strong>classic cast</strong>: <code>Foo foo = (Foo)bar</code></li>
<li>The <strong><code>as</code> cast operator</strong>: <code>Foo foo = bar as Foo</code></li>
<li>The <strong><code>is</code> test</strong>: <code>bool is = bar is Foo</code></li>
</ol>
<hr>
<ol>
<li>The... | <p>It should be quick enough to not matter. If you are checking the type of an object enough for it to make a noticeable impact on performance you need to rethink your design</p>
| 8,204 |
<p>Nowadays most of the Restaurants and other businesses have a "<a href="http://www.fedex.com//Dropoff/start" rel="nofollow noreferrer">Find Locations</a>" functionality on their websites which lists nearest locations for a given address/Zip. How is this implemented? Matching the zipcode against the DB is a simple no-... | <p>A lot of geospatial frameworks will help you out with this. In the geospatial world, a zip code is just a "polygon", which is just an area on a map which defines clear boundaries (not a polygon in the math sense). In SQL 2008 spatial, for example, you can create a new polygon based on your original polygon. So yo... | <p>Just like you said. Convert an address/ZIP into a 2D world coordinate and compare it to other known locations. Pick the nearest. :) I think some DB's (Oracle, MSSQL 2008) even offer some functions that can help, but I've never used them.</p>
| 42,708 |
<p>Is there a way to get the Unicode Block of a character in python? The <a href="http://www.python.org/doc/2.5.2/lib/module-unicodedata.html" rel="noreferrer">unicodedata</a> module doesn't seem to have what I need, and I couldn't find an external library for it.</p>
<p>Basically, I need the same functionality as <a ... | <p>I couldn't find one either. Strange!</p>
<p>Luckily, the number of Unicode blocks is quite manageably small.</p>
<p>This implementation accepts a one-character Unicode string, just like the functions in <code>unicodedata</code>. If your inputs are mostly ASCII, this linear search might even be faster than binary... | <p>unicodedata.name(chr)</p>
| 30,213 |
<p>We try to use Java and UTF-8 on Windows. The application writes logs on the console, and we would like to use UTF-8 for the logs as our application has internationalized logs.</p>
<p>It is possible to configure the JVM so it generates UTF-8, using <code>-Dfile.encoding=UTF-8</code> as arguments to the JVM. It works... | <p>Try <code>chcp 65001 && start.bat</code></p>
<p>The <code>chcp</code> command changes the code page, and 65001 is the Win32 code page identifier for UTF-8 under Windows 7 and up. A code page, or character encoding, specifies how to convert a Unicode code point to a sequence of bytes or back again.</p>
| <p>Have you tried <a href="http://en.wikipedia.org/wiki/PowerShell" rel="nofollow noreferrer">PowerShell</a> rather than old cmd.exe.</p>
| 7,861 |
<p>Are there any libraries out there (preferably a self contained Text Edit Control) for .NET that have Spell Check capabilities. I would like to add the typical red underline to miss-spelled words in the edit area of my application.</p>
<p>Edit: To clarify, this is for WinForms</p>
| <p>Not a redlining control, but: <a href="http://aspell-net.sourceforge.net/" rel="nofollow noreferrer">Aspell.Net</a> is a Free and Open Source .Net spell checking component. Based on the GNU Aspell project, Aspell.Net is one of the most powerful multi-lingual spelling engines available. The API is written in C# an... | <p>FCKEditor is a nice text editor (web based). It has spellchecking capabilities.</p>
| 31,543 |
<p>I have an actionscript file that defines a class that I would like to use inside a Flex application. </p>
<p>I have defined some custom controls in a actionscript file and then import them via the application tag:</p>
<pre>
<code>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:scorecard... | <p>You'd need to import the class inside a script tag.</p>
<pre><code><mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import com.apterasoftware.scorecard.controls.*;
// Other imports go here
// Functions and other code go here
</mx:Script>
<!-- Componen... | <p>@Herms: To clarify a little, namespace declarations can be used to "import" AS classes as well, when you're going to instantiate them using MXML.</p>
<p>For example, consider having a custom visual component you've written entirely in AS, let's say <code>com.apterasoftware.scorecard.controls.MathVisualizer</code>. ... | 6,101 |
<p>Is it OK to use XSPF for video content?</p>
<p>If not, what else should be used?</p>
<p>I am targeting flash players, including Jeroen Wijering's JW FLV media player.</p>
| <p>Yes, XSPF is suitable for "video playlists".</p>
<p>Let me invite you to the XSPF mailing list:<br>
<a href="http://lists.musicbrainz.org/mailman/listinfo/playlist" rel="nofollow noreferrer">http://lists.musicbrainz.org/mailman/listinfo/playlist</a></p>
<p>See you,</p>
<p>Sebastian</p>
| <p>Sure it is ok ...
The <a href="http://feedpixel.com" rel="nofollow">http://feedpixel.com</a> converts a podcast RSS feed to xspf format before play ...</p>
| 43,199 |
<p>I'm writing some server code that talks to a client process via STDIN. I'm trying to write a snippet of perl code that asynchronously receives responses from the client's STDOUT. The blocking version of the code might look like this:</p>
<pre><code>sub _read_from_client
{
my ($file_handle) = @_;
while (my $li... | <p><a href="http://www.perlmonks.org/?node_id=529812" rel="nofollow noreferrer">This thread</a> on <a href="http://www.perlmonks.org" rel="nofollow noreferrer">Perlmonks</a> suggests you can make a socket nonblocking on Windows in Perl this way:</p>
<pre><code>ioctl($socket, 0x8004667e, 1);
</code></pre>
<p>More deta... | <p>If you don't want to go the low-level route, you will have to look at the other more frameworked solutions.</p>
<p>You can use a <a href="http://search.cpan.org/perldoc?threads" rel="nofollow noreferrer">thread</a> to read from the input and have it stuff all data it reads into a <a href="http://search.cpan.org/per... | 17,073 |
<p>I'm creating a stored procedure to return search results where some of the parameters are optional.</p>
<p>I want an "if statement" in my <em>where</em> clause but can't get it working. The <em>where</em> clause should filter by only the non-null parameters.</p>
<p>Here's the sp</p>
<pre><code>ALTER PROCEDURE spV... | <pre><code>select tblVillas.*, tblWeeklyPrices.price
from tblVillas
INNER JOIN tblWeeklyPrices on tblVillas.villaId = tblWeeklyPrices.villaFK
where (@accomodationFK IS null OR accomodationTypeFK = @accomodationFK)
AND (@regionFK IS null or regionFK = @regionFK)
AND (@sleeps IS null OR sleeps = @sleeps)
AND (@pri... | <p>Try putting your IF statement around the entire SQL statement. That means will have one SQL statement for each condition. That worked for me.</p>
| 40,995 |
<p>here is my directory structure.</p>
<p>/user/a
/user/b
/user/b</p>
<p>inside folder a,b,c there is a file person.java (it is the Same file, just a one line modification.</p>
<p>now, on my shell, im on my /user/ directory and i try to do </p>
<pre><code> javac */person.java
</code></pre>
<p>the shell returns t... | <p>I think the problem here might be, that javac tries to compile everything in one go, which naturally results in duplicated class definitions. </p>
<p>A simple way to resolve this would be </p>
<p><code>find . -name '*.java' -exec javac {} \;</code></p>
<p><strong>Edit:</strong></p>
<p>Or to be more precise <code... | <p>I would go for the small shell script:</p>
<pre><code>for f in */person.java; do
javac $file
done
</code></pre>
<p>First line find all the files person.java in a sub-directory, second line compile the file.</p>
| 16,743 |
<p>Given the following sample array, how can I find all permutations of times available such that the amountNeeded is satisfied? In others words the follow array should produce the following:</p>
<blockquote>
<p>Available on 2008-05-14 from 08:00 to 08:10 using resource 10 and 13</p>
<p>Available on 2008-05-14... | <p><code>System.Diagnostics.Debugger.Break()</code></p>
<p>"If no debugger is attached, users are asked if they want to attach a debugger. If yes, the debugger is started. If a debugger is attached, the debugger is signaled with a user breakpoint event, and the debugger suspends execution of the process just as if a d... | <p>Not completely sure about this...</p>
<p>But I think when you use conditional breakpoints in Visual Studio, you can pretty much have the breakpoint set to evaluate any expression that you can write in .Net. Maybe try writing some Reflection code that checks to see if a property or method has been called, and then s... | 38,858 |
<p>Remember the little div that shows up at the top of the page to notify us of things (like new badges)?</p>
<p>I would like to implement something like that as well and am looking for some best practices or patterns.</p>
<p>My site is an ASP.NET MVC app as well. Ideally the answers would include specifics like "put... | <p>After snooping around the code a bit, here's a guess:</p>
<p>The following notification container is always in the view markup:</p>
<pre><code><div id="notify-container"> </div>
</code></pre>
<p>That notification container is hidden by default, and is populated by javascript given certain circumstance... | <p>I wrote this piece of Javascript that does just that including stacking, staying with you as you scroll like Stack Overflow's does and pushing the whole page down whenever a new bar is added. The bars also expire. The bars also slide into existence. </p>
<pre><code>// Show a message bar at the top of the screen to ... | 47,881 |
<p>c# + sql server: I have to import a few tables from Access into sql server. The new sql server tables are already defined and created. The Access tables have primary key - foreign key relationships that have to be maintained. I would like to have the new sql tables use identity values for the primary keys, but I can... | <p>I did some research on this very topic recently, as we had an issue with memory fragmentation. In the end we decided to stay with GNU libc's implementation, and add some application-level memory pools where necessary. There were other allocators which had better fragmentation behavior, but we weren't comfortable eno... | <p>I am writing a C memory allocator called tinymem that is intended to be able to defragment the heap, and re-use memory. Check it out:</p>
<p><a href="https://github.com/vitiral/tinymem" rel="nofollow">https://github.com/vitiral/tinymem</a></p>
<p>Note: this project has been discontinued to work on the rust impleme... | 21,346 |
<p>For some reason the combination of swfobject.js and script.aculo.us Ajax.Autocompleter on the same page causes the latter to fail. Autocompleter doesn't make its Ajax request. A separate Ajax control on the same page that uses Ajax.Updater doesn't seem to have the same problem.</p>
| <p>If you're using Firefox on a local machine, AJAX requests don't work for security reasons.</p>
<p>Either upload to a server, or try something like <a href="http://www.apachefriends.org/en/xampp.html" rel="nofollow noreferrer">xampp</a> to easily get a webserver running on your own machine.</p>
| <p>prototype.js (used by scriptaculous) and swfobject.js might be incompatible.
What are the versions of theses tools you are using ?
Did you try to switch the order of the 'script' import tags in order to import swfobject first ?</p>
| 10,250 |
<p>I'm trying to retrive a dataset to a Gridview, but I just don't get any row in my Gridview. What am I doing wrong?</p>
<p>the page code</p>
<pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CType(Master, AreaTrabalho).AlteraTitulo = "Projectos"
Using o... | <p>This should work:</p>
<pre><code>#!/usr/bin/python
from AppKit import NSWorkspace
activeAppName = NSWorkspace.sharedWorkspace().activeApplication()['NSApplicationName']
print activeAppName
</code></pre>
<p>Only works on Leopard, or on Tiger if you have PyObjC installed and happen to point at the right python bina... | <p>I needed the current frontmost application in a Python script that arranges the windows nicely on my screen (see <a href="https://github.com/SirVer/move_window" rel="nofollow noreferrer"><code>move_window</code></a>).</p>
<p>Of course, the complete credit goes to Peter! But here is the complete program:</p>
<pre><... | 48,775 |
<p>What is the most elegant way to calculate the previous business day in shell ksh script ?</p>
<p>What I got until now is :</p>
<pre><code>#!/bin/ksh
set -x
DAY_DIFF=1
case `date '+%a'` in
"Sun")
DAY_DIFF=2
;;
"Mon")
DAY_DIFF=3
;;
esac
PREV_DT=`perl -e '($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$... | <p>Here is a solution that doesn't use Perl. It works both with <code>ksh</code> and <code>sh</code>.</p>
<pre><code>#!/bin/ksh
diff=-1
[ `date +%u` == 1 ] && diff=-3
seconds=$((`date +%s` + $diff * 24 * 3600))
format=+%Y-%m-%d
if date --help 2>/dev/null | grep -q -- -d ; then
# GNU date (e.g., Linu... | <p>Well, if running Perl counts as part of the script, then develop the answer in Perl. The next question is - what defines a business day? Are you a shop/store that is open on Sunday? Saturday? Or a 9-5 Monday to Friday business? What about holidays?</p>
<p>Assuming you're thinking Monday to Friday and holidays ... | 27,674 |
<p>I want to calculate what is $x percentage of a $total. $x could be 15%, 20%, etc, and $total could be 1000, 2000, etc. So I'd want the 15% of 1000, for example.</p>
<p>What is the formula for calculating this? (I know this isn't <em>exactly</em> a coding question but I'm coding this feature and need help!</p>
| <pre><code>(actual / available) * 100 = percent // start
actual / available = percent / 100
actual = (percent / 100) * available // finish
</code></pre>
<p>E.g. 15% of 1000</p>
<pre><code>actual = (15 / 100) * 1000
actual = 0.15 * 1000
actual = 150
</code></pre>
| <pre><code>$x = 15;
$total = 1000;
$answer = $total * $x / 100
</code></pre>
| 44,573 |
<p>I've created a DBML file for a LINQ to SQL mapping and after dragging all of my tables into the designer surface. In the properties of each table, the "Delete", "Insert" and "Update" are grayed out so they're not editable like they're disabled. I'm not sure why this is. Does anyone know how to make it so that I can ... | <p>Do your tables have primary keys? LINQ to SQL won't allow you to change the data if it doesn't have a key to use. I've run into that a lot with legacy systems. A lot of the time the table is using a defacto key, but it's not specifically set up in the database. In those cases, you can just mark the field as primary ... | <p>If you right-click on the table in the designer and choose properties, the Delete, Insert and Update are grayed out. I am not sure if you can supply alternate Delete, Insert and Update methods...</p>
<p>But if your question is about inserting, updating and deleting values in your tables, once you drag a table onto... | 44,952 |
<p>Today I happens to find that one C# class can inherit one interface both in implicit and explicit way. This surprises me. If C# works in this way, then one instance can behave differently when referenced in different way.</p>
<pre><code>interface IFoo
{
void DoSomething();
}
class Foo : IFoo
{
#region IFoo... | <p>Your example does <strong>not</strong> implement IFoo both implicitly and explicitly. You only implement IFoo.DoSometing() explicitly. You have a new method on your class called DoSomething(). It has nothing to do with IFoo.DoSomething, except that it has the same name and parameters.</p>
| <p>Guys, Thanks for your answers.</p>
<p>It turns out that "C# class can inherits one interface in both implicit and explicit way at same time" is actually a illusion. Actually, one class can inherit one interface for one time. </p>
<p>In the original question, the "DoSomething" method seems "implicitly implement" in... | 31,541 |
<p>I am building a Facebook App which is heavy on Javascript. For this I have multiple Javascript files. Since in Facebook development, the page is served over a tunnel, there is excessive latency added while requesting multiple javascript files. Is it possible to combine the contents of multiple javascript files at ru... | <p>You can pass a <code>:cache</code> option to the <code>javascript_include_tag</code> which will combine the files into one:</p>
<pre><code><%= javascript_include_tag :all, :cache => true %>
</code></pre>
<p>Note that this depends on <code>ActionController::Base.perform_caching</code> being set to true, wh... | <p>I've used the <a href="http://github.com/imedo/asset_packager" rel="nofollow noreferrer">asset_packager</a> gem to do this in my applications.</p>
<p>It will combine and minimize your javascript (and CSS) files for production and adds some view helpers that make it very easy to use. There's a rake command that you ... | 40,562 |
<p>Are there any issues with changing elements which will appear on a web page within a thread. I am from a windows programming background and obviously if a thread needs to change the GUI in some way you have to delegate it to the GUI thread.</p>
<p>Basically my page uses 3 sql queries which can be run concurrently t... | <p>You're going to have to join all 3 threads before rendering the page. Once it's rendered out, there's no updating it.</p>
| <p>Basically asp.net rendering is about building a large string, which will be the rendered output, which is a html page. (Not counting dynamic image rendering and such.)
So the short answer is no, above any "normal" threading issues.</p>
| 38,448 |
<p>I am in the process of setting up the wso2 php web services framework on my ubuntu 8.04 development server.</p>
<p>However my webservice is failing. Looking into the wsf_client.log (custom log for the framework) file gives me the error in the question.</p>
<p>I belive the error is returned from axis, but I have no... | <p>I'm only relaying information from the original questioner here, posted in a different forum:</p>
<blockquote>
<p>solved.</p>
<p>thanks for the reply,</p>
<p>I think my issue was a wrongly setup localhost in the apache conf,</p>
<p>which caused the socket to try and connect in on itself.</p>
<p>anyways a reinstall a... | <p>Did you check /var/log/messages? If the error is at the OS level, you might have more clues in there. </p>
| 24,686 |
<p>I saw an article on creating Excel UDFs in VSTO managed code, using VBA: <a href="http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx</a>. </p>
<p>However I want to get this working in a C# Excel add-in using VSTO 2005 ... | <p>You should also have a look at ExcelDna - <a href="http://www.codeplex.com/exceldna" rel="nofollow noreferrer">http://www.codeplex.com/exceldna</a>. ExcelDna allows managed assemblies to expose user-defined functions (UDFs) and macros to Excel through the native .xll interface. The project is open-source and freely ... | <p>Creating UDF using a simple automation addin is quite easy. You will have to create a dedicated assembly and make it visible from COM. Unfortunately, you can't define a UDF in a managed VSTO Excel Addin.</p>
<p>Anyway, there is a work around, which I found very limiting. It is described <a href="http://www.bokebb.c... | 15,097 |
<p>I've just started to use linq to sql and have run into a problem with inserting a record with an auto incrementing field.</p>
<p>I have created a new instance of a company object defined by linq. it has initialised an auto incrementing field 'companyID' to 0.
InsertOnSubmit() fails with the following invalidOperati... | <p>Found the answer. It was to do with primary keys. In the linq designer the primary keys were setup as they should be. In the database the relevant fields were not set as primary keys. I fixed the keys in the databse and this resolved the problem.</p>
| <p>If that possible, drop your database and recreate. My case was when I forget to add primary key on the table. Then after first insert went into database I got excaption about missing primary key. I applied that manually in dbml designer, but first ID was already taken that caused 'Incorrect autosync' exception.</p>
| 46,794 |
<p>I'm fairly new to 3D printing but I'm getting the steam up and I chug out pieces without much hassle. One thing though is that I have the impression that sometimes, parts are easily broken, and I suspect bad adhesion between layers.</p>
<p>I'm printing eSun PLA at 208 °C (212 °C first layer), bed at 50&nb... | <p>I think the reason why the large cylinder is breaking much easier than the smokestack would is because of leverage. If you print the same cylinder at a much smaller scale it might be more difficult to break it. Think of taking a wooden stick, if you try to snap it by holding both hands near the center, it would be d... | <p>From my experience the most profound difference is in the material. Especially with eSun PLA that I have used over 10 spools I have found huge inconsistencies. In one spool the printing adhesion was fine on other spools it was very very bad. My first advise is try another branded filament, I would recomend Colorfabb... | 745 |
<p>It seems the ObservableCollection only support add, remove, clear operation from the UI thread, It throw Not Support Exception if it is operated by a NO UI thread. I tried to override methods of ObservableCollection, unfortunatly, I met lots of problems.
Any one can provide me a ObservableCollection sample which can... | <p>Using the link provided by <a href="https://stackoverflow.com/questions/187069/can-not-operate-observablecollection-in-multi-threads#187078">Kent</a>, you could use the following code to modify a collection across threads:</p>
<pre><code>while (!Monitor.TryEnter(_lock, 10))
{
DoEvents();
}
try
{
//modify col... | <p>You've basically got to Invoke or BeginInvoke over to the UI thread to do those operations.</p>
<pre><code>Public Delegate Sub AddItemDelegate(ByVal item As T)
Public Sub AddItem(ByVal item As T)
If Application.Current.Dispatcher.CheckAccess() Then
Me.Add(item)
Else
Application.Current.Disp... | 22,650 |
<p>So I have a custom proxy that is written in ruby using mongrel to handle some fairly complex caching logic. This works great for both http and ftp requests, however since mongrel is not designed to handle https requests, I wish to front the whole thing with apache and make use of the ProxyRemote command to pass thr... | <p>Just use ProxyPass and ProxyPassReverse, the connection between your reverse proxy (apache) and your mongrel will see normal plain http :), no magic necessary (especially not CONNECT, afaik thats only possbile for forward proxies, but I'm not sure).</p>
| <p>Hum, have you tried to do so ?</p>
<p>I've been using apache to do the https and just pass the requests with the old default .htaccess mod_rewrite rules.</p>
| 45,662 |
<p>I have 2 tables. One (domains) has domain ids, and domain names (dom_id, dom_url).</p>
<p>the other contains actual data, 2 of which columns require a TO and FROM domain names. So I have 2 columns rev_dom_from and rev_dom_for, both of which store the domain name id, from the domains table.</p>
<p>Simple.</p>
<p>N... | <p>you'd use another join, something along these lines:</p>
<pre><code>SELECT toD.dom_url AS ToURL,
fromD.dom_url AS FromUrl,
rvw.*
FROM reviews AS rvw
LEFT JOIN domain AS toD
ON toD.Dom_ID = rvw.rev_dom_for
LEFT JOIN domain AS fromD
ON fromD.Dom_ID = rvw.rev_dom_from
</code></pre>
<p><strong><... | <p>Read this and try, this will help you:</p>
<p><strong>Table1</strong> </p>
<pre><code>column11,column12,column13,column14
</code></pre>
<p><strong>Table2</strong> </p>
<pre><code>column21,column22,column23,column24
SELECT table1.column11,table1.column12,table2asnew1.column21,table2asnew2.column21
FROM table1 ... | 24,382 |
<p>As can be seen in the Mozilla changlog for JavaScript 1.7 they have added destructuring assignment. Sadly I'm not very fond of the syntax (why write a and b twice?):</p>
<pre><code>var a, b;
[a, b] = f();
</code></pre>
<p>Something like this would have been a lot better:</p>
<pre><code>var [a, b] = f();
</code>... | <p>First off, <code>var [a, b] = f()</code> works just fine in JavaScript 1.7 - try it!</p>
<p>Second, you can smooth out the usage syntax <em>slightly</em> using <code>with()</code>:</p>
<pre><code>var array = [1,2];
with (assign(array, { var1: null, var2: null }))
{
var1; // == 1
var2; // == 2
}
</code></pre>... | <p>In standard JavaScript we get used to all kinds of ugliness, and emulating destructuring assignment using an intermediate variable is not too bad:</p>
<pre><code>function divMod1(a, b) {
return [ Math.floor(a / b), a % b ];
}
var _ = divMod1(11, 3);
var div = _[0];
var mod = _[1];
alert("(1) div=" + div + ", m... | 25,021 |
<p>How long does it take for an experienced Windows programmer to learn writing simple software for Mac OS X? </p>
<p>Where does one start and what tools will be necessary?</p>
| <p><a href="https://rads.stackoverflow.com/amzn/click/com/0321503619" rel="noreferrer" rel="nofollow noreferrer">THIS</a>. I came from a Win32 API background programming lately a lot in C# and I was able to pick up on Objective-C and Cocoa very quickly by working through the book. You will be pleasantly surprised, th... | <p>I guess the "how long" question would depend on what languages you are used to using. </p>
<p>In terms of reference material, I have heard good things about <a href="http://www.compman.co.uk/scripts/browse.asp?ref=880360" rel="nofollow noreferrer">"Cocoa Programming for Mac OS X"</a>, and I'd love to have time to ... | 30,189 |
<p>Anyone know if it is possible?
And got any sample code for this?
Or any other java API that can do this?</p>
| <p>The Office 2007 format is based on XML and so can probably be written to using XML tools. However there is <a href="http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/index.html" rel="nofollow noreferrer">this library</a> which claims to be able to write DocX format word docume... | <p>As far as can be gathered from the <a href="http://poi.apache.org/" rel="nofollow noreferrer">project website</a>: no.</p>
| 15,337 |
<p>I have a Monoprice Maker Select V2.1 (rebadged Wanhao Di3) with a microswiss all metal hot-end and machined lever and extruder plate. It had been printing very consistently for months with this set up - through 5 or 6 kg of filament - until a couple of weeks ago when it has started to under-extrude and then stop par... | <p>Time to check things that usually don't need checking. At this point I would check the power split. </p>
<p>Check the power supply voltage (+12V or maybe +24V, I don't know the printer) at the controller before and after the extrusion stops or sputters. Assure that the voltage stays the same. If it drops you h... | <p>Have you checked your computers power saving settings, the USB port setting in particular, to see if your computer is turning off the USB port, the hard drive, or some other hardware vital to printing?</p>
| 1,345 |
<p>I need your expertise once again. I have a java class that searches a directory for xml files (displays the files it finds in the eclipse console window), applies the specified xslt to these and sends the output to a directory.</p>
<p>What I want to do now is create an xml containing the file names and file format ... | <p>Use an XML library. There are plenty around, and the third party ones are almost all easier to use than the built-in DOM API in Java. Last time I used it, <a href="http://jdom.org/" rel="nofollow noreferrer">JDom</a> was pretty good. (I haven't had to do much XML recently.)</p>
<p>Something like:</p>
<pre><code>El... | <p>Well just use a StringBuilder :</p>
<pre><code>StringBuilder builder = new StringBuilder();
for(File f : files) {
builder.append("<file>\n\t<fileName>").append(f.getName).append("</fileName>\n)";
[...]
}
System.out.println(builder.toString());
</code></pre>
| 49,882 |
<p>We have a strange problem occurring <em>once in a while</em> on our servers. It usually happens when one or more of our web applications are upgraded. Debugging the problem has gotten me this far...</p>
<p>During the processing of a request:</p>
<ul>
<li>In the ASP.NET application we put an object in session</li>
... | <p>HttpContext.Items are only available during the lifetime of the request not the entire session, so that needs to be considered.</p>
<p>To answer the original question,</p>
<ol>
<li><p>When you add the item to session can
you retrieve it successfully in the
next line? </p></li>
<li><p>Is it server specific?... | <p>Can you consider not using a session variable?</p>
<p>If you need the data in the same session, you can use HttpContext.Items which is much more lightweight than using a session variable.</p>
<p>Answering to your question:
Maybe the session is not created yet when you access it for the first time. It will throw a... | 19,012 |
<p>Example. 123456, and we want the third from the right ('4') out.</p>
<p>The idea in practise is to access each digit seperately (ie. 6 5 4 3 2 1).</p>
<p>C/C++/C# preferred.</p>
| <p>A more efficient implementation might be something like this:</p>
<pre><code>char nthdigit(int x, int n)
{
while (n--) {
x /= 10;
}
return (x % 10) + '0';
}
</code></pre>
<p>This saves the effort of converting all digits to string format if you only want one of them. And, you don't have to allo... | <p>In C you could do something like the following, where n=0 would indicate the rightmost digit</p>
<pre><code>char nthDigitFromRight(int x,int n)
{
char str[20];
sprintf(str,"%020d",x);
return(str[19 - x]);
}
</code></pre>
<p>Change [19-x] to [20-x] if you want n=1 for rightmost digit.</p>
| 24,939 |
<p>How much code kludge could you remove using the resharper 4?</p>
<p>I want to hear more about benefits on 10k+ codebases</p>
| <p>Resharper is a tool. Continuous refactoring is an attitude. If you've got the attitude, then IMO resharper is the best tool you can get. The tool by itself does not really remove any kludge.</p>
<p>The size of the codebase only makes these tools more important. With reasonably large codebases you have to trust the ... | <p>Resharper offers so many benifits in terms of developer productivity. It also improves better design by suggesting many improvements to the code on the fly. i have been encouraging people in my team to use all the shortcuts from Resharper and try and get off the habit of using mouse. Its not to say that you shouldn'... | 47,749 |
<p>Ok, my actual problem was this: I was implementing an <code>IList<T></code>. When I got to <code>CopyTo(Array array, int index)</code>, this was my solution:</p>
<pre><code>void ICollection.CopyTo(Array array, int index)
{
// Bounds checking, etc here.
if (!(array.GetValue(0) is T))
throw new ... | <p>The only way to be sure is with reflection, but 90% of the time you can avoid the cost of that by using <code>array is T[]</code>. Most people are going to pass a properly typed array in, so that will do. But, you should always provide the code to do the reflection check as well, just in case. Here's what my gene... | <p>Here is a little test of try / catch vs. reflection:</p>
<pre><code>object[] obj = new object[] { };
DateTime start = DateTime.Now;
for (int x = 0; x < 1000; x++)
{
try
{
throw new Exception();
}
catch (Exception ex) { }
}
DateTime end = DateTime.Now;
Console.WriteLine("Try/Catch: " + (e... | 20,470 |
<p>In a machine with AIX without <code>PERL</code> I need to filter records that will be considered duplicated if they have the same id and if they were registered between a period of four hours. </p>
<p>I implemented this filter using <code>AWK</code> and work pretty well but I need a solution much faster: </p>
<pre... | <p>This sounds like a job for an actual database. Even something like SQLite could probably help you reasonably well here. The big problem I see is your definition of "within 4 hours". That's a sliding window problem, which means you can't simply quantize all the data to 4 hour segments... you have to compute all "ne... | <p>If your data file contains all your records (i.e. it includes records that do not have dupicate ids within the file) you could pre-process it and produce a file that only contains records that have duplicate (ids).</p>
<p>If this is the case that would reduce the size of file you need to process with your AWK progr... | 2,821 |
<p>I need to query for a list of available Wireless Access points. I only need their SSIDs.</p>
<p>The App is currently .Net CF 2.0, but it's not a problem going with 3.5 if we have to.</p>
| <p>The list of "nearby" APs is retrived eitehr through NDIS or WZC, depending on what your NIC driver supports. Both are somewhat well documented in MSDN, but they aren't fun to wrap. OpenNETCF's SDF contains a wrapper that looks at both, depending on your NIC's support.</p>
<p>It's accessible via the <a href="http... | <p>Well the core of this is in the Windows Zero Config .dll otherwise known as WZC. However from a managed app you'll want to go via <a href="http://www.opennetcf.com/" rel="nofollow noreferrer">OpenNETCF</a> as they have a managed wrapper that can provide this information for you.
The classes of interest are the Adapt... | 41,690 |
<p>I've got a XmlNodeList which I need to have it in a format that I can then re-use within a XSLT stylesheet by calling it from a C# extension method.</p>
<p>Can anyone help? I have read that it might have something to do with using a XPathNavigator but I'm still a bit stuck.</p>
| <p>I had to solve this issue myself a couple of years ago. The only way I managed it was to create an XML fragment containing the nodes in the node list and then passing in the children of the fragment.</p>
<pre><code>XsltArgumentList arguments = new XsltArgumentList();
XmlNodeList nodelist;
XmlDocument nodesFrament =... | <p>The note at the end was the most useful, I had infact transformed the XmlNodeList into a XmlDocument already so could just use the Navigator on there and create it as a XPathNodeIterator. </p>
<p>Thanks for you help!</p>
| 19,055 |
<p>I need to store a list of key value pairs of (integer, boolean) in .NET</p>
<p>When I use a dictionary it re-orders them. Is there a built in collection that will handle this.</p>
| <pre><code> List<KeyValuePair<int, bool>> l =
new List<KeyValuePair<int, bool>>();
l.Add(new KeyValuePair<int, bool>(1, false));
</code></pre>
| <p>The dictionary is supposed to reorder them, the a map by itself has no notion of order.</p>
<p>There is a class in .Net that supports that notion:</p>
<pre><code>SortedDictionary<Tkey, Tvalue>
</code></pre>
<p>it requires that the Tkey type implements de IComparable interface so it known how to sort items. ... | 17,665 |
<p>I currently working on an issue tracker for my company to help them keep track of problems that arise with the network. I am using C# and SQL. </p>
<p>Each issue has about twenty things we need to keep track of(status, work loss, who created it, who's working on it, etc). I need to attach a list of teams affected b... | <p>What you are describing is called a "many-to-many" relationship. A team can be affected by many issues, and likewise an issue can affect many teams.</p>
<p>In SQL database design, this sort of relationship requires a third table, one that contains a reference to each of the other two tables. For example:</p>
<pr... | <p>If I understand you correctly, you want to create a new table of teams affected for each issue. Creating tables as part of normal operations rings my relational database design alarm bell. Don't do it! </p>
<p>Instead, use one affected_teams table with a <a href="http://en.wikipedia.org/wiki/Foreign_key" rel="nofol... | 41,673 |
<p>When we submit a job, the following steps are executed sequentially.</p>
<p>Then what is the importance of DPRTY?</p>
| <p><code>DPRTY</code> is a very old JCL keyword that harks back to the days of MVS/ESA. It was the dispatch priority which dictated to JES what priority individual steps should be given in a job.</p>
<p>On all versions of z/OS I have access to (all the supported ones), it has no effect. This is because the WLM (workl... | <p><code>DPRTY</code> is used to assign dispatching priority to the job step. It is different from the class priority, as class priority applies for the entire job whereas <code>DPRTY</code> applies to particular job step.</p>
<h1>Syntax:</h1>
<p><code>DPRTY(value1, value2) value1 = 0-15 value2 = 0-15</code></p>
<p><co... | 32,627 |
<p>What data structures would you use to represent a chessboard for a computer chess program?</p>
| <p>Initially, use an <strong>8 * 8 integer array</strong> to represent the chess board.</p>
<p>You can start programing using this notation. Give point values for the pieces. For example:</p>
<pre><code>**White**
9 = white queen
5 = white rook
3 = bishop
3 = knight
1 = pawn
**black**
-9 = white queen
-5 = white rook... | <p>An array would probably be fine. If you wanted more convenient means of "traversing" the board, you could easily build methods to abstract away the details of the data structure implementation.</p>
| 6,103 |
<p>My favorite equation for centering an xhtml element using only CSS is as follows:</p>
<pre><code>display: block;
position: absolute;
width: _insert width here_;
left: 50%;
margin-left: _insert width divided by two & multiplied by negative one here_
</code></pre>
<p>There's also the simpler margin:auto method i... | <pre><code>div #centered{
margin: 0 auto;
}
</code></pre>
<p>seems to be the most reliable from my experience.</p>
| <p>Try this; don't know if it works in IE, works fine in Fx though. It centers a DIV block on the page using CSS only (no JavaScript), no margin-auto and the text within the DIV block is still left aligned. I'm just trying to find out if vertical-centering could work that way, too, but so far without success.</p>
<pre... | 17,865 |
<p>In C# are the nullable primitive types (i.e. <code>bool?</code>) just aliases for their corresponding <code>Nullable<T></code> type or is there a difference between the two?</p>
| <p>If you look at the IL using <a href="http://msdn.microsoft.com/en-us/library/f7dy01k1%28v=vs.100%29.aspx" rel="noreferrer">Ildasm</a>, you'll find that they both compile down to <code>Nullable<bool></code>.</p>
| <p>No difference. Take a look here: <a href="http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx</a></p>
<p>"The syntax T? is shorthand for Nullable, where T is a value type. The two forms are interchangeable."</p>
| 8,045 |
<p>What is the simplest way in VB6 to loop through all the files in a specified folder directory and get their names?</p>
| <pre><code>sFilename = Dir(sFoldername)
Do While sFilename > ""
debug.print sFilename
sFilename = Dir()
Loop
</code></pre>
| <p>create button with name = browseButton
create filelistbox with name = List1</p>
<p>double click on button in design </p>
<p>and code should look like this</p>
<pre><code>Private Sub browseButton_Click()
Dim path As String
path = "C:\My Folder"
List1.path() = path
List1.Pattern = "*.txt"
End Sub
</code></pre>
... | 37,229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.