instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I tried to make the title as clear as possible... here is my scenario:</p>
<p>I have 2 tables (let's call them table A and table B) that have a similar schema. I would like write a stored procedure that would select specific columns of data out of table A, and insert this data as a new record in table B.</p>
<p>Ca... | <pre><code>INSERT INTO B (Col1, Col2) SELECT Col1, Col2 FROM A
</code></pre>
<p>Is this what you mean?</p>
| <p>use a SELECT INTO</p>
<pre><code>SELECT
[Col1],
[COl2]
INTO TableA
FROM TableB
</code></pre>
| 44,359 |
<p>I am looking for instructions on how to setup a PEAR channel for our project so that we can deploy it with the pear installer. I have searched the web for a while and cannot find any straightforward information. I followed <a href="http://greg.chiaraquartet.net/archives/123-Setting-up-your-own-PEAR-channel-with-Chia... | <p>It looks like you are one of the few people who want to do this. That tutorial you linked to appears to be the latest (!) but the package is still <a href="http://pear.chiaraquartet.net/index.php?package=Chiara_PEAR_Server" rel="nofollow noreferrer">somewhat in development</a>. The documentation in that package is a... | <p>What problems are you encountering on following the tutorial that you linked to?</p>
<p>You could set up your own channel with pirum or the chiara server ( <a href="http://pear.chiaraquartet.net/" rel="nofollow noreferrer">http://pear.chiaraquartet.net/</a> ) but you could also look into getting an account on <a hr... | 20,305 |
<p>I want to install PowerShell to 600 Window XP computers, and use it as the main processing shell. For example, for replacing batch scripts, VB scripts, and some other little programs. The installation process is not a problem. Some issues I think I'm going to come across are:</p>
<ol>
<li><p>Changing permissions to ... | <p>To speed up the start of PowerShell, Jeffrey Snover (the partner/architect responsible for PowerShell) provides an "Update-GAC" script <a href="http://blogs.msdn.com/powershell/archive/2008/09/02/speeding-up-powershell-startup-updating-update-gac-ps1.aspx" rel="nofollow noreferrer">here</a>.</p>
<p>Basically, it is... | <p>Changing permissions to allow Powershell scripts is possible to do via group policy. </p>
<p>Microsoft provide ADM templates <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2917a564-dbbc-4da7-82c8-fe08b3ef4e6d&DisplayLang=en" rel="nofollow noreferrer">here</a>, there is only one option "Turn ... | 13,878 |
<p>Can anyone recommend a library/SDK/etc. that is free or for purchase that I can integrate into my C++ application that enables the application to perform automatic error reporting? I have something now that I am using but it does not catch all exceptions. I'm looking for something more sophisticated and more robust ... | <p>You don't mention your platform, but if it's Windows, you could take a look at Microsoft's <a href="http://www.microsoft.com/whdc/maintain/StartWER.mspx" rel="nofollow noreferrer">Windows Error Reporting</a>.</p>
<p>This is the "Application XYZ has crashed. Do you want to send an error report to Microsoft?" stuff. ... | <p>You can use <em>SetUnhandledExceptionFilter</em> and <em>MiniDumpWriteDump</em> functions to make error reporting by yourself.</p>
| 44,620 |
<p>Upcasting is allowed in Java, however downcasting gives a compile error. </p>
<p>The compile error can be removed by adding a cast but would anyway break at the runtime. </p>
<p>In this case why Java allows downcasting if it cannot be executed at the runtime?<br>
Is there any practical use for this concept? </p>
... | <p>Downcasting is allowed when there is a possibility that it succeeds at run time:</p>
<pre><code>Object o = getSomeObject(),
String s = (String) o; // this is allowed because o could reference a String
</code></pre>
<p>In some cases this will not succeed:</p>
<pre><code>Object o = new Object();
String s = (String)... | <p>Downcasting is very useful in the following code snippet I use this all the time. Thus proving that downcasting is useful. </p>
<pre><code>private static String printAll(LinkedList c)
{
Object arr[]=c.toArray();
String list_string="";
for(int i=0;i<c.size();i++)
{
String mn=(String)arr[i]... | 49,904 |
<p>I have a project that I thought was going to be relatively easy, but is turning out to be more of a pain that I had hoped. First, most of the code I'm interacting with is legacy code that I don't have control over, so I can't do big paradigm changes.</p>
<p>Here's a simplified explanation of what I need to do: Sa... | <p>On Windows, you invoke CreatePipe first (similar to pipe(2)), then CreateProcess. The trick here is that CreateProcess has a parameter where you can pass stdin, stdout, stderr of the newly-created process.</p>
<p>Notice that when you use stdio, you need to do fdopen to create the file object afterwards, which expec... | <p>I think you've made a very good start to your problem by using the popen2() function to abstract away the cross-platform issues. I was expecting to come and suggest 'sockets', but I'm sure that's not relevant after reading the question. You could use sockets instead of pipes - it would be hidden in the popen2() fu... | 31,706 |
<p>I've been doing some mocking with RhinoMocks and it requires that mocked methods be made virtual. This is fine except we have a custom framework which contains the methods that I want to mock which are currently not marked as virtual.</p>
<p>I can't forsee any problem with making these methods virtual but I was won... | <p>Actually it can be very problematic if the method is not designed to be overridden and someone overrides it. In particular, never call a virtual method from a constructor. Consider:</p>
<pre><code>class Base {
public Base() {
InitializeComponent();
}
protected virtual void InitializeComponent() {... | <ul>
<li>If you have users that override your virtual methods you can't seal them again without breaking code.</li>
<li>Any virtual methods you call from the constructor may fall down to derived implementations and if they don't call the base method and the constructor depends on it, the object may be in an invalid sta... | 16,604 |
<p>As I recall <code>BOOST_MPL_ASSERT</code> was once preferred. Is this still true? Anyone know why?</p>
| <p><em>[Answering my own question]</em></p>
<p>It depends. This is an apples to oranges comparison. Although similar, these macros are NOT interchangeable. Here's a summary of how each works:</p>
<p><code>BOOST_STATIC_ASSERT( P )</code> generates a compilation error if <code>P != true</code>.</p>
<p><code>BOOST_M... | <p><code>BOOST_MPL_ASSERT</code> is (still) generally considered better. The messages from it are somewhat easier to see (and understand, if you use <code>BOOST_MPL_ASSERT_MSG</code>). There was some talk a few months ago about deprecating <code>BOOST_STATIC_ASSERT</code>, though I think everyone eventually agreed that... | 23,515 |
<p>I'm considering using <a href="https://en.wikipedia.org/wiki/Category_6_cable" rel="noreferrer">CAT6</a> cables to connect my printer's extruder assembly to the control board. They seem like an elegant solution, but I've read conflicting opinions online on whether or not this would be feasible.</p>
<p>I would like ... | <p>The ampacity question is not completely answerable because CAT6 does not specify wire gauge, so the current limit will depend on the specific gauge you get. CAT6 can be anywhere from 22 AWG to 24 AWG, and depending on who you ask this can be good for as much as 7A or as little as 0.5A. Given that you will have a bun... | <p>CAT6 cable by itself is not a problem, it is typically 23 AWG solid core wire which can take you to 4A just fine. The real problem comes from the connectors you use. CAT6 usually goes hand in hand with 8p8c ethernet connectors which only have contacts rated to 500mA.</p>
<p>Also typically CAT6 cable is meant to b... | 441 |
<p>Is there a simple out of the box way to impersonate a user in .NET?</p>
<p>So far I've been using <a href="http://www.codeproject.com/KB/cs/zetaimpersonator.aspx" rel="noreferrer">this class from code project</a> for all my impersonation requirements.</p>
<p>Is there a better way to do it by using .NET Framework?<... | <p>"Impersonation" in the .NET space generally means running code under a specific user account. It is a somewhat separate concept than getting access to that user account via a username and password, although these two ideas pair together frequently.</p>
<h2>Impersonation</h2>
<p>The APIs for impersonation ... | <p>You can use this solution. (Use nuget package)
The source code is available on : Github:
<a href="https://github.com/michelcedric/UserImpersonation" rel="nofollow">https://github.com/michelcedric/UserImpersonation</a></p>
<p>More detail
<a href="https://michelcedric.wordpress.com/2015/09/03/usurpation-didentite-dun... | 15,234 |
<p>Say we have a TestClass with the 2 methods, <code>-getSomeString</code> and <code>-getAnotherString</code>, and we are editing the following code and the cursor is in the location shown:</p>
<pre><code>NSString *aString = [TestClass get<cursorIsHere>SomeString];
</code></pre>
<p>Say I want to change it to us... | <p>I don't think that there is a one step operation to achieve this. My suggestion would be similar to Thomas Templemann, but rather than two steps of forward word select and then Delete, I would expand to the desired autocomplete, by bouncing on <strong>Control + .</strong> and then hit <strong>Option + forward delete... | <p>I don't think so. I have always used the following</p>
<ul>
<li>double click on getSomeString</li>
<li>press Escape (or your autocomplete key)</li>
<li>find replacement method</li>
</ul>
<p>that double click step has never really bothered me, but I would be interested if anyone knows better!</p>
| 42,410 |
<p>I have a device that supports 4-color graphics (much like CGA in the old days).</p>
<p>I wanted to use <a href="http://www.pythonware.com/products/pil/" rel="noreferrer">PIL</a> to read the image and convert it using my 4-color palette (of red, green, yellow, black), but I can't figure out if it's even possible at ... | <p>First: your four colour palette (black, green, red, yellow) has <em>no</em> blue component. So, you have to accept that your output image will hardly approximate the input image, unless there is no blue component to start with.</p>
<p>Try this code:</p>
<pre><code>import Image
def estimate_color(c, bit, c_error):... | <pre><code>import sys
import PIL
from PIL import Image
def quantizetopalette(silf, palette, dither=False):
"""Convert an RGB or L mode image to use a given P image's palette."""
silf.load()
# use palette from reference image
palette.load()
if palette.mode != "P":
raise ValueError("bad mod... | 29,290 |
<p>From using a number of programming languages and libraries I have noticed various terms used for the total number of elements in a collection.</p>
<p>The most common seem to be <code>length</code>, <code>count</code>, and <code>size</code>.</p>
<p>eg.</p>
<pre><code>array.length
vector.size()
collection.count
</c... | <p><code>Length()</code> tends to refer to contiguous elements - a string has a length for example. </p>
<p><code>Count()</code> tends to refer to the number of elements in a looser collection. </p>
<p><code>Size()</code> tends to refer to the size of the collection, often this can be different from the length in cas... | <p>To me, this is a little like asking whether "foreach" is better than "for each". It just depends on the language/framework.</p>
| 38,528 |
<p>Is it recommended to set member variables of a base class to protected, so that subclasses can access these variables? Or is it more recommended to set the member variables to private and let the subclasses get or set the varible by getters and setters?</p>
<p>And if it is recommended to use the getters and setters... | <p>This is very <em>similar</em> to <a href="https://stackoverflow.com/questions/355787">this question</a>, about whether to access information within the same class via properties or direct access. It's probably worth reading all those answers too.</p>
<p>Personally, I don't like any fields to be non-private with the... | <p>This is a trade-off here. Setters and getters are somewhat slower than accessing fields directly, so if you are doing heavy maths and read/write these fields a lot in your subclasses, you should go for accessing the fields directly. But this is more like an exception.</p>
<p>Normally, you should mark them as privat... | 47,340 |
<p>I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code:</p>
<pre><code>LOGO_GIF RCDATA logo.gif
</code></pre>
<p>Using resource explorer I verified it is in the DLL properly.</p>
<p>using the fol... | <p>RCDATA is a <a href="http://msdn.microsoft.com/en-us/library/aa381039(VS.85).aspx" rel="nofollow noreferrer">pre-defined</a> resource type with an integer ID of RT_RCDATA (declared in Types unit).</p>
<p>Try accessing it this way:</p>
<pre><code>rc := tResourceStream.Create(hInstance,'LOGO_GIF', MakeIntResource(RT... | <p>If I remember correctly you are actually dealing with an instance of the web server, not the dll. I don't remember the work around though, but that is the explanation for why that doesn't work. Hopefully someone else can build off of this.</p>
| 11,519 |
<p>The array has lots of data and I need to delete two elements. </p>
<p>Below is the code snippet I am using,</p>
<pre><code>my @array = (1,2,3,4,5,5,6,5,4,9);
my $element_omitted = 5;
@array = grep { $_ != $element_omitted } @array;
</code></pre>
| <p>Use splice if you already know the index of the element you want to delete.</p>
<p>Grep works if you are searching.</p>
<p>If you need to do a lot of these, you will get much better performance if you keep your array in sorted order, since you can then do binary search to find the necessary index.</p>
<p>If it ma... | <p>If you know the array index, you can <a href="http://perldoc.perl.org/functions/delete.html" rel="nofollow noreferrer">delete()</a> it. The difference between splice() and delete() is that delete() does not renumber the remaining elements of the array.</p>
| 20,999 |
<p>I am trying to display a pie chart that shows sales by company. However there are a lot of companies that only have a tiny sales which makes the pie chart look rubbish. </p>
<p>Is there a way to group companies like this into a single "Other" category?</p>
| <p>Chart Expert -> Data then select your "on change of" field then click the TopN button. From here you can specify what to do with the smaller amounts. I usually group together the bottom 5% into an "other" group.</p>
| <p>You could always make two pie charts from your data - one showing the main players and the other showing a blow-up of your smaller company data.</p>
| 45,884 |
<p>What considerations do I need to make if I want my code to run correctly on both 32bit and 64bit platforms ?</p>
<p>EDIT: What kind of areas do I need to take care in, e.g. printing strings/characters or using structures ?</p>
| <p>Options:</p>
<p>Code it in some language with a <a href="http://en.wikipedia.org/wiki/Virtual_machine" rel="nofollow noreferrer">Virtual Machine</a> (such as Java)</p>
<p>Code it in .NET and don't target any specific architecture. The <a href="http://www.dotnet-guide.com/jit.html" rel="nofollow noreferrer">.NET JI... | <p>I assume you are still talking about <em>compiling</em> them separately for each individual platform? As running them on both is completely doable by just creating a 32bit binary.</p>
| 5,247 |
<p>When you login to Stackoverflow you see a button with the openID logo between the text input field and the submit button.</p>
<p>When you click this button you get a dropdown with the main openID providers. This is an integrated 3rd party service called 'ID selector' which has been deprecated in favour of it's succ... | <p>Thanks for the kind word on RPX. Translations are on the shortterm roadmap.</p>
<p>UPDATE: Translations have been implemented.</p>
| <p>You might want to check out DotNetOpenID which I started incorporating in <a href="http://stacked-ra.ajax.org" rel="nofollow noreferrer">Stacked</a> yesterday in fact. I haven't gotten to play much around with it, and obviously I don't care about anything else then English (yet at least) but it seems promising... :)... | 42,120 |
<p>What are the benefits of doing static code analysis on your source code? I was playing around with FxCop and I was wondering if there any benefits beyond making sure you are following the coding standards. </p>
| <p>There are all kinds of benefits:</p>
<ol>
<li>If there are anti-patterns in your code, you can be warned about it.</li>
<li>There are certain metrics (such as McCabe's Cyclomatic Complexity)
that tell useful things about source code.</li>
<li>You can also get great stuff like call-graphs, and class diagrams
from st... | <p>actually, fxcop doesn't particularly help you follow a coding standard. What it does help you with is designing a well-thought out framework/API. It's true that parts of the coding standard (such as casing of public members) will be caught by FxCop, but coding standards isn't the focus.</p>
<p>coding standards ca... | 12,975 |
<p>I've got a PHP script that needs to invoke a shell script but doesn't care at all about the output. The shell script makes a number of SOAP calls and is slow to complete, so I don't want to slow down the PHP request while it waits for a reply. In fact, the PHP request should be able to exit without terminating the s... | <p>If it "doesn't care about the output", couldn't the exec to the script be called with the <code>&</code> to background the process?</p>
<p><strong>EDIT</strong> - incorporating what @<a href="https://stackoverflow.com/users/1103/adamthehutt">AdamTheHut</a> commented to this post, you can add this to a call to <... | <p>I can not use <code> > /dev/null 2>/dev/null &</code> on Windows, so I use <code>proc_open</code> instead. I run PHP 7.4.23 on Windows 11.</p>
<p>This is my code.</p>
<pre class="lang-php prettyprint-override"><code>
function run_php_async($value, $is_windows)
{
if($is_windows)
{
$command =... | 27,439 |
<p>I have two tables. Club and Coach.
Between them is 0,1 - 0,1 relationship (coach can have zero or one club. club can have zero or one coach).
When I want to change the coach of the given club, i have to update the club table. So i have to change idCoach of that club. Lets consider a new coach (the newly assigned coa... | <p>I suggest this might not be an appropriate use for triggers, which are very difficult to debug, and often surprise people by the way they don't support single-record operations as you would expect. Break it down into simple SQL statements and wrap a transaction around it instead.</p>
| <p>I recommend avoiding triggers if you can. If you must try and use Instead of triggers instead of normal triggers. The difference is instead of triggers fire before any data is actually modified. With that said I think your much better off using stored procedures, and looking to see if you </p>
<p>Another suggestion... | 38,051 |
<p>Vista SP1
Visual Studio 2008 SP1
.NET 3.5 SP1
C#</p>
<p>I have a winforms app I'm playing with that uses a SerialPort object as a private variable. When the application is compiled and executed, it works great. It also works running in debug mode wihtout any breakpoints. 90% of the time when I stop at a breakpoint ... | <p>I had the same problem just this morning. Surprisingly, it simply has gone away when I DISABLED the following options in VS2008 Tools->Options->Debugging->General:</p>
<ul>
<li>"Enable the exception assistant"</li>
<li>"Enable .NET Framework source stepping"</li>
<li>"Step over properties and operators"</li>
<li>"E... | <p>Well I'm not so sure this is an answer, but there was definately something about that project. It was originally written in 2.0 and converted to 3.5 by VS2008. I created a new project in C#-Express 2008 adding the original classes one-by-one and it works like a charm now! No idea what is different.</p>
| 37,043 |
<p>What is the best way to detect if a user leaves a web page?</p>
<p>The <code>onunload</code> JavaScript event doesn't work every time (the HTTP request takes longer than the time required to terminate the browser).</p>
<p>Creating one will probably be blocked by current browsers.</p>
| <p>Try the <code>onbeforeunload</code> event: It is fired just before the page is unloaded. It also allows you to ask back if the user really wants to leave. See the demo <em><a href="https://web.archive.org/web/20211028110528/http://www.4guysfromrolla.com/demos/OnBeforeUnloadDemo1.htm" rel="noreferrer">onbeforeunload ... | <p>For What its worth, this is what I did and maybe it can help others even though the article is old.</p>
<p>PHP:</p>
<pre><code>session_start();
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR'];
if(isset($_SESSION['userID'])){
if(!strpos($_SESSION['activeID'], '-')){
$_SESSION['activeID'] = $_SESSION[... | 17,773 |
<p>My organization is starting to take SOA seriously but before we jump in one of the components we seem to be missing is a rock solid repository for tracking these services across the enterprise. Can anyone suggest a product that they have worked with? If the product is also an ESB please mention that in your answer... | <p>You might like to take a look at IBM's WebSphere Service Registry and Repository. It does what you describe (with governance abilities as well), and integrates nicely with IBM's ESB products (although it not one itself).</p>
<p>Please feel free to get in touch if you want to ask any questions.</p>
<p>Disclaimer: I... | <p>I also have worked for IBM and I would stay away from WSRR - it is buggy, immature, expensive and overly complex. I would not recommend it.</p>
| 26,451 |
<p>While working on a project, I came across a JS-script created by a former employee that basically creates a report in the form of</p>
<pre><code>Name : Value
Name2 : Value2
</code></pre>
<p>etc.</p>
<p>The peoblem is that the values can sometimes be floats (with different precision), integers, or even in the form... | <p>You hav to convert your input into a number and then round them:</p>
<pre><code>function toInteger(number){
return Math.round( // round to nearest integer
Number(number) // type cast your input
);
};
</code></pre>
<p>Or as a one liner:</p>
<pre><code>function toInt(n){ return Math.round(Number(n)); ... | <p>Math.floor(19.5) = 19 should also work.</p>
| 30,549 |
<p>From a web developer point of view, what changes are expected in the development arena when Google Chrome is released?</p>
<p>Are the developments powerful enough to make another revolution in the web? Will the way we see web programming change?</p>
<p>Or is it just another web browser?</p>
| <p>I think this is just another web browser. The most impact I expect to be improved Javascript performance, and the usability perspective. The first will benefit developers, especially when using Google Gears. I think the users will benefit the most from an enhanced user experience, the safety features, and ease of us... | <p>@bpapa</p>
<blockquote>
<p>It's just another web browser that
very few people are going to use
because there are already 4 major
browsers out there that work just fine
for most people. It doesn't have the
extensions like Firefox,</p>
</blockquote>
<p>Actually, it is pretty clear that it has a plugin ar... | 6,091 |
<p>I remember looking at D about 2 years ago, and it looked nice, was actually faster than C for some of the typical language benchmarks, and in general seemed ok, but I didn't find any real projects written in D back then, so I just left as a I came. </p>
<p>Now that a few years have passed I was wondering if there h... | <p>Check the projects in <a href="http://www.dsource.org/projects/" rel="noreferrer">DSource</a>.</p>
<p>Give a look also to the <a href="http://www.digitalmars.com/d/dlinks.html" rel="noreferrer">DLinks</a> page.</p>
| <p>look also at <a href="http://code.google.com/hosting/search?q=label:d&btn=Search+Projects" rel="nofollow noreferrer">code.google.com</a> for some more D projects.</p>
| 48,374 |
<p>In the admin interface and newforms there is the brilliant helper of being able to define choices. You can use code like this:</p>
<pre><code>APPROVAL_CHOICES = (
('yes', 'Yes'),
('no', 'No'),
('cancelled', 'Cancelled'),
)
client_approved = models.CharField(choices=APPROVAL_CHOICES)
</code></pre>
<p>t... | <p>In terms of the forms library, you would use the <a href="http://docs.djangoproject.com/en/dev/ref/forms/fields/#multiplechoicefield" rel="noreferrer">MultipleChoiceField</a> field with a <a href="http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.CheckboxSelectMultiple" rel="noreferrer">CheckboxSe... | <p>@JonnyBuchanan gave the right answer.</p>
<p>But if you need this in the django admin for many models, and you're (like me) too lazy to customize a ModelForm and ovverride the right methods inside the ModelAdmin class, you can use this approach:</p>
<p><a href="http://www.abidibo.net/blog/2013/04/10/convert-select... | 17,793 |
<p>im trying to kick off a Runnable classes run method however i keep getting a NullPointerException, Im using WebSpheres commonj.workmanager to get an instance of executorService.this is the code im using.</p>
<pre><code>executorService.execute(new Runnable() {
public void run() {
System.out.println("Ins... | <p>Are you checking whether <code>executorService</code> is null before calling <code>execute()</code>? If not, it sounds like you need to check the WebSphere docs.</p>
| <p>thanks for the reply, its the <code>executorService</code> that is <code>null</code>. Im using Spring to inject the property.</p>
| 38,308 |
<p>I need to deploy a Delphi app in an environment that needs centralized data and file storage system (for document imaging) but has multiple branch offices with relatively poor inter connectivity. I believe a 3 tier database application is the best way to go so I can provide a rich desktop experience with relatively... | <p>Depends if you are tied to remote datasets. If you aren't dataset bound then SOAP would likely be a good choice. Or, what I've done is write my own protocol that is similar to SOAP in nature. This was done before SOAP was standard and I'm glad I did - this gives you the ability to control more of the flow of data... | <p>If you really wanna go "low-bandwidth" use BSD Sockets API - that'll give you full control over what's being sent and there you can send as little information as you want. Of course then you'll have to implement all the tiers yourself, but hey - that's still <em>an option</em> :D</p>
| 47,202 |
<p>When using MySQL full text search in boolean mode there are certain characters like + and - that are used as operators. If I do a search for something like "C++" it interprets the + as an operator. What is the best practice for dealing with these special characters?</p>
<p>The current method I am using is to conver... | <p>There's no way to do this in nicely using MySQL's full text search. What you're doing (substituting special characters with a pre-defined string) is the only way to do it.</p>
<p>You may wish to consider using <a href="http://www.sphinxsearch.com/" rel="noreferrer">Sphinx Search</a> instead. It apparently supports ... | <p>MySQL is fairly brutal in what tokens it ignores when building its full text indexes. I'd say that where it encountered the term "C++" it would probably strip out the plus characters, leaving only C, and then ignore that because it's too short. You could probably configure MySQL to include single-letter words, but... | 37,042 |
<p>I have a factory that returns an interface <code>FormatService</code>: </p>
<pre><code>public class FormatServiceFactory {
public FormatService getService() {
...
}
}
</code></pre>
<p>Is it possible to mock out this factory so that it will always return a stub implementation of <code>FormatService... | <p>Depends. How is the factory obtained/used by the code under test? </p>
<p>If it's instantiated explicitly in the methods you're testing, or if it's a static factory, you won't be able to mock it. </p>
<p>If it's injected into the object under test, you can create and inject the mocked factory before executing t... | <p>Mockery mockery = new JUnit4Mockery() {{setImposteriser(ClassImposteriser.INSTANCE);}};</p>
<p>final FormatServiceFactory factory = mockery.mock(FormatServiceFactory .class);</p>
<p>context.checking(new Expectations() {{
oneOf (factory ).getService(); will(returnValue(new FormatServiceMock()));
}});</p>
| 35,327 |
<p>We are building an application on an embedded platform that needs a reasonably high performance database (very low select speeds on tables with > 500,000 entries).<br>
<br>
The database needs to be able to :
<li> Store atomic commit information in NVRAM so that such information is preserved if power fails before the... | <p>Apple's iPhone (and iPod Touch) uses the SQLite DB for a lot of its functions, so there's definitely a proven flash-based platform there. However, I doubt the amount of data in any of those tables has > 500k rows.</p>
| <p>Codebase provides a solid portable lightweight fast isam with transactions.</p>
| 47,611 |
<p>Alan Kay was quoted several years ago to the effect that there had been only three new things in software in the preceding 20 years (effectively the lifespan of PCs). One of them was Spreadsheets.</p>
<p>Does anyone remember the other two?</p>
<p>Who is Alan Kay? (a few may ask.) His work at Xerox Parc arguably di... | <p>I will try to remember what I said, but none of the answers so far are correct (every one of them was done in the 60s and 70s before the commercialization of PCs in the 80s).</p>
<p>However, we could start all over and try to think of <a href="https://stackoverflow.com/q/432922/1288">new inventions in computing sin... | <p>Mice and GUI's</p>
| 46,659 |
<p>How can I print a message to the error console, preferably including a variable? </p>
<p>For example, something like:</p>
<pre><code>print('x=%d', x);
</code></pre>
| <p>Install <a href="http://en.wikipedia.org/wiki/Firebug_(software)" rel="noreferrer">Firebug</a> and then you can use <code>console.log(...)</code> and <code>console.debug(...)</code>, etc. (see <a href="http://getfirebug.com/wiki/index.php/Console_Panel#Message_types" rel="noreferrer">the documentation</a> for more).... | <p>This does not print to the Console, but will open you an alert Popup with your message which might be useful for some debugging:</p>
<p>just do:</p>
<pre><code>alert("message");
</code></pre>
| 19,877 |
<p>What are (if any)the implied assumptions or restrictions and the differences of designing like:</p>
<p>A) this:</p>
<pre><code>class SampleClass1
{
IWorker workerA;
IWorker workerB;
void setWorkerA(IWorker w);
void setWorkerB(IWorker w);
WorkResult doWork();
}
</code></pre>
<p>B) versus this:... | <p>In option (A) you are creating what is known as a Function Object or Functor, this is a design pattern that is <a href="http://en.wikipedia.org/wiki/Function_object" rel="noreferrer">well documented</a>. </p>
<p>The two main advantages are:</p>
<ul>
<li>The workers can be set by in one place and then the object us... | <p>Another Option:</p>
<p>IWorker class:</p>
<p>static WorkResult doWork(Iworker a, Iworker b);</p>
| 16,751 |
<p>I am looking for a taxonomy of embedded processors. Which processors belong to which families? Who decends from whom?</p>
<p>Does anyone here know of a simple article that describes it?</p>
| <p>The <a href="http://en.wikipedia.org/wiki/List_of_common_microcontrollers" rel="nofollow noreferrer">Common Microcontrollers</a> page on Wikipedia may be a place to start, or <a href="http://en.wikipedia.org/wiki/Microcontroller#Types_of_microcontrollers" rel="nofollow noreferrer">this shorter list</a> in the Microc... | <p><a href="http://www.instructables.com/id/ESICJ1VA2EEWIJKVP2/" rel="nofollow noreferrer">Instructables</a> has a nice overview.</p>
| 48,674 |
<p>What's a simple/easy way to access the system clock using Java, so that I can calculate the elapsed time of an event?</p>
| <p>I would avoid using <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#currentTimeMillis--" rel="noreferrer"><code>System.currentTimeMillis()</code></a> for measuring elapsed time. <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#currentTimeMillis--" rel="noreferrer"><co... | <p>Here is a small StopWatch class I wrote using the System.nanoTime() as suggested in the answer from Leigh:</p>
<pre><code>public class StopWatch {
// Constructor
public StopWatch() {
}
// Public API
public void start() {
if (!_isRunning) {
_startTime = System.nanoTime();
... | 29,558 |
<p>My company has a subsidiary with a slow Internet connection. Our developers there suffer to interact with our central <a href="http://en.wikipedia.org/wiki/Subversion_%28software%29" rel="noreferrer">Subversion</a> server. Is it possible to configure a slave/mirror for them? They would interact locally with the ser... | <p>It is possible but not necessarily simple: the problem you are trying to solve is dangerously close to setting up a distributed development environment which is not exactly what SVN is designed for.</p>
<p><strong>The SVN-mirror way</strong></p>
<p>You can use <code>svn mirror</code> as explained in the SVN book d... | <p>VisualSVN Server's <a href="http://www.visualsvn.com/server/features/multisite-replication/" rel="nofollow noreferrer">Multisite Repository Replication</a> was designed for this case.</p>
<p>You can keep the master repository in your main office and setup multiple writeable slave repositories at the remote location... | 17,289 |
<p>I'm working on a cross platform application in Java which currently works nicely on Windows, Linux and MacOS X. I'm trying to work out a nice way to do detection (and handling) of 'crashes'. Is there an easy, cross-platform way to detect 'crashes' in Java and to do something in response?</p>
<p>I guess by 'crashes'... | <p>For simple catch-all handling, you can use the following static method in <a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html" rel="nofollow noreferrer">Thread</a>. From the Javadoc:</p>
<blockquote>
<p>static void <a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#setDefaultUnc... | <p>Not sure if this is what you needing, but you can also detect if an exception has occurred from within your native code. See <a href="http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/functions.html#wp5234" rel="nofollow noreferrer">http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/functions.htm... | 8,699 |
<p>I have a column which is of type nvarchar(max). How do I find the length of the string (or the number of bytes) for the column for each row in the table?</p>
| <blockquote>
<p>SELECT LEN(columnName) AS MyLength
FROM myTable</p>
</blockquote>
| <p>If you want to find out the max there should be a way for you to get the schema of the table. Normally you can do something like <a href="http://dev.mysql.com/doc/refman/5.0/en/show-columns.html" rel="nofollow noreferrer">SHOW COLUMNS</a> in SQL or a <a href="http://dev.mysql.com/doc/refman/5.0/en/describe.html" re... | 5,719 |
<p>I want to pass the params collection from the controller to the model to parse filtering and sorting conditions. Does having a method in the model that takes the params from the controller break MVC?</p>
| <p>It depends. You are passing a hash of data to the model and saying "make sense of this".</p>
<pre><code>class Model < ActiveRecord::Base
def update_from_params(params)
....
end
end
class ModelsController < ActionController::Base
def update
...
@model.update_from_params(params)
end
end
</c... | <p>I don't believe it does, but then again I am not a rails veteran by any means. Typically, the params hash is used in the controller and that action may or may not read and write model information, so I guess if the params were to go through a method belonging to the model, it would be the same thing.</p>
<p>Either... | 44,778 |
<p>Is it possible to get a breakdown of CPU utilization <strong>by database</strong>?</p>
<p>I'm ideally looking for a Task Manager type interface for SQL server, but instead of looking at the CPU utilization of each PID (like <code>taskmgr</code>) or each SPID (like <code>spwho2k5</code>), I want to view the total CP... | <p>Sort of. Check this query out:</p>
<pre><code>SELECT total_worker_time/execution_count AS AvgCPU
, total_worker_time AS TotalCPU
, total_elapsed_time/execution_count AS AvgDuration
, total_elapsed_time AS TotalDuration
, (total_logical_reads+total_physical_reads)/execution_count AS AvgReads
, (total_logical... | <p>Take a look at <a href="http://www.sqlsentry.com/" rel="nofollow noreferrer">SQL Sentry</a>. It does all you need and more.</p>
<p>Regards,
Lieven</p>
| 4,862 |
<p>I'm working on a site similar to digg in the respect that users can submit "stories". </p>
<p>I keep track of how many "votes" and "similar adds" each item got. Similar adds are defined as two users adding the same "link". </p>
<p>Here is <em>part</em> of the algorithm (essentially the most important):</p>
<pre><... | <p>Try this one: everyone has one vote. Your vote sticks to the last thing you voted for. The time thing would come from user behaviour.</p>
| <p>There wouldn't be a need to execute SQL 10 times to get the result, you could get it in one execution something like:</p>
<pre><code>select sum(dayval)
from
( select count(*) / (current_date-day+1) dayval
from votes
where story_id = 123
and day >= current_date - 9
group by (current_date-day+1)
)
</code><... | 48,090 |
<p>Distributing ASP.NET user controls across different projects can be really useful when you want to create a library of controls that can be used by different projects.</p>
<p>Unfortunately, to my knowledge, ASP.NET (2.0 at least) doesn't support this very cleanly.</p>
<p>The only technique I know of is to add the ... | <p>You could check out this article by Scott Guthrie:</p>
<p><a href="http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx" rel="nofollow noreferrer">Building Re-Usable ASP.NET User Control and Page Libraries with VS 2005</a></p>
| <p>Check this out: <a href="http://support.microsoft.com/kb/324785" rel="nofollow noreferrer">How to share ASP.NET pages and user controls between applications by using Visual C# .NET</a></p>
<p>You'll find other resources like this at Google.</p>
| 41,908 |
<p>I run into this occasionally and always forget how to do it.</p>
<p>One of those things that pop up ever so often.</p>
<p>Also, what's the formula to convert angles expressed in radians to degrees and back again?</p>
| <pre><code>radians = degrees * (pi/180)
degrees = radians * (180/pi)
</code></pre>
<p>As for implementation, the main question is how precise you want to be about the value of pi. There is some related discussion <a href="https://stackoverflow.com/questions/19/fastest-way-to-get-value-of-pi">here</a></p>
| <pre><code>radians = (degrees/360) * 2 * pi
</code></pre>
| 16,453 |
<p>I am using <a href="http://www.simpletest.org/" rel="nofollow noreferrer">Simpletest</a> as my unit test framework for the PHP site I am currently working on. I like the fact that it is shipped with a simple HTML reporter, but I would like a bit more advanced reporter.</p>
<p>I have read the reporter API documentat... | <p>If you are talking about the python interpreter or CMD.exe that is the 'parent' of your script then no, it isn't possible. In every POSIX-like system (now you're running Windows, it seems, and that might have some quirk I don't know about, YMMV) each process has three streams, standard input, standard output and sta... | <p>In which context are you asking?</p>
<p>Are you trying to capture the output from a program you start on the command line?</p>
<p>if so, then this is how to execute it:</p>
<pre><code>somescript.py | your-capture-program-here
</code></pre>
<p>and to read the output, just read from standard input.</p>
<p>If, on ... | 4,458 |
<p>Is it possible to listen for a certain hotkey (e.g:<kbd>Ctrl</kbd><kbd>-</kbd><kbd>I</kbd>) and then perform a specific action? My application is written in C, will only run on Linux, and it doesn't have a GUI. Are there any libraries that help with this kind of task?</p>
<p>EDIT: as an example, amarok has global s... | <p>How global do your hotkeys need to be? Is it enough for them to be global for a X session? In that case you should be able to open an Xlib connection and listen for the events you need.</p>
<p>Ordinarily keyboard events in X are delivered to the window that currently has the focus, and propagated up the hierarchy... | <p>In UNIX, your access to a commandline shell is via a <strong>terminal</strong>. This harks back to the days when folks accessed their big shared computers literally via terminals connected directly to the machines (e.g. by a serial cable).</p>
<p>In fact, the 'xterm' program or whatever derivative you use on your U... | 10,042 |
<p>Let's collect some tips for evaluating the appropriate use of global.asax.</p>
| <p>It's simple to use if your session and application initialization code is very small and application-specific. Using an HttpModule is more useful if you want to reuse code, such as setting up rules for URL rewriting, redirects or auth. An HttpModule can cover everything a Global.asax file can. They can also be re... | <p>Global.asax can inherit from your own class that inherits httpapplication. Gives you more options as well as putting the bulk of the code you might have in global into a class library.</p>
<p>EDIT: Having your HttpApplication class (global.asax parent) in a seperate class library can promote reusability too. Althou... | 16,426 |
<p>I have a need to allow for a user to download an event that has multiple meeting dates. To do this I have created a memorystream to be downloaded which produces a .ics file. For example:</p>
<pre>
BEGIN:VCALENDAR
PRODID:-//Company//Product//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
SUMMARY:Subject of Event
LOCAT... | <p>I don't think this will work. Outlook is limited in importing those "open" specs. I had a similar problem trying to import a vCard file with multiple contacts. I ended up splitting the file and writing a script in Outlook to import all the files in a directory.</p>
| <p>This works: Take the ICS file, drag & drop on the calendar button in Outlook (bottom left corner on mine). That adds multiple entries to the default calendar, without any prompting when an ICS file contains multiple vevents. Updates & deletes of multiples are my next challenge.</p>
<p>Double clicking the sa... | 43,346 |
<p>The documentation available on the <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/boost_asio.html" rel="noreferrer">boost website</a> is... limited.</p>
<p>From what I've been able to read, the general consensus is that it is simply difficult to find good documentation on the boost::asio library.</p>
<p>Is... | <p>First, I've been using Boost.Asio for quite a while already -- and I share your concern. To address your question:</p>
<ul>
<li>There really is very scarce documentation about Boost.Asio aside from the introduction and tutorial. I am not the author, but this is mostly because there are just too many things to docum... | <p>I stumbled on the following pdf:
<a href="http://boost.cowic.de/rc/pdf/asio_doc.pdf" rel="nofollow noreferrer">http://boost.cowic.de/rc/pdf/asio_doc.pdf</a></p>
| 30,315 |
<p>The only method provided by the DNN framework to get a module by ID also required a tab ID. What can I do if I don't <em>have</em> a tab ID?</p>
| <p>The GetModule method off of the DotNetNuke.Entities.Modules.ModuleController class will accept a "null" value for tab ID if you don't have a tab ID. That is, try the following:</p>
<pre><code>new ModuleController().GetModule(moduleId, DotNetNuke.Common.Utilities.Null.NullInteger)
</code></pre>
<p>See also <a href... | <p>Brian, I just took a look at the code for GetModule(), and there isn't any specific VB code in the framework that checks for the tabid being null. What's interesting though is that the stored procedure that is part of the SqlDataProvider selects rows from the Modules view that have a matching moduleid, no matter wha... | 30,822 |
<p>I've got a div that contains some content that's being added and removed dynamically, so its height is changing often. I also have a div that is absolutely positioned directly underneath with javascript, so unless I can detect when the height of the div changes, I can't reposition the div below it.</p>
<p>So, how c... | <p>I wrote a plugin sometime back for <strong><a href="http://meetselva.github.io/attrchange/">attrchange</a></strong> listener which basically adds a listener function on attribute change. Even though I say it as a plugin, actually it is a simple function written as a jQuery plugin.. so if you want.. strip off the plu... | <p>You can use this, but it only supports Firefox and Chrome.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(element).bind('DOMSubtreeModified', function () {
var $th... | 20,821 |
<p>I am building a multithreaded system that works like this:</p>
<p>While there are entities:</p>
<ol>
<li><p>Gets an entity from nHibernate (using the current session)</p></li>
<li><p>Starts a new thread that will work with this entity*</p></li>
</ol>
<p>When I start this new thread, it is required to have a new S... | <p>If you're working with detached objects, you will have to reattach them to the session. You can do that if you have the correct Hibernate ids of the objects you're working with, calling a get, and then merging your copy with the one Hibernate just put into session. Make sure you use merge, though, because saveOrUpda... | <p>I detached it from the first thread, after attaching to the other thread.</p>
| 34,335 |
<p>In the Render method of an ASP.NET web-control, I need to alter the output of the Html based on whether JavaScript is enabled or disabled on the clients browser,</p>
<p>Does anyone know the right incantation to figure that out?</p>
| <p>The problem with using script to check whether javascript is enabled is that you only find that out after the script hasn't run.</p>
<p>Some solutions try the opposite - they use javascript to set a value and then supply Javascript enabled controls if that value is later detected. However, this fails with javascri... | <p>This is a way to check when a form is being submitted. </p>
<p><a href="https://web.archive.org/web/20210428071600/http://www.4guysfromrolla.com/webtech/082400-1.shtml" rel="nofollow noreferrer">https://web.archive.org/web/20210428071600/http://www.4guysfromrolla.com/webtech/082400-1.shtml</a></p>
<p>I dont think ... | 30,594 |
<p>I like Doxygen to create documentation of C or PHP code. I have an upcoming Python project and I think I remember that Python doesn't have <code>/* .. */</code> comments, and also has its own self-documentation facility which seems to be the pythonic way to document.</p>
<p>Since I'm familiar with Doxygen, how can I... | <p>This is <a href="http://www.doxygen.nl/manual/docblocks.html#pythonblocks" rel="noreferrer">documented on the doxygen website</a>, but to summarize here:</p>
<p>You can use doxygen to document your Python code. You can either use the Python documentation string syntax:</p>
<pre><code>"""@package docstring
Document... | <p>An other very good documentation tool is <a href="http://www.sphinx-doc.org/en/master/index.html" rel="nofollow noreferrer">sphinx</a>. It will be used for the upcoming python 2.6 <a href="http://docs.python.org/dev/" rel="nofollow noreferrer">documentation</a> and is used by <a href="http://docs.djangoproject.com/e... | 8,303 |
<p>How can I run a stored procedure from a CL program? RUNSQLSTM requires a source member, but I just want to build a command so users can pass in variables easily, so this won't work.</p>
| <p>You can call the system program <code>QZDFMDB2</code> and pass it one parameter with the SQL string to execute. In this case the SQL string is the call to your stored procedure:</p>
<pre><code> CALL PGM(QZDFMDB2) PARM('CALL PROCEDURE (''XYZ'', ''ABC'')')
</code></pre>
<p>To substitute in your values use a variab... | <p><code>QCMDEXC</code> might be the command you are looking for.</p>
| 30,706 |
<p>We use ASP.NET, C#</p>
<p>When making an update to one of our websites, we roll out the entire site rather than updating just the pages or sections that have changed. This scares me.</p>
<p>Is this a good idea? Should I roll out only the changes? </p>
<p>Should I break my site into smaller projects? </p>
<p>What... | <p>You should always roll out the entire site. Because the actually executable code is contained mostly in the DLLs, you can't actually only roll out the pages that changed, like you could with the old ASP. If there are parts of your website that are actually separate, you can break them apart into separate projects, ... | <p>Depends on how you test prior to deployment.</p>
<p>If you (automatically) test everything prior to release, isn't the only downside the overhead of the file transfer.</p>
| 30,222 |
<p>I have a "settings file" in my Winforms application called Settings.settings with a partial class for custom methods, etc. Is there a way to load / save dynamic settings based on arbitrary keys?</p>
<p>For example, I have some ListViews in my application in which I want to save / load the column widths; Instead of ... | <p>Store your column width settings in an Xml Serializable object. Ie, something that implements <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.aspx" rel="nofollow noreferrer">IXmlSerializable</a> then create a single setting entry of that type in Settings.settings.</p>
<p>... | <p>I think the error</p>
<blockquote>
<p>The settings property
'key' was not found.</p>
</blockquote>
<p>occurs because the 'key' value does not exist in your settings file (fairly self-explanatory).</p>
<p>As far as I am aware, you can't add settings values programmatically, you might need to investigate adding... | 24,568 |
<p>I'm curious about people's experiences using AR's to_xml() to build non-entity fields (as in, not an attribute of the model you are serializing, but perhaps, utilizing the attributes in the process) from a controller. </p>
<p>to_xml seems to supply a few options for doing this. </p>
<p>One is by passing in refer... | <p>Yes, an abstract class can have a constructor. Consider this:</p>
<pre><code>abstract class Product {
int multiplyBy;
public Product( int multiplyBy ) {
this.multiplyBy = multiplyBy;
}
public int mutiply(int val) {
return multiplyBy * val;
}
}
class TimesTwo extends Product {
... | <p>Yes..It is like any other class. It can have a constructor and it is called after creating object for the base class.</p>
| 32,593 |
<p>What's the best way to throw an exception in objective-c/cocoa?</p>
| <p>I use <code>[NSException raise:format:]</code> as follows:</p>
<pre><code>[NSException raise:@"Invalid foo value" format:@"foo of %d is invalid", foo];</code></pre>
| <p>There is no reason not to use exceptions normally in objective C even to signify business rule exceptions. Apple can say use NSError who cares. Obj C has been around a long time and at one time ALL C++ documentation said the same thing. The reason it doesnt matter how expensive throwing and catching an exception i... | 41,996 |
<p>I wrote a program using AutoIT to fetch information from a number of websites using Internet Explorer. AutoIT is capable of hiding the window so that it is not visible, however when I navigate to a new website on that hidden window I still get the IE navigation sounds (button click sound, etc.).</p>
<p>How can I di... | <pre><code>(data.RoleOwners.length === 0)
</code></pre>
| <p>An array (being an object too) can have non numeric properties which are not picked up by testing for zero length. You need to iterate through the properties just like testing for an empty object. If there are no properites then the array is empty.</p>
<pre><code>function isEmptyObject(obj) {
// This works for a... | 43,421 |
<p>does anybody know how could I get the TWO most largest values from the third column on the following array?</p>
<pre><code>$ar = array(array(1, 1, 7.50, 'Hello'),
array(1, 2, 18.90, 'Hello'),
array(3, 5, 11.50, 'Hello'),
array(2, 4, 15.90, 'Hello'));
</code></pr... | <p>If you're sure that the value (two) will never change, just iterate over the array and keep track of the two largest numbers. If not, sort the arrays using <a href="http://www.php.net/manual/en/function.usort.php" rel="nofollow noreferrer"><code>usort</code>()</a> and providing an appropriate callback. Then take the... | <p>One of the simplest ways to do this is to collect all the values into a single array, sort the array, then print out the first two values.</p>
<p>There are more efficient ways that don't involve sorting the whole array, but the above should get you started.</p>
| 31,800 |
<p>In Flash when you set text in a TextField object with the htmlText property, changing the alpha value no longer works. Is there a way around that?</p>
| <p>Some confusion here.</p>
<ol>
<li><p>Whether alpha works or not depends on whether the text field uses device fonts, not whether it uses HTML. (Device fonts are used any time you have a dynamic/input text and you don't embed the font.)</p></li>
<li><p>If possible, simply publish for Flash player 10, which now suppo... | <p>Dynamic text doesn't support the alpha property (among others). I assume setting it to HTML text imposes the same limits. One way I've found around this is to contain the text field in a movie clip and set the alpha on the movie clip instead.</p>
| 42,343 |
<p>I am writing a page where I need an HTML table to maintain a set size. I need the headers at the top of the table to stay there at all times but I also need the body of the table to scroll no matter how many rows are added to the table. Think a mini version of excel. This seems like a simple task but almost every so... | <p>I had to find the same answer. The best example I found is <a href="http://www.cssplay.co.uk/menu/tablescroll.html" rel="noreferrer">http://www.cssplay.co.uk/menu/tablescroll.html</a> - I found example #2 worked well for me. You will have to set the height of the inner table with Java Script, the rest is CSS.</p>
| <p>If its ok to use JavaScript here is my solution
Create a table set fixed width on all columns (pixels!) add the class Scrollify to the table and add this javascript + jquery 1.4.x set height in css or style!</p>
<p>Tested in: Opera, Chrome, Safari, FF, IE5.5(<strong>Epic script fail</strong>), IE6, IE7, IE8, IE9</p... | 15,853 |
<p>Are there any good JavaScript frameworks out there which primary audience is not web programming? Especially frameworks/libraries which improves the object orientation?
The framework should be usable within an desktop application embedding a JavaScript engine (such as Spidermonkey or JavaScriptCore), so no external ... | <p><a href="http://dojotoolkit.org/" rel="nofollow noreferrer">Dojo</a> can be used (and is used) in non-browser environments (e.g., Rhino, Jaxer, SpiderMonkey). It can be easily adapted for other environments too — all DOM-related functions are separated from functions dealing with global language features.</p>
... | <p><a href="http://cappuccino.org/learn/tutorials/objective-j-tutorial.php" rel="nofollow noreferrer">Objective-J</a>(avascript) is one. Is that the kind of thing you are looking for?</p>
| 41,343 |
<p>I'm trying to define a table to store student grades for a online report card. I can't decide how to do it, though.</p>
<p>The grades are given by subject, in a trimestral period. Every trimester has a average grade, the total missed classes and a "recovering grade" (I don't know the right term in English, but it's... | <p>You could try structuring it like this with your tables. I didn't have all the information so I made some guesses at what you might need or do with it all.</p>
<p>TimePeriods:</p>
<ul>
<li>ID(INT) </li>
<li>PeriodTimeStart(DateTime)</li>
<li>PeriodTimeEnd(DateTime)</li>
<li>Name(VARCHAR(50)</li>
</ul>
<p>Student... | <p>I think the best solution is to store one row per period. So you'd have a table like:</p>
<pre><code>grades
------
studentID
periodNumber
averageGrade
missedClasses
recoveringGrade
</code></pre>
<p>So if it's 2 semesters, you'd have periods 1 and 2. I'd suggest using period 0 to mean "overall for the year".</p>
| 31,718 |
<p>I have a Windows application that uses a .NET PropertyGrid control. Is it possible to change the type of control that is used for the value field of a property?</p>
<p>I would like to be able to use a RichTextBox to allow better formatting of the input value.
Can this be done without creating a custom editor class... | <p>To add your own custom editing when the user selects a property grid value you need to implement a class that derives from UITypeEditor. You then have the choice of showing just a small popup window below the property area or a full blown dialog box.</p>
<p>What is nice is that you can reuse the existing implementa... | <p>I think what you are looking for is Custom Type Descriptors.
You could read up a bit and get started here: <a href="http://www.codeproject.com/KB/miscctrl/bending_property.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/miscctrl/bending_property.aspx</a></p>
<p>I am not sure you can do any control you... | 9,810 |
<p>If you have Mathematica code in foo.m, Mathematica can be invoked with <code>-noprompt</code>
and with <code>-initfile foo.m</code>
(or <code>-run "<<foo.m"</code>)
and the command line arguments are available in <code>$CommandLine</code> (with extra junk in there) but is there a way to just have some mathemat... | <p>MASH -- Mathematica Scripting Hack -- will do this.</p>
<p>Since Mathematica version 6, the following perl script suffices:</p>
<p><a href="http://ai.eecs.umich.edu/people/dreeves/mash/mash.pl" rel="nofollow noreferrer">http://ai.eecs.umich.edu/people/dreeves/mash/mash.pl</a></p>
<p>For previous Mathematica versi... | <p>For mathematica 7</p>
<pre><code>$ cat test.m
#!/bin/bash
MathKernel -noprompt -run < <( cat $0| sed -e '1,4d' ) | sed '1d'
exit 0
### code start Here ... ###
Print["Hello World!"]
X=7
X*5
</code></pre>
<p>Usage:</p>
<pre><code>$ chmod +x test.m
$ ./test.m
"Hello World!"
7
35
</code></pre>
| 17,836 |
<p>How do I determine if the currency symbol is supposed to be on the left or right of a number using CFLocale / CFNumberFormatter in a Mac Carbon project?</p>
<p>I need to interface with a spreadsheet application which requires me to pass a number, currency symbol, currency symbol location and padding instead of a CS... | <p>As a workaround, I have started to create a string representing a currency value and determining the position of the currency symbol by searching the string, but this sure looks fishy to me.</p>
<pre><code> CFNumberFormatterRef numberFormatter = CFNumberFormatterCreate(kCFAllocatorDefault, CFLocaleCopyCurrent(),... | <p>You could try inspecting the format string returned from <code>CFNumberFormatterGetFormat</code>. It <a href="http://unicode.org/reports/tr35/tr35-6.html#Number_Format_Patterns" rel="nofollow noreferrer">looks like</a> you want to search for <code>¤</code> which is <code>\u00A4</code>.</p>
| 24,185 |
<p>I know this is particularly difficult with CSS and the current set of browsers, but nonetheless I have the requirement.</p>
<p>I need to be able to have 3 divs in a column. Each div should be able to take up a certain percentage of the vertical space (for example, 33%). The contents of each div <em>could</em> end u... | <p>Maybe I'm missing something, but given:</p>
<pre><code> <div id="column">
<div id="a" class="cell">A</div>
<div id="b" class="cell">B</div>
<div id="c" class="cell">C</div>
</div>
</code></pre>
<p>What's wrong with:</p>
<pre><code> #column
{
... | <p>The following renders properly on IE7, Firefox 3, and Google Chrome, now that I've fixed the boneheaded error in the CSS:</p>
<pre><code><html>
<head>
<style type="text/css">
#one {height: 33%; overflow: auto;}
#two {height: 33%; overflow: auto;}
#three {height: 33%; overflow: auto;}
</style>... | 46,034 |
<p>I often run into the following problem.</p>
<p>I work on some changes to a project that require new tables or columns in the database. I make the database modifications and continue my work. Usually, I remember to write down the changes so that they can be replicated on the live system. However, I don't always reme... | <p>In Ruby on Rails, there's a concept of a <a href="http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations" rel="noreferrer">migration</a> -- a quick script to change the database.</p>
<p>You generate a migration file, which has rules to increase the db version (such as adding a column) and rules to downgrad... | <p>In the absence of a VCS for table changes I've been logging them in a wiki. At least then I can see when and why it was changed. It's far from perfect as not everyone is doing it and we have multiple product versions in use, but better than nothing.</p>
| 2,280 |
<p>In all the Git tutorials I've read they say that you can do:</p>
<pre><code>git init
git add .
git commit
</code></pre>
<p>When I do that I get a big text file opened up. None of the tutorials seem to address this, so I don't know what to do with the file or what to put in it if anything.</p>
| <p>You're meant to put the commit message in this text file, then save and quit.</p>
<p>You can change the default text editor that git uses with this command:</p>
<pre><code>git config --global core.editor "nano"
</code></pre>
<p>You have to change nano to whatever command would normally open your text editor.</p>
| <p>The following is probably the easiest way to commit all changes:</p>
<pre><code>git commit -a -m "Type your commit message here..."
</code></pre>
<p>Of course there are much more detailed ways of committing, but that should get you started.</p>
| 8,514 |
<p>Every time I create a new project I copy the last project's ant file to the new one and make the appropriate changes (trying at the same time to make it more flexible for the next project). But since I didn't really thought about it at the beginning, the file started to look really ugly.</p>
<p>Do you have an Ant t... | <p>An alternative to making a template is to evolve one by gradually generalising your current project's Ant script so that there are fewer changes to make the next time you copy it for use on a new project. There are several things you can do.</p>
<p>Use ${ant.project.name} in file names, so you only have to mention ... | <p>I used to do exactly the same thing.... then I switched to <a href="http://maven.apache.org/" rel="nofollow noreferrer">maven</a>. Maven relies on a simple xml file to configure your build and a simple repository to manage your build's dependencies (rather than checking these dependencies into your source control s... | 4,785 |
<p>I'm having a lot of trouble printing polypropylene right now, and I think it may have to do with the conditions. I'm using a very thin coat of ABS on the base plate (just as you would do when printing with ABS) in order to promote sticking.</p>
<p>In this following first picture, I attempted with a 240°C tip and a ... | <p>Polypropylene CAN be printed with excellent results, you just need a good filament roll and good printing setup.
A few days ago I read this topic and was kind of afraid of testing it, now I am so happy I tried it.</p>
<p>I am printing the PP filament from the brand Smart Materials 3D (search on google).</p>
<p>I a... | <p>First picture clearly shows that temperature was too hight, second one suggests too small extruding speed (too little) which is connected to your printing speed.</p>
<p>35mm/s is quite slow :)</p>
| 245 |
<p>Simply moving the file to <code>~/.Trash/</code> will not work, as if the file os on an external drive, it will move the file to the main system drive..</p>
<p>Also, there are other conditions, like files on external drives get moved to <code>/Volumes/.Trash/501/</code> (or whatever the current user's ID is)</p>
<... | <p>Alternatively, if you're on OS X 10.5, you could use Scripting Bridge to delete files via the Finder. I've done this in Ruby code <a href="http://osx-trash.rubyforge.org/git?p=osx-trash.git;a=blob;f=bin/trash;h=26911131eacafd659b4d760bda1bd4c99dc2f918;hb=HEAD" rel="noreferrer">here</a> via RubyCocoa. The the gist ... | <p>Another one in ruby:</p>
<pre><code>Appscript.app('Finder').items[MacTypes::Alias.path(path)].delete
</code></pre>
<p>You will need <a href="http://rubygems.org/gems/rb-appscript" rel="nofollow noreferrer">rb-appscript</a> gem, you can read about it <a href="http://appscript.sourceforge.net/rb-appscript/index.html... | 31,064 |
<p>I'm trying to connect my PC to my Anet A8 through <a href="https://www.pronterface.com/" rel="nofollow noreferrer">Pronterface</a> on Ubuntu.</p>
<p>But when I'm clicking on the "connect" button in Pronterface, all I see is "<em>Connecting ...</em>".</p>
<p>What I did so far</p>
<ul>
<li>added my... | <p>I have this printer and used this board many times over USB.</p>
<p>The genuine Arduino boards use the FTDI FT232RL to convert USB signals to UART signals.</p>
<p>The problem with these Arduino based clone boards is that they do not use the FTDI chips as these are too expensive. These boards use a CH340G chip which ... | <p>You may need to install a device driver for the USB interface chip that your printer uses. I'm guessing that the Anet A8 uses a clone of the FTDI FT232RL chip (which was and may still be common with cheap Chinese printers).</p>
<p>If this is the case, you will need to install the appropriate driver from this site: <... | 1,749 |
<p>I have read the following properties from AD,</p>
<pre><code>TerminalServicesProfilePath
TerminalServicesHomeDirectory
TerminalServicesHomeDrive
</code></pre>
<p>I've tried DirectoryEntry and DirectorySearcher. But they does not include the properties.</p>
<p>I found some example in vbscript and VC to read them.
... | <p>I don't remember exactly, but it's something like this:</p>
<pre><code>//user is a DirectoryEntry
IADsTSUserEx adsiUser = (IADsTSUserEx)user.NativeObject;
</code></pre>
<p>then you can get the TerminalServices properties you want via adsiUser.</p>
<p>From my experience you're better off developing on a Windows S... | <p>This works for me:</p>
<pre><code> DirectoryEntry user = new DirectoryEntry("LDAP://" + sLDAP_SERVER + "/cn=" + SAMAccount + "," + sLdapFullPath, sUser, sPwd);
//ActiveDs.IADsUser iADsUser = (ActiveDs.IADsUser)user.NativeObject;
ActiveDs.IADsUser cont = null;
cont = ... | 46,333 |
<p>I've done some Googling, and can't find anything, though maybe I'm just looking in the wrong places. I'm also not very adept at VBA, but I'm sure I can figure it out with the right pointers :)</p>
<p>I have a string I'm building that's a concatenation of various cells, based on various conditions. I hit these in or... | <p>Try:</p>
<pre><code>=IF(ISERROR(FIND("Y",A1)),A1,SUBSTITUTE(A1,"D, ",""))
</code></pre>
<p>But that assumes you always have the comma and space following the D.</p>
| <p>It's probably easier to start at the end, make your additions to the beginning of the string, and only add D if Y is not present.</p>
| 32,947 |
<p>I have an Excel spreadsheet with 1 column, 700 rows. I care about every seventh line. I don't want to have to go in and delete the 6 rows between each row I care about. So my solution was to create another sheet and specify a reference to each cell I want.</p>
<pre><code>=sheet1!a1
=sheet1!a8
=sheet1!a15
</code></p... | <p>In A1 of your new sheet, put this:</p>
<pre><code>=OFFSET(Sheet1!$A$1,(ROW()-1)*7,0)
</code></pre>
<p>... and copy down. If you start somewhere other than row 1, change ROW() to ROW(A1) or some other cell on row 1, then copy down again.</p>
<p>If you want to copy the nth line but multiple columns, use the formula... | <p>Add new column and fill it with ascending numbers. Then filter by ([column] mod 7 = 0) or something like that (don't have Excel in front of me to actually try this);</p>
<p>If you can't filter by formula, add one more column and use the formula =MOD([column; 7]) in it then filter zeros and you'll get all seventh r... | 25,923 |
<p>I've got two applications I'm developing using Qt on windows. I want the user to be able to press a button in one application which makes the other application come to the foreground. (The programs communicate using QLocalSocket and named pipes.)</p>
<p>Currently I'm using Qt's QWidget::activateWindow() which occas... | <p>Are you sure this is not a debugging issue? The deal is, if an application HAS the foreground, it is allowed to change the foreground.</p>
<p>Clicking a button on window A will give that windows thread foreground activation. If it calls SetForegroundWindow (or equivalent) on the other window, that window WILL be gi... | <p>I think the APIs you need are <a href="http://msdn.microsoft.com/en-us/library/ms632668(VS.85).aspx" rel="nofollow noreferrer">AllowSetForegroundWindow()</a> and <a href="http://msdn.microsoft.com/en-us/library/ms633539(VS.85).aspx" rel="nofollow noreferrer">SetForegroundWindow()</a>. I don't know what the equivalen... | 24,982 |
<p>I'm writing a resource handling method where I control access to various files, and I'd like to be able to make use of the browser's cache. My question is two-fold:</p>
<ol>
<li><p>Which are the definitive HTTP headers that I need to check in order to know for sure whether I should send a 304 response, and what am... | <p>Here's how I implemented it. The code has been working for a bit more than a year and with multiple browsers, so I think it's pretty reliable. This is based on <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="noreferrer">RFC 2616</a> and by observing what and when the various browsers were sen... | <p>regarding cache-control:</p>
<p>You shouldn't have to worry about the cache-control when serving out, other than setting it to a reasonable value. It's basically telling the browser and other downstream entities (such as a proxy) the maximum time that should elapse before timing out the cache.</p>
| 2,647 |
<p>What is the best way to parse a float in CSharp?
I know about TryParse, but what I'm particularly wondering about is dots, commas etc.</p>
<p>I'm having problems with my website. On my dev server, the ',' is for decimals, the '.' for separator. On the prod server though, it is the other way round.
How can I best ca... | <p>I agree with leppie's reply; to put that in terms of code:</p>
<pre><code>string s = "123,456.789";
float f = float.Parse(s, CultureInfo.InvariantCulture);
</code></pre>
| <p>Since you don't know the web user's culture, you can do some guesswork. TryParse with a culture that uses , for separators and . for decimal, AND TryParse with a culture that uses . for separators and , for decimal. If they both succeed but yield different answers then you'll have to ask the user which they intend... | 17,797 |
<p>I am currently updating a web app that uses ActiveX objects in client side code to manipulate some xml. Of course, this app only works in IE and I need to get it cross browser compatible.</p>
<p>I am looking to get a javascript xml library to handle the cross browser oddities, and was wondering if the ASP.Net ajax... | <p>Is "sometex.png" in your resources? If you right-click on the .app that Xcode creates and select "Show Package Contents", do you see it there? It sounds like it's not being bundled with your app at build time.</p>
| <p>Looks like the program can't find "sometex.png". When I replace "sometex.png" with the entire path"users/ blah blah /sometex.png" the crash doesn't happen.</p>
| 31,768 |
<p>I have used checkbox column in gridview. I want to check status of that checkboxes. On click of a button it should be checked that if any checkbox is checked or not. If none checkbox is checked then it should display alert message that check checkbox first.</p>
| <p>Hey, I found answer. It is as follows:</p>
<pre><code>function checkBoxselectedornot()
{
var frm=document.forms['aspnetForm'];
var flag=false;
for(var i=0;i<document.forms[0].length;i++)
{
if(document.forms[0].elements[i].id.indexOf('chkDownloadSelectedEvent')!=-1)
... | <pre><code> <script type="text/javascript" language="javascript">
function CheckboxSelect() {
var LIntCtr;
var LIntSelectedCheckBoxes = 0;
for (LIntCtr = 0; LIntCtr < document.forms[0].elements.length; LIntCtr++) {
if ((document.forms[0].elements[LI... | 45,425 |
<p>OK, so Sybase (12.5.4) will let me do the following to DROP a table if it already exists:</p>
<pre><code>IF EXISTS (
SELECT 1
FROM sysobjects
WHERE name = 'a_table'
AND type = 'U'
)
DROP TABLE a_table
GO
</code></pre>
<p>But if I try to do the same with table creation, I always get warned that the ... | <p>The only workaround I've come up with so far is to use execute immediate:</p>
<pre><code>IF NOT EXISTS (
SELECT 1
FROM sysobjects
WHERE name = 'a_table'
AND type = 'U'
)
EXECUTE("CREATE TABLE a_table (
col1 int not null,
col2 int null
)")
GO
</code></pre>
<p>works like a charm, feels like a... | <pre><code>IF object_id('a_table') IS NULL
BEGIN
CREATE TABLE a_table (
col1 int not null,
col2 int null
)
END
</code></pre>
| 39,653 |
<p>I'm trying to use <a href="http://www.jboss.org/community/docs/DOC-10032" rel="noreferrer">this method</a> for receiving mail in our EJB3 app. In short, that means creating an MDB with the following annotations:</p>
<pre><code>@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "mailServer"... | <p>You can externalise the annotations into the ejb-jar.xml that you deploy in the META-INF of your jar file as follows:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>YourMDB</ejb-nam... | <p>As of JBoss AS 5.1 at least, you can use AOP to configure the @ActivationConfigProperties. I discovered this by looking at the examples that jboss provides <a href="http://docs.jboss.org/ejb3/docs/tutorial/1.0.0/ejb3-1.0.0-tutorials.zip" rel="nofollow">here</a>. This is useful if you do not want your username and ... | 39,688 |
<p>I guess, the following is a standard problem on every school or university:</p>
<p>It is Your job to teach programming. Unfortunately, some of the students
are semi-professionals and have years of experience while others do not even know the basic concepts, e.g. the concept "typed variable".</p>
<p>As far as I kno... | <p>I think the best way to keep it interesting is to bring up practical and interesting exercises along the theory. Taking a problem-solution approach is great (with interesting, funny, exciting, real-world problems). This requires the professor himself to have hands-on experience, work with new technologies and know t... | <p>In one course I took, a large part of the course grade was derived from a end-of-term project which was announced in advance with extra credit available for assorted add-ons and frills. Sufficiently experienced student could start working on it while their less prepraed brethren were being taught the basics.</p>
<p... | 45,283 |
<p>What is the advantages/disadvantages of using inline functions in C++? I see that it only increases performance for the code that the compiler outputs, but with today's optimized compilers, fast CPUs, huge memory etc. (not like in the 1980< where memory was scarce and everything had to fit in 100KB of memory) wha... | <p>Inline functions are faster because you don't need to push and pop things on/off the stack like parameters and the return address; however, it does make your binary slightly larger. </p>
<p>Does it make a significant difference? Not noticeably enough on modern hardware for most. But it can make a difference, whic... | <p>Conclusion from <a href="https://stackoverflow.com/questions/60830/what-is-wrong-with-using-inline-functions">another discussion</a> here:</p>
<p><strong>Are there any drawbacks with inline functions?</strong></p>
<p>Apparently, There is nothing wrong with using inline functions.</p>
<p>But it is worth noting the... | 17,580 |
<p>Does anyone know of a simple way of getting the raw xml that is returned from querying a webservice?</p>
<p>I have seen a way of doing this via <a href="http://devlicio.us/blogs/billy_mccafferty/archive/2006/10/09/Examine-XML-of-Web-Service-Response.aspx" rel="noreferrer">Web Services Enhancements</a>, but I don't ... | <p>I would primarily use a text field, or a series of text fields, even if you are using a numerical phone number for the following reasons. </p>
<ol>
<li>Phone numbers have a great range of values, including extension numbers which may result in numerical columns losing precision.</li>
<li>Losing precision in a phone... | <p>I don't know if you have read these two questions, but they might help you a little.</p>
<ul>
<li><a href="https://stackoverflow.com/questions/290597/phone-number-columns-in-a-database">Phone Number Columns in a Database</a></li>
<li><a href="https://stackoverflow.com/questions/41925/is-there-a-standard-for-storing... | 40,617 |
<p>I need to queue events and tasks for external systems in a reliable/transactional way. Using things like MSMQ or ActiveMQ look very seductive, but the transactional part becomes complicated (MSDTC, etc).</p>
<p>We could use the database (SQL Server 2005+, Oracle 9+) and achieve easier transactional support, but th... | <p>our system has 60 computers, each running 12 tasks (threads) which need to "get next job". All in all, it comes to 50K "jobs" per day. do the math of how many transactions per minute and realize task time is variable, so it is possible to get multiple "pop" events at the exact same time.</p>
<p>We had our first ver... | <p>Is WebSphere MQ (MQ Series) an option? Is supports transactional messaging.</p>
| 20,029 |
<p>I'm currently updating a legacy system which allows users to dictate part of the schema of one of its tables. Users can create and remove columns from the table through this interface. This legacy system is using ADO 2.8, and is using SQL Server 2005 as its database (you don't even WANT to know what database it wa... | <p>The code is using a server-side cursor, that's what those calls are for. The first set of calls is preparing/opening the cursor. Then fetching rows from the cursor. Finally closing the cursor. Those sprocs are analogous to the OPEN CURSOR, FETCH NEXT, CLOSE CURSOR T-SQL statements.</p>
<p>I'd have to take a clo... | <p>The behavior you describe is allowed. How is the code making the schema changes? Building SQL on the fly and executing through an ADO Command? Or using ADOX?</p>
<p>If you have access to the database server, try running a SQL Profiler trace while testing the scenario you outlined. See if the trace logs any erro... | 8,235 |
<p>I am working on Linux with the GCC compiler. When my C++ program crashes I would like it to automatically generate a stacktrace.</p>
<p>My program is being run by many different users and it also runs on Linux, Windows and Macintosh (all versions are compiled using <code>gcc</code>).</p>
<p>I would like my program... | <p>For Linux and I believe Mac OS X, if you're using gcc, or any compiler that uses glibc, you can use the backtrace() functions in <code>execinfo.h</code> to print a stacktrace and exit gracefully when you get a segmentation fault. Documentation can be found <a href="http://www.gnu.org/software/libc/manual/html_node/... | <p>I forgot about the GNOME tech of "apport", but I don't know much about using it. It is used to generate stacktraces and other diagnostics for processing and can automatically file bugs. It's certainly worth checking in to.</p>
| 10,263 |
<p>I print my ABS at:</p>
<ul>
<li>240 °C;</li>
<li>with a bedtemp of 80 °C; </li>
<li>5 % rectilinear infill;</li>
<li>0.25 mm layer height;</li>
<li>2 solid layers top and bottom; </li>
<li>Fan is completely disabled;</li>
<li>0.25 mm extrusion width;</li>
<li>50 mm/s perimeter print speed;</li>
<li>60 mm/s infill s... | <p>Looking at the infill pattern visible through the tears in the top layer, it looks as if you have unreliable extrusion on the infill layers also.</p>
<p>The solid fill layer is lifted and torn, so it is unlikely that one or two more layers of solid fill will make the result better. In my experience, bumps lead to ... | <p>This looks a bit like you may have a level issue with your printer. I've had similar results when my nozzle isn't clean and my bed is slightly off level. When the nozzle isn't clean (inside and out) either the flow rate out is different than what you set it to be due to back pressure or there is material on the nozz... | 673 |
<p>I have basically succumbed to the fact that if you are a hardcore computer user, you will have to reimage your computer every few months because something bad happened. Because of this, I bought imaging software and then really got into imaging. I am now ready to move my development environment completely into a vir... | <p>I have tried the following combinations:</p>
<ul>
<li>Windows XP SP3 on Virtual Server
2005 R2 </li>
<li>Windows Vista Business
x64 on Virtual Server 2005 R2 </li>
<li>Windows XP on Virtual PC 2007 </li>
<li>Windows 2003 on Virtual Server 2005
R2 </li>
<li>Windows XP on VMWare Fusion</li>
</ul>
<p>and the Virtual ... | <p>I think the biggest question (from my standpoint) is whether or not you'll be doing development (like SharePoint) that requires a server platform. If you anticipate a lot of SharePoint development (or perhaps Exchange, or BizTalk, or another product that requires development be done on a server platform), then go wi... | 49,181 |
<p>Greetings, </p>
<p>I have a particular object which can be constructed from a file, as such:</p>
<pre><code>public class ConfigObj
{
public ConfigObj(string loadPath)
{
//load object using .Net's supplied Serialization library
//resulting in a ConfigObj object
ConfigObj dese... | <p>Your second option is what is called a <a href="http://en.wikipedia.org/wiki/Factory_method_pattern" rel="nofollow noreferrer">factory method</a> and is a common design technique. If you do use this technique, you may find that you need to know the type of class you will load before you actually load the class. If y... | <p>I always go with the static method. Usually it's kind of a hierarchy which is loaded, and therefore only the root object needs the method. And it's not really an unusual approach in the .NET framework (e.g. Graphics.FromImage), so it should be fine with users of your class.</p>
| 25,486 |
<p>I have a form that sits behind ASP.NET forms authentication. So far, the implementation follows a typical "out of the box" type configuration.</p>
<p>One page allows users to post messages. If the user sits on that page for a long time to compose the message, it may run past the auth session expiration. In that ... | <p>My coworker came up with a general solution to this kind of problem using an HttpModule.</p>
<p>Keep in mind he decided to to handle his own authentication in this particular application.</p>
<p>Here goes:</p>
<p>He created an HttpModule that detected when a user was no longer logged in. If the user was no longer... | <p>When the session timeout happens the user's session (and page information) get disposed, which would mean the eventual postback would fail. As the others have suggested there are some work arounds, but they all assume you don't care about authentication and security on that particular page.</p>
<p>I would recommend... | 37,072 |
<p>I have an asp.net textbox and a MaskedEditExtender control attached to it. The textbox is used for date input. The MaskedEditExtender has MaskType="Date" Mask="99/99/9999".</p>
<p>When the form is submitted with an invalid date, the browser shows a Javascript error "... string was not recognized as a valid datetime... | <p>Stop the form from submitting with an invalid date. Use a MaskedEditValidator</p>
| <p>Don't specify mask type as "Date", that should stop this error.</p>
| 18,221 |
<p>I'm looking for SMS library that is written in c#, anyone the best library for it and it's free ? I can find more than 1 in Linux, but I'm can't found anything that is written in c# and free</p>
| <p>To logon as the 'console' user (the one to be used for logging in locally) then you use a parameter for mstsc.exe From a command prompt type in mstsc /h to see the help. MSTSC /ADMIN /V:YOURSERVERNAME
or
MSTSC /CONSOLE /V:YOURSERVERNAME</p>
<p>(depending on the version that you have)</p>
| <p>Here's how you can switch over.</p>
<ol>
<li>Start task manager</li>
<li>Switch to the users tab</li>
<li>There should be two users listed. The one you logged on with and the original session you are trying to connect to.</li>
<li>Right click on the one you want to connect to and select "Switch" or "connect". I c... | 42,548 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.