instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>In php, how can I get the number of apache children that are currently available <br>(<code>status = SERVER_READY</code> in the apache scoreboard)?</p>
<p>I'm really hoping there is a simple way to do this in php that I am missing.</p>
| <p>You could execute a shell command of <code>ps aux | grep httpd</code> or <code>ps aux | grep apache</code> and count the number of lines in the output.</p>
<pre><code>exec('ps aux | grep apache', $output);
$processes = count($output);
</code></pre>
<p>I'm not sure which status in the status column indicates that i... | <p>If you have access to the Apache server status page, try using the ?auto flag:</p>
<p><a href="http://yourserver/server-status?auto" rel="nofollow noreferrer">http://yourserver/server-status?auto</a></p>
<p>The output is a machine-readable version of the status page. I <em>believe</em> you are looking for "IdleWor... | 9,338 |
<p>In our game project we did have a timer loop set to fire about 20 times a second (the same as the application framerate). We use this to move some sprites around.
I'm wondering if this could cause problems and we should instead do our updates using an EnterFrame event handler?
I get the impression that having a time... | <p>I'd go for the Enter frame, in some special cases it can be useful to have two "loops" one for logic and one for the visuals, but for most games I make I stick to the Enter frame-event listener. Having a separate timer for moving your stuff around is a bit unnecessary since having it set to anything except the frame... | <p>I think timerEvent and Enter Frame are both good options, I have used both of them in my games. ( Did you mean timerEvent by timer loop? )</p>
<p>PS: notice that in slow machines the timer may not refresh quick enough, so you may need to adjust your code to make game work "faster" in slow machines.</p>
| 15,375 |
<p>I have a pretty simple app on the web (written in Flex) which is very straightforward to use once it has data inside it. The steps to get data inside it are themselves also pretty simple, but not at all obvious to my audience when they first log into my app. </p>
<p>I have been wrestling with how to communicate t... | <p>Have you taken a look at:
<a href="http://www.askthecssguy.com/2007/03/form_field_hints_with_css_and.html" rel="nofollow noreferrer">http://www.askthecssguy.com/2007/03/form_field_hints_with_css_and.html</a></p>
<p>I believe there is a jquery or prototype or mootools or whatever framework that goes a couple steps b... | <p>You could display the links to the data setup pages in a small strip on your main page like this (pardon the ugliness - this is just a usability idea):</p>
<p><a href="http://www.freeimagehosting.net/uploads/052b13acb7.jpg" rel="nofollow noreferrer">alt text http://www.freeimagehosting.net/uploads/052b13acb7.jpg</a... | 41,227 |
<p>I know I can call the GetVersionEx Win32 API function to retrieve Windows version. In most cases returned value reflects the version of my Windows, but sometimes that is not so.</p>
<p>If a user runs my application under the compatibility layer, then GetVersionEx won't be reporting the real version but the version ... | <p>The best approach I know is to check if specific API is exported from some DLL. Each new Windows version adds new functions and by checking the existance of those functions one can tell which OS the application is running on. For example, Vista exports <a href="http://msdn.microsoft.com/en-us/library/ms724451(VS.85)... | <p><strong>Note:</strong> Gabr is asking about an approach that can bypass the limitations of <code>GetVersionEx</code>. JCL code uses GetVersionEx, and is thus subject to compatibility layer. This information is for people who don't need to bypass the compatibility layer, only.</p>
<p>Using the Jedi JCL, you can a... | 8,131 |
<p>So i have a piece of assembly that needs to call a function with the fastcall calling convention on windows, but gcc doesn't (afaict) support it. GCC does provide the regparm attribute but that expects the first 3 parameters to be passed in eax, edx and ecx, whereas fastcall expects the first two parameters to be p... | <p>GCC does support <code>fastcall</code>, via <code>__attribute__((fastcall))</code>. It appears to have been introduced in GCC 3.4.</p>
| <p>If you're calling the function from asm then surely you have complete control over how you call the function. What's stopping you from just loading up the registers and issuing a <code>CALL</code>?</p>
| 19,993 |
<p>We may tag a question with multiple tags in StackOverflow website, I'm wondering how to find out the most related questions with common tags.</p>
<p>Assume we have 100 questions in a database, each question has several tags. Let's say user is browsing a specific question, and we want to make the system to display t... | <p>Perhaps something like:</p>
<pre><code>select qt.question_id, count(*)
from question_tags qt
where qt.tag in
( select qt2.tag
from question_tags qt2
where qt2.question_id = 123
)
group by qt.question_id
order by 2 desc
</code></pre>
| <p>Not entirely sure what you mean, but <a href="https://stackoverflow.com/tags">the Tags page</a> lists tags in order of popularity (as in amount tagged).</p>
<p><strong>Edit:</strong> is this about SO or about your own application? If it is about your own app, remove the SO tag as it's kind of misleading.</p>
<p><s... | 30,645 |
<p>I tried the following code in LINQPad and got the results given below:</p>
<pre><code>List<string> listFromSplit = new List<string>("a, b".Split(",".ToCharArray())).Dump();
listFromSplit.ForEach(delegate(string s)
{
s.Trim();
});
listFromSplit.Dump();
</code></pre>
<blockquote>
<p>"a" and " b"</... | <p>you're just creating a trimmed string, not assigning anything to it.</p>
<pre><code>var s = " asd ";
s.Trim();
</code></pre>
<p>won't update s, while..</p>
<pre><code>var s = " asd ";
s = s.Trim();
</code></pre>
<p>will.. </p>
<pre><code>var listFromSplit = "a, b".Split(',').Select(s=>s.Trim());
</cod... | <p>Split on both spaces and commas and remove any empty entries. All nice and trimmed. Assumes that your strings don't contain spaces, though.</p>
<pre><code>List<string> listFromSplit =
new List<string>( "a , b ".Split( new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries ));
</code></pr... | 25,154 |
<p>Perhaps the biggest risk in pushing new functionality to live lies with the database modifications required by the new code. In Rails, I believe they have 'migrations', in which you can programmatically make changes to your development host, and then make the same changes live along with the code that uses the revis... | <p>I've never come across a tool that would do the job. Instead I've used individual files, numbered so that I know which order to run them: essentially, a manual version of Rails migrations, but without the rollback.</p>
<p>Here's the sort of thing I'm talking about:</p>
<pre><code>000-clean.sql # wipe out e... | <p>I've always preferred to keep my development site pointing to the same DB as the live site. This may sound risky at first but in reality it solves many problems. If you have two sites on the same server pointing to the same DB, you get a real time and accurate view of what your users will see when it goes live. </p>... | 5,548 |
<p>I have a requirement to produce a Web User Control (in C#) which will exhibit different behaviour when clicked depending on whether the shift (or control) key is pressed at the time. The control itself will contain an ImageButton and/or Hyperlink.</p>
<p>Is this possible?</p>
<p>Basically, if the logged in user is... | <p>How about <a href="http://www.javascripter.net/faq/ctrl_alt.htm" rel="nofollow noreferrer">here</a>?</p>
<p>To implement the <kbd>Ctrl</kbd> / <kbd>Alt</kbd> / <kbd>Shift</kbd> detection, you can use the properties <code>event.ctrlKey</code>, <code>event.altKey</code>, <code>event.shiftKey</code> and the deprecated... | <p>Well the 'powers' have decided that the Shift/Ctrl + Click approach was too clunky. </p>
<p>After a brainstorming session we have decided to go down the route of displaying a small 'Edit' button next to the control. This will only be visible for Administrator users and I've pulled it together in about two hours.</p... | 31,350 |
<p>Is there a way to enable STRICT_ALL_TABLES for a single MySQL database?</p>
| <p>set sql_mode = 'STRICT_ALL_TABLES'; will do it.</p>
| <p>Don't think you can do this directly but you might get close with setting Strict for the current session when working on a particular database. Could do this in the config files of specific users. </p>
| 19,932 |
<p>Essentially i want to have a generic function which accepts a LINQ anonymous list and returns an array back. I was hoping to use generics but i just can seem to get it to work.</p>
<p>hopefully the example below helps</p>
<p>say i have a person object with id, fname, lname and dob.
i have a generic class with cont... | <p>You'd just call <a href="http://msdn.microsoft.com/en-us/library/bb298736.aspx" rel="nofollow noreferrer">ToArray</a>. Sure, the type is anonymous... but because of type inference, you don't have to say the type's name.</p>
<p>From the example code:</p>
<pre><code> packages _
.Select(Function(pkg) pkg.Comp... | <p>I'm not sure that you can easily pass anonymous objects as parameters, anymore than you can have them as return values.</p>
<p>I say easily, because:</p>
<ul>
<li><a href="http://tomasp.net/blog/cannot-return-anonymous-type-from-method.aspx" rel="nofollow noreferrer">http://tomasp.net/blog/cannot-return-anonymous-... | 42,136 |
<p>I would like to execute the jQuery $(document).ready() in a drupal site. While i know that i can just stick it in the index page , this is really messy and a hack. </p>
<p>What i want to know is where is the correct location to put this, it would also need to be theme specific as i dont want all themes to use it.</... | <p>Not a Drupal specialist, but this <a href="http://raincitystudios.com/blogs-and-pods/katherine-bailey/the-lowdown-jquery-drupal-part-two" rel="noreferrer">blog entry</a> suggest that, as of Drupal 6, you don't need to include the <code>$(document).ready()</code> function in our jQuery code at all. </p>
<p>Instead y... | <p>Not a Drupal specialist, but this <a href="http://raincitystudios.com/blogs-and-pods/katherine-bailey/the-lowdown-jquery-drupal-part-two" rel="noreferrer">blog entry</a> suggest that, as of Drupal 6, you don't need to include the <code>$(document).ready()</code> function in our jQuery code at all. </p>
<p>Instead y... | 47,992 |
<p>What implementations of the <a href="http://en.wikipedia.org/wiki/Prototype_pattern" rel="nofollow noreferrer">Prototype</a> Pattern exist on the Java platform?</p>
<blockquote>
<p>A prototype pattern is a creational design pattern used in software development when the type of objects to create is determined by a... | <p>According to Josh Bloch and Doug Lea, <a href="http://www.artima.com/intv/bloch13.html" rel="nofollow noreferrer">Cloneable is broken</a>. In that case, you can use a <a href="http://www.javapractices.com/topic/TopicAction.do?Id=12" rel="nofollow noreferrer">copy constructor</a>.</p>
| <p>Java defines the <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Cloneable.html" rel="nofollow noreferrer">Cloneable</a> interface, described here at <a href="http://www.jguru.com/faq/view.jsp?EID=255004" rel="nofollow noreferrer">JGuru</a></p>
<blockquote>
<p>Java provides a simple interface named Clo... | 28,358 |
<p>I'd like a consistent and simple way to throw exceptions in JNI code; something that handles chained exceptions (implicitly from the env->ExceptionOccurred method, or explicitly by parameters, either way is good) and saves me looking up constructors every time I want to do this. All of the above is preferably in C,... | <p>We just code utility methods for each of the types of exceptions we want to throw. Here are some examples:</p>
<pre><code>jint throwNoClassDefError( JNIEnv *env, char *message )
{
jclass exClass;
char *className = "java/lang/NoClassDefFoundError";
exClass = (*env)->FindClass( env, className);
... | <p>I will put a more complete and general answer for who need a little bit more explanations like I need before.</p>
<p>First is nice to set your method with a <code>Throw Exception</code> so the IDE will ask for try/catch.</p>
<pre><code>public native int func(Param1, Param2, Param3) throws IOException;
</code></pre... | 28,556 |
<p>All my applications are developed in Native Code. I am hesitant to move to .Net because of all the negatives that I hear, such as:</p>
<ol>
<li>Slow response time</li>
<li>Lock-In into Windows</li>
<li>Dependance on huge .Net run-time that makes installation a pain and slow as well.</li>
</ol>
<p>etc. etc.</p>
<p... | <p>Don't do that just for the sake of converting.</p>
<p>If you have some other technical reason to convert, then you should consider it, but be aware that it is not a small change, especially for larger projects.</p>
<p>EDIT: I also want to add that it would be better if you start some small project in .NET, just to... | <p>It depends on several factors.</p>
<p>Does your application NEED to be rewritten? How long will the advantages of .Net take to offset the cost of rewriting? Is Windows lock-in a problem for you?</p>
<p>.Net is a great platform, but it's not for everyone or every project. I will say that the run-time issue was a ... | 40,487 |
<p>Can someone tell me how can I extract a public keu in .pem format from a .cer file ?
I'm trying to configure webservice over https with nusoap.</p>
<p>Tks,
ED</p>
| <p>Any time I need to convert certificate formats I like to hop on my Linux shell and use the openssl CLI.</p>
<p>Take a look at <a href="http://shib.kuleuven.be/docs/ssl_commands.shtml" rel="nofollow noreferrer">this page</a> for common openssl commands. You will be most interested in the one titled "Convert DER (.c... | <p>Any time I need to convert certificate formats I like to hop on my Linux shell and use the openssl CLI.</p>
<p>Take a look at <a href="http://shib.kuleuven.be/docs/ssl_commands.shtml" rel="nofollow noreferrer">this page</a> for common openssl commands. You will be most interested in the one titled "Convert DER (.c... | 49,596 |
<p>In our MOSS '07 site we have a page that contains just a Page Viewer web part in it that points to a site on another server. However, I've noticed that on that page (and any others that have a Page Viewer web part on it) our drop down menus and hover effects are <strong>super slow</strong> and completely max out th... | <pre><code>function loadJSInclude(scriptPath, callback)
{
var scriptNode = document.createElement('SCRIPT');
scriptNode.type = 'text/javascript';
scriptNode.src = scriptPath;
var headNode = document.getElementsByTagName('HEAD');
if (headNode[0] != null)
headNode[0].appendChild(scriptNode);
... | <p>you can load script dynamically by adding <code><script src="..."></code> tag to DOM tree.</p>
| 40,020 |
<p>I have a relationship between two entities (e1 and e2) and e1 has a collection of e2, however I have a similar relationship set up between (e2 and e3), yet e2 does not contain a collection of e3's, any reason why this would happen? Anything I can post to make this easier to figure out?</p>
<p>Edit: I just noticed t... | <p><strong>Using this setup, everything worked.</strong> </p>
<p><em>1) LINQ to SQL Query, 2) DB Tables, 3) LINQ to SQL Data Model in VS.NET 2008</em></p>
<p><strong>1 - LINQ to SQL Query</strong></p>
<pre><code>DataClasses1DataContext db = new DataClasses1DataContext();
var results = from threes in db.tableThrees... | <p>the FK_Contraints are set up like this:</p>
<p>ALTER TABLE [dbo].[e2] WITH CHECK ADD CONSTRAINT [FK_e2_e1] FOREIGN KEY([E1Id]) REFERENCES [dbo].[e1] ([Id])</p>
<p>ALTER TABLE [dbo].[e3] WITH CHECK ADD CONSTRAINT [FK_e3_e2] FOREIGN KEY([E2Id]) REFERENCES [dbo].[e2] ([Id])</p>
<p>is this what you were asking for?</... | 7,369 |
<p>My Y-axis on my Monoprice maker select running ramps 1.4 and Marlin makes a thud noise when moving every now and then. I have noticed a 1 to 2 mm shift in the print when this occurs. I tighten the belts and alas no joy. I ordered new bearings which should be coming Monday. I also tried slowing the print down and... | <p>The issue was the X-axis top smooth rod came out. this caused the extruder to bang around and shift on the Y-axis when it shifted forward. thank everyone for their help. </p>
| <p>A thudding noise is usually a belt slipping through its end-restraints. A clicking noise is usually a stepper motor missing a step. Seized bearings could be the cause.</p>
| 734 |
<p>Which would be faster for say 500 elements.</p>
<p>Or what's the faster data structure/collection for retrieving elements?</p>
<pre><code> List<MyObj> myObjs = new List<MyObj>();
int i = myObjs.BinarySearch(myObjsToFind);
MyObj obj = myObjs[i];
</code></pre>
<p>Or</p>
<pre><cod... | <p>I assume in your real code you'd actually <em>populate</em> myObjs - and sort it.</p>
<p>Have you just tried it? It will depend on several factors:</p>
<ul>
<li>Do you need to sort the list for any other reason?</li>
<li>How fast is MyObj.CompareTo(MyObj)?</li>
<li>How fast is MyObj.GetHashCode()?</li>
<li>How fas... | <p>BinarySearch requires the list to already be sorted. [edit: Forgot that dictionary is a hashtable. So lookup is O(1)]. The 2 are not really the same either. The first one is really just checking if it exists in the list and where it is. If you want to just check existance in a dictionary use the contain method.</p>
| 46,828 |
<p>I use the jQuery <a href="http://docs.jquery.com/Utilities/jQuery.extend" rel="nofollow noreferrer">extend</a> function to extend a class prototype.</p>
<p>For example:</p>
<pre><code>MyWidget = function(name_var) {
this.init(name_var);
}
$.extend(MyWidget.prototype, {
// object variables
widget_name: '',... | <p>I quite like John Resig's <a href="http://ejohn.org/blog/simple-javascript-inheritance/" rel="noreferrer">Simple JavaScript Inheritance</a>.</p>
<pre><code>var MyWidget = Class.extend({
init: function(widget_name){
this.widget_name = widget_name;
},
doSomething: function() {
alert('my name is ' + thi... | <p>This is long gone dead, but if anyone else searches for jQuery creating class - check this plugin:
<a href="http://plugins.jquery.com/project/HJS" rel="nofollow noreferrer">http://plugins.jquery.com/project/HJS</a></p>
| 11,020 |
<p>I recently got a Creality Ender-3, and tried printing a few things for some tests. I’ve printed a cube and just printed a cylindrical tube today, and I notice each time, it adds this random line on the left and a sort of outline around the actual print. Neither of these were there in my Cura file, but they’re always... | <p>If the printer is printing, it is instructed to do so by the <a href="https://reprap.org/wiki/G-code" rel="nofollow noreferrer">G-code</a> file unless you are printing through an external software program that has extra G-code to print before your print starts. E.g. in OctoPrint print server it is possible to execut... | <p>These are features, not bugs. </p>
<p>The line off to the left is the "priming line"; the printer is extruding a bead of material to ensure that any oozing is cleaned off of the filament tip, and that the filament is properly pressed into the hotend and flowing consistently from the nozzle, before beginning your pr... | 1,504 |
<p>Forgive me for being a complete newbie with Windows DDK.</p>
<p>I have create a simple file named <code>test.cpp</code>:</p>
<pre><code>#include <windows.h>
#define BAD_ADDRESS 0xBAADF00D
int __cdecl main(int argc, char* args[])
{
char* p =(char*)BAD_ADDRESS;
*p='A';
return 0;
}
</code></pre>
... | <p><a href="https://stackoverflow.com/questions/226790/error-when-compiling-with-windows-ddk#226952">Rob Walker</a> explains the why but <a href="http://blogs.msmvps.com/kernelmustard/2005/11/04/building-win32-apps-with-build-exe-and-the-ddk/" rel="nofollow noreferrer">Kernel Mustard</a> explains the how.</p>
| <p>You have compiled a 'native application' rather than a win32 one. The TARGET_TYPE definition controls this.</p>
<p>See '<a href="http://technet.microsoft.com/en-us/sysinternals/bb897447.aspx" rel="nofollow noreferrer">Inside Native Applications</a>' for a discussion of using the DDK to generate a native applicatio... | 28,049 |
<p>I have a line (actually a cube) going from (x1,y1,z1) to (x2,y2,z2). I would like to rotate it so that it is aligned along another line going from (x3,y3,z3) to (x4,y4,z4). Presently I am using <code>Math::Atan2</code> along with <code>Matrix::RotateYawPitchRoll</code>. Any better ways to do this?</p>
<p>Edit: I th... | <p>Yes you can do this without needing to think in terms of angles at all.</p>
<p>Since you have a cube, suppose you pick one corner and then define the 3 edges radiating out from it as vectors f0, f1, f2 (these are direction vectors, relative to the corner you've picked). Normalise those and write them as columns in... | <p>You might want to add how to actually interpolate the matrices. Source and destination matrices are fine in your answer, but computing the inverse is pointless. Quaternions will give you the shortest rotational path, so take the rotational 3x3 matrices on both matrices, convert to quaternions and lerp those. Do a se... | 31,607 |
<p>Is there a macro or a way to conditionally copy rows from one worksheet to another in Excel 2003?</p>
<p>I'm pulling a list of data from SharePoint via a web query into a blank worksheet in Excel, and then I want to copy the rows for a particular month to a particular worksheet (for example, all July data from a Sh... | <p>This works: The way it's set up I called it from the immediate pane, but you can easily create a sub() that will call MoveData once for each month, then just invoke the sub.</p>
<p>You may want to add logic to sort your monthly data after it's all been copied</p>
<pre><code>Public Sub MoveData(MonthNumber As Integ... | <p>If this is just a one-off exercise, as an easier alternative, you could apply filters to your source data, and then copy and paste the filtered rows into your new worksheet?</p>
| 10,992 |
<p>Reading <a href="http://msdn.microsoft.com/en-us/library/ms345265.aspx" rel="nofollow noreferrer">MSDN</a> (and other sources) about custom report items (CRI) for reporting services 2005. It looks like I'm limited to generating a bitmap. Not even with some mapping overlay for detecting mouse clicks on it. Is there a... | <p>You didn't missing anything.</p>
<p>For me, like you mentioned, the main disadvantage is, that with a CRI you can only render images. You don't get any scalable text or something similar.
If you want include swf, you need to render it as static image.</p>
| <p>You can render the report as HTML and include the report using a floating frame in a page with the swf file. You can use functions to format dynamic text. SSRS 2008 solves some of these problems with the "richly" formated textbox (not RTF). it may worth a look, if it's an option. </p>
| 4,118 |
<p>I am a recent college graduate working for a large corporation that has an aging workforce. I am curious for peoples experiences on working with an age gap preferably from both sides. </p>
<p>Examples Issues I have encountered so far: </p>
<ul>
<li>Agile practices vs Waterfall</li>
<li>Collaboration between progra... | <p>I have been on both sides of the fence, so to speak.</p>
<p>The problem with agile programming is that, like any tool, it isn't always appropriate for the task. In some environments a waterfall methodology is still effective.</p>
<p>I don't think the collaboration differences come from an age difference, but rathe... | <p>I'm a recent college graduate as well. I work with aging developers, but for the most part they embrace agile methodology and understand why it is a necessary for our purposes to use that instead of waterfall. I'll admit that their execution of it sometimes isn't correct, but at least they try.</p>
<p>I find that... | 38,919 |
<p>I'm using MBUnit Framework for unit testing and looking for a good test runner.</p>
<p>MbUnit's runner is fast however lacking lots of stuff such as </p>
<ul>
<li>You can't set execution path</li>
<li>It's collapsing all trees in every run which drives me crazy</li>
<li>And almost all other test runner provides so... | <p>I really enjoy NUnit. Now I enjoy even more since I can use it inside the IDE with ReSharper that let me do quick test for a method very fast.</p>
| <p>I'm using resharper to run individual tests in IDE, but nunit-console to run all tests for speed.</p>
| 39,554 |
<p>I'm working on an exceedingly large codebase, and recently upgraded to GCC 4.3, which now triggers this warning:</p>
<blockquote>
<p>warning: deprecated conversion from string constant to ‘char*’</p>
</blockquote>
<p>Obviously, the correct way to fix this is to find every declaration like</p>
<pre><code>char *s = &q... | <p>I believe passing <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wno-write-strings" rel="nofollow noreferrer">-Wno-write-strings</a> to GCC will suppress this warning.</p>
| <blockquote>
<p>The problem right now is that I'm running with -Werror</p>
</blockquote>
<p>This is your real problem, IMO. You can try some automated ways of moving from (char *) to (const char *) but I would put money on them not just working. You will have to have a human involved for at least some of the work.
F... | 8,434 |
<p>I'm relatively new to Python and am having problems programming with Scapy, the Python network manipulation tool. However, I can't tell if it's as much a Scapy problem as it is a being-a-Python-newbie problem. On the <a href="http://www.secdev.org/projects/scapy/build_your_own_tools.html" rel="noreferrer">scapy site... | <p>With the caveat from Federico Ramponi "You should use scapy as an interpreter by its own, not as a library", I want to answer the non-scapy-specific parts of the question.</p>
<p><strong>Q:</strong> when installing Python libraries, do I need to change my path or anything similar?</p>
<p><strong>A:</strong> I thin... | <p>The <a href="http://www.secdev.org/projects/scapy/index.html" rel="nofollow noreferrer">scapy</a> package is a tool for network manipulation and monitoring. I'm curious as to what you're trying to do with it. It's rude to spy on your friends. :-)</p>
<pre><code>coventry@metta:~/src$ wget -q http://www.secdev.org/... | 28,440 |
<p>In Latex how can you make the background image to occupy the whole sheet on every page <i>except</i> a certain stripe on the inner side of each page? I can't figure it out.<br>
I have a background image I'd like to be seen in whole on each page after printing/binding.</p>
<p>Matyi</p>
| <p>The beauty of two's complement is that at the binary level it's a matter of interpretation rather than algorithm - the hardware for adding two signed numbers is the same as for unsigned numbers (ignoring flag bits). </p>
<p>Your first example - "just add them" - is exactly the right answer. Your example numbers </p... | <p>Adding in two's complement doesn't require any special processing when the signs of the two arguments are opposite. You just add them as you normally would in binary, and the sign of the result is the sign you keep.</p>
| 45,119 |
<p>I've got a DB table where we store a lot of MD5 hashes (and yes I know that they aren't 100% unique...) where we have a lot of comparison queries against those strings.
This table can become quite large with over 5M rows.</p>
<p>My question is this: Is it wise to keep the data as hexadecimal strings or should I con... | <p>Do it like this:</p>
<pre><code>char s[256];
strcpy(s, "one two three");
char* token = strtok(s, " ");
while (token) {
printf("token: %s\n", token);
token = strtok(NULL, " ");
}
</code></pre>
<p>Note: <code>strtok</code> modifies the string its tokenising, so it cannot be a <code>const char*</code>. </p>
| <pre><code>int not_in_delimiter(char c, char *delim){
while(*delim != '\0'){
if(c == *delim) return 0;
delim++;
}
return 1;
}
char *token_separater(char *source, char *delimiter, char **last){
char *begin, *next_token;
char *sbegin;
/*Get the start of the token */
if(source)
be... | 33,396 |
<p>Is it possible to use stored procedures for designing Reports in Report builder?</p>
| <p>If you're asking if it's possible to use sprocs in SSRS reports that you create, then yes. Just call the sproc in the query for your DataSet like you would normaly.</p>
| <p>If you're using Oracle on the backend, you can query the results of a table function (a stored function that returns a TABLE of TYPE). The query string for your Dataset will look like:</p>
<pre><code>select * from table (f_foo(:p_bar))
</code></pre>
<p>...where f_foo is your table function stored in the database ... | 12,429 |
<p>What is the keyboard short cut in Eclipse to jump to the closing brace of a scope?</p>
| <p>Place the cursor next to an opening <em>or closing</em> brace and punch <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> to find the matching brace. If Eclipse can't find one you'll get a <em>"No matching bracket found"</em> message.</p>
<p><strong><em>edit:</em></strong> as <a href="https://stackoverflow.com/a/16... | <p>On the Macintosh, place the cursor after either the opening or closing curly brace <code>}</code> and use the keys: <kbd>Shift</kbd> + <kbd>Command</kbd> + <kbd>P</kbd>.</p>
| 36,843 |
<p>I'm writing some code to scale a 32 bit RGBA image in C/C++. I have written a few attempts that have been somewhat successful, but they're slow and most importantly the quality of the sized image is not acceptable. </p>
<p>I compared the same image scaled by OpenGL (i.e. my video card) and my routine and it's miles... | <p>I've found the wxWidgets implementation fairly straightforward to modify as required. It is all C++ so no problems with portability there. The only difference is that their implementation works with unsigned char arrays (which I find to be the easiest way to deal with images anyhow) with a byte order of RGB and the ... | <p>Take a look at <a href="http://www.imagemagick.org" rel="nofollow noreferrer">ImageMagick</a>, which does all kinds of rescaling filters.</p>
| 45,981 |
<p>My code:</p>
<pre><code> string input1;
input1 = Console.ReadLine();
Console.WriteLine("byte output");
byte[] bInput1 = Encoding.Unicode.GetBytes(input1);
for (int x = 0; x < bInput1.Length; x++)
Console.WriteLine("{0} = {1}", x, bInput1[x]);
</code></pre>
... | <p>You should read "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)" at <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="nofollow noreferrer">http://www.joelonsoftware.com/articles/Unicode.html</a></p>
<p>You can find a lis... | <p>At <a href="http://www.unicode.org/charts/" rel="nofollow noreferrer">http://www.unicode.org/charts/</a> you can find all the Unicode code charts. <a href="http://www.unicode.org/charts/PDF/U0000.pdf" rel="nofollow noreferrer">http://www.unicode.org/charts/PDF/U0000.pdf</a> shows that the code point for 'h' is U+006... | 35,568 |
<p>I have been used to working with VS2005 and 2008 - using msbuild, etc, but I have inherited a set of projects that have to remain in vc6.0 for now. I don't like opening each project in the developer studio and building. I prefer to build form command line (I am automating the builds). Is this possible?</p>
<p>I ... | <p>I think I found m answer here:
<a href="http://msdn.microsoft.com/en-us/library/aa699274.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa699274.aspx</a></p>
<p>thanks all</p>
| <p>Another option which is less labor intensive is</p>
<p><BR> Pulldown Menu (BUILD)
<BR> Select (BATCHBUILD)
<BR> Push Button (REBUILDALL)</p>
| 17,155 |
<p>Here's my problem - I'd like to communicate between two websites and I'm looking for a clean solution. The current solution uses Javascript but there are nasty workarounds because of (understandable) cross-site scripting restrictions.</p>
<p>At the moment, <strong>website A</strong> opens a modal window containing ... | <p>My best suggestion would be to create a webservice on each site that the other could call with the information that needs to get passed. If security is necessary, it's easy to add an SSL-like authentication scheme (or actual SSL even, if you like) to this system to ensure that only the two servers are able to talk t... | <p>@jmein - you've described how to create a modal popup (which is exactly what jqModal does) however you've missed that the content of the modal window is served from another domain. The two domains involved belong to two separate companies so can't be combined in the way you describe.</p>
| 5,310 |
<p>When do you test against an <a href="http://martinfowler.com/bliki/InMemoryTestDatabase.html" rel="nofollow noreferrer">In-Memory Database</a> vs. a Development Database?</p>
<p>Also, as a related side question, when you do use a Development Database, do you use an Individual Development Database, an Integration D... | <p>In memory is an excellent choice for your <em>unit</em>-tests, when the data is easy to seed for your given test cases and a very particular operation is being tested. A real database is better for <em>integration</em> tests, where the data pre-requisites are more complex and there is value to having the base data ... | <p>For my team, it's in-memory on developper machine, and the real-database on the continuous integration server.</p>
| 15,588 |
<p>I saw a link to find out if AD was running, but am not too sure if the same applies to AD/AM.
One caveat is that I should be able to check about any AD/AM instance (any domain) assuming I have permissions.</p>
| <p>the same approach applies to AD or to AD LDS (lightweight directory services, new name for ADAM). .NET examples at <a href="http://msdn.microsoft.com/en-us/library/x8wxt72e(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/x8wxt72e(VS.71).aspx</a></p>
| <p>the same approach applies to AD or to AD LDS (lightweight directory services, new name for ADAM). .NET examples at <a href="http://msdn.microsoft.com/en-us/library/x8wxt72e(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/x8wxt72e(VS.71).aspx</a></p>
| 45,143 |
<p>Ok, so after spending a good portion of a day debugging a stupid typing mistake inside a piece of code I am curious as to why the specific actions occured rather than an exception.</p>
<p>First of all the problem code.</p>
<pre><code>Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.Instant... | <p>Google has a library for generating coredumps from inside a running process called <a href="http://code.google.com/p/google-coredumper/" rel="noreferrer">google-coredumper</a>. This should ignore ulimit and other mechanisms. </p>
<p>The documentation for the call that generates the core file is <a href="http://code... | <p>system ("kill -6 ")</p>
<p>I'd give it a try if you are still looking for something</p>
| 41,187 |
<p>In postgresql you have a wealth of optimizations at hand to configure it for your performance needs. The settings for memory usage are still easy enough, but with other options like the cost factors for CPU and IO which are used for the query optimizer are quite a mystery for me. I wonder if there is <strong>a progr... | <p>Not that I know of, but the next best thing is the <a href="http://www.pgcon.org/2008/schedule/events/104.en.html" rel="nofollow noreferrer">GUCs: A Three Hour Tour</a> presentation. You can download a <a href="http://www.pgcon.org/2008/schedule/attachments/44_annotated_gucs_draft1.pdf" rel="nofollow noreferrer">PDF... | <p>Understanding indexes is the where most people should start when trying to improve any databases performance.</p>
| 18,984 |
<p>So, I have a nice domain model built. Repositories handle the data access and what not. A new requirements has popped up that indicates that reasons need to be logged with deletes. Up until now, deletes have been fairly simple => Entity.Children.Remove(child). No internal change tracking was happening as my ORM ... | <p>Ok, this sounds crazy and I'm going to take another shot at this -- even though I might be spanked for bad nHibernate usage. Before you delete, why don't you select the children that are going to be deleted (you already have their ids correct?) and do a transformation into whatever entity your going to be using to... | <p>Could you implement the <a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/#manipulatingdata-interceptors" rel="nofollow noreferrer">IInterceptor interface</a> and override the onDelete functionality to pull the information you need from the entity and send it to logger before you del... | 22,191 |
<p>I looked at the AdaCore site, as well as for A# (which now appears to be owned by AdaCore) and neither appear to be free (although I could have misread something). Any recommendations?</p>
| <p>GNAT is available for download here: <a href="https://libre.adacore.com/" rel="noreferrer">https://libre.adacore.com/</a></p>
<p>Look for "GNAT GPL Edition". Not sure why it is so well hidden on that little known site.</p>
| <p>Thomas, you can find the GPL edition of GNAT Adacore Ada framework in <a href="http://libre.adacore.com/libre/" rel="nofollow">http://libre.adacore.com/libre/</a> and download it from <a href="http://libre.adacore.com/libre/download/" rel="nofollow">http://libre.adacore.com/libre/download/</a>. Just select Free Soft... | 21,808 |
<p>Inspired by <a href="https://stackoverflow.com/questions/220044/which-sort-algorithm-works-best-on-mostly-sorted-data">this question</a></p>
<p>The choice of which algorithm to use to sort a collection can be made better if we know ahead of time how well sorted a collection is. Is there a way we can measure (or mai... | <p>You could use sampling: Check N elements spaced evenly in the list and see how many are in order. (Of course that only works in a random-access list, but usually that's the type you sort.)</p>
<p>Also have a threshold for small N. If N is small (e.g. <code>10</code>) insertion sort is good even if the list isn't ... | <p>Well, first check if the collection is sorted by definition, that will always save you a bunch of time :) For the most part, don't bother extending a collection to test if it is sorted during its insert/delete operations, if the collection needs to be sorted, use a collection that is sorted by definition.</p>
<p>I... | 27,092 |
<p>How do i make the plus minus icons bigger in the tree view in C# .net with out making visual styles disable.</p>
| <p>I don't think you have any control about it. The only thing you can do is override the DrawNode event and paint the nodes yourself.</p>
<p>First you need to change the DrawMode to OwnerDrawAll. Take a look at the relevant msdn page, it contains surprisingly much detail: <a href="http://msdn.microsoft.com/en-us/libr... | <p>Bigger than the default 10px or so? I think follow the answer above, but because I came across this while trying to determine how to restore the original size:</p>
<p>Turns out you have some control if you set the indent property - anything less than 10 px starts to shrink the +/- icons. I had a treeview that was b... | 27,777 |
<p>How can I check if a string ends with a particular character in JavaScript?</p>
<p>Example: I have a string </p>
<pre><code>var str = "mystring#";
</code></pre>
<p>I want to know if that string is ending with <code>#</code>. How can I check it?</p>
<ol>
<li><p>Is there a <code>endsWith()</code> method in JavaScr... | <p><strong>UPDATE (Nov 24th, 2015):</strong></p>
<p>This answer is originally posted in the year 2010 (SIX years back.) so please take note of these insightful comments:</p>
<ul>
<li><a href="https://stackoverflow.com/users/570040/shauna">Shauna</a> -</li>
</ul>
<blockquote>
<p>Update for Googlers - Looks like ECMA6 ad... | <p>7 years old post, but I was not able to understand top few posts, because they are complex. So, I wrote my own solution:</p>
<pre><code>function strEndsWith(str, endwith)
{
var lastIndex = url.lastIndexOf(endsWith);
var result = false;
if (lastIndex > 0 && (lastIndex + "registerc".length) == ... | 35,491 |
<p>In another question, <a href="https://stackoverflow.com/users/26310/mark">Mark</a> speaks highly of IDEs, saying "some people still just dont know "why" they should use one...". As someone who uses vim for programming, and works in an environment where most/all of my colleagues use either vim or emacs for all of th... | <p>It really depends on what language you're using, but in C# and Java I find IDEs beneficial for:</p>
<ul>
<li>Quickly navigating to a type without needing to worry about namespace, project etc</li>
<li>Navigating to members by treating them as hyperlinks</li>
<li>Autocompletion when you can't remember the names of a... | <p>A very good reason for using IDEs is that they are the accepted way of producing modern software. If you do not use one, then you likely use "old fashioned" stuff like vi and emacs. This can lead people to conclude - possibly wrongly - that you are stuck in your ways and unable to adapt to new ways of working. In an... | 25,539 |
<p>Can I put the painter into the class variables? :</p>
<pre><code>protected:
QPainter *myPainter;
...
void MyWidget::paintEvent(QPaintEvent *event)
{
myPainter = new QPainter(this);
</code></pre>
| <p>A new anser to address more reentrancy more specifically...</p>
<p><a href="https://stackoverflow.com/users/19884/danatel">danatel</a> left the following comment to <a href="https://stackoverflow.com/questions/193656/is-it-necessary-for-qtpaintevent-to-be-reentrant#195755">this message</a> (in part):</p>
<blockqu... | <p>If you are trying to avoid passing the painter widget to a number of subroutine calls, you can probably get away with a pointer to the painter as a class variable. As mentioned, you should still create/destroy it in the paintEvent function. Personally, I would probably just pass it to the helper functions, but you... | 23,534 |
<p>I have a User class which may or may not have an associated Department. This is referenced through the foreign key DepartmentId, and the relevant field in the User table is set to allow nulls.</p>
<p>When I set up my "Create User" form and select no Department, I get a conflict error on SubmitChanges():</p>
<pre>... | <p>I have found a less-than-desirable solution by putting the following in my <code>UsersController.Create</code> method:</p>
<pre><code>// Snipped UpdateModel call
if (form["User.DepartmentId"].Length == 0)
{
createdUser.DepartmentId = null;
}
Models.User.DataContext.SubmitChanges();
</code></pre>
<p>Of course, ... | <p>You could have an entry "N/A" in Department which you assign when no department is selected. Then you wouldn't get a foreign key conflict.</p>
| 22,197 |
<p>Does anyone have any examples or resources where i might find information on scrolling text which is too long to display in a button control? I'm thinking something along these lines.</p>
<ul>
<li>Display as much text will fit within the current rect with a '...' at the end to signify overflow.</li>
<li>Pause for ... | <p>Here's an idea: instead of ellipses (...), use a gradient on each side, so the extra text fades away into the background color. Then you could do this with three CALayers: one for the text and two for fade effect.</p>
<p>The fade masks would just be rectangles with a gradient that goes from transparent to the back... | <p>Pretty sure you can't do that using the standard API, certainly not with UILineBreakMode. In addition, the style guide says that an ellipsis indicates that the button when pressed will ask you for more information -for example Open File... will ask for the name of a file. Your proposed use of ellipsis violates this ... | 17,715 |
<p>I Have following code:</p>
<p>Controller:</p>
<pre><code>public ActionResult Step1()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Step1(FormCollection form)
{
TempData["messageStatus"] = new Random().Next(1, 1000);
return RedirectToAction("Step1");
}
</code></pre>
... | <p>I'm guessing you're running into caching problems. It's not a problem with redirect to action. All RedirectToAction does is issues a redirect response to your browser telling it to request Step01. Then your browser makes a request for Step01.</p>
<p>In that case, your browser might have Step01 cached. So you need t... | <p>Try this:</p>
<pre><code>TempData["messageStatus"] = new Random(DateTime.Now.Millisecond).Next(1, 1000);
</code></pre>
| 49,227 |
<p>Can anyone point me to a good tutorial on creating a bootable Linux CD from scratch?</p>
<p>I need help with a fairly specialized problem: my firm sells an expansion card that requires custom firmware. Currently we use an extremely old live CD image of RH7.2 that we update with current firmware. Manufacturing puts t... | <p>One key piece of advice I can give is that most LiveCDs use a compressed filesystem called squashfs to cram as much data on the CD as possible. Since you don't need compression, you could run the mksquashfs step (present in most tutorials) with -noDataCompression and -noFragmentCompression to save on decompression ... | <p>Depends on your distro. Here's a good article you can check out from <a href="http://lwn.net/Articles/172132/" rel="nofollow noreferrer">LWN.net</a></p>
<p>There is a book I used which covers a lot of distros, though it does not cover creating a flash-bootable image. The book is <a href="https://rads.stackoverflo... | 5,313 |
<p>I have a simple web service operation like this one:</p>
<pre><code> [WebMethod]
public string HelloWorld()
{
throw new Exception("HelloWorldException");
return "Hello World";
}
</code></pre>
<p>And then I have a client application that consumes the web service and then calls the ope... | <p>Unfortunately I don't think this is possible.</p>
<p>The exception you are raising in your web service code is being encoded into a Soap Fault, which then being passed as a string back to your client code.</p>
<p>What you are seeing in the SoapException message is simply the text from the Soap fault, which is not ... | <p>I ran into something similar a bit ago and <a href="http://theruntime.com/blogs/jacob/archive/2008/01/28/getting-at-the-details.aspx" rel="nofollow noreferrer">blogged about it</a>. I'm not certain if it is precisely applicable, but might be. The code is simple enough once you realize that you have to go through a M... | 5,201 |
<p>Does anyone have time to take a look at it? </p>
<p>I've read a bit and it promises a lot, if it's half what they say, it'll change web Development a lot</p>
| <p>I have compared Mozilla Firefox 3.0.1 and Google Chrome 0.2.149.27 on <a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider.html" rel="noreferrer">SunSpider JavaScript Benchmark</a> with the following results:</p>
<ul>
<li>Firefox - total: 2900.0ms +/- 1.8%</li>
<li>Chrome - total: <strong>1549.2ms +/- 1.7%<... | <p>It's really speedy. Visibly so. I was pretty impressed with its performance compared with Firefox 3. Already made it my default browser.</p>
| 6,227 |
<p>Is there a way to have two columns, that match each other in height, without using table cells, fixed heights or Javascript?</p>
<p><strong>Using a TABLE</strong></p>
<pre><code><table>
<tr>
<td style="background:#F00;">
This is a column
</td>
<td ... | <p><a href="http://www.xs4all.nl/~peterned/examples/csslayout1.html" rel="nofollow noreferrer">http://www.xs4all.nl/~peterned/examples/csslayout1.html</a></p>
<p>this is the kind of thing you want, give them both a height of 100% (using this css trick) and they'll stretch out to the height of the containing div!</p>
... | <p>Theres a simple way of achieving this with clever HTML and CSS.</p>
<p>First the HTML:</p>
<pre><code><div id="container">
<div id="col1">
this is column 1
</div>
<div id="col2">
this is column 2<br />
it is obviously longer than the first column &l... | 43,527 |
<p>I usually format my project directory like J-P Boodhoo. a main dir containing solution file, then a lib folder for all third-party lib, a src dir, a tools lib for third-party that wont be deployed.... <a href="http://blog.jpboodhoo.com/DirectoryStructureForProjects.aspx" rel="noreferrer">For more info look here</a><... | <p>I'm not sure which Visual Studio language you use, but if it's C++, then then file paths are stored in the <code>.vcproj</code> project file which should also be under version control. (NOTE: the <code>.sln</code> solution file does NOT store path settings) If you are careful to use relative, rather than absolute p... | <p>I use a shared folder on the network for stuff like that. And give that folder full trust. on the PDC i just have a login script that maps approriately. Its might not be the best way, but its worked for me without any issues.</p>
<p>Another solution I have used in the past is a common folder on each machine where a... | 15,684 |
<p>I'm trying to retrieve numeric values from a <code>DataGridView</code>. So far, the only way I've found is to retrieve them as a string and convert them to numeric.</p>
<pre><code>Convert.ToDouble(MyGrid.SelectedRows[0].Cells[0].Value.ToString());
</code></pre>
<p>There must be an easier way. The cell is originall... | <p>With <code>DataGridViewCell</code> you can just cast the <code>.Value</code> to your known type; the following is a complete example that shows this happening (using double) from a <code>DataTable</code> (like your example).
Additionally, <code>Convert.To{blah}(...)</code> and <code>Convert.ChangeType(...)</code> mi... | <p>What is the error you are getting? <code>Convert.ToDouble</code> has an overloaded method that takes an object, so you shouldn't need the <code>ToString()</code>? Unless you are doing a <code>TryParse</code>?</p>
| 18,702 |
<p>I have been wanting to learn about 3D printing a long time so I really want this site to succeed but I have no previous experience with the subject. </p>
<p>I was wondering how can I help the site at this early stage. I thought about asking about how to get started with 3D printing but SE explicitly discourages "ea... | <h1>Vote!</h1>
<p>Private Betas love, love, <em>love</em> votes. Without votes, it's difficult to attain privileges, get rewards, and help push us out to public beta.</p>
<h1>Ask Questions!</h1>
<p>I know you said this:</p>
<blockquote>
<p>I thought about asking about how to get started with 3D printing but SE ex... | <p>I would suggest doing a bit of basic research on 3D printing (including reading questions and answers). From these you will learn more about it and hopefull you will have new questions about 3D printing that can be asked. </p>
<p>If you are looking at getting a 3D printer, you could ask about different features l... | 0 |
<p>I googled for this for a while but can't seem to find it and it should be easy. I want to append a CR to then end of an XML file that I am creating with a Transformer. Is there a way to do this></p>
<p>I tried the following but this resulted in a blank file?</p>
<pre><code>
Transformer xformer = TransformerFactory... | <p>Simple... just add the <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileOutputStream.html#FileOutputStream(java.io.File,%20boolean)" rel="noreferrer">append</a> option:</p>
<pre><code> new FileOutputStream(f, true /* append */);
</code></pre>
| <p>I didn't know this Transformer class. But I see no connection between your writer/file variables and your xformer/source/result variables... Looks like you write only a newline.<br>
Unless you omitted some essential part.</p>
| 48,294 |
<p>I have a ListCtrl that displays a list of items for the user to select. This works fine except that when the ctrl is not large enough to show all the items, I want it to expand downwards with a vertical scoll bar rather than using a horizontal scroll bar as it expands to the right.</p>
<p>The ListCtrl's creation:</... | <p>Use the <a href="http://docs.wxwidgets.org/stable/wx_wxlistctrl.html#wxlistctrl" rel="nofollow noreferrer">wxLC_REPORT</a> style.</p>
<pre><code>import wx
class Test(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None)
self.test = wx.ListCtrl(self, style = wx.LC_REPORT | wx.LC_NO_HEADER... | <p>Try this:</p>
<pre><code>import wx
class Test(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None)
self.test = wx.ListCtrl(self, style = wx.LC_ICON | wx.LC_AUTOARRANGE)
for i in range(100):
self.test.InsertStringItem(self.test.GetItemCount(), str(i))
self.S... | 26,441 |
<p>I'm desperately searching for a tool allowing me to copy documents with their old versions from a SharePoint 2003 to a SharePoint 2007 site.<br />
Do you know about any simple (and preferably free) tool which does this?<br /></p>
| <p>We recently did a migration from SPS 2003 to MOSS 2007, and I was trying to figure out how to do this. Sadly, there didn't seem to be a great way. What I ended up doing was using a back up of my SPS 2003 content database and a MOSS 2007 VM to do a database attach upgrade of the whole SPS 2003 portal. Then, I used th... | <p>the splistcp worked really well, but I was getting a time out error every once in a while when it was trying to move a file. I was getting a time out message, then a message that file couldn't be found, then the program just quit. I downloaded the source code, found in MBSPListItemsMap.cs where the program was tryi... | 34,320 |
<p>I have a simple application, which should send a single byte to a serial port once a minute. But sometimes, from some strange reason, it freezes somewhere in the WriteFile() function. Both sw and hw flow controls are turned off. I've googled some stuff about pending read operations performed from another threads, bu... | <p>If you google for the words <em>writefile hangs</em>, you'll find a number of discussions on this problem. Some leads are buffer overruns, sizing your buffer correctly, a defective COM port, clearing the status on error... Seems like there are plenty of things to try.</p>
<p>Another thing I would suggest is to use ... | <p>Well, I'm using this library: <a href="http://lhdelphi.ic.cz/uploader/storage/ComDrv32.pas" rel="nofollow noreferrer">http://lhdelphi.ic.cz/uploader/storage/ComDrv32.pas</a> in Delphi 7, on Windows XP, but the component inside is just a wrapper around some Win API calls, CreateFile, WriteFile, etc.</p>
| 31,340 |
<p>Recently, the ticking sounds started to come from feeder of my UM2. Inspecting it I have noticed that once in a while stepper motor jumps back for few steps. I have an idea of what can be the reason, but I just want to hear what you can think of. That is the video of feeder during the printing :)
<a href="https://yo... | <p>Ultimately, your stepper motor is unsuccessful in driving the filament through the extruder. A couple potential reasons:</p>
<ul>
<li>extruder temperature isn't high enough. This could either be operator error from not setting the temperature correctly or your machine is getting a false reading. Typically, for ABS/... | <p>Oh yeah that is way too low for the ultimaker.</p>
<p>That temp is a general "this is what PLA melts at" so if you took plastic, heated it up to that temp it would melt.</p>
<p>However, you don't heat all the plastic at once. Your hotend it at that temp and if you let it sit it would heat up (fairly quickly). Prin... | 240 |
<p>Can anyone recommend a decent C image library?</p>
<p>I'm after loaders for bmp, gif, jpg, png and tga.</p>
<p>I want to use this for programming my <strong>Sony Playstation Portable</strong>, so opensource would be very handy.</p>
<p>After some googleing I've found FreeImage and CImg, but both feel rather heavy,... | <p>If you control the images you're loading, the lightest loader I know is Sean Barrett's awesome <a href="http://nothings.org/stb_image.c" rel="noreferrer">stb_image.c</a> (direct link to single file source code!).</p>
<p>There are also other very worthwhile libraries on Sean's site such as a tiny TrueType rasterizer... | <p><a href="http://code.google.com/p/kgui/source/browse/trunk/kguiimage.cpp" rel="nofollow noreferrer">Here</a> is some code I wrote for handling images. It is in c++ ( not c ) but you should be able to easily extract the BMP and GIF load code. It's licensed LGPL. </p>
<p>I use the libpng and jpeglib for decompressing... | 7,269 |
<p>I am trying to build a working encrypted signature for the Amazon S3 web service, writing a connection library using Objective C. </p>
<p>I have run into HMAC SHA-1 digest problems with the ObjC code, so I'm putting that to the side and looking at existing, working Perl code, to try to troubleshoot digest creation.... | <p>I find the the main problems I have had with hashes in comparisons are:</p>
<ol>
<li>ensure the data and key are the same in both comparisons</li>
<li>ensure the data and key are in the same character encoding in both comparisons</li>
<li>ensure the key and text are being passed the same in both scripts, i.e. which... | <p>I'm afraid I can't help much here, but there's definitely something wrong with what you posted. Your example script produces different output for me and the output you posted really cannot be correct.</p>
<p>How could this </p>
<pre><code>secret key hex: abcd...1234
</code></pre>
<p>ever be the result of that</p>... | 47,307 |
<p>I have an ASP.NET 1.1 application that uses the following code to write out a file in the response:</p>
<pre><code>Dim objStream As Object
objStream = Server.CreateObject("ADODB.Stream")
objStream.open()
objStream.type = 1
objStream.loadfromfile(localfile)
Response.BinaryWrite(objStream.read)
</code></pre>
<p>This... | <p>I have a code like this for download files from server:</p>
<pre><code>strFilename = Server.MapPath("/App_Upload/" & strFilename)
With Response
.AddHeader("Content-Type", "binary/octet-stream")
.AddHeader("Content-Disposition", "attachment; filename=" & strFilename & ";")
.WriteFile(strFil... | <p>So the images that are being served by Asp.Net are tiff files. And it says <a href="http://forums.asp.net/p/1113169/2332853.aspx#2332853" rel="nofollow noreferrer">here</a> that IE7 doesn't display files with 4 letter extensions for some reason. I think I'll try to change it to 3 letters and see what happens.</p>
| 35,982 |
<p>List comprehensions can be useful in certain situations, but they can also be rather horrible to read.. As a slightly exaggerated example, how would you indent the following?</p>
<pre><code>allUuids = [x.id for x in self.db.query(schema.allPostsUuid).execute(timeout = 20) if x.type == "post" and x.deleted is not Fa... | <p>It depends on how long they are. I tend to structure them like so:</p>
<pre><code>[x.id for x
in self.db.query(schema.allPostsUuid).execute(timeout=20)
if x.type == 'post'
and x.deleted is not False
and ...
and ...]
</code></pre>
<p>That way every expression has its own line.</p>
<p>If any line bec... | <pre><code> allUuids = [
x.id
for x in self.db.query(schema.allPostsUuid).execute(timeout = 20)
if x.type == "post"
and x.deleted
]
</code></pre>
| 40,149 |
<p>I have a piece of code looking like this : </p>
<pre><code>TAxis *axis = 0;
if (dynamic_cast<MonitorObjectH1C*>(obj))
axis = (dynamic_cast<MonitorObjectH1C*>(obj))->GetXaxis();
</code></pre>
<p>Sometimes it crashes : </p>
<pre><code>Thread 1 (Thread -1208658240 (LWP 11400)):
#0 0x0019e7a2 in _d... | <p>Some possible reasons for the crash:</p>
<ul>
<li><code>obj</code> points to an object with a non-polymorphic type (a class or struct with no virtual methods, or a fundamental type).</li>
<li><code>obj</code> points to an object that has been freed.</li>
<li><code>obj</code> points to unmapped memory, or memory tha... | <p>Can the value of obj be changed by a different thread?</p>
| 35,161 |
<p>How can I enable Emacs key bindings in Microsoft Visual C# 2008 Express Edition?</p>
| <p>It seems that the Emacs keybinding file (<strong>Emacs.vsk</strong>) it's not included on Visual Studio Express Editions, however you might be able to find it and use it :-)</p>
| <p>Additionally, install Visual C++ Express Edition. It includes the emacs keybindings.</p>
| 42,384 |
<p>Can someone supply me with a regex to match a search term that is not preceded or followed by <code>[a-z]</code> and <code>[A-Z]</code>? (Other characters are OK.) I.e., when searching for <code>key</code>, I don't want <code>keyboard</code> in my search results, but <code>key.</code> is okay.</p>
| <p><code>\bkey\b</code> should do what you want.</p>
<p><code>\b</code> is a word boundary</p>
| <p>No need for the <code>OR</code>s if you do it like this:</p>
<pre><code>(^|[^A-Za-z])key([^A-Za-z]|$)
</code></pre>
| 34,191 |
<p>In a file called index.asp, which is set up in IIS as a default document for the directory, I'm trying to determine via .asp VBScript if the page was called as the default document versus directly by name, i.e. I'm trying to distinguish between these two cases server-side:</p>
<p><a href="http://someurl/" rel="nofo... | <p>The server won't know, but the client will. In JavaScript you can examine the <code>location.href</code>, then pass that value back to the server using an Ajax call to whatever logging mechanism you want.</p>
| <p>How about this...<br />
Create a new file IndexDefault.asp and set it as the default document<br />
In IndexDefault.asp make it a redirect to Index.asp<br />
In IndexDefault.asp check the referrer for the IndexDefault.asp.</p>
| 49,296 |
<p>OK, So i have been watching some MVC vids and reading some bits.
I am new to the entire MVC pattern, and until now have been happily wrapped up in the web forms world!</p>
<p>Like with so many demos it all seems great and I'm sure I'll have lots I dont understand as I move along, but in the first instance...</p>
<... | <p>Setup your strongly typed ViewData class with two properties like this</p>
<pre><code>public class MyViewData
{
public IEnumerable<Car> Cars { get; set; }
public IEnumerable<People> People { get; set; }
}
</code></pre>
<p>and then fill them in the controller,
Sorry for the duplicate. In good MVC... | <p>You can either pass both objects inside the ViewData hashtable, or create a MyViewViewModel, add two properties, and set them both from your controller.</p>
| 40,997 |
<p>Looking through some code I came across the following code</p>
<pre><code>trTuDocPackTypdBd.update(TrTuDocPackTypeDto.class.cast(packDto));
</code></pre>
<p>and I'd like to know if casting this way has any advantages over </p>
<pre><code>trTuDocPackTypdBd.update((TrTuDocPackTypeDto)packDto);
</code></pre>
<p>I'v... | <p>These statements are not identical. The cast method is a normal method invocation (<code>invokevirtual</code> JVM instruction) while the other is a language construct (<code>checkcast</code> instruction). In the case you show above, you should use the second form: <code>(TrTuDocPackTypeDto) packDto</code></p>
<p>Th... | <p>Both of these statements are identical. Pick whichever one you find more readable. The second method is more common in my experience, and it is the once that I prefer.</p>
<p>I tend to use the cast method solely when I am working with reflection, and it reads nicer in that situation. All other times I find myself u... | 30,209 |
<p>I am wondering, what goes into the creation of a GUID. I don't mean what is used to create a GUID in a specific language (NewID() in SQL Server, Guid.NewGuid() in C#), I mean when you call those methods/functions, what do they do to make the GUID?</p>
| <p>The details of GUIDs, including the algorithm used to generate them is described on <a href="http://en.wikipedia.org/wiki/Globally_Unique_Identifier" rel="nofollow noreferrer">wikipedia</a>.</p>
| <p>Hash function. Its complicated.</p>
<p><a href="http://en.wikipedia.org/wiki/GUID#Algorithm" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/GUID#Algorithm</a> Knows more than I do.</p>
| 11,262 |
<p>Ok I am a total beginner with the Solaris Operating system and I need to install and configure samba on 3 boxes each has a different version of Solaris (8,9,10).</p>
<p>What I want to know location of samba configuration file i.e., <code>smb.conf</code> files in each version? So far all I have found is </p>
<ol>
<... | <p>Samba configuration files can be set anywhere your administrator want you to have them.</p>
<ul>
<li><code>/usr/local/samba/</code> is the path where samba can be installed.</li>
<li>smb.conf is one of the configuration files, along with private/secrets.tdb or username.map</li>
</ul>
<p>You can launch your samba w... | <p>The FILES section of the manpage for `smbd' may give some hints. I don't have any Solaris box handy, so cannot unfortunately confirm.</p>
| 40,903 |
<p>As best-behaved as I try to be about keeping my unit tests disconnected from the database, etc. etc, it still seems inevitable that my day will be interrupted by small regular enforced breaks while I wait for my machine to do something boring.</p>
<p><img src="https://imgs.xkcd.com/comics/compiling.png" alt="xkcd c... | <ol>
<li>StackOverflow</li>
<li>Coffee</li>
<li>StackOverflow</li>
<li>Side project coding</li>
</ol>
<p>See also <a href="https://stackoverflow.com/questions/55922/how-to-keep-concentrated-and-focused-while-waiting-for-your-compiler">How to keep concentrated and focused while waiting for your compiler?</a></p>
| <p>I usually read blogs, articles, mostly work related.<br>
I have dedicated time to read everything not work related (30 minutes time-frame after lunch).
<br> I also find myself going through our websites to see if I find a bug or something that can be improved.
<br><br> And on a Friday (like today:) ) I read Freak An... | 34,181 |
<p>I'm trying to safely update the home directory as specified in <code>/etc/passwd</code>,
but the standard Linux utils - usermod and vipw - for doing so aren't provided
by Cygwin.</p>
<p>Could anyone tell me how they changed this in Cygwin?</p>
| <p><strong>EDIT:</strong> For recent versions of Cygwin (1.7.34 and beyond), see <a href="https://stackoverflow.com/q/1494658/1858225">this newer question</a>.</p>
<p>Like sblundy's answer, you can always edit by-hand.</p>
<p>But if you want to do it the "official" way, use the cygwin-specific <a href="https://cygwin... | <p>I edited my /etc/passwd file directly (making sure nothing else would be accessing it), and changed all references to /home to be /Users (on Windows 7). I found that, in order for everything to work correctly, I had to delete any directories in the /home directory (or move them to the appropriate other location). ... | 27,909 |
<p>I'm looking to be able to reference certain state/objects through anywhere in my application. For instance, a user logs in to their application, I need to call a web service and retrieve the users information. Then I want to be able to access this information from anywhere in the application with something like the ... | <p>Normally, you should only connect things to the app delegate if they:</p>
<ul>
<li>Were created from the same NIB file as the app delegate (i.e. static UI elements in single window interfaces)</li>
<li>Are associated with application-level event handling that passes through the app delegate (like the menu item for... | <p>Usually you would ask your application's controller for this information and it would be responsible for knowing how to store it/look it up in whatever data model exists. Your application's controller may or may not be the same as the applications delegate (in most simple applications, it is the same).</p>
| 43,979 |
<p>I want to make an order with this configuration</p>
<ul>
<li>Arduino MEGA 2650 R3</li>
<li>Ramps 1.6 Plus</li>
<li>2 TMC2130 </li>
<li>2 Stepper motors 17hs3401</li>
<li>1 Fan</li>
</ul>
<p><img src="https://i.stack.imgur.com/Nl0sE.png" alt="stepper_motor"></p>
<p>But I am not sure what voltage and current would ... | <p>The easiest way to know how powerful the PSU should be is to download from <a href="https://github.com/rcarlyle/StepperSim" rel="nofollow noreferrer">https://github.com/rcarlyle/StepperSim</a> the Excel workbook which simulates the power absorbed by the stepper motor. Input the motor specifications, check in the gra... | <p>Yes, A power supply that can deliver 12 volts and up to 15 Amps will work. Since that board says 12 V, that means it is designed to work at 12V. The components on the board might not survive 24V. The TMC stepper motor drivers specified can tolerate a max of 2.5 amps. That current draw is dependent on the per phase w... | 1,617 |
<p>How can I list all the local users configured on a windows machine (Win2000+) using java.<br>
I would prefer doing this with ought using any java 2 com bridges, or any other third party library if possible.<br>
Preferable some native method to Java. </p>
| <p>Using a Java-COM Bridge , like <a href="http://danadler.com/jacob/" rel="nofollow noreferrer">Jacob</a>. You then select an appropriate COM library, e.g. <a href="http://msdn.microsoft.com/en-us/library/aa389276(VS.85).aspx" rel="nofollow noreferrer">COM API for WMI</a> to list local users, or any other Windows mana... | <p>There is a simpler solution for what I needed.<br>
This implementation will use the "<a href="http://support.microsoft.com/kb/251394" rel="nofollow noreferrer">net user</a>" command to get the list of all users on a machine. This command has some formatting which in my case I don't care about, I only care if my user... | 43,274 |
<p>What is a good command line tool to create screenshots of websites on Linux? I need to automatically generate screenshots of websites without human interaction. The only tool that I found was <a href="http://khtml2png.sourceforge.net/" rel="noreferrer">khtml2png</a>, but I wonder if there are others that aren't base... | <p>A little more detail might be useful...</p>
<p>Start a firefox (or other browser) in an X session, either on your console or using a vncserver. You can use the <code>--height</code> and <code>--width</code> options to set the size of the window to full screen. Another firefox command can be used to set the URL be... | <p>I don't know of anything custom built, I'm sure there could be something done with the gecko engine to render to a png file instead of the screen ...</p>
<p>Or, you could fire up firefox in full screen mode in a dedicated VNC server instance and use a screenshot grabber to take the screenshot. Fullscreen = minimal ... | 15,316 |
<p>Are JKS (Java Key Store) files encrypted? Do they provide full protection for encryption keys, or do I need to rely solely on access control?<br>
Is there a way to ensure that the keys are protected?</p>
<p>I'm interested in the gritty details, including algorithm, key management, etc. Is any of this configurable?<... | <p>They are encrypted.</p>
<p>The algorithm is provider dependent. The provider will return the key/certificate based on a password. If you need strong security, find a keystore provider that uses a strong encryption.</p>
| <p>They are encrypted.</p>
<p>The algorithm is provider dependent. The provider will return the key/certificate based on a password. If you need strong security, find a keystore provider that uses a strong encryption.</p>
| 20,978 |
<p>I have a function, parseQuery, that parses a SQL query into an abstract representation of that query.</p>
<p>I'm about to write a function that takes an abstract representation of a query and returns a SQL query string.</p>
<p>What should I call the second function?</p>
| <p>I think the verb you want is 'compose'.</p>
| <p>I believe the answer you're looking for is: "Don't parse SQL or assemble SQL in the first place. Use an Object/Relational Mapper and stop wasting your employer's money by solving problems that have already been solved for quite some time."</p>
| 17,936 |
<p>My Anet A8 reads as 120ish degrees Celsius, but it is set to 200 degrees. I don't know if it is reading the wrong temperature because it still pushes out plastic when I force it. It will climb up and then go back down. I don't know if the hot end it broke or if the thermistor is broke.</p>
| <h2>You are sitting on a fire risk!</h2>
<p>If you are using the stock/original firmware, you should <em><strong>immediately stop printing</strong></em>. The stock firmware of the Anet A8 has no <a href="https://3dprinting.stackexchange.com/questions/8466/what-is-thermal-runaway-protection">thermal runaway protection</... | <p>Without any other information, the highest odds are that the fan is blowing on the hot end. If the temp drops when the fan is on, and rises when the fan is off, then simply re-position the fan nozzle. If that's not the problem, check the thermistor. If that's not it, check the termination (tighten the screws... | 1,247 |
<pre><code>SELECT
avg(con_hits) as avg_hits
FROM
content
WHERE
con_type = 1
AND con_posttime < $twelve_hrs_ago
AND con_refresh = 0
ORDER BY
con_posttime DESC
LIMIT 100
</code></pre>
<p>I would like it to go to the first record that was posted at least 12 hours ago (denoted by the <code>$twelve... | <p><code>LIMIT</code> is applied to the resultset, after <code>AVG</code> is calculated. You can do what you want, with a subselect:</p>
<pre><code>SELECT avg(con_hits) as avg_hits
FROM (
SELECT con_hits
FROM content
WHERE
con_type = 1
AND con_posttime < $twelve_hrs_ago
AND con_refresh = 0
ORDER... | <p>What about:</p>
<pre><code>
SELECT avg(con_hits) as avg_hits FROM (
SELECT con_hits FROM content
WHERE con_type = 1 AND con_posttime < $twelve_hrs_ago AND con_refresh = 0
ORDER BY con_posttime DESC
LIMIT 100
)
</code></pre>
<p>Mysql supports subqueries, so this might do it for you.</p>
<p... | 42,987 |
<p>Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression?</p>
| <p>From <a href="http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx" rel="noreferrer">MSDN</a> about System.IO.Compression.GZipStream:</p>
<blockquote>
<p>This class represents the gzip data format, which uses an industry standard algorithm for lossless file compression and decompression.<... | <p>I agree with andreas. You probably won't be able to open the file in an external tool, but if that tool expects a stream you might be able to use it. You would also be able to deflate the file back using the same compression class.</p>
| 9,570 |
<p>I am new to C# and am doing some work in an existing application. I have a DirectX viewport that has components in it that I want to be able to position using arrow keys.</p>
<p>Currently I am overriding ProcessCmdKey and catching arrow input and send an OnKeyPress event. This works, but I want to be able to use mo... | <p>Within your overridden ProcessCmdKey how are you determining which key has been pressed?</p>
<p>The value of keyData (the second parameter) will change dependant on the key pressed and any modifier keys, so, for example, pressing the left arrow will return code 37, shift-left will return 65573, ctrl-left 131109 and... | <p>I upvoted <a href="https://stackoverflow.com/questions/4850/c-and-arrow-keys/5026#5026">Tokabi's answer</a>, but for comparing keys there is some additional advice on <a href="https://stackoverflow.com/questions/1369312/c-keys-enumeration-confused-keys-alt-or-keys-rbutton-keys-shiftkey-keys-alt/2033796#2033796">Stac... | 2,683 |
<p>If I use <code>assert()</code> and the assertion fails then <code>assert()</code> will call <code>abort()</code>, ending the running program abruptly. I can't afford that in my production code. Is there a way to assert in runtime yet be able to catch failed assertions so I have the chance to handle them gracefully... | <p>Yes, as a matter of fact there is. You will need to write a custom assert function yourself, as C++'s <code>assert()</code> is exactly C's <code>assert()</code>, with the <code>abort()</code> "feature" bundled in. Fortunately, this is surprisingly straightforward.</p>
<p><em>Assert.hh</em></p>
<pre><code>templat... | <pre><code>_set_error_mode(_OUT_TO_MSGBOX);
</code></pre>
<p>believe me, this function can help you.</p>
| 5,816 |
<p>As a UI guy (coding and designing user interfaces) I often find myself in the odd situation arguing about the quality of userinterfaces with programmers and other "laymen".</p>
<p>I find it somewhat hard to argue about things like colors, icons or layout and it doesn't seem that there is a factual right or wrong. B... | <p>Ultimately the customer makes the decision because the customer pays the bills. However, the customer is usually paying me because they believe that I have skills and abilities that they don't possess. Typically I'll try to explain to them why I believe a particular layout or color choice makes sense from a design ... | <p>A lot of my clients are small. They don't have the money for a usability/UI expert so we make due. They understand my limitations and we both do our best to bring a little common sense to the table - understanding that we're building good-enough versus the best (UI-wise).</p>
<p>In my experience, large clients have... | 47,256 |
<p>You are doing contract first development of web services in a SOA world.</p>
<p>After editing an XSD file, what is the best way to automatically (re)generate .net classes from the XSD files?</p>
| <p>xsd.exe will generate new classes for you.</p>
<p>Depending on how Visual Studio is set up, adding xsd.exe to "Properties / build events / post-build events" will force a regeneration every time you do a rebuild.</p>
| <p>I have used <a href="http://xsd2code.codeplex.com/releases/view/22222" rel="nofollow">http://xsd2code.codeplex.com/releases/view/22222</a> VS addin for this.</p>
| 32,490 |
<p>I currently have a functioning in-house Windows Forms application which extensively uses the <code>DataGridView</code> control for data entry. There are some support issues which are expected when we roll this out to more locations, so one of our consultants has recommended putting together an AJAX application with ... | <p>The easiest way, but not neccessarly the best way is to get familiar with the UpdatePanel, which is part of the ASP.net AJAX controls.
You can use an ASP.net GridView control (which shares much of the Winforms equiv. functionality), wrap an UpdatePanel around it and you're away.</p>
<p>Further on from that you will... | <p>What you're wanting to do isn't very hard especially with Telerik's or Infragistic's controls, but as the previous commenter stated, they aren't cheap. They are probably worth the price if you don't want to spend the time rolling your own responsive and editable grid.</p>
| 22,605 |
<p>I'm looking to start a <a href="http://en.wikipedia.org/wiki/MUD" rel="nofollow noreferrer">MUD client</a> application, which connects to a MUD hosted on a telnet server. The only thing important to me is that it runs painlessly and efficiently across any OS. Aside from that requirement, I'm not really sold on any... | <p>I would always consider <a href="http://twistedmatrix.com/trac/" rel="nofollow noreferrer">Twisted</a> for this kind of thing (Python).</p>
<p>The beauty is that if you later decide to swap it out to SSH or anything more secure than telnet, you can with little pain.</p>
| <p>pmc ( <a href="http://sourceforge.net/projects/perlmudclient/" rel="nofollow noreferrer">http://sourceforge.net/projects/perlmudclient/</a> ) was an attempt to do exactly this. I've spent some of the last week going through it; it uses an older modified version of Net::Telnet to do its connectivity work. </p>
<p>My... | 41,655 |
<p>Is there a way to set a different value for service startup timeout per service?
I can change it using the ServicesPipeTimeout registry key, but it's per machine (<a href="http://support.microsoft.com/kb/824344" rel="noreferrer">http://support.microsoft.com/kb/824344</a>).</p>
<p>At the moment the only thing I thou... | <p>It's good practice to finish starting your service as fast as possible. So, during the <em>start</em> state, do only what you absolutely need to acknowledge it started successfully; and do the rest later. If the <em>start</em> is still a lengthy process, use <a href="http://msdn.microsoft.com/en-us/library/ms686241.... | <p>I also had to deal with a service which may takes a few seconds/minutes to have a good Start. When the service starts, it tries to connect to a SQL Server. However, when the whole server was restarted , my service was starting BEFORE SQL Server. (I know about the Service dependency but it dont apply to my situati... | 26,603 |
<p>I have a <code>DataGridView</code> with several created columns. I've add some rows and they get displayed correctly; however, when I click on a cell, the content disappears.</p>
<p>What am I doing wrong?</p>
<p>The code is as follows:</p>
<pre><code>foreach (SaleItem item in this.Invoice.SaleItems)
{
DataGri... | <p>Just to extend this question, there's also another way to add a row to a <code>DataGridView</code>, especially if the columns are always the same:</p>
<pre><code>object[] buffer = new object[5];
List<DataGridViewRow> rows = new List<DataGridViewRow>();
foreach (SaleItem item in this.Invoice.SaleItems)
{... | <p><em>Edit: oops! made a mistake on the second line of code. - fixed it.</em></p>
<p>Sometimes, I hate defining the datasource property.</p>
<p>I think that whenever you create and set a new row for "row", for some weird reason,the old value get disposed. try not using an instance to hold the rows you create :</p>
... | 17,934 |
<p>I need to create several applications that all share a Microsoft SQL Server database. These include ASP.NET web applications, WPF desktop applications, and probably the odd console app every now and then.</p>
<p>I'd like to use the ADO.NET Entity Framework for data access, extend its objects for my business logic,... | <p>for that I would recommend creating a Visual Studio Solution that contains multiple Projects. Your DAL would be contained within its own project then for the other projects that need to make use of that functionality, create a Project Reference back to the DAL project.</p>
<p>Hope this helps!</p>
| <p>I'd recommend creating a new Visual Studio solution that contains multiple projects. For a DAL/BLL separation I would recommend using a class library. Making this abstraction allows you to wrap it by other projects like a WCF web service for example and expose it openly to not only .NET systems -- but potentially ... | 32,450 |
<p>When I call <code>socket.getsockname()</code> on a socket object, it returns a tuple of my machine's internal IP and the port. However, I would like to retrieve my external IP. What's the cheapest, most efficient manner of doing this?</p>
| <p>This isn't possible without cooperation from an external server, because there could be any number of NATs between you and the other computer. If it's a custom protocol, you could ask the other system to report what address it's connected to.</p>
| <p>Using the address suggested in the source of <a href="http://whatismyip.com" rel="nofollow noreferrer">http://whatismyip.com</a></p>
<pre><code>import urllib
def get_my_ip_address():
whatismyip = 'http://www.whatismyip.com/automation/n09230945.asp'
return urllib.urlopen(whatismyip).readlines()[0]
</code></p... | 8,266 |
<p>So I'm working on some legacy code that's heavy on the manual database operations. I'm trying to maintain some semblance of quality here, so I'm going TDD as much as possible.</p>
<p>The code I'm working on needs to populate, let's say a <code>List<Foo></code> from a DataReader that returns all the fields req... | <p>To make this less tedious, you will need to encapsulate/refactor the mapping between the DataReader and the Object you hold in the list. There is quite of few steps to encapsulate that logic out. If that is the road you want to take, I can post code for you. I am just not sure how practical it would be to post th... | <p>You can put the Foo instances in a list and compare the objects with what you read: </p>
<pre><code>var arrFoos = new Foos[]{...}; // what you expect
var expectedFoos = new List<Foo>(arrFoos); // make a list from the hardcoded array of expected Foos
var readerResult = ReadEntireList(reader); // read everythi... | 4,980 |
<p>My company requires me to use Outlook for my E-mail. Outlook does virtually nothing the way I want to do it and it frustrates me greatly. (I'm not trying to start a flame war here, it must do exactly what thousands of CEO's want it to do, but I'm not a CEO.)</p>
<p>I would like to be able to automatically extract... | <p><a href="http://www.dimastr.com/redemption/" rel="noreferrer">Outlook Redemption</a> is the best thing currently to use that I have found. It will allow you to get into the messages and extract the attachments and the message bodies. i am using it now to do just that.</p>
<p>Here is some code I use in a class. I... | <p>If you want to extract your e-mails take a look at
Outlook Email Extractor
at codeproject
<a href="http://69.10.233.10/KB/dotnet/OutlookEmailExtractor.aspx" rel="nofollow noreferrer">http://69.10.233.10/KB/dotnet/OutlookEmailExtractor.aspx</a></p>
<p>rob
www.filefriendly.com</p>
| 27,597 |
<p>Does a caching-nameserver usually cache the negative DNS response SERVFAIL? </p>
<p>EDIT:
To clarify the question, I can see the caching nameserver caching negative responses NXDOMAIN, NODATA. But it does not do this for SERVFAIL responses. Is this intentional?</p>
| <p>SERVFAIL is covered by §7.1 of RFC2308:</p>
<blockquote>
<p>Server failures fall into two major
classes. The first is where a
server can determine that it has been
misconfigured for a zone. This may
be where it has been listed as a server, but not configured to be a
server for the zone, or where i... | <p>One of the timeout fields in the SOA is a "negative timeout". It is usually set to a short time, such as 30 or 60 seconds. So, yes, but for a shorter time than a "positive" response.</p>
| 9,908 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.