instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Assuming I have a tree structure</p>
<pre><code>UL
--LI
---INPUT (checkbox)
</code></pre>
<p>And I want to grab the checked inputs, I would select </p>
<pre><code>$('ul li input:checked')
</code></pre>
<p>However, I want to select the checked inputs of a specific object $myUL that doesn't have an ID.</p>
<pre><... | <p>use <code>$myUL.find('li>input:checked')</code></p>
| <p><code>$myUL.find('li>input:checked')</code> work as expected. Any trade off of performance?</p>
| 38,334 |
<p>Here's my scenario:</p>
<p>I've got a table of (let's call them) nodes. Primary key on each one is simply "node_id".</p>
<p>I've got a table maintaining a hierarchy of nodes, with only two columns: parent_node_id and child_node_id.</p>
<p>The hierarchy is maintained in a separate table because nodes can have an ... | <p>"which one is likely to have the best performance? " : No one can know ! The only thing you can do is try both and MEASURE. That's sadly enough the main answer to all performance related questions... except in cases where you clearly have a O(n) difference between algorithms.</p>
<p>And, by the way, "multiple paren... | <p>I think a general statements could lead into problem, because it depends on how you your queries respectively the stored procedure make of usage of the indices.
To make a helpful declaration it would be necessary to compare the SQL of your selects and the stored procedure.</p>
| 42,452 |
<p>I personally like the <em>exclusive or</em>, <code>^</code>, operator when it makes sense in the context of boolean checks because of its conciseness. I much prefer to write</p>
<pre><code>if (boolean1 ^ boolean2)
{
//do it
}
</code></pre>
<p>than</p>
<pre><code>if((boolean1 && !boolean2) || (boolean2 ... | <p>You can simply use <code>!=</code> instead.</p>
| <p>If the usage pattern justifies it, why not? While your team doesn't recognize the operator right away, with time they could. Humans learn new words all the time. Why not in programming? </p>
<p>The only caution I might state is that "^" doesn't have the short circuit semantics of your second boolean check. If you r... | 19,425 |
<p>I would like to translate some C code to Python code or bytecode. The C code in question is what i'd call purely algorithmic: platform independent, no I/O, just algorithms and in-memory data structures.</p>
<p>An example would be a regular expression library. Translation tool would process library source code and p... | <p>There is frankly no way to mechanically and meaningfully translate C to Python without suffering an insane performance penalty. As we all know Python isn't anywhere near C speed (with current compilers and interpreters) but worse than that is that what C is good at (bit-fiddling, integer math, tricks with blocks of ... | <p>You can always compile the C code, and load in the libraries using ctypes in python.</p>
| 16,057 |
<p>This is a follow up question for <a href="https://3dprinting.stackexchange.com/q/20196/20803">What are viable substitutes for Raspberry Pi to run Octoprint or similar software for Prusa i3 MK3S+?</a></p>
<p>I was able to grab Raspberry Pi 400 for around $70, so <a href="https://www.raspberrypi.com/news/raspberry-pi-... | <p>The recommended hardware for OctoPi is <a href="https://octoprint.org/download/" rel="nofollow noreferrer">listed</a> as:</p>
<blockquote>
<p>Recommended hardware: Raspberry Pi 3B, 3B+, 4B or Zero 2. Expect print artifacts and long loading times with other options, especially when adding a webcam or installing third... | <p>While the server will work, there are some challenges.</p>
<p>Raspberry Pi 400 lacks the camera and screen connectors, specifically:</p>
<ul>
<li>2-lane MIPI DSI display port</li>
<li>2-lane MIPI CSI camera port</li>
</ul>
<p>so you can't use Pi screens and camera modules. You need to find compatible USB webcam if y... | 2,229 |
<p>How can I modify a SharePoint site so that versioning is turned on by default in Document Libraries?</p>
| <p>Versioning is not done at the site level, but at the list level.</p>
<p>If you want versioning to be turn on on each new library, you'll have to either:</p>
<ul>
<li>Use your own library template (with versioning turned on)</li>
<li>Use feature + event handler to programmatically activate versioning on each new li... | <p>You could of course create your own site definition, but that's probably not the best solution. Creating a custom library template will work too, but if you want versioning turned on for the libraries that a particular site definition creates for you, you'll have to come up with something else.</p>
<p>We happen to... | 22,025 |
<p>In my LOB apps I usually wind up with containers that contain a bunch of different textblocks and textboxes for users to enter data. Normally I need to apply a certain margin or vertical/horizontal alignment to each control.</p>
<p>Let's say I have Grid on my form that looks like this (a lot of markup was eliminate... | <p>You can put a "global" style into the <code>Resources</code> section of the grid, thus confining its impact. To re-use "global" styles in different locations, put them into a non-default resource dictionary and include it as <code>MergedDictionary</code>:</p>
<p>in <code>Styles.xaml</code>:</p>
<pre><code><Reso... | <p>You could use #4 but then explicitly override those properties on the Grid itself.</p>
| 44,120 |
<p>Inspired by this CodingHorror article, "<a href="http://www.codinghorror.com/blog/archives/001167.html" rel="noreferrer">Protecting Your Cookies: HttpOnly</a>"</p>
<p>How do you set this property? Somewhere in the web config?</p>
| <p>If you're using ASP.NET 2.0 or greater, you can turn it on in the Web.config file. In the <system.web> section, add the following line:</p>
<pre><code><httpCookies httpOnlyCookies="true"/>
</code></pre>
| <p>Interestingly putting <code><httpCookies httpOnlyCookies="false"/></code> doesn't seem to disable <code>httpOnlyCookies</code> in ASP.NET 2.0. Check this article about <a href="http://nerd.steveferson.com/2007/09/14/act-sessionid-and-login-problems-with-asp-net-20/" rel="nofollow noreferrer">SessionID and Logi... | 5,362 |
<p>I've been tasked with integration testing of a large system. Presently, I have a COM dll that I'm testing useing a UI that I created that kicks off a series of unit tests that call into the dll. This works, but I'm wanting to migrate this over to MbUnit. When I start the first test in MbUnit, it seems to hang at "F... | <p>This is how we kick off our MBUnit test application (command line):</p>
<pre><code>namespace UnitTest
{
class Program
{
static void Main(string[] args_)
{
// run unit test
AutoRunner auto = new AutoRunner();
auto.Load();
auto.Run();
HtmlReport report = new HtmlReport();
... | <p>Try stepping through the code manually with a debugger.</p>
| 40,565 |
<p>Does anybody know a Europe-based provider for OpenID?
I am not using one of the well-known bigger services (Yahoo,..). </p>
| <p>I have developed one myself, <a href="http://www.loginbuzz.com/en" rel="nofollow noreferrer">LoginBuzz</a>. It is primarily Danish and I have first translated many parts of it the last week, but it should be fully functional.</p>
<p>It supports simple registration, attribute exchange and PAPE. I have also implement... | <p>And of course, there is the <a href="http://www.clavid.ch/" rel="nofollow noreferrer">Clavid</a> OpenID provider supporting many secure authentication mechanisms.</p>
| 13,917 |
<p>Systems demand that certain primitives be aligned to certain points within the memory (ints to bytes that are multiples of 4, shorts to bytes that are multiples of 2, etc.). Of course, these can be optimized to waste the least space in padding.</p>
<p>My question is why doesn't GCC do this automatically? Is the mo... | <p>gcc does not reorder the elements of a struct, because that would violate the C standard. Section 6.7.2.1 of the C99 standard states:</p>
<blockquote>
<p>Within a structure object, the non-bit-field members and the units in which bit-fields
reside have addresses that increase in the order in which they are declar... | <p>You might want to try the latest gcc trunk or, struct-reorg-branch which is under active development.</p>
<p><a href="https://gcc.gnu.org/wiki/cauldron2015?action=AttachFile&do=view&target=Olga+Golovanevsky_+Memory+Layout+Optimizations+of+Structures+and+Objects.pdf" rel="nofollow">https://gcc.gnu.org/wiki/c... | 14,371 |
<p>OK, so I've read through various posts about teaching beginner's to program, and there were some helpful things I will look at more closely. But what I want to know is whether there are any effective tools out there to teach a kid <em>Java</em> specifically? </p>
<p>I want to teach him Java specifically because (... | <p>You may find some inspiration in this project:</p>
<p><a href="http://java.sys-con.com/node/44575" rel="noreferrer">Teaching Kids Programming: Even Younger Kids Can Learn Java</a></p>
<blockquote>
<p>Java Programming for Kids, Parents and Grandparents.</p>
</blockquote>
<p>You can find here at the <a href="http... | <p>This question is similar to <a href="https://stackoverflow.com/questions/165905/how-and-when-do-you-teach-a-kid-to-code#165909">https://stackoverflow.com/questions/165905/how-and-when-do-you-teach-a-kid-to-code#165909</a>. </p>
<p>My oldest is also 8 and I know he has the right brain for programming but he takes hi... | 31,944 |
<p>I have a threading problem with Delphi. I guess this is common in other languages too. I have a long process which I do in a thread, that fills a list in main window. But if some parameters change in the mean time, then I should stop current executing thread and start from the beginning. Delphi suggests terminating ... | <p>The preferred way is to modify the code so that it doesn't block without checking for cancellation.</p>
<p>Since you can't modify the code, you can't do that; you either have to live with the background operation (but you can disassociate it from any UI, so that its completion will be ignored); or alternatively, yo... | <p>I wrote this in reply to a <a href="https://stackoverflow.com/questions/209086/how-do-i-guarantee-fast-shutdown-of-my-win32-app#210385">similar question</a>:</p>
<blockquote>
<p>I use an exception-based technique
that's worked pretty well for me in a
number of Win32 applications.</p>
<p>To terminate a th... | 31,850 |
<p>I have a checkbox in GridViewColumn which i use for show/change database value. The click event for the checkbox is used for change value in the database. For handling the state of property "IsChecked" I'm using datatrigger and a setter, se xaml code below:</p>
<pre><code><Style TargetType="CheckBox">
<... | <p>Shouldn't </p>
<pre><code><Style TargetType="CheckBox">
</code></pre>
<p>instead be:</p>
<pre><code> <Style TargetType="{x:Type CheckBox}">
</code></pre>
<p>Edit:</p>
<p>you could try this:</p>
<pre><code> <Style TargetType="{x:Type CheckBox}" >
<Setter Property="IsChecked" Valu... | <p>You can try to add a second data trigger to set the checkbox to false. As I can see from your code you set the IsChecked only to true, but never to false.</p>
| 36,416 |
<p>I would like to write a small application that unlocks the workstation. To put the specs of what I need very simple: Have an exe that runs and at a defined time (let's say midnight) unlocks the workstation.
Of course the application knows the user and password of the logged on account.</p>
<p>I know of the LogonUse... | <p>Just so you have an answer for this instead of people leaving answers which might be better off as comments.</p>
<p>This is certainly possible, though as many people have already said it's not really wise, what happens if someone is walking by the computer as it unlocks, how long do they have to play around, etc?</... | <p>Let your app run as a service, then you do not need user/password as that is set up with the service.</p>
| 20,991 |
<p>For std::map, how will insert behave if it has to resize the container and the memory is not available?</p>
| <p>STL map does not have to "resize" container. map (just like list) is a node based container; each insert allocates memory.</p>
<p>That said, out of memory situation is handled just like any other out-of-memory situation in C++: it throws a std::bad_alloc. STL containers with default allocators don't do anything fan... | <p>New will throw an exception. Easy as that.</p>
<p>The insert will not happen, and neither will the content of the dictionary be modified or corrupted.</p>
| 13,006 |
<p>If I have a function that returns an object, but this return value is never used by the caller, will the compiler optimize away the copy? (Possibly an always/sometimes/never answer.)</p>
<p>Elementary example:</p>
<pre><code>ReturnValue MyClass::FunctionThatAltersMembersAndNeverFails()
{
//Do stuff to members ... | <p>If the ReturnValue class has a non-trivial copy constructor, the compiler must not eliminate the call to the copy constructor - it is mandated by the language that it is invoked.</p>
<p>If the copy constructor is inline, the compiler might be able to inline the call, which in turn might cause a elimination of much ... | <p>I doubt most compilers could do that if they were in different compilation objects (ie. different files). Maybe if they were both in the same file, they could.</p>
| 34,374 |
<p>At the moment, I'm creating an XML file in Java and displaying it in a JSP page by transforming it with XSL/XSLT. Now I need to take that XML file and display the same information in a PDF. Is there a way I can do this by using some kind of XSL file?</p>
<p>I've seen the <a href="http://www.lowagie.com/iText/" rel=... | <p>You can use XSL Formatting objects.
Here are some good articles on how to do it:</p>
<ul>
<li><a href="http://www.xml.com/pub/a/2001/01/17/xsl-fo/index.html" rel="noreferrer">http://www.xml.com/pub/a/2001/01/17/xsl-fo/index.html</a></li>
<li><a href="http://www.xml.com/pub/a/2001/01/24/xsl-fo/index.html?page=1" rel... | <p>Use JasperReports. You can either pull the data from Database or XML.
You can export to many formats : pdf, excel, html, etc...</p>
| 26,126 |
<p>The simple question is: how to find out the location of an executable file in a Cocoa application. </p>
<p>Remember that, in many Unix-like OS people use PATH environment to assign the preferred location for their executables, especially when they have several versions of same application in their system. As a good... | <p>The tricky part of trying to do this is the fact that the user could have their shell set to anything: sh, bash, csh, tcsh, and so on, and each shell sets up its terminal environment differently. I'm not sure if I'd go to the trouble for this myself, but if you <em>really</em> want to, here's the route I would take... | <p>Isn't the path for Finder (and hence, any GUI-launched Cocoa apps) set from your login shell? If your login shell and the shell you're using in Terminal.app aren't the same, that'd probably lead to some confusion.</p>
<p>This information might be helpful:
<a href="http://lists.apple.com/archives/cocoa-dev/2005/Oct/... | 25,630 |
<p>It is unclear to me from the <a href="http://msdn.microsoft.com/en-us/library/system.icloneable.aspx" rel="nofollow noreferrer">MSDN documentation</a> if I should provide a deep or a shallow clone when implementing ICloneable. What is the preferred option?</p>
| <p>Short answer: Yes.</p>
<p>Long Answer: Don't use ICloneable. That is because .Clone isn't defined as being a shallow or a deep clone. You should implement your own IClone interface, and describe how the clone should work.</p>
| <p>Clones are deep by default, thats the naming convention
and copy constructors can be shallow if they want, for performance reasons.</p>
<p>Edit: This naming convention goes beyond boundaries, its the same for .Net, Java, C++, Javascript, etc... the actual source is beyond my knowledge but its part of the standard O... | 18,259 |
<p>This one has me beat;</p>
<p>I have a WPF window with two (important for this case) controls, both from the WPF toolkit available at CodePlex; A DatePicker and a DataGrid.</p>
<p>The DataContext of this window is set to a CLR object that has all the information it needs. This CLR object has a large list of data, a... | <p>Here is my complete code. I hope this will help.</p>
<p>The xaml code:</p>
<pre><code><Window x:Class="DataGridSort.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dg="clr-namespace:Microsoft.Windows.Controls;ass... | <p>If you build your class with INotifyPropertyChanged like this:</p>
<pre><code>public class MyDataObject : INotifyPropertyChanged
{
private DateTime _SelectedDate;
public DateTime SelectedDate
{
get
{
return _SelectedDate;
}
set
{
_SelectedD... | 37,997 |
<p>A lot of iPhone apps use a blue badge to indicate the number of items in the subviews, such as the Mail client:</p>
<p><a href="http://skitch.com/leonho/4xeu/iphoto" rel="noreferrer">iPhoto http://img.skitch.com/20081103-tjr9yupbhgr3sqfh7u56if4rsn.preview.jpg</a></p>
<p>Are there any standards way (or even an API)... | <p>To my knowledge there's no API for this. However, using CoreGraphics (NSBezierPath is not available on iPhone), you can do it pretty easily. It's just two arcs in a CGPath and some text:</p>
<pre><code>CGContextRef context = UIGraphicsGetCurrentContext();
float radius = bounds.size.height / 2.0... | <p>There is also another type of badge that you might already know, it's the "red" one that is on the application icon. They are created by doing something like:</p>
<pre><code>NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0];
NSString *caldate = [[now
dateWithCalendarFormat:@"%b"
timeZone:nil] ... | 32,255 |
<p>I'm trying to decide on the best way to store event times in a MySQL database. These should be as flexible as possible and be able to represent "single events" (starts at a certain time, does not necessarily need an end time), "all day" and "multi day" events, repeating events, repeating all day events, possibly "3r... | <p>Table: Events</p>
<ul>
<li>StartTime (dateTime)</li>
<li>EndTime (dateTime) null for no end time</li>
<li>RepeatUnit (int) null = noRepeat, 1 = hour, 2 = day, 3 = week, 4 = dayOfMonth, 5 = month, 6 = year</li>
<li>NthDayOfMonth (int) </li>
<li>RepeatMultiple (int) eg, set RepeatUnit to 3, and this to 2 for ev... | <p>Use datetime and mysql's built in NOW() function. Create the record when the process starts, update your column that tracks the end time when it the process ends.</p>
| 12,563 |
<p>Doesn't work with other modules, but to give an example. I installed Text::CSV_XS with a CPAN setting:</p>
<pre><code>'makepl_arg' => q[PREFIX=~/lib],
</code></pre>
<p>When I try running a test.pl script:</p>
<blockquote>
<p>$ perl test.pl</p>
</blockquote>
<pre><code>#!/usr/bin/perl
use lib "/homes/foobar... | <p>When you installed the module, did you watch the output? Where did it say it installed the module? Look in <i>lib</i>. Do you see the next directory you expect?</p>
<p>Look in ~/lib to see where eveything ended up to verify that you have the right directory name in your <code>use lib</code> statement:</p>
<pre><code... | <p>Does the file in question (CSV_XS.so) exist?</p>
<p>Does it exist at the listed location?</p>
<p>If you do:</p>
<pre><code>set |grep PERL
</code></pre>
<p>What is the output?</p>
<p>Have you successfully installed other local perl modules?</p>
| 12,845 |
<p>In php I have open a .php file and want to evaluate certain lines. Specifically when the $table_id and $line variables are assigned a value.</p>
<p>Within the text file I have:</p>
<pre><code>...
$table_id = 'crs_class'; // table name
$screen = 'crs_class.detail.screen.inc'; // file ide... | <p>use !==false instead of ===true<br />
stripos returns the position as an integer if the needle is found. And that's never ===bool.
<br />
You might also be interested in PHP's <a href="http://de2.php.net/tokenizer" rel="noreferrer">tokenizer module</a> or the <a href="http://pear.php.net/package/PHP_LexerGenerator" ... | <p>Why are you using the === Argument?</p>
<p>If it is anywhere in the line, it will be an integer. You're comparing the type also by using ====</p>
<p>From my understand you're asking it "If the position is equal and of the same type as true" which will never work.</p>
| 10,904 |
<p>Due to the lack of generic variance in the .NET framework, is it more "correct" to have methods that handle the non-generic versions of the System.Collection interfaces, if the methods are being designed to handle multiple types?</p>
<p>Ideally, once moved to .NET 3.5, the code would modified to change these method... | <p>No, the more "correct" thing to do is to make the methods that handle multiple types generic themselves.</p>
| <p>Define "Multiple types" do you mean, for example, a List that contains both Cars and Dogs? Or one List that contains Cars and another that contains Dogs? Unless you're doing something "special" I'd say the correct thing to do is to implement the Generic version and not the non-generic version.</p>
| 18,153 |
<p>Hi im new to MVC and I've fished around with no luck on how to build MVC User Controls that have ViewData returned to them. I was hoping someone would post a step by step solution on how to approach this problem. If you could make your solution very detailed that would help out greatly.</p>
<p>Sorry for being so di... | <p>If I understand your question, you are trying to pass ViewData into the user control. A user control is essentially a partial view, so you would do this:</p>
<pre><code><% Html.RenderPartial("someUserControl.ascx", viewData); %>
</code></pre>
<p>Now in your usercontrol, ViewData will be whatever you passed i... | <p>I am pretty sure view data is accessible inside user controls so long as you extend System.Web.Mvc.ViewUserControl and pass it in. I have a snippet of code:</p>
<pre><code><%Html.RenderPartial("~/UserControls/CategoryChooser.ascx", ViewData);%>
</code></pre>
<p>and from within my CategoryChooser ViewData is... | 19,064 |
<p>I'm stuck with the following problem. I'm trying to implement a basic GridView paged result set, which connects to an Oracle database. By itself, the GridView, and the paged results, work fine. The problem comes when I try to put it in page layout class that we have at work.</p>
<p>We have ClassA, which inherits fr... | <p>I ran into a similar situation where the base (ClassA in your example) had variables that were set up to handle all the paging and sorting bits, and the GridView was wired up to events that used those variables. Not setting the proper base class variables in my page caused the exact same sort of error.</p>
| <p>I lost my original unregistered login which I used to post this question.</p>
<p>Anyway, Harper Shelby's answer turned out to be correct. There was an unset variable in that base class (a custom object that is our corporate standard) that caused the problem (and no helpful error message). </p>
<p>If an admin, or s... | 14,817 |
<p>I have a very simple Java RMI Server that looks like the following:</p>
<pre><code> import java.rmi.*;
import java.rmi.server.*;
public class CalculatorImpl extends UnicastRemoteObject implements Calculator {
private String mServerName;
public CalculatorImpl(String serverName) throws R... | <p>In case anyone is having a similar problem, I figured out the answer myself. Here is my exit() method:</p>
<pre><code>public void exit() throws RemoteException
{
try{
// Unregister ourself
Naming.unbind(mServerName);
// Unexport; this will also remove us from the RMI runtime
Un... | <p>Actually just unregistering and immediately calling System.exit doesn't shut down cleanly. It basically breaks the connection before informing the client that the message was completed. What works is to start a small thread that shuts down the system like:</p>
<pre><code>public void quit() throws RemoteException {
... | 29,825 |
<p>I'm trying to parse an international datetime string similar to:</p>
<pre><code>24-okt-08 21:09:06 CEST
</code></pre>
<p>So far I've got something like:</p>
<pre><code>CultureInfo culture = CultureInfo.CreateSpecificCulture("nl-BE");
DateTime dt = DateTime.ParseExact("24-okt-08 21:09:06 CEST",
"dd-MMM-yy HH:m... | <p>AFAIK the time zone abbreviations are not recognized. However if you replace the abbreviation with the time zone offset, it will be OK. E.g.:</p>
<pre><code>DateTime dt1 = DateTime.ParseExact("24-okt-08 21:09:06 CEST".Replace("CEST", "+2"), "dd-MMM-yy HH:mm:ss z", culture);
DateTime dt2 = DateTime.ParseExact("24-ok... | <p>Here's what I had to do. </p>
<p>I receive the datetime from javascript and then pass it on to ASP.NET to store in Oracle database. Here is my C# code for Eastern and Central times. </p>
<pre><code>string datetimevalue = hidfileDateTime.Value;
datetimevalue= datetimevalue.Replace("EDT", "EST");
datetimevalue ... | 29,928 |
<p>What are some good suggestions or resources to look at to help me secure a single click URL based authentication? </p>
<p>Essentially, the situation is a third party system which accepts an HTTPS request, through the browser, where you supply authentication information (un, pw, authkey, etc...). The service then,... | <ol>
<li><p>Don't think about "secure this up a bit". It's either secure from the ground up, or it's got holes that will cost you dearly.</p></li>
<li><p>Look at <a href="http://en.wikipedia.org/wiki/Digest_access_authentication" rel="noreferrer">HTTP Digest Authentication</a>. It's simple, reliable and works well un... | <p>You should probably use HTTPS to avoid the credentials being eavesdropped upon while in transit to the third party web server.</p>
| 29,865 |
<p>With ASP.NET MVC, it is common to have AJAX code(e.g. jQuery) to invoke web service from server to without page refreshing. It's natural to make web service RESTful. It seems that there are two ways to go. First, the ASP.NET MVC URI's are RESTful, it is very easy to make some Controller/Action to act as web service ... | <p>If you're already using ASP.Net MVC for the rest of the website, I suppose it makes sense to use the same framework for the AJAX calls as well.</p>
<p>With regard to the ASP.Net pipeline, I assume you're worried about the whole Page Lifecycle thing. The page lifecycle is only executed if you use Views with the WebFo... | <p>Additional advantage of using WCF stack is the possibility of exposing all the interfaces needed for CRUD and data exploration in a matter of few mouseclicks using WCF Data Services/ODATA (<a href="http://odata.org" rel="nofollow">spec</a>, <a href="http://live.visitmix.com/MIX10/Sessions/FT12" rel="nofollow">demo</... | 45,500 |
<p>I noticed by looking at sample code from Apple, that they tend to design methods that receive structures instead of multiple parameters. Why is that? As far as ease of use, I personally prefer the latter, but as far as performance goes, is there one better choice than the other?</p>
<pre><code>[pencil drawPoint:Poi... | <p>Don't muddle this question with concerns of performance. Don't make premature optimizations (until you know you have a problem) and when thinking about performance hot spots in your code, its almost always in areas dealing with I/O (eg, database, files). So, separate your question on message passing style with per... | <p>If you are passing the same set of parameters around it is useful to pass them in a structure because they belong together semantically. </p>
<p>The performance hit is probably negligible for such a simple structure as 3 points. Use the readable/reusable solution and then profile your code if you think it is slow :... | 43,592 |
<p>I've got a Sharepoint WebPart which loads a custom User Control. The user control contains a Repeater which in turn contains several LinkButtons. </p>
<p>In the RenderContent call in the Webpart I've got some code to add event handlers:</p>
<pre><code> ArrayList nextPages = new ArrayList();
//popula... | <p>By the time RenderContent() is called, all the registered event handlers have been called by the framework. You need to add the event handlers in an earlier method, like OnLoad():</p>
<pre><code>protected override void OnLoad(EventArge e)
{ base.OnLoad(e);
EnsureChildControls();
var linkButtons = from c in ... | <p>You need to make sure that the link button is re-added to the control tree and/or that the event is rewired up to the control before the event fires. </p>
<p><a href="https://web.archive.org/web/20211031102347/https://aspnet.4guysfromrolla.com/articles/092904-1.aspx" rel="nofollow noreferrer">Article @ 4guysfromrol... | 14,943 |
<p>I am trying to get the value of some ListViewSubItems, but I have no idea what values it uses for its keys. I have some simple code:</p>
<pre><code> protected override void OnItemDrag(ItemDragEventArgs e)
{
base.OnItemDrag(e);
ListViewItem item = e.Item as ListViewItem;
s... | <p>The key of the <code>ListViewSubItem</code> is the <code>Name</code> property as described <a href="http://msdn.microsoft.com/en-us/library/1x4396ba.aspx" rel="nofollow noreferrer">here</a>. </p>
<p>Setting the Name equal to the column name, would allow you to index into the SubItems by the name of the column.</p>
... | <p>Subitems are only ordered by column index unluckily. So you'd have to access them like:</p>
<pre><code>protected override void OnItemDrag(ItemDragEventArgs e)
{
base.OnItemDrag(e);
ListViewItem item = e.Item as ListViewItem;
string val = item.SubItems[0].ToString();
}
</code></pre>
| 19,374 |
<p>I have several types of entities, each with their own fields, which are stored in separate tables.<br>
Each record in such a table may be connected to zero or more records in a different table, i.e., linked to records from different entity types.<br>
If I go with lookup tables, I get (m(m-1))/2=O(m^2) separate looku... | <p>This is Object-Relational Mapping, a classically hard problem. You really need a ORM tool to do this properly, or it'll drive you nuts.</p>
<p>The connection problem you refer to is one of the pitfalls, and it needs very careful optimisation and query tuning, else it'll kill performance (e.g. the N+1 SELECT proble... | <p>The other option would be to use an <a href="http://en.wikipedia.org/wiki/Comparison_of_object_database_management_systems" rel="nofollow noreferrer">Object Oriented Database</a> such as db40 or Cache. It may be looking into this if performance isn't a huge concern and you are determined to store your entire object ... | 17,598 |
<p>I want to use the functions exposed under the OpenGL extensions. I'm on Windows, how do I do this?</p>
| <p><strong>Easy solution</strong>: Use <a href="http://glew.sourceforge.net/" rel="nofollow noreferrer">GLEW</a>. See how <a href="https://stackoverflow.com/questions/17370/using-glew-to-use-opengl-extensions-under-windows">here</a>.</p>
<p><strong>Hard solution</strong>:
If you have a <strong>really strong reason</st... | <p>@Kronikarz: From the looks of it, <strong>GLEW</strong> seems to be the way of the future. NVIDIA already ships it along with its <strong><a href="http://developer.nvidia.com/object/sdk_home.html" rel="nofollow noreferrer">OpenGL SDK</a></strong>. And its latest release was in 2007 compared to GLEE which was in 2006... | 3,523 |
<p>Suppose we have a table A:</p>
<pre><code>itemid mark
1 5
2 3
</code></pre>
<p>and table B:</p>
<pre><code>itemid mark
1 3
3 5
</code></pre>
<p>I want to join A*B on A.itemid=B.itemid both right and left ways. i.e. result:</p>
<pre><code>itemid A.mark B.mark
1 5 3
2 3 NUL... | <p>It's called a full outer join and it's not supported natively in MySQL, judging from its <a href="http://dev.mysql.com/doc/refman/4.1/en/join.html" rel="noreferrer">docs</a>. You can work around this limitation using UNION as described in the comments to the page I linked to.</p>
<p>[edit] Since others posted snipp... | <p>This works for me on SQL Server:</p>
<pre><code>select isnull(a.id, b.id), a.mark, b.mark
from a
full outer join b on b.id = a.id
</code></pre>
| 3,099 |
<p>I keep reading about C99 and C++11 and all these totally sweet things that are getting added to the language standard that might be nice to use someday. However, we currently languish in the land of writing C++ in Visual Studio.</p>
<p>Will any of the new stuff in the standard ever get added to visual studio, or is ... | <p>MS has a series of public replies to this, most of them blaming their users. Like this one:</p>
<p><a href="https://devblogs.microsoft.com/cppblog/iso-c-standard-update/" rel="noreferrer">https://devblogs.microsoft.com/cppblog/iso-c-standard-update/</a></p>
<blockquote>
<p>Now, the Visual C++ compiler team receives ... | <p>The Visual C++ Bloq provides a lot of information on several interesing points regarding the support of C++11 in VC++11, including several tables</p>
<ul>
<li>C++11 Core Language Features</li>
<li>C++11 Core Language Features: Concurrency</li>
<li>C++11 Core Language Features: C99</li>
<li>x86 Container Sizes (Byte... | 17,629 |
<p>Older K&R (2nd ed.) and other C-language texts I have read that discuss the implementation of a dynamic memory allocator in the style of <code>malloc()</code> and <code>free()</code> usually also mention, in passing, something about data type alignment restrictions. Apparently certain computer hardware architect... | <p>Sparc, MIPS, Alpha, and most other "classical RISC" architectures only allow aligned accesses to memory, even today. An unaligned access will cause an exception, but some operating systems will handle the exception by copying from the desired address in software using smaller loads and stores. The application code w... | <p>You still need to be aware of alignment issues when laying out a class or struct in C(++). In these cases the compiler will do the right thing for you, but the overall size of the struct/class may be more wastefull than necessary</p>
<p>For example:</p>
<pre><code>struct
{
char A;
int B;
char C;
... | 5,705 |
<p>I'm working on a project where a program running on the mobile phone needs to communicate with a program running on the PC it's connected to. Ideally, I'd like to use USB, WiFi, whatever to communicate.</p>
<p>The two programs should be able to communicate things like battery life, text messages, etc... But I can... | <p>"Best" is really subjective and highly dependent on a lot of factors like devices, topology, firewall presence, need for security, etc, etc. </p>
<p>Where do you need the comms to originate and will you have an ActiveSync connection? If the PC initiates the comms and you have ActiveSync, then RAPI is the transport... | <p>WIMO is working on WiFi to desktop support and may be done. Might be worth a look at the code either way.</p>
<p><a href="http://www.wimobot.com/" rel="nofollow noreferrer">home</a></p>
<p><a href="http://www.wimobot.com/SourceCode.aspx#WimoII" rel="nofollow noreferrer">source</a></p>
| 44,788 |
<p>I am creating an ASP script that uses the application object to store the pages. The question in my mind is whether there is a size limit to this object. Anyone know?</p>
| <p>An application pool may specifiy the Maximum virtual memory size that a worker process can allocate. This is setting will affect the maximum size of data that the application object can hold.</p>
<p>If this setting is not specified (or is larger than 2GB) then another factor will be whether the process is running ... | <p>I'm fairly sure there's no explicit limit - but of course at some point you will use up so much memory that you'll see other effects - e.g. your application being recycled because it has exceeded its memory limit, or your application grinding to a halt as the server runs out of memory.</p>
| 19,551 |
<p>I have code similar to the following in many places:</p>
<pre><code>var dbParams = db.ReadParams(memberID, product, GetSubscriptionFields());
Debug.Assert(dbParams.Count == 4);
_memberCode = dbParams[0];
_password = dbParams[1];
_userName = dbParams[2];
_reasonCode = dbParams[3];
</code></pre>
<p>ReadParams() ret... | <p>Why not use constants instead?</p>
<p>Then in your code you could have</p>
<pre><code>dbParams[MEMBER_CODE]
dbParams[PASSWORD]
dbParams[USERNAME]
dbParams[REASON_CODE]
</code></pre>
<p>which meets your goal of meaningful names without changing the way the method works.</p>
| <p>Not really; since the number of arguments isn't fixed, there isn't really a better way of doing it. The problem with regular tuples is that you are still working positionally - just with ".Value0" instead of "[0]". And anonymous types can't be directly exposed in an API.</p>
<p>Of course, you could subsequently wra... | 33,180 |
<p>In general I'd like to understand which templates to use when, when I'm making new iPhone apps. Could anyone offer some guidelines, tips, rules-of-thumb?</p>
<p>Also, how much should I agonize over this? If I start off with the wrong one, can I add the missing pieces manually, is it hard?</p>
<p>For reference he... | <p>Start with your prototype and possibly wireframes and then the correct template should jump out at you.</p>
<p>If this does not work for you, then:</p>
<ol>
<li><p>If your app looks like 'Contacts', use Navigation-Based Application.</p></li>
<li><p>If you're writing a game (or something that looks like one), then ... | <p>Also note - there aren't that many templates.
Create a new project for each one, Build and Run immediately, and you'll get an idea what you need.</p>
| 47,889 |
<p>I know how to use rpm to list the contents of a package (<code>rpm -qpil package.rpm</code>). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?</p>
| <p>There is a package called <code>yum-utils</code> that builds on YUM and contains a tool called <code>repoquery</code> that can do this.</p>
<pre><code>$ repoquery --help | grep -E "list\ files"
-l, --list list files in this package/group
</code></pre>
<p>Combined into one example:</p>
<pre><code>$ r... | <p>Yum doesn't have it's own package type. Yum operates and helps manage RPMs. So, you can use yum to list the available RPMs and then run the rpm -qlp command to see the contents of that package.</p>
| 12,960 |
<p>Why is the following displayed different in Linux vs Windows?</p>
<pre><code>System.out.println(new String("¿".getBytes("UTF-8"), "UTF-8"));
</code></pre>
<p>in Windows:</p>
<p>¿</p>
<p>in Linux:</p>
<p>¿</p>
| <p>System.out.println() outputs the text in the system default encoding, but the console interprets that output according to its own encoding (or "codepage") setting. On your Windows machine the two encodings seem to match, but on the Linux box the output is apparently in UTF-8 while the console is decoding it as a si... | <p>It's hard to know exactly which bytes your source code contains, or the string which getBytes() is being called on, due to your editor and compiler encodings.</p>
<p>Can you produce a short but complete program containing only ASCII (and the relevant \uxxxx escaping in the string) which still shows the problem?</p>... | 21,227 |
<p>When you are learning a new language, what is there a particularly good/effective exercise to help get the hang of it? And why?</p>
<p>EDIT:
Preferably looking for things that are more complicated that 'Hello World'.</p>
| <p>other than hello world, I try to port one of the existing programs to the new languange. this will challenge me to learn some good old techniques in the new language and help me build a new library of classes or helpers..</p>
| <p>Often I'll implement the <a href="http://en.wikipedia.org/wiki/K-means_algorithm" rel="nofollow noreferrer">k-means clustering algorithm.</a></p>
| 16,849 |
<p>I've been reading many a tutorial/article on unmanaged DLLs in C++. For the life of me, however, I cannot seem to grasp the concept. I'm easily confused by the seeming disagreement about whether it needs a header file, how to export it, whether I need a .lib file and what have you.</p>
<p>So, let's assume I have ju... | <p>I cannot stress this enough, the C++ compiler does not see header files, after the preprocessor is done, there's just one big source file ( also called the compilation unit ). So strictly you don't need a header to export this function from a dll.
What you do need is some form of conditional compilation to export th... | <p>You need to export the function using either<code>__declspec( dllexport )</code> or adding the function to a module definition file (.def). Then compile tho project as a DLL. </p>
<p>On the client side, you have two options. Either use an import library (.lib) which is generated when compiling the DLL. Simply linki... | 29,208 |
<p>I am in the process of designing a Web Services course for students in an Information Technology program. Some students stop after getting a two-year associates degree, but other students in the program go on to a four-year bachelor's degree. This course would be for students going on to the four-year degree.</p>
... | <p>First of all, what do you understand by "web service"? As far as I know, the standard definition of a web service is that it's a "software system to support <strong>machine-to-machine</strong> interaction over a network". If it really is what you had in mind, well then (1) those parts about CMS doesn't apply and (2)... | <p>I would teach (even briefly) the layers model. If students don't fundamentally understand it, somewhere down the road it will come back to haunt them. And yes, I have met students who went through a 4 year CS degree without understanding the network layer model or the OS layer model.</p>
| 17,461 |
<p>In prior versions of Windows before Vista you could have a Windows Service interact with the current logged in desktop user to easy display information on the screen from the service. In Windows Vista Session 0 was added for security to isolate the services from the desktop. What is an easy way to communicate betwee... | <p>You can use shared memory or named pipe to facilitate IPC as well. Conceptually this is similar to TCP/IP, but you don't have to worry about finding an unused port.</p>
<p>You have to make sure that the named objects you create are prefixed with "Global\" to allow them to be accessed by all sessions as described <a... | <p>For the service to talk to the desktop, you're pretty much stuck with one of the RPC mechanisms. The .NET remoting mechanism (<a href="http://msdn.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcserverchannel.aspx" rel="nofollow noreferrer">IpcServerChannel</a>) isn't to hard to implement for thi... | 7,945 |
<p>I'm trying to rebuild an old metronome application that was originally written using MFC in C++ to be written in .NET using C#. One of the issues I'm running into is getting the timer to "tick" accurately enough.</p>
<p>For example, assuming an easy BPM (beats per minute) of 120, the timer should tick every .5 sec... | <p>There are three timer classes called 'Timer' in .NET. It sounds like you're using the Windows Forms one, but actually you might find the System.Threading.Timer class more useful - but be careful because it calls back on a pool thread, so you can't directly interact with your form from the callback.</p>
<p>Another... | <p>Timer classes can start behaving strangely when the timer 'tick' event code is not finished executing by the time the next 'tick' occurs. One way to combat this is to disable the timer at the beginning of the tick event, then re-enable it at the end.</p>
<p>However, this approach is not suitable in cases where the ... | 3,023 |
<p>How do you use the <strong>CSS</strong> <code>content</code> property to add <strong>HTML</strong> entities?</p>
<p>Using something like this just prints <code>&nbsp;</code> to the screen instead of the non-breaking space:</p>
<pre class="lang-css prettyprint-override"><code>.breadcrumbs a:before {
content: '&... | <p>You have to use the escaped unicode :</p>
<p>Like</p>
<pre class="lang-css prettyprint-override"><code>.breadcrumbs a:before {
content: '\0000a0';
}
</code></pre>
<p>More info on : <a href="http://www.evotech.net/blog/2007/04/named-html-entities-in-numeric-order/" rel="noreferrer">http://www.evotech.net/blog/2007/... | <p><strong>Here are two ways:</strong> </p>
<ul>
<li><p>In HTML:</p>
<p><code><div class="ics">&#9969;</div></code></p></li>
</ul>
<p>This will result into
⛱</p>
<ul>
<li><p>In Css:</p>
<p><code>.ics::before {content: "\9969;"}</code></p></li>
</ul>
<p>with HTML code <code><div class=... | 23,105 |
<p>Suppose I have a "tags" table with two columns: <strong>tagid</strong> and <strong>contentid</strong>. Each row represents a tag assigned to a piece of content. I want a query that will give me the contentid of every piece of content which is tagged with tagids 334, 338, and 342.</p>
<p>The "easy" way to do this ... | <pre><code>SELECT contentID
FROM tags
WHERE tagID in (334, 338, 342)
GROUP BY contentID
HAVING COUNT(DISTINCT tagID) = 3
--In general
SELECT contentID
FROM tags
WHERE tagID in (...) --taglist
GROUP BY contentID
HAVING COUNT(DISTINCT tagID) = ... --tagcount
</code></pre>
| <p>What type of SQL? MS SQL Server, Oracle, MySQL?</p>
<p>In SQL Server doesn't this equate to:</p>
<pre><code>select contentid from tags where tagid IN (334,338,342)
</code></pre>
| 19,811 |
<p><strong>Most recent edits in bold</strong>
I am using the .net <code>HttpListener</code> class, but I won't be running this application on IIS and am not using ASP.net. This <a href="http://www.leastprivilege.com/CommentView.aspx?guid=0c34094a-bdd4-4041-be6e-919f10fe1d31" rel="noreferrer">web site</a> describes wha... | <p>I don't have it entirely implemented yet, but this web site seems to give a <a href="http://developers.de/blogs/damir_dobric/archive/2006/08/01/897.aspx" rel="noreferrer">good walkthrough</a> of setting up the certificates and the code.</p>
| <p>The <a href="http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx" rel="nofollow noreferrer">class documentation</a></p>
<p>has this note:</p>
<blockquote>
<p>If you create an HttpListener using
https, you must select a Server
Certificate for that listener.
Otherwise, an HttpWebRequest quer... | 2,603 |
<p>I am creating a pdf document using C# code in my process. I need to protect the docuemnt
with some standard password like "123456" or some account number. I need to do this without
any reference dlls like pdf writer.</p>
<p>I am generating the PDF file using SQL Reporting services reports.</p>
<p>Is there are ea... | <blockquote>
<p>I am creating a pdf document using C#
code in my process</p>
</blockquote>
<p>Are you using some library to create this document? The <a href="http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf" rel="noreferrer">pdf specification</a> (8.6MB) is quite big and all tasks involving pdf manipula... | <p>If anyone is looking for a IText7 reference.</p>
<pre><code> private string password = "@d45235fewf";
private const string pdfFile = @"C:\Temp\Old.pdf";
private const string pdfFileOut = @"C:\Temp\New.pdf";
public void DecryptPdf()
{
//Set reader properties and password
ReaderProperties ... | 48,412 |
<p>The default output from Drupal's Form API is:</p>
<pre><code><input id="edit-submit" class="form-submit" type="submit" value="Save" name="op"/>
</code></pre>
<p>How do I theme that so I get:</p>
<pre><code><button id="edit-submit" class="form-submit" type="submit">
<span>Save</span>
<... | <p>The basic idea to themeing a form_foo if you're using a plain PHP theme (like Chameleon), is to write a function called theme_form_foo().</p>
<p>You can also theme one element (like this button) specifically, by declaring a theme function just for it. See <a href="http://api.drupal.org/api/file/developer/topics/for... | <p>I now have a function along the lines of</p>
<pre><code>function mytheme_button($element) {
return "<button><span></span></button>"; # lots of code missing here for clarity
}
</code></pre>
<p>In order to make it work I simply cleared the cache and Drupal noticed and used it automatically.... | 33,698 |
<p>My developers are waging a civil war. In one camp, they've embraced Hibernate and Spring. In the other camp, they've denounced frameworks - they're considering Hibernate though.</p>
<p>The question is: Are there any nasty surprises, weaknesses or pit-falls that newbie Hibernate-Spring converts are likely to stumble... | <p>I've used Hibernate a number of times in the past. Each time I've run into edge cases where determining the syntax devolved into a scavenger hunt through the documentation, Google, and old versions. It is a powerful tool but poorly documented (last I looked).</p>
<p>As for Spring, just about every job I've intervie... | <p>Frameworks are not evil. even the Java SDK is a framework.</p>
<p>What they probably fight is <em>framework proliferation</em>. You shouldn't bring a framework to a project just for the kick of it, it should bring consistent value in a reasonable time. Every framework requires a learning curve, but should reward yo... | 12,550 |
<p>Wondering if it would ever be useful to index every possible state of an application using some reference keys...</p>
<p>Meaning, say we have a program that starts, has only so many possible outcomes, say 8.</p>
<p>but if each outcome is attained through stepping through many more logic states, and in between each... | <p>This would not be possible to solve for a general program. The halting problem proves that is impossible to determine whether a program will halt. The problem of determining whether a given state is possible is reducible to the halting problem, thus not solvable either.</p>
| <p>This is done on the function level; it's a technique called <a href="http://en.wikipedia.org/wiki/Memoization" rel="nofollow noreferrer">memoization</a>.</p>
| 19,762 |
<p>I understand about race conditions and how with multiple threads accessing the same variable, updates made by one can be ignored and overwritten by others, but what if each thread is writing the same value (not different values) to the same variable; can even this cause problems? Could this code:</p>
<p>GlobalVar.p... | <p>The problem comes when you read that state back, and do something about it. Writing is a red herring - it is true that as long as this is a single word most environments guarantee the write will be atomic, but that doesn't mean that a larger piece of code that includes this fragment is thread-safe. Firstly, presumab... | <p>If the operation is atomic, you <em>should</em> be able to get by just fine. But I wouldn't do that in practice. It is better just to acquire a lock on the object and write the value.</p>
| 9,769 |
<p>Is it possible to show multiple lines of text in grid cells using the .NET Compact framework? We need to create a grid where the middle column contains an address. We'd like to show this over multiple lines and (possibly) apply some formatting to the final line. </p>
<p>e.g.<br>
123 Anywhere Street<br>
Birmingham<b... | <p>Take a look at Ilya Tumanov's <a href="http://blogs.msdn.com/netcfteam/archive/2006/04/25/583542.aspx" rel="nofollow noreferrer">example of custom formatting data in the DataGrid</a>. He does custom painting of cells in it.</p>
| <p>Set AutoSizeRowsMode property in DataGridView control to DisplayedCells .</p>
<p>Additional info here :
<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autosizerowsmode.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autosi... | 15,349 |
<p>I have used AJAXToolkit AutoComplete extender in my project.It works fines.But the issue is with the form of the page.
when i type in the AutoComplete, i get list of suggestions.When i click on the page other than the Autocomplete, the form gets submitted.
any suggestions how to stop submission of entire form whenev... | <p>Does your TextBox have AutoPostBack="True" set? If so, it will automatically postback when you're "finished" (when the input control loses focus). If this is the case, just set it to false.</p>
| <p>yeah,My TextBox AutoPostBack was set to true which i have changed it to false, now.</p>
<p>but i have a url attached to each of my suggestions.On click of suggestion, user gets navigated to that particular url. When i do AutoPostback= "false", i wont get navigated to that page.</p>
<p>HOw do i handle it?</p>
| 39,167 |
<p>I have the following table</p>
<pre><code><td class="style2">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>Location</asp:ListItem>
<asp:ListItem>Name</asp:ListItem>
<asp:ListItem>SSN</asp:ListItem>
</asp:DropDow... | <p>It is safe but I'd recommend against it.
If you put your error reporting up to E_NOTICES you'll see your code producing a lot of them, masking any real errors (such as a mistyped variable name).</p>
<p>What you should really be doing is:</p>
<pre><code>if (!isset($arr[$key]))
$arr[$key] = 0;
</code></pre>
<p>... | <p>As of <code>php 7</code> you can now do the following:</p>
<pre><code>foreach ($item as $key=>$value) {
$arr[$key] = ($arr[$key] ?? 0) + other_arr[$value];
}
</code></pre>
| 39,790 |
<p>Contrary to a lot of other corner related problems (where the corners are bulging), I seem to have a different problem where the corners (ONLY) seem to stick out and appear blobby in the x/y plane. This only happens for corners/edges with a fillet radius greater than 3-4mm and only in the x/y plane. Anything smaller... | <p>I suspect you are printing through a usb or network connection, and the communication rate it's to slow for any of many reasons. A curve consists of many tiny linear movements, each requiring a command exchange between the PC and printer. </p>
<p>If you can, try printing from an sd card plugged into the printe... | <p>150 °C is way too low for pretty much any material commonly used in 3D printing, especially ABS. I'm quite surprised anything comes out of the nozzle at all rather than just griding in the extruder gear. Most ABS filament manufacturers recommend a nozzle temperature in the range 210-250 °C. From your images, it look... | 1,470 |
<p>I am writing a deployment script using MSBuild. I want to clean my web directories prior to copying all the new files in. My current "Clean" target looks like this:</p>
<pre><code> <Target Name="Clean">
<Exec Command="del %(DeploymentSet.LocalWebRoot)\* /Q /F /S" IgnoreExitCode="true" />
</Targ... | <p>You can <code>rmdir /s /q</code> each sub-directory individually, then <code>del %(DeploymentSet.LocalWebRoot)\* /Q /F</code> your clean target. For example:</p>
<pre><code> <Target Name="Clean">
<Exec Command="rmdir %(DeploymentSet.LocalWebRoot)\subdir1 /Q /S" IgnoreExitCode="true" />
<Exec ... | <p>If you don't want to specify the names of each sub-directory, use this:</p>
<pre><code><Target Name="Clean">
<Exec Command="del /F /Q %(DeploymentSet.LocalWebRoot)\*.*" />
<Exec Command="for /d /r &quot;%(DeploymentSet.LocalWebRoot)&quot; %v IN (*) DO rd /S /Q &quot;%v&quot;" ... | 44,909 |
<p>I am looking to write some C# code for linux/windows/mac/any other platform, and am looking for best practices for portable code.</p>
<p>Project <a href="http://go-mono.org" rel="noreferrer">mono</a> has some great <a href="http://www.mono-project.com/Category:Porting" rel="noreferrer">porting</a> resources.</p>
<... | <p>I've actually used winforms and it was fine. It was BUTT UGLY, but it worked.</p>
<p>Obviously, don't use P/Invoke, or any win32 stuff like the registry. Also be aware of any third party DLL's. For example, we use a third party SQLite dll which actually contains native code in it which we have to swap out if we wan... | <p>If you want the code to be portable, you need to closely review the list of completed features on the Mono site. They go into detail on each class in the framework, and the level of completeness. You will have to take these things into consideration during the design process so that you don't go too far down a pat... | 6,418 |
<p>I'd like to log the <em>call trace</em> during certain points, like failed assertions, or uncaught exceptions.</p>
| <p>This code works on any thread:</p>
<pre><code>NSLog(@"%@", NSThread.callStackSymbols);
</code></pre>
<blockquote>
<p>Returns an array containing the call stack symbols. Each element is an <code>NSString</code> object with a value in a format determined by the <code>backtrace_symbols()</code> function.</p>
... | <p>If you want to get it as NSString.</p>
<pre><code>[NSThread callStackSymbols].description
</code></pre>
| 27,107 |
<p>I've written a Python package that includes a bsddb database of pre-computed values for one of the more time-consuming computations. For simplicity, my setup script installs the database file in the same directory as the code which accesses the database (on Unix, something like /usr/lib/python2.5/site-packages/mypa... | <p>Try using pkg_resources, which is part of setuptools (and available on all of the pythons I have access to right now):</p>
<pre><code>>>> import pkg_resources
>>> pkg_resources.resource_filename(__name__, "foo.config")
'foo.config'
>>> pkg_resources.resource_filename('tempfile', "foo.conf... | <p>That's probably the way to do it, without resorting to something more advanced like using setuptools to install the files where they belong.</p>
<p>Notice there's a problem with that approach, because on OSes with real a security framework (UNIXes, etc.) the user running your script might not have the rights to acc... | 6,015 |
<p>I am a big fan of the light colors on a dark background color scheme for programming - which is unfortunately not what Quest's Toad comes with by default. </p>
<p>I notice that it is possible to export and import settings under the language management window, and I know that Toad has a large level of community in... | <p><em>UPDATED ENTIRELY:</em></p>
<ol>
<li><p><strong>What's the official name?</strong></p>
<p>The file extension (<code>.dvtcolortheme</code>) suggests <code>"Color Theme"</code> or <code>"DWT Color Theme"</code> are the official names. Most users on Toad forums seem to use the same terminology.</p></li>
<li><p><st... | <p>The right file for new versions of TOAD is <strong>EditorLexers.xml</strong>.</p>
<p>For version 12.9 is here</p>
<p>C:\Users\%username%\AppData\Roaming\Dell\Toad for Oracle\12.9\User Files</p>
<p>instead for version 12.11 is here</p>
<p>C:\Users\%username%\AppData\Roaming\Quest Software\Toad for Oracle\12.11\Us... | 12,811 |
<p>What's the best performing way to convert a DataRowCollection instance to a DataRow[]?</p>
| <pre><code>DataRow[] rows = dt.Select();
</code></pre>
<p>Assuming you still have access to the datatable.</p>
| <p>This is kind of obvious, but:</p>
<p><code>DataRowCollection.CopyTo(DataRow[] array, Int32 offset)</code> ?</p>
<p>It seems like no matter what, you're going to have to iterate the collection (CopyTo iterates the internal DataRowTree elements).</p>
<p>I suppose you could use reflection to access the non-public tr... | 28,114 |
<p>I am re-writing this question because, well, it needs to be updated.</p>
<p>I have the Anet A6, but in a general sense of things, what kind of threads can I produce before it no longer works? </p>
| <p>This depends on the nozzle diameter, the layer thickness, and the material. </p>
<p>I've made very good M8 and acceptable M6 threads (nut and bolt) at 0.2mm layers with a 0.5mm nozzle, out of ABS, and also out of PETG. </p>
| <p>I have found that I get slightly different results with different printers and different plastics and print temperatures. For doing parts like nuts and bolts you will probably have to print several prototype parts once you get your printer to get the setting and tolerances right, once you get a print. But just decre... | 710 |
<p>Our team is setting up nightly and continuous integration builds. We own Team Foundation Server and could use Team Foundation Build. I'm more familiar with CC.Net and lean that way but management sees all the money spent on TFS and wants to use it.</p>
<p>Some things I like better about CC.Net is the flexibility ... | <p>I've used both. I guess it depends on what your organization values.</p>
<p>Since you are familiar with CC Net, I won't speak much to that. You already know what makes it cool.</p>
<p><strong>Here's what I like about Team Foundation Build:</strong></p>
<ul>
<li>Build Agents. It's very simple to turn any box into ... | <p>We've been using CruiseControl.net since June '07 and it's worked great for us. Best part, it integrates to SVN easily which is a far superior source control provider.</p>
<p>So our setup is:</p>
<ul>
<li><a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" rel="nofollow ... | 10,556 |
<p>what is the best way of displaying/using the revision number in a java webapp?</p>
<p>we just use ant to build our .war archive, no buildserver or such. i'd hope there was some kind if $ref that i could write in a resource file, but this is only updated when the file in question is committed. i need it globally.</p... | <p><strong>There are a couple of Ant tasks that can do this for you.</strong></p>
<p><a href="http://subclipse.tigris.org/svnant.html" rel="nofollow noreferrer">SvnAnt task</a> from tigris is the oldest.</p>
<p>Documentation is <a href="http://subclipse.tigris.org/svnant/svn.html#info" rel="nofollow noreferrer">here<... | <p>Before the webapp is packaged, run svn info and redirect the output to some file in WEB-INF/classes. When the webapp starts up, parse this file and have it stashed away in the servlet context or some similar place. In the footer of every page, display this version - if you are using something like Tiles or SiteMesh,... | 20,085 |
<p>I am about to make some changes to an existing Apache C module to fix some possible security flaws and general bad practices. However the functionality of the code must remain unchanged (except in cases where its fixing a bug). Standard regression testing stuff seems to be in order. I would like to know if anyone kn... | <p>I've been thinking of answering this for a while, but figured someone else might come up with a better answer, because mine is rather unsatisfactory: no, I'm not aware of any such unit testing framework.</p>
<p>I think your best bet is to try and refactor your C module such that it's dependencies on the httpd code ... | <p>Spent some time looking around the interwebs for you as its a question i was curious myself. came across a wiki article stating that </p>
<p><a href="http://cutest.sourceforge.net/" rel="nofollow noreferrer">http://cutest.sourceforge.net/</a></p>
<p>was used for the apache portable c runtime testing. might be wort... | 42,220 |
<p>This one is for a coworker:</p>
<blockquote>
<p>We are having a problem with one of our wireframe sets (a Visio file). Basically, the file continues to increase in size and is currently at 43 MB (yes, forty three!), when the average of our other sets are at about 5-10 MB each. When I saved a copy to my desktop ... | <p>They found the answer...</p>
<blockquote>
<p>It happens that Visio was converting one our icons to a larger file, and every time we copied/pasted it, it added a LOT of size (even though the icon is idddddy biddddy). [another coworker] is working on reformatting the image so we can use it as a stencil. Without th... | <p>I suspect that may have some unused shapes that you've deleted from the drawing page, but are still in the stencil. <a href="http://support.microsoft.com/kb/305025" rel="nofollow noreferrer">This MS support article</a> gives some tips on fixing both this and other Visio size issues.</p>
| 43,445 |
<p>For some reason, when using two sums on a group by, i run into the error "invalid column name 'id'. When i only do one sum, it works as expected.</p>
<p>The following <strong>fails</strong> and throws the error:</p>
<pre><code>from pd in PrDetails.Where(_pd => _pd.PrId == 46)
group pd by new { pd.ProgramFun... | <p>About the only think I can think it might be is a conflict with the names of your parameters. Try this:</p>
<pre><code>from pd in PrDetails.Where(_pd => _pd.PrId == 46)
group pd by new { pd.ProgramFund, pd.ProjectDetail.CostCenter, pd.ProjectDetail.Wbs }
into g
select new
{
g.Key.ProgramFund,
g.Key.CostC... | <p>About the only think I can think it might be is a conflict with the names of your parameters. Try this:</p>
<pre><code>from pd in PrDetails.Where(_pd => _pd.PrId == 46)
group pd by new { pd.ProgramFund, pd.ProjectDetail.CostCenter, pd.ProjectDetail.Wbs }
into g
select new
{
g.Key.ProgramFund,
g.Key.CostC... | 48,272 |
<p>How do you stay up-to-date when it comes to new software versions? Above all, I mean minor updates (new version for your Joomla-Installation, forum-software, FTP-Client, ...).</p>
<p>Versiontracker, RSS-Feeds, Newsletter... what else? Anyone wrote a script crawling websites for new versions or something similar?</p... | <p>Often your operating system will help you with these things, at least in (most distributions of) Linux. As soon as a piece of software is available as an installable package, and installed, your package management system will keep track of it and it will be possible to find out that a new version is available.</p>
... | <p>On Windows, many installers handle this for you, for example the InstallShield update manager. Personally, I disable most of these until I need the new functionality or something goes wrong. Reason being that if my existing setup is working well, an update is more likely to break it and cause me pain than adding v... | 25,963 |
<p>What would be the best way to write log statements to a file or database in an iPhone application?</p>
<p>Ideally, NSLog() output could be redirected to a file using freopen(), but I've seen several reports that it doesn't work. Does anyone have this going already or have any ideas how this might best be done?</p>... | <p>I've successfully used freopen(...) on the phone to re-direct output to my own file.</p>
| <p>Consider using <a href="https://github.com/robbiehanson/CocoaLumberjack" rel="nofollow">Cocoa Lumberjack</a>. It's a light but flexible utility to replace NSLog functionality. In my opinion it's in the same class as Log4J, allowing for custom appenders and the like. It has an SQLite logger, for example.</p>
| 24,730 |
<p>I've read this <a href="https://stackoverflow.com/questions/40122/exceptions-in-web-services">thread</a> for WCF has inbuilt Custom Fault codes and stuff.</p>
<p>But what is the best practice for <em>ASP.Net</em> web services? Do I throw exceptions and let the client handle the exception or send an Error code (succ... | <p>Jeff Atwood posted <a href="http://www.codinghorror.com/blog/archives/000054.html" rel="nofollow noreferrer">an interesting aerticle</a> about this subject some time ago. Allthough a .NET exception is converted to a SoapFault, which is compatible with most other toolkits, the information in the faults isn't very goo... | <p>Depends on how you are going to consume the web service - i.e. which protocol are you going to use.</p>
<p>If it is GET or POST, better return error code, as the calling HttpWebRequest (.Net) or other code will receive server error, and have to deal with it to extract the exception code.</p>
<p>If it is SOAP - the... | 10,352 |
<p>I'm running Xorg and my (Qt) program daemonises itself. Now I log out and restart the X server. When I log in again my process is still running fine, but I can't see it.</p>
<p>Is there a way of attatching the new incarnation of the X server to the old process?
If I don't restart the whole server, but log out and i... | <p>xpra should achieve your requirement. And it can also start tcp connection (without need of ssh). Start it on the you server:</p>
<pre><code>xpra start :100 --start-child=xterm --bind-tcp=0.0.0.0:10000
</code></pre>
<p>Connect it on your client:</p>
<pre><code>xpra attach tcp:SERVERHOST:10000
</code></pre>
<p>Yo... | <p>After the connection to the X server is lost, it is not possible to regain it.</p>
<p>There was an xserver proxy called xmove, but it is quite deprecated and doesn't work with several newer X extension, which are likely used by modern toolkits.</p>
<p>You could try to run your process in another virtual X server l... | 40,625 |
<p>For some reason Eclipse is no longer showing me Java compilation Errors in the Problems View.</p>
<p>It is still showing Warnings.</p>
<p>This has suddenly happened and I cannot think of anything that I have changed which would affect this.</p>
<p>I am using the "Maven Integration for Eclipse" plugin but I have b... | <p>I had same problem and randomly did such things as (several times): </p>
<p>1) Project->Clean..., <br>
2) close and open Eclipse again, <br>
3) Run As...</p>
<p>And it started to work again, without changing configuration.</p>
| <p>If "Debug" has been recently activated then check the top right of the program (under the Minimise button) and click back onto Java.</p>
| 31,579 |
<p>Can anbyody tell me how to include a certain folder when running unit tests in visual studio. In the folder are xml-files needed by the tests. I can't seem to find anymore where I need to add this folder.</p>
<p>Thx, Lieven Cardoen aka Johlero</p>
| <p>If you click on properties on the XML file, you can tell it to copy to the output folder so that it is available in the same folder as the tests. Alternately, you could select to embed it as a resource if you don't want to have to copy all the support files for your tests around.</p>
| <p>I'm not sure you can add a folder to a test solution on an as-needed basis; it either has to be added to the solution and loaded every time, or you'll have to load the files individually inside your tests. </p>
<p>Could you clarify exactly what you're looking for, please?</p>
| 27,340 |
<p>I have a rails form with a datetime_select field. When I try to submit the form, I get the following exception:</p>
<pre><code>ActiveRecord::MultiparameterAssignmentErrors in WidgetsController#update
1 error(s) on assignment of multiparameter attributes
</code></pre>
<p>If it's a validation error, why don't I see... | <p>It turns out that rails uses something called Multi-parameter assignment to transmit dates and times in small parts that are reassembled when you assign params to the model instance.</p>
<p>My problem was that I was using a datetime_select form field for a date model field. It apparently chokes when the multi-param... | <p>This error can also occur with webrat/cucumber when filling in form data using a table.</p>
<p>eg this doesn't work:</p>
<pre><code>When I fill in the following:
| report_from_1i | 2010 |
| report_from_2i | January |
| report_from_3i | 1 |
| report_to_1i | 2010 |
| report_to_2i | Febr... | 11,879 |
<p>How to filter my datagridview by the value of my label.text on click event? That value is from my linq query:</p>
<pre><code>dataSet.Tables[0].AsEnumerable().Where(c => c.Field<int>("ageColumn") > 3 &&
c.Field<int>("ageColumn") < 5).Count();
</code></pre>
<p>Let's just say the abo... | <p>Do you need it to be dynamic? Perhaps store the query itself as a lambda in the Tag property of your label:</p>
<pre><code>Predicate<DataColumn> clause = c => c.Field<int>("ageColumn") > 3
&& c.Field<int>("ageColumn") < 5;
label1.Tag = clause;
</code></pre>
<p>... then re-ev... | <p>Now I do not use LINQ, but logic would suggest that whatever is retured by the expression</p>
<pre><code>dataSet.Tables[0].AsEnumerable().Where(c => c.Field<int>("ageColumn") > 3 &&
c.Field<int>("ageColumn") < 5)
</code></pre>
<p>Contains the data you seek? Is there not a property in ... | 40,085 |
<p>If you are writing a program that is executable from the command line, you often want to offer the user several options or flags, along with possibly more than one argument. I have stumbled my way through this many times, but is there some sort of design pattern for looping through args and calling the appropriate h... | <p>I don't know of any documented "patterns" for processing.</p>
<p>I believe one of the oldest libraries/APIs for handling arguments is getopt. Googling "getopt" shows lots of man pages and links to implementations.</p>
<p>Generally, I have a preferences or settings service in my application that the argument proce... | <p>You don't mention a language for this but if you are looking for a really nice Objective-C wrapper around getopt then Dave Dribin's DDCLI framework is really nice.</p>
<p><a href="http://www.dribin.org/dave/blog/archives/2008/04/29/ddcli" rel="nofollow noreferrer">http://www.dribin.org/dave/blog/archives/2008/04/29... | 7,804 |
<p>I have a form where i have used Infragistics windows grid control to display the data.
In this, i have placed a button on one of the cell. I want to set its visibility either True or False based on the row condition.
I have handled the <strong>InitializeRow</strong> event of <strong>UltraWinGrid</strong> control a... | <pre><code>UltraGridRow row = ...
row.Cells[buttonCellIndex].Hidden = true;
</code></pre>
<p>(I'm using the <code>UltraGrid</code> in Infragistics NetAdvantage for Windows Forms 2008 Vol. 2 CLR 2.0.)</p>
| <p>At first yo must achieve the row and cell ,
then use findControl method and assign that to a button ,
now the button is in your hand . you can set the visibility :)</p>
| 18,308 |
<p>When dealing with mobile clients it is very common to have multisecond delays during the transmission of HTTP requests. If you are serving pages or services out of a prefork Apache the child processes will be tied up for seconds serving a single mobile client, even if your app server logic is done in 5ms. I am looki... | <p><a href="http://www.telerik.com/fiddler" rel="nofollow noreferrer">Fiddler</a>, a free tool from Telerik, does at least some of the things you're looking for.</p>
<p>Specifically, go to <code>Rules | Custom Rules...</code> and you can add arbitrary Javascript code at all points during the connection. You could sim... | <p>Unfortunately, I'm not aware of a ready-made solution for this. In the worst case scenario, consider developing it yourself, say, using Java NIO -- it shouldn't take more than a week.</p>
| 12,272 |
<p>I'm having a problem running a T4 template using TextTransform.exe on my build server. On my dev machine the template works perfectly. The error message is as follows.</p>
<blockquote>
<p>error : Running transformation: System.TypeLoadException: Could not instantiate type System.Xml.Linq.XDocument</p>
</blockquot... | <p>Some syntax sugar</p>
<pre><code>1 in [1,2,3]
</code></pre>
| <p>You can also use matches with regular expression like this:</p>
<pre><code>boolean bool = List.matches("(?i).*SOME STRING HERE.*")
</code></pre>
| 7,515 |
<p>Is there anything like Winsplit Revolution for Mac OS X?</p>
| <p><strong>Try these</strong>:</p>
<ul>
<li><strong><a href="http://coderage-software.com/zooom/" rel="noreferrer">Zooom/2</a></strong> ($15) has been my favorite since I installed it. Fast, flexible, and minimizes the number of key combinations I need to remember </li>
<li><strong><a href="http://mizage.com/divvy/" r... | <p>I doubt it. Between Spaces and Expose, there's not much need for a third-party app to help manage multiple windows.</p>
| 34,418 |
<p>I have been playing with the Ruby library "shoes". Basically you can write a GUI application in the following way:</p>
<pre><code>Shoes.app do
t = para "Not clicked!"
button "The Label" do
alert "You clicked the button!" # when clicked, make an alert
t.replace "Clicked!" # ..and replace the label's text... | <p>You could actually pull this off, but it would require using metaclasses, which are <em>deep</em> magic (there be dragons). If you want an intro to metaclasses, there's a series of <a href="http://www.ibm.com/developerworks/linux/library/l-pymeta.html" rel="nofollow noreferrer">articles from IBM</a> which manage to ... | <p>Declarative is not necessarily more (or less) pythonic than functional IMHO. I think a layered approach would be the best (from buttom up):</p>
<ol>
<li>A native layer that accepts and returns python data types.</li>
<li>A functional dynamic layer.</li>
<li>One or more declarative/object-oriented layers.</li>
</ol>... | 8,314 |
<p>I got this flash application where you can click a link while watching a video. It will open a new tab and pause the video. Now when you come back to the flash application it would be nice if the video would start playing again. Is there a way, an event or so to do this ?</p>
| <p>A cleaner approach would be to use something along the lines of this:</p>
<pre><code>stage.addEventListener( Event.ACTIVATE, playMovie );
stage.addEventListener( Event.DEACTIVATE, pauseMovie );
</code></pre>
| <p>The Flash player send outs activate and deactivate events when the focus enters and leaves the player. You could probably uses these, but they are limited to only when the flash content focus changes, not when the page focus changes.</p>
<p>Take a look here <a href="http://blog.flexexamples.com/2008/02/29/determini... | 14,136 |
<p>Is there a way in .net 2.0 to discover the network alias for the machine that my code is running on? Specifically, if my workgroup sees my machine as //jekkedev01, how do I retrieve that name programmatically?</p>
| <p>Since you can have multiple network interfaces, each of which can have multiple IPs, and any single IP can have multiple names that can resolve to it, there may be more than one.</p>
<p>If you want to know all the names by which your DNS server knows your machine, you can loop through them all like this:</p>
<pre>... | <p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.environment.aspx" rel="nofollow noreferrer">System.Environment</a> class. It has a property for retrieving the machine name, which is retrieved from the NetBios. Unless I am misunderstanding your question.</p>
| 8,440 |
<p>I'm trying to use grep with -v for invert-match along with -e for regular expression. I'm having trouble getting the syntax right. </p>
<p>I'm trying something like</p>
<pre><code>tail -f logFile | grep -ve "string one|string two"
</code></pre>
<p>If I do it this way it doesn't filter
If I change it to</p>
<pre... | <p>The problem is that by default, you need to escape your |'s to get proper alternation. That is, grep interprets "foo|bar" as matching the literal string "foo|bar" only, whereas the pattern "foo\|bar" (with an escaped |) matches either "foo" or "bar".</p>
<p>To change this behavior, use the -E flag:</p>
<pre><code... | <p>You need to escape the pipe symbol when -e is used:</p>
<pre><code>tail -f logFile | grep -ve "string one\|string two"
</code></pre>
<p>EDIT: or, as <a href="https://stackoverflow.com/questions/364105/using-grep-with-regular-expression-to-filter-out-matches#364113">@Adam</a> pointed out, you can use the -E flag: <... | 47,534 |
<p>I've got a sign up form that requires the user to enter their email and password, both are in two separate text boxes. I want to provide a button that the user can click so that the password (which is masked) will appear in a popup when the user clicks the button.</p>
<p>Currently my JavaScript code for this is as ... | <p>I did a quick example up of a working version:</p>
<pre><code><html>
<head>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript">
function toggleShowPassword() {
var textBox = $('PasswordText')... | <p>You do not need to do <code>button.value = password;</code> since reading the value does not change it. I'm not sure why it's being cleared, maybe JavaScript does not allow password field values to be modified.</p>
| 6,618 |
<p>I've been contacted to see about updating an old legacy web application that was built using ASP and Access. The server is running Windows 2000 Advanced Server and I believe IIS 5.0 (I am trying to get confirmation on that, but the company isn't technical so I highly doubt Apache is running on the server).</p>
<p>W... | <p>I have a similar situation, did it about a year ago, and ended up using asp.net 2.0. </p>
<p>Generally ok, but the machine is showing it's age, I usually need to get someone to give it the 3 fingered salute every month or so, and it blew a psu recently. </p>
<p>If it's only low volume, you might be able to inst... | <p>In this scenario, I would probably go with ASP.NET. Since you're running on a microsoft server, there will be plenty of documentation from MS on installing, configuring, and running the site. It's a lot easier to support something when all the components are "in the same family" so to speak. Asp.net will run fine... | 39,087 |
<p>I have a problem with some zombie-like processes on a certain server that need to be killed every now and then. How can I best identify the ones that have run for longer than an hour or so?</p>
| <p>If they just need to be killed:</p>
<pre><code>if [[ "$(uname)" = "Linux" ]];then killall --older-than 1h someprocessname;fi
</code></pre>
<p>If you want to see what it's matching</p>
<pre><code>if [[ "$(uname)" = "Linux" ]];then killall -i --older-than 1h someprocessname;fi
</code></pre>
<p>The <code>-i</code> ... | <p>Using ps is the right way. I've already done something similar before but don't have the source handy.
Generally - ps has an option to tell it which fields to show and by which to sort. You can sort the output by running time, grep the process you want and then kill it.</p>
<p>HTH</p>
| 2,795 |
<p>I've been searching on SO on how to do i18n support on my little application...</p>
<p>I know that Microsoft offers 'culture' classes, but you have to re-compile your application to include any new string you add. So, all I'm trying to do is to put all my strings in a external file and offers users the choice to tr... | <p>Here is a nice blog post from Scott Hanselman which contains several good resources:
<a href="http://www.hanselman.com/blog/ASPNETInternationalizationGlobalizationAndLocalizationWhew.aspx" rel="nofollow noreferrer">http://www.hanselman.com/blog/ASPNETInternationalizationGlobalizationAndLocalizationWhew.aspx</a></p>
... | <p>if you include a new string in your app, you have to recompile it anyway, do you not?</p>
<p>if you add languages often, resource files and/or satellite DLLs are probably your best bet</p>
<p>failing that, you can write your own provider. Here are some links I found useful, your mileage may vary:</p>
<p><a href="... | 16,296 |
<p>I've tried to use the new <a href="http://groovy.codehaus.org/Grape" rel="noreferrer">Groovy Grape</a> capability in Groovy 1.6-beta-2 but I get an error message;</p>
<pre><code>unable to resolve class com.jidesoft.swing.JideSplitButton
</code></pre>
<p>from the Groovy Console (/opt/groovy/groovy-1.6-beta-2/bin/gr... | <p>There is still some kinks in working out the startup/kill switch routine. For Beta-2 do this in it's own script first:</p>
<pre><code>groovy.grape.Grape.initGrape()
</code></pre>
<p>Another issue you will run into deals with the joys of using an unbounded upper range. Jide-oss from 2.3.0 onward has been compilin... | <p>Different example using latest RC-2 (note: Grab annotates createEmptyInts):</p>
<pre><code>// create and use a primitive array
import org.apache.commons.collections.primitives.ArrayIntList
@Grab(group='commons-primitives', module='commons-primitives', version='1.0')
def createEmptyInts() { new ArrayIntList() }
de... | 23,385 |
<p>Our server application is listening on a port, and after a period of time it no longer accepts incoming connections. (And while I'd love to solve this issue, it's not what I'm asking about here;)</p>
<p>The strange this is that when our app stops accepting connections on port 44044, so does IIS (on port 8080). Ki... | <p>You may well be starving the stack. It is pretty easy to drain in a high open/close transactions per second environment e.g. webserver serving lots of unpooled requests. </p>
<p>This is exhacerbated by the default TIME-WAIT delay - the amount of time that a socket has to be closed before being recycled defaults t... | <p>I guess the port number comment from RichS is correct.</p>
<p>Other than that, the TCP/IP stack is just a module in your operating system and, as such, can have bugs that might allow an application to kill it. It wouldn't be the first driver to be killed by a program.</p>
<p>(A tip to the hat towards Andrew Tanenb... | 16,155 |
<p>I have a handful of projects that all use one project for the data model. Each of these projects has its own applicationContext.xml file with a bunch of repetitive data stuff within it.</p>
<p>I'd like to have a modelContext.xml file and another for my ui.xml, etc.</p>
<p>Can I do this?</p>
| <p>From the <a href="http://static.springframework.org/spring/docs/2.5.5/reference/beans.html#beans-definition" rel="noreferrer">Spring Docs (v 2.5.5 Section 3.2.2.1.)</a>:</p>
<blockquote>
<p>It can often be useful to split up
container definitions into multiple
XML files. One way to then load an
application ... | <p>Another thing to note is that although you can do this, if you aren't a big fan of XML you can do a lot of stuff in Spring 2.5 with annotations. </p>
| 12,013 |
<p>In java, I could do this with the 'final' keyword. I don't see 'final' in C#. Is there a substitute?</p>
| <p>You're looking for the <code>sealed</code> keyword. It does exactly what the <code>final</code> keyword in Java does. Attempts to inherit will result in a compilation error.</p>
| <p>The <code>sealed</code> keyword would work, but still you can derive from the class using reflection IIRC.</p>
| 18,703 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.