instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I want to make an anime-style figurine in Blender with long strands of wavy hair coming down from pigtails, similar to sailor moon, but more so.</p>
<p>They are going to be extremely challenging to print in place as they will be very thin and difficult to support.</p>
<p>Would it be possible simply to print long fla... | <p>Yes, printing a flat strand structure and then shaping it using heat to form hair is something people already do, for example with the <a href="https://www.thingiverse.com/thing:2007221" rel="nofollow noreferrer">Hairy Lion model</a>.</p>
| <p>YES you can reshape printed PLA with heat.</p>
<p>I have a bin for all my brim/cleanup offcuts, stored at the printer. When it gets a bit full I simply blast it with my hot-air gun normally used for finishing prints. This shrinks the wispy bits, and thicker parts soften and droop down under their own weight.</p>
<... | 2,064 |
<p>I prefer to keep our SSIS packages in a solution on the server, not in sql. By default, sensitive data is encrypted with a user key. Since the sql server agent uses a service account to run jobs, we have to change this encryption method to something else. I like encrypting with a password.</p>
<p>The problem is whe... | <p>There is no need for you to have a password in the package at all if you can use Windows authentication and avoid SQL Server authentication and ensure that the rights necessary to execute your package are available to your service account.</p>
<p>Barring that, you should already be overriding the connection string ... | <p>You need set the password on your Job. </p>
<p>Go to the properties of your Job > two clicks over your Step > in the tab "General" type your login and password, than in the tab "Configuration" type your password (the password that you put inside the SSIS)</p>
| 33,420 |
<p>The first layer is very patchy indeed. I've calibrated the build plate pretty accurately but even if it was a badly calibrated build plate I don't think it would have this effect.</p>
<p><a href="https://imgur.com/S4KsNA3.png" rel="nofollow noreferrer"><img src="https://imgur.com/S4KsNA3.png" alt="Patchy First Lay... | <p>First things first:</p>
<h1>Don't Panic</h1>
<p>Your heated bed is made from metal with some sort of Build-Tak-Clone surface. It is not broken from what I can see. Your print is <strong>not failed</strong>, however, the quality does suffer a little bit.</p>
<p>Your bed does warp a little under heating. That is perfe... | <h2>I'm having the same problem but worse.</h2>
<p>Some parts of the print are squished and towards the middle I will have bad or no bed adhesion. I always have to print with a raft or else the first layer will fail.</p>
<h3>Borosilicate glass</h3>
<p>From what I've read online the best solution it to replace the build... | 1,140 |
<p>I was thinking earlier today about an idea for a small game and stumbled upon how to implement it. The idea is that the player can make a series of moves that cause a little effect, but if done in a specific sequence would cause a greater effect. So far so good, this I know how to do. Obviously, I had to make it be ... | <p>I'm not absolutely completely sure that I understand exactly what you're saying, but as an analagous situation, say someone's inputting an endless stream of numbers on the keyboard. '117' is a magic sequence, '468' is another one, '411799' is another (which contains the first one). </p>
<p>So if the user enters:</p... | <p>What you're describing sounds very similar to the technology tree in a game live Civilization.</p>
<p>I don't know how the Civ authors built theirs, but I'd be inclined to use a multigraph to represent possible 'moves' - there will be some you can start at with no 'experience', and once you're in them, there will b... | 22,667 |
<p>Can you recommend peer reviewed libraries that I can use in C environment (something like Boost for C++) ? Something that provides hash, thread, interprocess communications, lists, smart memory management...</p>
<p>The environment is embedded system, not a very minimal system, but also not a PC!</p>
| <p>+1 for <a href="http://library.gnome.org/devel/glib/stable/" rel="noreferrer">GLib</a> from me, too. Plus, it has its own <a href="http://library.gnome.org/devel/glib/stable/glib-Threads.html" rel="noreferrer">threading API</a> too, so you don't have to learn pthreads if you don't want to.</p>
<p>Not sure if there ... | <p>I'll jump on the GLib bandwagon too. Remember that C doesn't provide any syntactic sugar for complex data structures, so there are lots of casts and long function names in GLib, but it really does a great and efficient job with a little added verbosity!!</p>
| 26,240 |
<p>I have written a message handler function in Outlook's Visual Basic (we're using Outlook 2003 and Exchange Server) to help me sort out incoming email. </p>
<p>It is working for me, except sometimes the rule fails and Outlook deactivates it. </p>
<p>Then I turn the rule back on and manually run it on my Inbox to ca... | <p>This code showed me the different TypeNames that were in my Inbox:</p>
<pre><code>Public Sub GetTypeNamesInbox()
Dim myOlItems As Outlook.Items
Set myOlItems = application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
Dim msg As Object
For Each msg In myOlItems
Debug.Print TypeName(msg)
'email... | <p>why not use a simple error handler for the code? Seriously. You could write an error for each read of a property or object that seems to fail. Then have it Resume no matter what. No need for complex error handling. Think of a test that shows an empty subject. Since you don't know what value it will return, if ... | 10,437 |
<p>I have a large project for which I am attempting to use TDD.
I am using <a href="http://tut-framework.sourceforge.net/" rel="nofollow noreferrer">Tut</a> as my test framework, which has its flaws but is sufficient for what I need. </p>
<p>I need to exploit link time test seams, <strong>each test must be in its own ... | <p>"Is it possible to hide projects from a build and yet still have them build?"</p>
<p>You can make separate solution for test cases.
Then you can set up post build step of your main projects. This post-build should build tests-projects via separate solution and run them. Building test-projects should be done via com... | <p>You could try to group your tests into folders (are they called filters?) within your solution in Solution Explorer. This would separate tests from your other projects.</p>
<p>But, otherwise, could you avoid using link time test seams (Yes, I know, its probably too late to suggest this) and use polymorphism to pro... | 32,264 |
<p>I'm in big trouble here, today i was asked to add a new user to TFS, the first thing I do is adding it to SharePoint, but now every time I tried to enter the project portal (Team Explorer -> right click on project -> Show project portal) I got an page not found error, with every single project, Here are some basic i... | <p>my SharePoint problem is fixed, here are the details. </p>
<ol>
<li>Run "SharePoint Product Technologies Configuration Wizard"<br>
1.1. Select do not disconnect from this server farm, click next<br>
1.2. Select No, this machine will continue to host the web site, click next.<br>
1.3 Click Next </li>
<li>Restart I... | <p>I have had the same problem with the core.css file. I didn't want to use Sharepoint designer to solve it cause it would have unghosted my site!</p>
<p>So I tried this (it works) : on the site administration, go to "master page", and down the page you have a way to redefine the css used for the site. So i put there ... | 41,291 |
<p>I am new to C and i have this question. why does the following code crash:</p>
<pre><code>int *a = 10;
*a = 100;
</code></pre>
| <p>Because you are trying to write 100 to the memory location 0x0000000A which is probably not allocated to your program. That is,</p>
<pre><code>int *a = 10;
</code></pre>
<p>does not mean that the pointer 'a' will point to a location in memory having the value of 10. It means it is pointing to address 10 (0x0000000... | <p>It's probably crashing because you are assigning the pointer to some part of memory which you don't have access to and then you're assigning some value to that memory location (which you're not allowed to do!).</p>
| 25,469 |
<p>What is JDBC and where can I start learning about?</p>
<p>I know it's a way to access databases with Java, but what problems does it solve? Is it an ORM (or does it try to be)? Does it abstract away differences between databases, at the syntax level? What does it do? and what does it not do?</p>
| <p>JDBC is a driver that allows you to access database. It provides you with a very raw way to access the database using SQL. Its primary function is to allow you (the user) to run SQL commands on the database. It is not an ORM and never will be. The sun website <a href="http://java.sun.com/docs/books/tutorial/jdbc... | <p>You've practically answered your own question.</p>
<p>It provides a common interface for accessing databases, which means that regardless of the nuances of individual databases, or how they are implemented, your API calls are the same. It is not an ORM.</p>
| 39,178 |
<p>I have three <code>divs</code>:</p>
<pre><code><div id="login" />
<div id="content" />
<div id="menu" />
</code></pre>
<p>How would I define the CSS styles (without touching the HTML) to have the <code>menu-div</code> as the left column, the <code>login-div</code> in the right column and the ... | <pre><code>#menu {
position:absolute;
top:0;
left:0;
width:100px;
}
#content, #login {
margin-left:120px;
}
</code></pre>
<p>Why this way? The menu coming last in the markup makes it tough. You might also be able to float both content and login right, and added a clear:right to content, but I think this mi... | <p>Floats away... not perfect. <a href="https://stackoverflow.com/questions/134125/positioning-three-divs-with-css#134162">Chris's answer</a> seems a better solution.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-c... | 16,238 |
<p>In the admin section of a website i am building i would like to put together a dashboard page, or 'quick look' type page where the most recent changes/additions/etc in several different areas can be viewed.</p>
<p>I was thinking the best way to do this would be to use partials and have each partial contain the mark... | <p>Partials are definitely the way to go, especially when you can pass in arbitrary data into them to make them do stuff. To answer your logic separation issue specifically, you would use: </p>
<pre><code><%= render :partial => "name_of_partial", :locals => { :some_var => @data_from_model } %>
</code><... | <p>The controller should be responsible for retrieving the data you need to present (and, usually implicitly, passing it to the view). Build no HTML here.</p>
<p>The partials, of course, are where you figure out presentation - you can make it a list, graph, Google Visualization widget, a single number in 40-point fon... | 41,086 |
<p>I need to extract only the 2nd level part of the domain from request.servervariables("HTTP_HOST") what is the best way to do this?</p>
| <p>This can be solved through a regular expression.</p>
<p>Since the <code>HTTP_HOST</code> server variable can contain only valid host names, we don't need to care about <em>validating</em> the string, only about finding out its structure. Therefore the regex is kept fairly simple, but would not work reliably in broa... | <p>Since HTTP_HOST header only returns the domain (excluding any subdomains), you should be able to do the following:</p>
<pre><code>'example: sample.com
'example: sample.co.uk
host = split(request.serverVariables("HTTP_HOST"), ".")
host(0) = "" 'clear the "sample" part
extension = join(host, ".") 'put it back togeth... | 23,902 |
<p>I have seen <a href="http://blogs.msdn.com/djpark/archive/2007/11/07/how-to-use-solutions-and-projects-between-visual-studio-2005-and-2008.aspx" rel="nofollow noreferrer">Solutions created in Visual Studio 2008 cannot be opened in Visual Studio 2005</a> and tried workaround 1. Yet to try the workaround 2. </p>
<p>B... | <p>I have a project that I work on in both VS 2005 and VS 2008. The trick is just to have to different solution files, and to make sure they stay in sync. Remember that <strong>projects</strong> keep track of their <strong>files</strong>, so the main thing <strong>solutions</strong> do is keep track of which <strong>... | <p>I'd say you should restore your 2005 version from source control, assuming you have source control and a 2005 copy of the file.</p>
<p>Otherwise, there are plenty of pages on the net that details the changes, but unfortunately no ready-made converter program that will do it for you.</p>
<p>Be aware that as soon as... | 4,542 |
<p>What's the most natural way to model a group of objects that form a set? For example, you might have a bunch of user objects who are all subscribers to a mailing list.</p>
<p>Obviously you could model this as an array, but then you have to order the elements and whoever is using your interface might be confused as ... | <p>In Python, you would use the <a href="http://docs.python.org/library/stdtypes.html#types-set" rel="nofollow noreferrer"><code>set</code></a> datatype. A <code>set</code> supports containing any hashable object, so if you have a custom class you need to store in a set and the default hashable behaviour is not appropr... | <p>In c as a stand-in for understanding the machine directly:</p>
<ul>
<li>For small, discrete and well defined ranges: use a bitwise array to indicate the presence of each possible item (set for present, unset for absent).</li>
<li>Use a hash-table for all other cases.</li>
</ul>
<p>Write functions to implement addi... | 47,047 |
<p><a href="https://msdn.microsoft.com/en-us/library/system.io.path.combine%28v=vs.110%29.aspx" rel="noreferrer">Path.Combine</a> is handy, but is there a similar function in the .NET framework for <a href="http://en.wikipedia.org/wiki/Uniform_resource_locator" rel="noreferrer">URLs</a>?</p>
<p>I'm looking for syntax ... | <p><a href="https://learn.microsoft.com/en-us/dotnet/api/system.uri" rel="noreferrer"><code>Uri</code></a> has a constructor that should do this for you: <code>new Uri(Uri baseUri, string relativeUri)</code></p>
<p>Here's an example:</p>
<pre><code>Uri baseUri = new Uri("http://www.contoso.com");
Uri myUri = new Uri(... | <p>I have to point out that <code>Path.Combine</code> appears to work for this also directly, at least on .NET 4.</p>
| 48,746 |
<p>I need to display profiling information pulled from a deeply embedded CPU, presenting it in a way which other developers on my team will be able to act upon. The profiling data is a snapshot of a cycle counter at the entry and exit of every function, so we have a call graph annotated with sub-microsecond timing accu... | <p>Another neat tool to visualize profiling data is the <a href="http://code.google.com/p/jrfonseca/wiki/Gprof2Dot" rel="nofollow noreferrer">gprof2dot.py python script</a>.
It can be used to visualize several different formats: "This is a Python script to convert the output from prof, gprof, oprofile, Shark, AQtime, a... | <p>I've written a browser-based visualization tool, <a href="https://pypi.python.org/pypi/ProfileEye/" rel="nofollow">profile_eye</a>, which operates on the output of <a href="https://github.com/jrfonseca/gprof2dot" rel="nofollow">gprof2dot</a>.</p>
<p>gprof2dot is great at grokking many profiling-tool outputs, and do... | 7,865 |
<p>Is there a way to colorize parts of logs in the eclipse console. I know I could send to error and standard streams and color them differently but I'm more looking someting in the lines of ANSI escape codes (or anyother, HTML ?) where I could embed the colors in the string to have it colored in the logs.</p>
<p>It ... | <p>Have a try with this Eclipse Plugin: <a href="http://marketplace.eclipse.org/content/grep-console" rel="noreferrer">Grep Console</a></p>
<p><strong>[Update]</strong>:<br>
<strike>As pointed out by commenters:
When installing Grep Console in the currently last version of Eclipse, you need to uncheck 'Group items by ... | <h1>Emoji</h1>
<p>You can use colors for text as others mentioned in their answers.</p>
<p>But you can use <strong>emojis</strong> instead! for example you can use You can use <code>⚠️</code> for warning messages and <code></code> for error messages to make them standing out!</p>
<p>Or simply use these note books as a ... | 28,936 |
<p>I'm exploring the XML -> XSLT -> HTML meme for producing web content. I have very little XSLT experience.</p>
<p>I'm curious what mechanisms are available in XSLT to handle abstractions or "refactoring".</p>
<p>For example, with generic HTML and a service side include, many pages can be templated and decomposed to... | <p>For my own project, this is how I divided up my pages. There was a template.xsl file which was imported
by each of my XSLs. Most pages just had template.xsl, but some pages such as cart, etc. needed their own
because of the different kind of data they were parsing. </p>
<pre><code><page title="Home">
<... | <p>XSLT is powerful, but it is very different from most programming languages and it is quite limited in what it makes available to you, so things that you have built-in with another language may need some quite complex xsl manipulation to work with. I found <a href="http://www.mulberrytech.com/quickref/" rel="nofollow... | 20,225 |
<p>I've built a entity framework model against a 2008 database. All works ok against the 2008 database. When I try to update the entity on a 2005 database I get this error. </p>
<pre>The version of SQL Server in use does not support datatype 'datetime2</pre>
<p>I specifically did not use any 2008 features when I b... | <p>A quick google points me to what looks like the <a href="http://alexduggleby.com/2008/08/11/entity-data-model-generated-against-sql-2008-used-against-sql-2005/" rel="noreferrer">solution</a>.</p>
<p>Open your EDMX in a file editor (or “open with…” in Visual Studio and select XML Editor). At the top you will find th... | <p>Better solution to me is instead of manually editing EDMX file is just open edmx in design mode and in context menu "Update Model from Database...".
You have to be pointing to right SQL version of course whatever this is for you.</p>
| 40,855 |
<p>I need to get a file from sourcesafe database programmatically. Any idea of how to do it? </p>
<p>ps: I'll do that by using C#.</p>
| <pre><code>using System;
using System.Collections.Generic;
using SourceSafeTypeLib;
namespace YourNamespace
{
public class SourceSafeDatabase
{
private readonly string dbPath;
private readonly string password;
private readonly string rootProject;
private readonly string username;
private readonly... | <p>There is a command-line SS.EXE program that you can call to do source control operations. However, it relies on global SourceSafe configuration and so it sometimes is hard to make it do what you want.</p>
| 36,452 |
<p>As I've increasingly absorbed Agile thinking into the way I work, yagni ("you aren't going to need it") seems to become more and more important. It seems to me to be one of the most effective rules for filtering out misguided priorities and deciding what <em>not</em> to work on next.</p>
<p>Yet yagni seems to be a ... | <p>TDD has subsumed YAGNI in a way. If you do TDD properly, that is, only write those tests that result in required functionality, then develop the simplest code to pass the test, then you are following the YAGNI principle by default. In my experience, it is only when I get outside the TDD box and start writing code ... | <p>I don't see YAGNI as the opposite of quick-and-dirty, really. It is doing just what is needed and no more and not planning like the software someone writes has to last 50 years. It may come rarely because there aren't really that many questions to ask around it, at least to my mind. Similar to the "don't repeat y... | 48,314 |
<p>My hope is to one-click a shortcut, and get a grid of cygwin shells laid out before me, filling up my whole screen.</p>
<p>Any idea where I should start looking?</p>
| <p>Would ~ (<a href="http://en.wikipedia.org/wiki/Tilde" rel="nofollow noreferrer">tilde</a>) work?</p>
<p>Edit: Google now treats <a href="http://news.cnet.com/8301-10784_3-9748779-7.html" rel="nofollow noreferrer">underscores and dashes as word separators</a> so you can use dashes as dashes and underscores as space... | <p>Why not use Url Encoding? Most frameworks have built in utilities to do this.</p>
| 34,011 |
<p>I need to store items with a calendar date (just the day, no time) in a sqlite database. What's the best way to represent the date in the column? Julian days and unix seconds come to mind as reasonable alternatives. If I go with a unit other than days at what clock time should it be?</p>
<p>Update: I am aware of... | <p>If you expect to be handing the date to an external tool or library, you should use whatever format it expects. Unix time seems to be the lingua franca of digital horography, so it's a good default if external circumstances don't make the choice for you.</p>
<p><a href="http://en.wikipedia.org/wiki/ISO_8601#Calenda... | <p>If you want to cover your bases make sure you store the date in utc and pick an iso standard. This approach requires minimal effort and will protect your code from future Interop headaches.
I agree with @skymt <a href="http://en.wikipedia.org/wiki/ISO_8601#Calendar_dates" rel="nofollow noreferrer">ISO 8601</a> is a... | 14,769 |
<p>In Ruby I have often written a number of small classes, and had a main class organize the little guys to get work done. I do this by writing </p>
<pre><code>require "converter.rb"
require "screenFixer.rb"
.
.
.
</code></pre>
<p>at the top of the main class. How do I do this in Java? Is it "import?"</p>
<p>Also, c... | <p>If you mean that you are going to write some code that will be using another class. Yes you will need to import those classes using an import statement.</p>
<p>i.e. </p>
<pre><code>package com.boo;
import com.foo.Bar;
public class StackOverflow {
private Bar myBar;
}
</code></pre>
| <pre><code>
public class Example {
public Example(IConverter converter, IScreenFixer screenFixer) {
}
}
</code></pre>
<p><a href="http://en.wikipedia.org/wiki/Facade_pattern" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Facade_pattern</a> ?</p>
| 27,212 |
<p>Are there any alternatives to JSTL? One company I worked for 3 years ago used JSTL and custom tag libraries to separate presentation from logic. Front-end developers used EL to do complex presentation logic, generate layouts in JSP pages and it worked out great. Perhaps new technologies have come out. Anything bette... | <p>JSTL and EL are two distinct concepts.</p>
<p>JSTL is just one tag library. Most frameworks provide their own taglib that approximately duplicates the functionality of JSTL. I say approximately, because these often misuse or overlook key principles of JSP and the Servlet API. </p>
<p>The strength of JSTL is that i... | <p>I won't say they're a replacement or alternative, but I think <a href="http://jsftutorials.net/" rel="nofollow noreferrer">Java-Server-Faces</a> go a step further in separation presentation from logic...</p>
| 44,384 |
<p>Reading over the responses to this question <a href="https://stackoverflow.com/questions/64333/what-is-the-downside-to-test-driven-development">Disadvantages of Test Driven Development?</a> I got the impression there is alot of misunderstanding on what TDD is and how it should be conducted. It may prove useful to ad... | <p>I feel the accepted answer was one of the weakest (<a href="https://stackoverflow.com/questions/64333/what-is-the-downside-to-test-driven-development#67184">Disadvantages of Test Driven Development?</a>), and the most up-modded answer smells of someone who might be writing over specified tests.</p>
<blockquote>
<... | <p>The misconception that I often see is that TDD ensures good results.</p>
<p>Often times tests are written off of flawed requirements, and therefore, the developers produce a product that does not do what the user is expecting. Key to TDD is, in my opinion, working with the users to define requirements while helping... | 9,771 |
<p>I want to know the basic principle used for WYSIWYG pages on the web. I started coding it and made it using a text area, but very soon I realized that I cannot add or show images or any HTML in the text area. So I made it using DIV, but I did not understand how I could make it editable.</p>
<p>So, in gist, <strong>... | <p>There's the <code>contentEditable</code> flag that can be added to any element on a page to make it editable, eg.</p>
<pre><code><div contentEditable>I am editable!!!!</div>
</code></pre>
<p>Should work in all major browsers nowadays, and things like shortcuts keys (cmd/ctrl-b, etc) will Just Work.</p>... | <p><a href="http://tinymce.moxiecode.com/" rel="nofollow noreferrer">TinyMCE</a> is open-source, so you could take a look at how it works under the hood. :)</p>
<p>It appears from the <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Installation#The_most_basic_page_integration_.28converts_all_textarea_elements_int... | 47,603 |
<p>In a project our team is using object lists to perform mass operations on sets of data that should all be processed in a similar way. In particular, different objects would ideally act the same, which would be very easily achieved with polymorphism. The problem I have with it is that inheritance implies the <em>is... | <p>I think you should be implementing interfaces to be able to enforce your <em>has a</em> relationships (am doing this in C#):</p>
<pre><code>public interface IDamageable
{
void AddDamage(int i);
int DamageCount {get;}
}
</code></pre>
<p>You could implement this in your objects:</p>
<pre><code>public class ... | <p>Sometimes it's worth giving up the ideal for the realistic. If it's going to cause a massive problem to "do it right" with no real benefit, then I would do it wrong. With that said, I often think it's worth taking the time to do it right, because unnecessary multiple inheritance increases complexity, and it <em>ca... | 3,296 |
<p>I'm a web developer, and I want to make the web sites I develop more accessible to those using screen readers. What limitations do screen readers have that I should be most aware of, and what can I do to avoid hitting these limitations.</p>
<p>This question was sparked by reading another question about <a href="ht... | <blockquote>
<p>Are screen readers really so primitive that they would read text that isn't even displayed on the screen?</p>
</blockquote>
<p>What you have to remember is that any HTML parser doesn't read the screen - it reads the source markup. Whta you see on the screen is the browser's attempt to apply CSS to th... | <p>Have a look at <a href="http://www.w3.org/WAI/" rel="nofollow noreferrer">ARIA</a>, it's a standard for developing accessible rich-web-client applications.</p>
| 4,651 |
<p>I recently completed development of a mid-traficked(?) website (peak 60k hits/hour), however, the site only needs to be updated once a minute - and achieving the required performance can be summed up by a single word: "caching".</p>
<p>For a site like SO where the data feeding the site changes <em>all the time</em>... | <p>Here's some code for sampling without replacement based on Algorithm 3.4.2S of Knuth's book Seminumeric Algorithms.</p>
<pre><code>void SampleWithoutReplacement
(
int populationSize, // size of set sampling from
int sampleSize, // size of each sample
vector<int> & samples // output,... | <p>Another algorithm for sampling without replacement is described <a href="http://rosettacode.org/wiki/Knuth%27s_algorithm_S" rel="nofollow">here</a>. </p>
<p>It is similar to the one described by John D. Cook in his answer and also from Knuth, but it has different hypothesis: The population size is unknown, but the ... | 40,170 |
<p>This question is not so much programming related as it is deployment related.</p>
<p>I find myself conversing a lot with the group in my company whose job it is to maintain our production Windows servers and deploy our code on them. For legal and compliance reasons, I do not have direct visibility or any control ov... | <p>You should open up IE on the server for which you are looking for this info, and go to this site: <a href="http://www.hanselman.com/smallestdotnet/" rel="noreferrer">http://www.hanselman.com/smallestdotnet/</a></p>
<p>That's all it takes.</p>
<p>The site has a script that looks your browser's "UserAgent" and figur... | <p>It is probably a nasty way to find versions out, but I was always under the impression that all version got installed to <code><root>:\WINDOWS\Microsoft.NET\Framework</code>.</p>
<p>This provides folders with names such as <code>v2.0.50727</code> which I believe give detailed version information.</p>
| 16,923 |
<p>I know how to create a <code>SEL</code> at compile time using <code>@selector(MyMethodName:)</code> but what I want to do is create a selector dynamically from an <code>NSString</code>. Is this even possible?</p>
<p>What I can do:</p>
<pre><code>SEL selector = @selector(doWork:);
[myobj respondsToSelector:selector... | <p>I'm not an Objective-C programmer, merely a sympathizer, but maybe <a href="https://developer.apple.com/documentation/foundation/1395294-nsselectorfromstring?language=objc" rel="noreferrer">NSSelectorFromString</a> is what you need. It's mentioned explicity in the <a href="http://developer.apple.com/documentation/Co... | <p>I know this has been answered for long ago, but still I wanna share. This can be done using <code>sel_registerName</code> too.</p>
<p>The example code in the question can be rewritten like this:</p>
<pre><code>SEL selector = sel_registerName("doWork:");
[myobj respondsToSelector:selector];
</code></pre>
| 13,769 |
<p>I am interested to know whether anyone has written an application that takes advantage of a <a href="http://en.wikipedia.org/wiki/GPGPU" rel="nofollow noreferrer">GPGPU</a> by using, for example, <a href="http://www.nvidia.com/object/cuda_get.html" rel="nofollow noreferrer">nVidia CUDA</a>. If so, what issues did y... | <p>I have been doing gpgpu development with <a href="http://ati.amd.com/technology/streamcomputing/sdkdwnld.html" rel="nofollow noreferrer">ATI's stream SDK</a> instead of Cuda.
What kind of performance gain you will get depends on a <strong><em>lot</em></strong> of factors, but the most important is the numeric intens... | <p>Yes. I have implemented the <a href="http://www.cs.huji.ac.il/~cheny/reading/diffusion/classic.pdf" rel="nofollow noreferrer">Nonlinear Anisotropic Diffusion Filter</a> using the CUDA api.</p>
<p>It is fairly easy, since it's a filter that must be run in parallel given an input image. I haven't encountered many dif... | 7,915 |
<p><strong>Problem:</strong> EmacsW32 is a version of Emacs that allows the user to make Emacs treat the "Windows" key as the "Meta" key (instead of treating the Alt key as the "Meta" key). Although this works as advertised, the question is what happens when you want to create an Emacs keybinding for the "Alt" key?</p>... | <p>To figure out if Emacs is recognizing your Alt key at all: type <code>C-h c</code>, then some key combination that starts with Alt, e.g. Alt-f. <br/>If it says "<code>M-f runs the command forward-word</code>" (for example), then Emacs thinks of your Alt key as a Meta key too, and anything you bind to Meta will work ... | <p>You can either bind both the Windows and the Alt key to <code>Meta</code>, or you can assign the Alt key to a different change key. Emacs provides these possible bindings:</p>
<p><code>Shift</code><br>
<code>Control</code><br>
<code>Meta</code><br>
<code>Hyper</code><br>
<code>Super</code> </p>
<p>You will have ... | 47,803 |
<p>I am calling a SQL proc that has 3 OUTPUT params. After the call to the proc one of the params does not return a value when the other two do. Profiler shows that all 3 values are being returned.</p>
<p>The params are declared as follows in the proc...</p>
<pre><code>@UsrVariableID INT OUTPUT,
@OrganisationName NVA... | <p>With output parameters that have variable length data types (nvarchar, varchar, etc), I've found that being more explicit leads to better results. In the case you've posted, a type is not specified on the C# side. I would probably change things to look something like the following:</p>
<pre><code>SqlParameter theOr... | <p>Thanks everyone, As suggested by Ady and Scott explicly declaring the type in the parameter declaration solved it.I picked Scotts answer as it was more concise.</p>
| 30,771 |
<p>I seem to be seeing more 'for' loops over iterators in questions & answers here than I do for_each(), transform(), and the like. Scott Meyers suggests that <a href="http://www.ddj.com/cpp/184401446" rel="noreferrer">stl algorithms are preferred</a>, or at least he did in 2001. Of course, using them often means... | <p>It depends on:</p>
<ul>
<li>Whether high-performance is required</li>
<li>The readability of the loop</li>
<li>Whether the algorithm is complex</li>
</ul>
<p>If the loop isn't the bottleneck, and the algorithm is simple (like for_each), then for the current C++ standard, I'd prefer a hand-rolled loop for readabili... | <p>I think a big factor is the developer's comfort level.</p>
<p>It's probably true that using transform or for_each is the right thing to do, but it's not any more efficient, and handwritten loops aren't inherently dangerous. If it would take half an hour for a developer to write a simple loop, versus half a day to ... | 16,367 |
<p>I am having an ASP.net Membership I need to verify the User Question and Answer.</p>
<p>I dont need to use Password Because its Hashed we cannot validate it</p>
<p>MembershipUser msUser = Membership.GetUser("Rasel");</p>
<p>thanks,
Lalithambigai</p>
| <p>Ask the user a question and compare their answer with their previously provided answer?</p>
<p>However, a hashed password doesn't prevent you from verifying it. Simply hash the user's response and compare the hash with the stored password hash. Note that the hashing scheme may contain salt, or initialization char... | <p>If you are storing the Question/Answer in the membership provider (which it sounds like you are) then you pass the answer to the msUser.ResetPassword method. If the answer is incorrect it will throw a MembershipPasswordException. </p>
| 33,730 |
<p>I have a DataSet which I get a DataTable from that I am being passed back from a function call. It has 15-20 columns, however I only want 10 columns of the data.</p>
<p>Is there a way to remove those columns that I don't want, copy the DataTable to another that has only the columns defined that I want or is it just... | <p>Aside from limiting the columns selected to reduce bandwidth and memory:</p>
<pre><code>DataTable t;
t.Columns.Remove("columnName");
t.Columns.RemoveAt(columnIndex);
</code></pre>
| <p>How about you just select the columns you want like this:</p>
<pre><code>Dim Subjects As String = "Math, English"
Dim SubjectData As DataTable = Table.AsDataView.ToTable(True, Subjects.Split(","))
</code></pre>
| 10,070 |
<p>What does the following error mean? </p>
<p>Geeneration of designer file failed: Exception from HRESULT: 0x80042929 </p>
<p>It started showing up in my application when building and I'm not sure what's causing it. I'm using VS.Net 2008 and .Net 3.5</p>
| <p>This adds to EvilTeach's advice. Keep in mind that it's fairly easy to <em>link</em> Fortran 77 and C/C++ code, so you can convert parts of your application incrementally and link them together with the old parts. You'll have to think about all the usual fortran/c discrepancies (row/column-major arrays, array inde... | <p>I've worked on a application that, at its heart, was code converted from FORTRAN using <strong>for_c</strong> . The code it created was god awful. It was very difficult to maintain since most of it was indecipherable. Luckily that code was pretty stable and it was rare that anything had to be done to it.</p>
<p>How... | 34,720 |
<p>I have a single image with 9 different states and the appropriate background-position rules set up as classes to show the different states. I can't use the :hover pseudo-selector because the background image being changed is not the same element that is being hovered over. I have defined the classes this way:</p>
<... | <p>Guess one: Rendering bug 1</p>
<p>Make sure that you have triggered hasLayout on the elements. You can do this by giving them a height or, if that isn't a posibility then position = relative & z-index = 1, will also trigger hasLayout. Try it for these elements + suspect parent elements.</p>
<pre><code>/* fix h... | <p>Use <code>className</code> DOM property. <code>setAttribute()</code> is utterly broken in IE < 8.</p>
| 26,197 |
<p>Recently the company I work for was asked to pitch for creation of a forum targetted at children as part of a website solution.</p>
<p>I think that at least we should reccommend</p>
<ul>
<li>Human moderation by a trained individual to protect these kids</li>
<li>Code alarm / suspicious analysis into the forum</li>... | <p>It's not an online forum, but they do discuss some of the things they had to deal with to provide a safe environment for children. Check out the post-mortem of the game team that developed Disney's toontown: <a href="http://www.gamasutra.com/view/feature/2027/postmortem_disney_onlines_.php" rel="nofollow noreferrer... | <p>Live moderators are probably your best bet. Disney's Toontown actually ran into quite a few privacy/security problems when they missed that kids are often rather clever.</p>
<p>Although I don't know if it's still in there, there used to be a function where you had an "apartment" you could fill with "furniture," SIM... | 47,672 |
<p>I'm in a 10 person team working on a large legacy code base with a less than ideal product owner. Our backlog is in pretty bad shape and large epics have frequently been breaking our sprints. The team also struggles with its definition of done - some members write unit test religiously, others don't, sometimes depen... | <p>This is recognized around our office as the "Ah, crap! I forgot about that." burndown:</p>
<pre><code> # # #
# # # #
# # # # #
# # # # # #
# # # # # # #
# # # # # # # #
# # # # # # # #
</code></pre>
| <p>Here it's often like that:</p>
<pre><code>#####
#######
########
#########
#########
#########
##########
</code></pre>
<p>Positive: Delivery on time.</p>
<p>Negative: Too big backlog items or too many backlog items started at the same time from the beginning.</p>
| 26,204 |
<p>Why does my 3 mm PLA filament always snap near the spool some time (usually a few hours) after a print has finished?</p>
<p>I have had it snap mid print but this is quite rare.</p>
<p>I have 3 rolls of 3 mm PLA filament from Velleman and 3DPrima. They all exhibit this behavior. They are between 2 and 3 y... | <p>PLA seems to become brittle with age. Micro-fractures develop on the surface, and they will grow if filament is taken off the spool and held straight. This behaviour does not seem to be linked to moisture content. The best course of action is probably to use PLA quickly. Don't give it time to age.</p>
| <p>PLA snapping is pretty universal. The best countermeasure is to always remove the filament from the printer after a print and place it in a low-humidity chamber. Other answers speak of moisture-induced micro-cracks, for which I have no evidence for or against.</p>
<p>This has occurred for me when I've been lazy a... | 1,541 |
<p>I've encountered a weird situation:</p>
<p>Messages are sent from ServerA to ServerB. It goes into ServerA outgoing queue and then sent to ServerB's queue.</p>
<p>ServerB crashed. We had to reformat. When we brought it up, we forgot to install the MSMQ Service.</p>
<p>Messages begin pilling up in ServerA's outgoi... | <p>When opening a queue to send messages to a remote computer (when dwAccess is set to <code>MQ_SEND_ACCESS</code>), Message Queuing does not check for the existence of the queue. </p>
<p>From the MSMQ Docs: </p>
<p><a href="http://msdn2.microsoft.com/en-us/library/ms699817.aspx" rel="nofollow noreferrer">http://msdn... | <p>We have a similar behavior where messages dissappeared. What I noticed is that if the 'UseDeadLetterQueue' is set to true, at least when the transmission fails it keeps a copy in the dead letter queue on the source system.</p>
<p>Example:</p>
<pre><code>var message = new System.Messaging.Message();
message.UseDea... | 39,455 |
<p>Would you guys think that a master page should be part of the company's framework or it should be part of each application? Or perhaps the company's framework should only have a interface to provide the least functionality to all master pages ?</p>
<p>Currenlty we face two problems: Firstly, the original idea was t... | <p>I would try to move UI elements like common controls into your framework libraries, and create a master page for each application <em>in</em> the application. This will give you the ability to maintain common UI elements across your applications through the use of common controls, and will provide the flexibility t... | <p>Share some CSS and design library (templates, images, palette,) but a single shared master page is unlikely to be flexible enough.</p>
| 32,156 |
<p>My C(++) program, written and compiled using Visual C(++)/Visual Studio, runs fine on my own machine, but refuses to run on another machine. The error message I get is "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."</p>
| <p>If you write a C++ program, it links dynamically to the C Runtime Library, or CRT for short. This library contains your printf, your malloc, your strtok, etcetera. The library is contained in the file called MSVCR80.DLL. This file is not by default installed on a Windows system, hence the application cannot run.</p>... | <p>Often times this error is the result of attempting to run the debug version of an application that uses .NET. Since the .NET redistributable package doesn't include the debug versions of the dlls that are installed with Visual Studio, your application will often get this error when running it on any other machine t... | 12,468 |
<p>So I've been using InstantRails to check out Ruby on rails. I've been using Notepad++ for the editing. Now I don't want to install Ruby or Rails on my machine. Is there any walk through/tutorial on how to integrate Radrails or Netbeans with InstantRails? </p>
| <p>Here's a tutorial: <a href="http://ruby.meetup.com/73/boards/view/viewthread?thread=2203432" rel="nofollow noreferrer">http://ruby.meetup.com/73/boards/view/viewthread?thread=2203432</a><br>
(I don't know if it's any good.)</p>
<p>And here's one with InstantRails+Netbeans: <a href="https://web.archive.org/web/20100... | <p>I recommend learning Rails and Ruby itself first, and then picking up something like InstantRails. Having too many layers when learning something new can make it hard to know what features are part of which language, and potentially confuse you when trying to determine where a bug is occurring.</p>
| 5,832 |
<p>I'm trying to modify some parts on <a href="https://www.thingiverse.com/thing:2115095" rel="noreferrer">this</a> thing. I'm kind of new to dealing with the modeling aspects of this.</p>
<p>I am attempting to widen the part essentially 3mm. This would involve modifying the chain segments, and the anchor points.</p>
... | <p>I found that the answer provided by @Marco was helpful but not the correct answer I was looking for.</p>
<p>Here is the general approach I used (Based on <a href="https://open-shelf.appspot.com/FreeCAD/en-US/34.html" rel="nofollow noreferrer">this</a>).</p>
<ol>
<li>Create new document</li>
<li>Import STL file</li... | <p>I found Dave G's answer to be helpful, however I could only use additive features (e.g. Pad) on the created object, and could not make subtractive features <em>into</em> the object (e.g. Pocket).</p>
<p>Here's what worked for me using FreeCAD 0.19 (Instructions from <a href="http://pinter.org/archives/4255" rel="no... | 972 |
<p>What does the <code>,</code> operator do in C?</p>
| <p>The expression:</p>
<pre><code>(expression1, expression2)
</code></pre>
<p>First <code>expression1</code> is evaluated, then <code>expression2</code> is evaluated, and the value of <code>expression2</code> is returned for the whole expression.</p>
| <p>I'm reviving this simply to address questions from @Rajesh and @JeffMercado which i think are very important since this is one of the top search engine hits.</p>
<p>Take the following snippet of code for example </p>
<pre><code>int i = (5,4,3,2,1);
int j;
j = 5,4,3,2,1;
printf("%d %d\n", i , j);
</code></pre>
<p>... | 7,577 |
<p>I have a Silverlight 2 application that validates data OnTabSelectionChanged. Immediately I began wishing that UpdateSourceTrigger allowed more than just LostFocus because if you click the tab without tabbing off of a control the LINQ object is not updated before validation. </p>
<p>I worked around the issue for Te... | <p><a href="http://blog.mustoverride.com/2010/01/silverlight-updatesourcetrigger.html?showComment=1279149377285_AIe9_BFLaR4pbpg_swaitgIUU0PR-hQVluTHi6P3siH156dRQIYsaNKVxx_ptreNpwv-HaozS_tab7wC55uFRxgzpOU22HtkC6-Cz2DwtrHdnmZZ5dn0sOwczJ_MpPg5K5LsT24F6GdNHZyI9LYI4kQQaU0V7rtwuIkU1AsYxATywIYpt_ZIRS5lh4WjahPQqu4-c9TBPqHvJN0z... | <p>I know it's old news... but I got around this by doing this:</p>
<p>Text="{Binding Path=newQuantity, UpdateSourceTrigger=PropertyChanged}"</p>
| 31,624 |
<p>Suppose we have a 3D Space with a plane on it with an arbitrary equation: ax+by+cz+d=0
now suppose that we pick 3 random points on that plane: (x0, y0, z0) (x1, y1, z1) (x1, y1, z1)</p>
<p>now I have a different point of view(camera) for this plane. I mean I have a different camera that will look at this plane from ... | <p>DataGrids are excellent for displaying large amounts of tabular data bound to a backing store. </p>
<p>But what happened in the WinForms world was that people often used them for everything that required a multi-element scrolling list. Souped-up third-party DataGrids soon became available that allowed columns and f... | <p>After working with WPF for about 2 years now. I would say that a DataGrid is really just a glorified ListBox (since [almost] everything in WPF is styleless). </p>
<p>One could style a ListBox to take an Entity of some sort and show a "record" control for each entry. Depending on how flexible these are made, they co... | 15,625 |
<p>Our CD autostarts, but occasionally customers have that disabled (by a CD burner, etc.).</p>
<p>As a backup, we include instructions on the back of our CD (below). I'm trying to find better instructions, for Windows XP and above. (Ideally for Windows 98 and above)</p>
<p><strong>CURRENT</strong></p>
<p>If it doe... | <p>One way might be : make an icon on your CD, and have user look for that icon.</p>
<p>Make the icon stand out so it's easy to look for and just tell them to double-click the icon.</p>
<p>Use the same icon on start.exe too.</p>
<p>And you might as well move everything else into its own folder on the CD, leaving onl... | <p>Well, the Windows+E key will bring up Windows Explorer. You could ask them to press that key combination, and that will at least get them an Explorer window without having to go to the desktop...</p>
| 29,331 |
<p>In another <a href="https://stackoverflow.com/questions/89193/does-linq-to-sql-support-composable-queries">posting: Does Linq-To-Sql support composable queries</a> there was discussion on how to compose/concat where clauses dynamically. This appears to be done with an "AND" (i.e. the first where clause and the seco... | <p>Is what you want as simple as:</p>
<pre><code>var people = from p in Person
where p.age < 18 || p.firstName == "Daniel"
select p;
</code></pre>
<p>or have you just given a simple example?</p>
<p>In which case you can use:</p>
<pre><code>var under18 = from p in Person
wh... | <p>The predicate option is the way to go. The Union option DOES NOT build good sql. Reference <a href="http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/thread/925b245d-5529-4a64-8cd4-4bc83ee6fe7a/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/thread/925b24... | 47,979 |
<p>Here's my problem.I have 2 xmlfiles with identical structure, with the second xml containing only few node compared to first.</p>
<p>File1</p>
<pre><code> <root>
<alpha>111</alpha>
<beta>22</beta>
<gamma></gamma>
<delta></delta>
</root>... | <p>Here is a little bit simpler and more efficient solution that that proposed by Alastair (see my comment to his solution).</p>
<p>This transformation:</p>
<pre>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<x... | <p>This merge seems very specific.</p>
<p>If that is the case, just write some code to load both xml files and apply the changes as you described.</p>
| 42,362 |
<p>I'm a Python novice, trying to use pyCurl. The project I am working on is creating a Python wrapper for the twitpic.com API (<a href="http://twitpic.com/api.do" rel="nofollow noreferrer">http://twitpic.com/api.do</a>). For reference purposes, check out the code (<a href="http://pastebin.com/f4c498b6e" rel="nofollow ... | <p>Using a StringIO would be much cleaner, no point in using a dummy class like that if all you want is the response data...</p>
<p>Something like this would suffice:</p>
<pre><code>import pycurl
import cStringIO
response = cStringIO.StringIO()
c = pycurl.Curl()
c.setopt(c.URL, 'http://www.turnkeylinux.org')
c.seto... | <p><a href="http://pycurl.sourceforge.net/doc/curlobject.html" rel="nofollow noreferrer">The pycurl doc</a> explicitly says:</p>
<blockquote>
<p>perform() -> None</p>
</blockquote>
<p>So the expected result is what you observe.</p>
<p>looking at an example from the pycurl site:</p>
<pre><code>import sys
import py... | 32,017 |
<p>is it possible to display ⇓ entity in ie6? It is being display in every browser but not IE 6.I am writing markup such as: </p>
<pre><code><span>&#8659;</span>
</code></pre>
| <p>According to <a href="https://web.archive.org/web/20080221144246/http://www.ackadia.com:80/web-design/character-code/character-code-symbols.php" rel="nofollow noreferrer">this page</a>, that symbol doesn't show in IE6 at all. </p>
<pre><code>Symbol Character Numeric Description
⇓ &dArr; &#8659;... | <p>Yes, it is possible... But you'll need to explicitly tell IE which font to find it in. For instance:</p>
<pre><code><span style="font-family:Arial Unicode MS"> &#8659; </span>
</code></pre>
<p>should produce ⇓ in most browsers.</p>
| 8,563 |
<p>In ASP.NET, I am exporting some data to Excel by simply binding a DataSet to a GridView and then setting the ContentType to Excel.</p>
<p>My ASPX page is very simple and looks like this:</p>
<pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExamExportReport.aspx.cs" Inherits="Cabi.CamCentral.... | <p>@azamsharp - I found the solution elsewhere while you were replying. :-) It turns out that removing the form tag entirely from the ASPX page is the trick, and the only way to do this is to override the VerifyRenderingInServerForm method as you are doing.</p>
<p>If you update your solution to include the fact that ... | <p>An easier solution is to override the Render (HtmlTextWriter writer) method and make it empty:</p>
<p>protected override void Render(HtmlTextWriter writer){}</p>
<p><a href="http://c-sharpe.blogspot.com/2009/05/get-rid-of-blank-row-when-exporting-to.html" rel="nofollow noreferrer">http://c-sharpe.blogspot.com/2009... | 19,946 |
<p><s><a href="https://stackoverflow.com/questions/354160/what-do-you-do-while-your-codes-compiling#354176">An answer</a></s> <strong>(see below)</strong> to one of the questions right here on Stack Overflow gave me an idea for a great little piece of software that could be invaluable to coders everywhere.</p>
<p... | <p>In Linux (you never mentioned which OS you're on, so this <em>could</em> be relevant) you can create block devices from RAM and mount them like any other block device (that is, a HDD).</p>
<p>You can then create scripts that copy to and from that drive on start-up / shutdown, as well as periodically.</p>
<p>For ex... | <p>Just as James Curran says, the fact that most programs follow the law of locality of references, the frequent code and data page count will be narrowed over time to a manageable size by the OS disk cache.</p>
<p>RAM disks were useful when operating systems were built with limitations such as stupid caches (Win 3.x,... | 46,149 |
<p>Suppose I am entering validation code into my model of multi-language publication database. The database needs either an English or a Japanese title for a particular journal. So I need to validate_presence_of at least one of the two. Right now I can easily check that both exists, but am stumped on the case of "at le... | <pre><code>class Article < ActiveRecord::Base
belongs_to :publication
validate_presence_of :journal_title, :if => :check_japanese
validate_presence_of :journal_title_ja, :if => :check_english
def check_japanese
journal_title_ja.nil?
end
def check_english
journal_title.nil?
end
end... | <p>I haven't written a single line of Ruby before, but I did happen to stumble across this in my Rails book today - sorry if it's no help at all and totally wrong! The syntax almost certainly will be:</p>
<pre><code>class Article < ActiveRecord::Base
belongs_to :publication
if journal_title.nil? && journ... | 49,830 |
<p>My class contains a <code>Dictionary<T, S> dict</code>, and I want to expose a <code>ReadOnlyCollection<T></code> of the keys. How can I do this without copying the <code>Dictionary<T, S>.KeyCollection dict.Keys</code> to an array and then exposing the array as a <code>ReadOnlyCollection</code>? <... | <p>If you really want to use ReadOnlyCollection<T>, the issue is that the constructor of ReadOnlyCollection<T> takes an IList<T>, while the KeyCollection of the Dictionary is only a ICollection<T>.</p>
<p>So if you want to wrap the KeyCollection in a ReadOnlyCollection, you'll have to create an... | <p>It's ugly, but this will do it</p>
<pre><code>Dictionary<int,string> dict = new Dictionary<int, string>();
...
ReadOnlyCollection<int> roc = new ReadOnlyCollection<int>((new List<int>((IEnumerable<int>)dict.Keys)));
</code></pre>
| 36,038 |
<p>Looking for a good choice of .NET-based Wiki Platform. Doesn't need to be Open Source, but the cheaper the better.</p>
| <p><a href="http://www.heartland-it.com/LinkedNotes/ProductInfo.aspx" rel="nofollow noreferrer">Linked Note</a></p>
<p><a href="http://en.wikipedia.org/wiki/SharpForge" rel="nofollow noreferrer">SharpForge</a> is an asp.net 2.0(c#) project management application, released under the new BSD license. Each project has i... | <p>If anyone is interested, I've just released a self made....
<a href="http://codebrewery.blogspot.com/2011/02/iknow-release-10.html" rel="nofollow">http://codebrewery.blogspot.com/2011/02/iknow-release-10.html</a></p>
<p>It's small, very small but I created it mainly for intranet knowledge-database scenarios..</p>
| 28,651 |
<p>One of the fun parts of multi-cultural programming is number formats.</p>
<ul>
<li>Americans use 10,000.50</li>
<li>Germans use 10.000,50</li>
<li>French use 10 000,50</li>
</ul>
<p>My first approach would be to take the string, parse it backwards until I encounter a separator and use this as my decimal separator.... | <p>I think the best you can do in this case is to take their input and then show them what you think they meant. If they disagree, show them the format you're expecting and get them to enter it again.</p>
| <p>The difference between 12.345 in French and English is a factor of 1000. If you supply an expected range where max < 1000*min, you can easily guess. </p>
<p>Take for example the height of a person (including babies and children) in mm.</p>
<p>By using a range of 200-3000, an input of 1.800 or 1,800 can unambigu... | 2,269 |
<p>Can I find out when the last INSERT, UPDATE or DELETE statement was performed on a table in an Oracle database and if so, how?</p>
<p>A little background: The Oracle version is 10g. I have a batch application that runs regularly, reads data from a single Oracle table and writes it into a file. I would like to skip ... | <p>Since you are on 10g, you could potentially use the <code>ORA_ROWSCN</code> pseudocolumn. That gives you an upper bound of the last SCN (system change number) that caused a change in the row. Since this is an increasing sequence, you could store off the maximum <code>ORA_ROWSCN</code> that you've seen and then loo... | <p>Please use the below statement</p>
<pre><code>select * from all_objects ao where ao.OBJECT_TYPE = 'TABLE' and ao.OWNER = 'YOUR_SCHEMA_NAME'
</code></pre>
| 33,220 |
<p>I made a class that derives from Component:</p>
<pre><code>public class MyComponent: System.ComponentModel.Component
{
}
</code></pre>
<p>I saw that Visual Studio put this code in for me:</p>
<pre><code>protected override void Dispose(bool disposing)
{
try
{
if (disposing && (components ... | <p>Change:</p>
<pre><code>if (disposing && (components != null))
{
components.Dispose();
}
</code></pre>
<p>to be:</p>
<pre><code>if (disposing && (components != null))
{
_dataset.Dispose();
components.Dispose();
}
</code></pre>
| <p>Wrap the disposables in components and add them in the <code>components</code> collection. The generated implementation of the dispose pattern will dispose of them correctly.</p>
<pre><code>public partial class MyComponent : System.ComponentModel.Component
{
private readonly System.Data.DataSet _dataSet;
p... | 31,171 |
<p>We have a system that is used by a few hundred separate customers, at the end of the month the customer likes to generate a report of the activity with his/her clients. These reports are nothing special; they maybe contain a logo, address and a few lines of mathematical data. Currently we use Crystal Reports but tha... | <p>Well, we use CR as well. I have heard about <a href="http://itextsharp.sourceforge.net" rel="nofollow noreferrer">iTextSharp</a>, and have seen it used for pdf concatenation in our systems. Maybe thats what you look for. For Excel report generation we use csv format for simple tabular data and <a href="http://msdn.m... | <p>We use SQL Server Reporting Services (SSRS). Reports are built in Visual Studio.
<a href="http://www.microsoft.com/sql/reporting/" rel="nofollow noreferrer">link text</a></p>
| 22,554 |
<p>I have a full path which I would like to remove certain levels of it. So for instance,</p>
<pre><code>/home/john/smith/web/test/testing/nothing/
</code></pre>
<p>I would like to get rid of 4 levels, so I get</p>
<pre><code>/test/testing/nothing/
</code></pre>
<p>What would be a good of doing this?</p>
<p>Thanks... | <p>A simple solution is to slice the path up into parts, and then manipulate the array before sticking it back together again:</p>
<pre><code>join("/", array_slice(explode("/", $path), 5));
</code></pre>
<p>Of course, if you wanted to remove that specific path, you could also use a regular expression:</p>
<pre><code... | <p>Why are you all using regular expressions for something that requires absolutely no matching; CPU cycles are valuable!</p>
<p>str_replace would be more efficient:</p>
<pre><code>$s_path = '/home/john/smith/web/test/testing/nothing/';
$s_path = str_replace('john/smith/web/test/', '', $s_path);
</code></pre>
<p>And... | 48,182 |
<p>I have an aspx page which is loading some controls dynamically on postback (ie when a click event happens) and adding them to a placeholder. Depending on what is clicked a different set of controls needs to be loaded.<br>
This works perfectly the first time, but when I clear the placeholder's controls and attempt t... | <p>Yuriy Solodkyy explains it well here: <a href="http://www.singingeels.com/Articles/Dynamically_Created_Controls_in_ASPNET.aspx" rel="noreferrer">Dynamically Created Controls in ASP.NET</a></p>
| <p>When dynamically creating controls you must ensure that every control you create has an unique id.</p>
<p>I think what is happening here is that you are naming your controls like: Control1, Control2, Control3.</p>
<p>And perhaps when you click to create a different set of controls you might give the same name to a... | 44,679 |
<p>Is it possible to customize the syntax highlighting in Visual Studio 2005? Up to now, I found no way to do this.</p>
<p>In eclipse for example, it's possible to setup custom highlighting.</p>
| <p>Do you mean more than just changing the colors -- like defining a new language with its own symbols and keywords? If so,</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb165041(VS.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/bb165041(VS.80).aspx</a></p>
| <p>This is an great free library: <a href="http://studiostyl.es/" rel="nofollow">http://studiostyl.es/</a></p>
<p>Import the settings Via Tools->Import/Export Settings</p>
| 14,066 |
<p>I keep wondering how does a debugger work? Particulary the one that can be 'attached' to already running executable. I understand that compiler translates code to machine language, but then how does debugger 'know' what it is being attached to?</p>
| <p>The details of how a debugger works will depend on what you are debugging, and what the OS is. For native debugging on Windows you can find some details on MSDN: <a href="http://msdn.microsoft.com/en-us/library/ms809754.aspx" rel="noreferrer">Win32 Debugging API</a>.</p>
<p>The user tells the debugger which process... | <p>My understanding is that when you compile an application or DLL file, whatever it compiles to contains symbols representing the functions and the variables.</p>
<p>When you have a debug build, these symbols are far more detailed than when it's a release build, thus allowing the debugger to give you more information... | 26,654 |
<p>Ruby setters—whether created by <code>(c)attr_accessor</code> or manually—seem to be the only methods that need <code>self.</code> qualification when accessed within the class itself. This seems to put Ruby alone the world of languages:</p>
<ul>
<li>All methods need <code>self</code>/<code>this</code> (like Perl, ... | <p>Well, I think the reason this is the case is because <code>qwerty = 4</code> is ambiguous—are you defining a new variable called <code>qwerty</code> or calling the setter? Ruby resolves this ambiguity by saying it will create a new variable, thus the <code>self.</code> is required.</p>
<p>Here is another case wher... | <p>Because otherwise it would be impossible to set local variables at all inside of methods. <code>variable = some_value</code> is ambiguous. For example:</p>
<pre><code>class ExampleClass
attr_reader :last_set
def method_missing(name, *args)
if name.to_s =~ /=$/
@last_set = args.first
else
sup... | 6,646 |
<p>I'm trying to inject a dynamic where clause in my Linq to SQL query and I get an overload exception. The same expression work when added in the query proper?</p>
<pre><code> qry.Where(Function(c) c.CallDate < Date.Now.AddDays(-1))
</code></pre>
<p>Any thoughts on how to this to work?</p>
<p>The exception read... | <p>Apparently you can use <a href="https://learn.microsoft.com/lt-lt/cpp/c-runtime-library/argc-argv-wargv?view=msvc-160" rel="nofollow noreferrer"><code>__argv</code></a> outside <code>main()</code> to access the pre-parsed argument vector...</p>
| <p>The following is about the simplest way I can think of to obtain an old-fashioned argc/argv pair at the top of WinMain. Assuming that the command-line really was ANSI text, you don't actually need any conversions fancier than this.</p>
<pre><code>int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPS... | 37,168 |
<p>I need to use feature stapler to add some text columns to Posts list inside OOTB blog site definition. I plan not to use site columns, but only to add those columns to list (I don't use site columns because I have multiple site collections and there will be only one Posts list per site collection, so site columns ar... | <p>Perhaps you can create a feature that uses the object model from the feature receiver to add (and remove as appropriate) the columns to just the specific list when the feature is activated.</p>
<p>I would use the XML Schema approach for creating the columns in order to ensure the same GUID for each column. <a href=... | <p>I cannot see what benefit I have from creating custom action for posts list. Both posts are helpful, but I'll probably create custom feature for that.</p>
| 35,081 |
<p>I'm writing a C# application for a proprietary Windows CE 4.2 device (for which I don't have the specs or pretty much any other information. I've got access to the file system, and that is basically it.)
I also can't get support from the original manufacturer.</p>
<p>Now, I can install the .NET Compact framework jus... | <p>There are a few Windows CE and CF behaviors that you're seeing here that's giving you this behavior. Unfortuantely there's no really good solution, but I can at least give you some guidance.</p>
<ol>
<li>Windows CE stores the current object store, including files in the filesystem not specifically on a persistent ... | <p>I think you need to run RegSave to save the registry settings after installing something. I had to do this in an older (pre .Net) version of Windows CE.</p>
| 45,628 |
<p>Are there PHP libraries which can be used to fill PDF forms and then save (flatten) them to PDF files?</p>
| <p>The libraries and frameworks mentioned here are good, but if all you want to do is fill in a form and flatten it, I recommend the command line tool called pdftk (PDF Toolkit).</p>
<p>See <a href="https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/" rel="noreferrer">https://www.pdflabs.com/tools/pdftk-the-pdf-toolk... | <p>Looks like this has been <a href="https://stackoverflow.com/questions/7364/pdf-editing-in-php">covered before</a>. Click through for relevant code using Zend Framework PDF library.</p>
| 10,329 |
<p>I am developing a .NET (2.0) WinForms utility that connects to a SQL Server 2005 database. I have found reference material, such as <a href="https://stackoverflow.com/questions/42833/how-do-i-avoid-having-the-database-password-stored-in-plaintext-in-sourcecode">Avoiding Plaintext Passwords</a> for handling the actua... | <p>The main problem with encrypted configuration is protecting the key used to decrypt the configuration settings.</p>
<p>With a server application, you can do this by restricting access to the server. A client WinForms app will need to have access to the key while running as the current user, therefore the user will... | <p>The main problem with encrypted configuration is protecting the key used to decrypt the configuration settings.</p>
<p>With a server application, you can do this by restricting access to the server. A client WinForms app will need to have access to the key while running as the current user, therefore the user will... | 46,582 |
<p>When debugging web sites that I'm working on, I tend to use Attach to Process rather than F5 to start debugging (since the site's already on in Firefox). However, occasionally when doing so, I'll get the following error:</p>
<blockquote>
<p>EXECUTE permission denied on object 'sp_sdidebug', database 'master', ow... | <p>You can change the debugging engines used to attach to a process by clicking on the 'select...' button on the 'attach to:' line in the attach dialog. </p>
<p>Choose the 'Debug these code types' option instead of the automatic one, and make sure the T-SQL option is cleared.</p>
<p>I don't know how to set this as a ... | <p>If you right click the database connection in the server explorer in VS, you should see 2 debugging options, ensure they are not ticked.</p>
<p>Also in the project settings, you can alter whether SQL debugging is enabled.</p>
| 32,338 |
<p>Today I stumbled about a Problem which seems to be a bug in the Zend-Framework. Given the following route:</p>
<pre><code><test>
<route>citytest/:city</route>
<defaults>
<controller>result</controller>
<action>test</action>
</defaults>... | <p>The problem is the following:</p>
<blockquote>
<p>Using the /u pattern modifier prevents
words from being mangled but instead
PCRE skips strings of characters with
code values greater than 127.
Therefore, \w will not match a
multibyte (non-lower ascii) word at
all (but also won’t return portions of
... | <p>The u modifier makes the regexp expect utf-8 input. This would suggest that ZF expects utf-8 encoded input, and not ISO-8859-1 (I'm not too familiar with ZF, so I'm just guessing here).</p>
<p>If that's the case, you'll have to <a href="http://www.php.net/utf8_encode" rel="nofollow noreferrer">utf-8 encode</a> the ... | 15,499 |
<p>I have a pseudo random number generator (PRNG) class that I want to unit test. There are two approaches:</p>
<ol>
<li>write a test case that takes a large amount of samples and test whether they are properly distributed. This approach may lead to a fairly long execution time for the test case;</li>
<li>calculate a ... | <p>Get another implementation of the same PRNG algorithm, generate a smallish number of longish test cases based on known seeds, and verify that your implementation of the algorithm matches everyone else's implementations. The more data you test, the more chance it does. If you want to be serious, look into how FIPS va... | <p>Strictly, there's no way to test if the random generator is really random :-) First approach gives you the knowledge of can it keed distribution proper or not for a fixed amount of samples only, no matter how big this ammount is. The second approach can suport knowlege of does it behave like an algorythm, but again ... | 22,584 |
<p>Hoping that someone has some info on how to parse a xfa file. I can parse csv or xml files just fine, but an xfa one has come along and I'm not familar with the format. Looks like tab delimited body with column metadata at the top.</p>
<p>Anyone dealt with these before or can give me a steer on how to parse them?</... | <p>Mmm, looks like nobody has a clue. The problem is that .xfa doesn't look like a "standard" extension: after all, anybody can create its own extension names, from .xyz to .something...</p>
<p>I looked around a bit, found, unsurprisingly (the 'x') an XML format with this extension, not much more.</p>
<p>Indicating w... | <p>Check out the Adobe page: </p>
<p><a href="http://partners.adobe.com/public/developer/xml/index_arch.html" rel="nofollow noreferrer">http://partners.adobe.com/public/developer/xml/index_arch.html</a></p>
<p>(Adobe XML Forms Architecture, currently 1400 pages)</p>
<p>Let LiveCycle/Acrobat parse it for you.</p>
| 23,628 |
<p>I noticed C++ will not compile the following:</p>
<pre><code>class No_Good {
static double const d = 1.0;
};
</code></pre>
<p>However it will happily allow a variation where the double is changed to an int, unsigned, or any integral type:</p>
<pre><code>class Happy_Times {
static unsigned const u = 1;
};
</co... | <p>The problem is that with an integer, the compiler <em>usually</em> doesn't have to ever create a memory address for the constant. It doesn't exist at runtime, and every use of it gets inlined into the surrounding code. It can still decide to give it a memory location - if its address is ever taken (or if it's pass... | <p>here is my understanding based on Stroustrup's statement about in-class definition </p>
<blockquote>
<p>A class is typically declared in a header file and a header file is
typically included into many translation units. However, to avoid
complicated linker rules, C++ requires that every object has a unique
... | 48,370 |
<p>I have a <code>popen()</code> function which executes <code>tail -f sometextfile</code>. Aslong as there is data in the filestream obviously I can get the data through <code>fgets()</code>. Now, if no new data comes from tail, <code>fgets()</code> hangs. I tried <code>ferror()</code> and <code>feof()</code> to no av... | <p>In Linux (or any Unix-y OS), you can mark the underlying file descriptor used by popen() to be non-blocking. </p>
<pre><code>#include <fcntl.h>
FILE *proc = popen("tail -f /tmp/test.txt", "r");
int fd = fileno(proc);
int flags;
flags = fcntl(fd, F_GETFL, 0);
flags |= O_NONBLOCK;
fcntl(fd, F_SETFL, flags);
<... | <p>I you would use POSIX functions for IO instead of those of C library, you could use <a href="http://linux.die.net/man/2/select" rel="nofollow noreferrer">select</a> or <a href="http://linux.die.net/man/2/poll" rel="nofollow noreferrer">poll</a>.</p>
| 18,059 |
<p>I have few asynchronous tasks running and I need to wait until at least one of them is finished (in the future probably I'll need to wait util M out of N tasks are finished).
Currently they are presented as Future, so I need something like</p>
<pre><code>/**
* Blocks current thread until one of specified futures i... | <p>simple, check out <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorCompletionService.html" rel="noreferrer">ExecutorCompletionService</a>.</p>
| <p>See this option:</p>
<pre><code>public class WaitForAnyRedux {
private static final int POOL_SIZE = 10;
public static <T> T waitForAny(Collection<T> collection) throws InterruptedException, ExecutionException {
List<Callable<T>> callables = new ArrayList<Callable<T>>();
... | 14,330 |
<p>I'm making my first foray into the J2ME world. I'd prefer to use a functional language to do the development.</p>
<p>Scala used to have CLDC support, but it's no longer maintained. Bigloo seems to have disappeared.</p>
<p>Interpreters (such as Jython) are a no-go, since J2ME apps have to be small (at least, mine h... | <p>Running a different language on top of CLDC might be cool but the devices are usually very constrained in memory and CPU that this is merely impossible.</p>
<p>Look forward to <a href="http://javafx.com/" rel="nofollow noreferrer">JavaFX</a> which will bring new wind to mobile marketplace. For existing handsets you... | <p>Java is one of the most widely available runtimes. So if your app is aimed at a wide range of Handsets you should indeed choose Java ME. If you are targeting a particular make/model you could have other choices.
For example, The <a href="http://www.forum.nokia.com/I_Want_To/Develop_Mobile_Applications/Get_Started.x... | 41,225 |
<p>I know that it's possible to get SVN to send emails after a commit using hooks, but I was just wondering if there's any way to create a personal "watch list" like MediaWiki (Wikipedia) has, whereby you only get notified if there have been changes to certain files?</p>
| <p>The way we take care of this is we have a watch property, you add your email address to that property in any directory and you get emailed about any changes in or below that directory.</p>
<p>The way this is achieved behind the scenes is that the post commit script checks every directory back to projects for each f... | <p>One could certainly develop such a thing that would run as a Subversion hook. We had a similar system set up for CVS mailings at one place I worked at years ago.</p>
<p>Subversion itself doesn't have this capability built in, but I suspect there is at least one add-on out there that does this.</p>
| 29,940 |
<p>What is this thing called a KGL SIMULATOR and how can its memory utilisation be managed by application developers?</p>
<p>The background to the question is that I'm occasionally getting errors like the following and would like to get a general understanding of what is using this heap-space?</p>
<blockquote>
<p>O... | <p>KGL=Kernel General Library cache manager, as the name says it deals with library objects such cursors, cached stored object definitions (PL/SQL stored procs, table definitions etc).</p>
<p>KGL simulator is used for estimating the benefit of caching if the cache was larger than currently. The general idea is that wh... | <p>I've found that KGL stands for "Kernel Generic Library".</p>
<p>Your issue could be a memory leak within Oracle. You probably should open a case with Oracle support.</p>
| 22,246 |
<p>CPU Cycles, Memory Usage, Execution Time, etc.?</p>
<p>Added: Is there a quantitative way of testing performance in JavaScript besides just perception of how fast the code runs?</p>
| <p>Profilers are definitely a good way to get numbers, but in my experience, perceived performance is all that matters to the user/client. For example, we had a project with an Ext accordion that expanded to show some data and then a few nested Ext grids. Everything was actually rendering pretty fast, no single operat... | <p>This is a good way of collecting performance information for the specific operation.</p>
<pre><code>start = new Date().getTime();
for (var n = 0; n < maxCount; n++) {
/* perform the operation to be measured *//
}
elapsed = new Date().getTime() - start;
assert(true,"Measured time: " + elapsed);
</code></pre>
| 13,653 |
<p>Does beautiful soup work with iron python?
If so with which version of iron python?
How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? </p>
| <p>I was asking myself this same question and after struggling to follow advice here and elsewhere to get IronPython and BeautifulSoup to play nicely with my existing code I decided to go looking for an alternative native .NET solution. BeautifulSoup is a wonderful bit of code and at first it didn't look like there wa... | <p>If you have the complete standard library and the real <code>re</code> module (google for IronPython community edition) it might work. But IronPython is an incredible bad python implementation, I wouldn't count on that.</p>
<p>Besides, give <code>html5lib</code> a try. That parser parses with the same rules firef... | 14,447 |
<p>Like it is the case with jpeg images for example?
What's about mp3 or ogg vorbis audio files?</p>
| <p>It all depends on the definition of "loading" and "saving".</p>
<p>If the program in question actually decodes mp3/ogg upon loading and encodes in back when saving (this could be detected by noticeable time it takes to save a file), then yes - you could experience degradation in quality. Especially if the encoding ... | <p>Any time you use a lossy compression, you're going to lose some quality. If you're lucky, most of what you lose the second time was already lost the first time.</p>
<p>If you're curious, try it yourself and see - take the same mp3 file and load and save it repeatedly, then compare to the original. I'm sure you'll... | 22,340 |
<p>I was wondering how as semantic service like Open Calais figures out the names of companies, or people, tech concepts, keywords, etc. from a piece of text. Is it because they have a large database that they match the text against? </p>
<p>How would a service like Zemanta know what images to suggest to a piece of te... | <p>I'm not familiar with the specific services listed, but the field of natural language processing has developed a number of techniques that enable this sort of information extraction from general text. As Sean stated, once you have candidate terms, it's not to difficult to search for those terms with some of the oth... | <p>Open Calais probably use language parsing technology and language statics to guess which words or phrases are Names, Places, Companies, etc. Then, it is just another step to do some kind of search for those entities and return meta data.</p>
<p>Zementa probably does something similar, but matches the phrases agains... | 4,207 |
<p>I have the following markup for buttons (can be changed, but I really don't want to):</p>
<pre><code><a href="#" class="button">
Button text
<img src="someimage.png" />
</a>
</code></pre>
<p>This is styled using CSS to become a rather neat button with an icon on it. I am using jQuery to round... | <p>You can use the following to select anchors with / without a child image</p>
<pre><code>$('a.button:has(img)')
$('a.button:not(:has(img))')
</code></pre>
| <p>To select a elements with class of 'button' that contain an img element</p>
<pre><code>$('a.button:has(img)').corner('tl bl 10px');
</code></pre>
<p>To select a elements with class of 'button' that do not contain an img element</p>
<pre><code>$('a.button:not(:has(img))').corner()
</code></pre>
<p>You could prob... | 38,661 |
<p>I've created a utf8 encoded RSS feed which presents news data drawn from a database. I've set all aspects of my database to utf8 and also saved the text which i have put into the database as utf8 by pasting it into notepad and saving as utf8. So everything should be encoded in utf8 when the RSS feed is presented to ... | <p>Get rid of your escaping code and use XMLFormat instead:</p>
<pre><code><item>
<title>#XMLFormat(news.headline)#</title>
<link>#Application.siteRoot#news/index.cfm?id=#XMLFormat(news.id)#</link>
<guid>#Application.siteRoot#news/index.cfm?id=#XMLFormat(news.id)#</gu... | <p>Your escaping function is too simple. You need to change <code>&</code> to <code>&amp;</code> first.</p>
<p>If you use named entities (i.e. <code>&pound;</code>) that is cause of the error.</p>
| 47,301 |
<p>One of classes in my program uses some third-party library. Library object is a private member of my class:</p>
<pre><code>// My.h
#include <3pheader.h>
class My
{
...
private:
3pObject m_object;
}
</code></pre>
<p>The problem with this - any other unit in my program that use... | <p>The Private Implementation (PIMPL) pattern:</p>
<p><a href="http://www.codeproject.com/KB/tips/PIMPL.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/tips/PIMPL.aspx</a></p>
<p>Basically, you define that your class holds a pointer to a struct that you forward declare. Then you define the struct inside... | <p>All of the internal structure of <a href="http://trolltech.com/products" rel="nofollow noreferrer">QT</a> is done using private implementation classes.<br>
You can look it up for a good reference on how it is done correctly.</p>
| 24,935 |
<p>Is it possible, with Javascript or some other technology to determine which hyperlink a user has clicked on, without changing the hyperlink source code.</p>
<p>For example:
Can you click on a 'tag' button, then click on a hyperlink hosted in a different iframe, and be able to calculate which hyperlink the user clic... | <p>Using jQuery, you are able to set the context of your selection. i.e. </p>
<p>$('a', $('#iframe-id')).click(function() {...});</p>
<p>You can then implement an event handler that will handle the iFrame hyperlink clicks. The <em>"this"</em> property within the handler will allow you to interrogate the hyperlink and... | <p>I just thought of a solution, would this work, or are there other options?</p>
<p>The solution would be to proxy the content of the iframe soruce page, replacing href's with code to call a javascript function which would identify which href was clicked on.</p>
<p>This could then be used in conjunction with the tag... | 26,418 |
<p>For example, using the answer for this question: </p>
<p><a href="https://stackoverflow.com/questions/152024/how-to-select-all-users-who-made-more-than-10-submissions">How to select all users who made more than 10 submissions</a>
"How to select all users who made more than 10 submissions."</p>
<pre><code>select us... | <p>Slight error in previously posted example, need an alias for a table name for the subquery:<p></p>
<pre><code>
select count(*) from
(select userId
from submission
group by userId
having count(submissionGuid) > 10) t
</code></pre>
<p>I'm not sure about scalability, but this is the solution. If this isn... | <p>You can try way this:
I hope to help you.</p>
<pre><code>select top(1) row_number() over(partition by count(userId) order by count(userId)) as RowNumber
from submission
group by userId
having count(submissionGuid) > 10
order by userId desc
</code></pre>
| 30,487 |
<p>I am working on a desktop application in PyGTK and seem to be bumping up against some limitations of my file organization. Thus far I've structured my project this way:</p>
<ul>
<li>application.py - holds the primary application class (most functional routines)</li>
<li>gui.py - holds a loosely coupled GTK gui imp... | <p>In the project <a href="http://wader-project.org" rel="noreferrer">Wader</a> we use <a href="http://pygtkmvc.sourceforge.net/" rel="noreferrer">python gtkmvc</a>, that makes much easier to apply the MVC patterns when using pygtk and glade, you can see the file organization of our project in the <a href="http://trac.... | <p>Python 2.6 supports <a href="http://docs.python.org/whatsnew/2.6.html#pep-366-explicit-relative-imports-from-a-main-module" rel="nofollow noreferrer">explicit relative imports</a>, which make using packages even easier than previous versions.
I suggest you look into breaking your app into smaller modules inside a pa... | 26,565 |
<p>OK, this is my own fault, but I can't seem to rescue myself.</p>
<p>Whenever I try to step into a class that has fields with assignments calling into .NET code, I get a dialog box that contains the text "There is no source code available for the current location.":</p>
<p><img src="https://i.stack.imgur.com/3pfTr.... | <p>See if some source files are accidentally excluded. Do properties of the solution and look at the Debug Source Files section under Common Properties.</p>
| <p>I had the same problem, and I solved it on this way (Visual Studio 2008):</p>
<p>"Formato de la informacion de depuracion" to "Base de datos de programa (/Zi)"</p>
<p><img src="https://i.stack.imgur.com/EDQK2.png" alt="Enter image description here"></p>
| 40,551 |
<p>How can I draw something in JPanel that will stay the same and not be repainted, I am doing a traffic simulation program and I want the road to be drawn once because It will not change.
Thanks </p>
| <p>I'm not sure you actually want your road to never be repainted - repaint events fire (for example) when your window is resized, or when it becomes visible following another window obstructing it. If your panel never repaints then it'll look peculiar.</p>
<p>As far as I remember, Swing will only fire appropriate pai... | <p>What I do is set a boolean value to whether or not a certain part needs to be redrawn. Then, in the <code>paintComponent()</code> method I can check the value and redraw the certain thing, or not.</p>
<pre><code>protected void paintComponent(Graphics g){
super.paintComponent(g);
if (drawRoad) {
dra... | 34,761 |
<p>I have some tables that I build as a part of my report rollup. I don't need them afterwards at all. Someone mentioned to truncate them as it would be faster. </p>
| <p>Deleting records from a table logs every deletion and executes delete triggers for the records deleted. Truncate is a more powerful command that empties a table without logging each row. SQL Server prevents you from truncating a table with foreign keys referencing it, because of the need to check the foreign keys on... | <blockquote>
<h3>DELETE</h3>
<p>The DELETE command is used to remove rows from a table. A WHERE clause can be used to only remove some rows. If no WHERE condition is specified, all rows will be removed. After performing a DELETE operation you need to
COMMIT or ROLLBACK the transaction to make the change permanent or to... | 16,424 |
<p>I've got a request to implement a visualization service for geographical related data.</p>
<p>I have a list of <strong>Italian ZIP Codes</strong> (they are called CAP in Italian). I've already found a table which maps these ZIP codes to <strong>geographical coordinates (lat/long)</strong>.</p>
<p>So, the data I ha... | <p><a href="http://www.geonames.org/postalcode-search.html?q=80125&country=IT" rel="nofollow noreferrer">GeoNames</a> offers a data set and open source libraries for geo mapping</p>
| <p>take a look at Mapv - a library of geography visualization</p>
<p><a href="https://i.stack.imgur.com/Niol6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Niol6.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/Niol6.jpg" rel="nofollow noreferrer">enter image... | 37,298 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.