qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
464,913 | <p>I have a txt file which actually is a html source of some webpage.
Inside that txt file there are various strings preceded by a "title=" tag.
e.g. </p>
<pre><code><div id='UWTDivDomains_5_6_2_2' title='Connectivity Framework'>
</code></pre>
<p>I am interested in getting the text <strong>Connectivity Frame... | [
{
"answer_id": 464920,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 0,
"selected": false,
"text": "<p>Here's the regex you need</p>\n\n<pre><code>title='([a-zA-Z0-9]+)'\n</code></pre>\n\n<p>but if you're going to be doing a l... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759376/"
] | I have a txt file which actually is a html source of some webpage.
Inside that txt file there are various strings preceded by a "title=" tag.
e.g.
```
<div id='UWTDivDomains_5_6_2_2' title='Connectivity Framework'>
```
I am interested in getting the text **Connectivity Framework** to be extraced and written to a... | I'm not familiar with PowerGrep, however, your regex is incomplete. Try this:
```
title='[a-zA-Z0-9 ]*'
```
or better yet:
```
title='([^']*)'
``` |
464,929 | <p>Actually i'm working with C# and already got DataBinding and Serialization to work. But now i'd like to combine both methods in one class and i have a little problem with it.</p>
<p>So let's start with a little sample class:</p>
<pre><code>using System;
using System.Runtime.Serialization;
using System.Windows.Form... | [
{
"answer_id": 465031,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": true,
"text": "<p>Personally, I doubt that this is ever going to be \"clean\" - serialization works well for data, but not so well fo... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1838048/"
] | Actually i'm working with C# and already got DataBinding and Serialization to work. But now i'd like to combine both methods in one class and i have a little problem with it.
So let's start with a little sample class:
```
using System;
using System.Runtime.Serialization;
using System.Windows.Forms;
namespace MySampl... | Personally, I doubt that this is ever going to be "clean" - serialization works well for data, but not so well for objects tightly connected to objects outside of the serialization graph.
At the point of deserialization, the object is in the ether (in fact, `DataContractSerializer` doesn't even use **any** constructor... |
464,948 | <p>I have a problem: when i call a Response.Redirect() from the MasterPage it doesn't work.
Well, debugging i can see that until the Pre_Render() method the target page is loaded, but then is rendered the previous page.</p>
<p>Here's some code to better explain:</p>
<p>(from MasterPageMain.master.cs)</p>
<pre><code>... | [
{
"answer_id": 465091,
"author": "Echostorm",
"author_id": 12862,
"author_profile": "https://Stackoverflow.com/users/12862",
"pm_score": 0,
"selected": false,
"text": "<p>I don't know if its the root of your problem but I'd change 2 things. I'd change your code to:</p>\n\n<pre><code>Res... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47432/"
] | I have a problem: when i call a Response.Redirect() from the MasterPage it doesn't work.
Well, debugging i can see that until the Pre\_Render() method the target page is loaded, but then is rendered the previous page.
Here's some code to better explain:
(from MasterPageMain.master.cs)
```
protected void Page_Init(ob... | If you want to redirect not logged in users to a login-page you should check the Request.RawUrl() like this:
```
string strURL=Request.RawUrl.ToUpper();
if (!strURL.Contains("LOGIN.ASPX") && !strURL.Contains("LOGOUT.ASPX")
&& !strURL.Contains("ERROR.ASPX") && !strURL.Contains("UNDERCONSTRUCTION.ASPX"))
{
Resp... |
464,960 | <p>Implement an algorithm to merge an arbitrary number of sorted lists into one sorted list. The aim is to create the smallest working programme, in whatever language you like.</p>
<p>For example:</p>
<pre><code>input: ((1, 4, 7), (2, 5, 8), (3, 6, 9))
output: (1, 2, 3, 4, 5, 6, 7, 8, 9)
input: ((1, 10), (), (2, 5... | [
{
"answer_id": 464967,
"author": "James Brady",
"author_id": 29903,
"author_profile": "https://Stackoverflow.com/users/29903",
"pm_score": 3,
"selected": false,
"text": "<p><strong>Python: 113 characters</strong></p>\n\n<pre><code>def m(c,l):\n try:\n c += [l[min((m[0], i) for ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29903/"
] | Implement an algorithm to merge an arbitrary number of sorted lists into one sorted list. The aim is to create the smallest working programme, in whatever language you like.
For example:
```
input: ((1, 4, 7), (2, 5, 8), (3, 6, 9))
output: (1, 2, 3, 4, 5, 6, 7, 8, 9)
input: ((1, 10), (), (2, 5, 6, 7))
output: (1, ... | Common Lisp already has a `merge` function for general sequences in the language standard, but it only works on two sequences. For multiple lists of numbers sorted ascendingly, it can be used in the following function (97 essential characters).
```
(defun m (&rest s)
(if (not (cdr s))
(car s)
(apply #'m... |
464,970 | <p>I'm making a script parser in python and I'm a little stuck. I am not quite sure how to parse a line for all its functions (or even just one function at a time) and then search for a function with that name, and if it exists, execute that function short of writing a massive list if elif else block....</p>
<p><em>ED... | [
{
"answer_id": 464987,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 0,
"selected": false,
"text": "<p>Take a look at <a href=\"http://www.dabeaz.com/ply/\" rel=\"nofollow noreferrer\">PLY</a>. It should help you keep your par... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2128/"
] | I'm making a script parser in python and I'm a little stuck. I am not quite sure how to parse a line for all its functions (or even just one function at a time) and then search for a function with that name, and if it exists, execute that function short of writing a massive list if elif else block....
*EDIT*
This is ... | Once you get the name of the function, use a dispatch dict to run the function:
```
def mysum(...): ...
def myotherstuff(...): ...
# create dispatch dict:
myfunctions = {'sum': mysum, 'stuff': myotherstuff}
# run your parser:
function_name, parameters = parse_result(line)
# run the function:
myfunctions[function_na... |
464,983 | <p>How to get list of computer names in a domain using C# ?</p>
| [
{
"answer_id": 465007,
"author": "Hath",
"author_id": 5186,
"author_profile": "https://Stackoverflow.com/users/5186",
"pm_score": 3,
"selected": false,
"text": "<pre><code>using System.DirectoryServices;\n\npublic void PrintComputersInDomain (string domainName)\n{\n DirectoryEntry de ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/464983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27052/"
] | How to get list of computer names in a domain using C# ? | ```
using System.DirectoryServices;
public void PrintComputersInDomain (string domainName)
{
DirectoryEntry de = new DirectoryEntry ("LDAP://" + domainName);
de.Children.SchemaFilter.Add ("computer");
foreach (DirectoryEntry c in de.Children)
{
Console.WriteLine (c.Name);
}
}
```
from <ht... |
465,001 | <p>I'm using the <a href="http://mojo.codehaus.org/appassembler/index.html" rel="noreferrer">Maven Application Assembler</a> plugin to generate stand-alone executables from my Java project. The application reads in configuration files, including Spring files. The Application Assembler plugin has an option (activated by... | [
{
"answer_id": 469024,
"author": "Taner Gedikoğlu",
"author_id": 57525,
"author_profile": "https://Stackoverflow.com/users/57525",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know if I understand you correctly. But what I have done in the past for a project where I needed to co... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1428/"
] | I'm using the [Maven Application Assembler](http://mojo.codehaus.org/appassembler/index.html) plugin to generate stand-alone executables from my Java project. The application reads in configuration files, including Spring files. The Application Assembler plugin has an option (activated by default) to add a etc/ directo... | You can also use resource filtering:
<http://maven.apache.org/guides/getting-started/index.html#How_do_I_filter_resource_files>
turn on filtering:
```
...
<build>
...
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
... |
465,004 | <p>On Windows, the following registry setting configures the script interpreter to be used by Apache:</p>
<pre><code>HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command=C:\Perl\bin\perl.exe
</code></pre>
<p>How is this done on Linux?</p>
| [
{
"answer_id": 465012,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": -1,
"selected": false,
"text": "<p>There is no registry under Linux. Also, I doubt you will get Perl.exe running under Linux.</p>\n"
},
{
"answer_i... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | On Windows, the following registry setting configures the script interpreter to be used by Apache:
```
HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command=C:\Perl\bin\perl.exe
```
How is this done on Linux? | If you are talking about CGI script handlers.
It is set on the first line of each CGI script, I frequently use TCL as my script handler in Apache and hence add:
```
#!/bin/tclsh
```
Add this line on top of your script, eg. test.cgi and it will be executed by TCL shell whenever it is requested by someone.
Similary ... |
465,014 | <p>I'm in the process of trying to migrate my ASPNET site to Django. All my current data is tied up in MS SQL Server on a shared host that (helpfully) doesn't support python... I could use my existing code to export all the data but I've also stopped using Windows. The site is mainly compiled VB.NET so I'd need to inst... | [
{
"answer_id": 465068,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 4,
"selected": true,
"text": "<pre><code>Select table_name from information_schema.tables\n</code></pre>\n\n<p>for any given table you can get the metadata... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12870/"
] | I'm in the process of trying to migrate my ASPNET site to Django. All my current data is tied up in MS SQL Server on a shared host that (helpfully) doesn't support python... I could use my existing code to export all the data but I've also stopped using Windows. The site is mainly compiled VB.NET so I'd need to install... | ```
Select table_name from information_schema.tables
```
for any given table you can get the metadata with
```
sp_help tablename
``` |
465,034 | <p>Is there a way in C# sytax for defining a new line? (Like in VB _ )</p>
<p>Example:</p>
<p>Instead of:</p>
<pre><code>string myStr = "very long string" +
"another long string";
</code></pre>
<p>This:</p>
<pre><code>string myStr = "very long string \something
another long string"
</code></pre>
<p>Or; does compi... | [
{
"answer_id": 465036,
"author": "Serhat Ozgel",
"author_id": 31505,
"author_profile": "https://Stackoverflow.com/users/31505",
"pm_score": 4,
"selected": false,
"text": "<p>You can use</p>\n\n<pre><code>string myStr = @\"very long string\nanother long string\";\n</code></pre>\n\n<p>@\" ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35012/"
] | Is there a way in C# sytax for defining a new line? (Like in VB \_ )
Example:
Instead of:
```
string myStr = "very long string" +
"another long string";
```
This:
```
string myStr = "very long string \something
another long string"
```
Or; does compiler handles this and does something like; "string" + "string" ... | Compiler turns "ABC" + "DEF" into "ABCDEF" so there's no cost in using + |
465,040 | <p>I have a script component which I need to reference a global variable? I guess I can dtsconfig file. How do I set this and read it back out from my script component?</p>
| [
{
"answer_id": 465479,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 1,
"selected": false,
"text": "<p>From <a href=\"http://blogs.conchango.com/jamiethomson/archive/2005/02/09/964.aspx\" rel=\"nofollow noreferrer\">http... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52843/"
] | I have a script component which I need to reference a global variable? I guess I can dtsconfig file. How do I set this and read it back out from my script component? | You can use
```
Me.Variables.YourVariableName
```
this will work only in script component of Data Flow task. In script task you can use like this:
```
Dts.Variables("YourVariableName").Value.ToString
```
All you need is to configure the package variable in the dts config file by specifying the value. |
465,042 | <p>Is there a way to add a Subversion repository as a Git submodule in my Git repository?</p>
<p>Something like:</p>
<pre><code>git-svn submodule add https://svn.foo.com/svn/proj --stdlayout svn-project
</code></pre>
<p>Where <code>https://svn.foo.com/svn/proj</code> points to a Subversion repository.</p>
<p>I know... | [
{
"answer_id": 465151,
"author": "richq",
"author_id": 4596,
"author_profile": "https://Stackoverflow.com/users/4596",
"pm_score": 8,
"selected": true,
"text": "<p>No. Your best bet would be to set up a mirror of the svn repository in a dedicated git repository. </p>\n\n<pre><code>git sv... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50765/"
] | Is there a way to add a Subversion repository as a Git submodule in my Git repository?
Something like:
```
git-svn submodule add https://svn.foo.com/svn/proj --stdlayout svn-project
```
Where `https://svn.foo.com/svn/proj` points to a Subversion repository.
I know there is `git-svn` which allows one to interact wi... | No. Your best bet would be to set up a mirror of the svn repository in a dedicated git repository.
```
git svn clone -s http://subversion.example.com/ mysvnclone
cd mysvnclone
git remote add origin git@example.com:project.git
git push origin master
```
Then you can add the git repository as a submodule to the origi... |
465,049 | <p>I created a service and what it does is writing information into a xml file.</p>
<p>Sometime, it seem to happen mostly with unscheduled reboot, the service cannot start because the file used is "locked". This error happen while the system is still starting up since my service is set to "auto start".</p>
<p>This is... | [
{
"answer_id": 465151,
"author": "richq",
"author_id": 4596,
"author_profile": "https://Stackoverflow.com/users/4596",
"pm_score": 8,
"selected": true,
"text": "<p>No. Your best bet would be to set up a mirror of the svn repository in a dedicated git repository. </p>\n\n<pre><code>git sv... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40868/"
] | I created a service and what it does is writing information into a xml file.
Sometime, it seem to happen mostly with unscheduled reboot, the service cannot start because the file used is "locked". This error happen while the system is still starting up since my service is set to "auto start".
This is under windows 20... | No. Your best bet would be to set up a mirror of the svn repository in a dedicated git repository.
```
git svn clone -s http://subversion.example.com/ mysvnclone
cd mysvnclone
git remote add origin git@example.com:project.git
git push origin master
```
Then you can add the git repository as a submodule to the origi... |
465,057 | <p>Say, for example, I have many web applications using the same class library compiled into a dll in C# and I want to update a specific method of a class for a particular application. I don't want to change the existing code because it will affect everyone, and I don't want to inherit from a class to create a new one.... | [
{
"answer_id": 465084,
"author": "Dmitri Nesteruk",
"author_id": 9476,
"author_profile": "https://Stackoverflow.com/users/9476",
"pm_score": 3,
"selected": false,
"text": "<p>Maybe extension methods would work?</p>\n"
},
{
"answer_id": 465094,
"author": "Gerrie Schenck",
... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57083/"
] | Say, for example, I have many web applications using the same class library compiled into a dll in C# and I want to update a specific method of a class for a particular application. I don't want to change the existing code because it will affect everyone, and I don't want to inherit from a class to create a new one. I ... | Polymorphism seems to be the best solution for this. This way base classes can be compiled and left alone and inherited classes can be changed for individual applications without changing the way the original is used (unless necessary).
BaseClasses.cs
```
public class BaseUser {
public BaseUser() {}
public ... |
465,065 | <p>I've not used Unit Tests before other than a quick introduction in a Uni course. I'm currently writing an application though and would like to teach myself TDD in the process. The problem is, I've no idea what to test or really how.</p>
<p>I'm writing a Django application, and so far have only created the models (a... | [
{
"answer_id": 465242,
"author": "Daniel Nadasi",
"author_id": 54830,
"author_profile": "https://Stackoverflow.com/users/54830",
"pm_score": 3,
"selected": false,
"text": "<p>I'm not exactly sure of the specifics of what you're trying to test here, I'd need more code snippets for this, b... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10583/"
] | I've not used Unit Tests before other than a quick introduction in a Uni course. I'm currently writing an application though and would like to teach myself TDD in the process. The problem is, I've no idea what to test or really how.
I'm writing a Django application, and so far have only created the models (and customi... | **Is a function to test each model within the ModelTests class a good way of writing tests?**
No.
**What exactly should I be testing for?**
* That creating a model with all of the fields completed works?
* That a half complete model fails?
* That any special cases are tested (like a null and is\_required=False)?
* I... |
465,071 | <p>Im looing for a way to have a simple "on mouse over"-effect. (I want the page to show a dialogbox)</p>
| [
{
"answer_id": 465102,
"author": "veggerby",
"author_id": 54108,
"author_profile": "https://Stackoverflow.com/users/54108",
"pm_score": 2,
"selected": false,
"text": "<p>I'd go for the <a href=\"http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/\" rel=\"nofollow noreferrer\">jQu... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/148909/"
] | Im looing for a way to have a simple "on mouse over"-effect. (I want the page to show a dialogbox) | Use some Javascript.
Jquery makes thoose things quite easy. Do you already have the information or is it something you want to pull from the server when the mouse is hovering?
With Jquery you could do something like this
```
<script type="javascript">
$(document).ready(
function(){
$("divToShow").hide();
... |
465,083 | <p>When writing destructive queries (e.g., DELETE or UPDATE) in SQL Server Management Studio I always find myself wishing I could preview the results of the query without actually running it. Access very conveniently allows you to do this, but I prefer to code my SQL by hand which, sadly, Access is very poor at.</p>
<... | [
{
"answer_id": 465105,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 2,
"selected": false,
"text": "<p>When you are in the context of the transaction, you can rollback changes any time before the transaction is committed. (E... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1944/"
] | When writing destructive queries (e.g., DELETE or UPDATE) in SQL Server Management Studio I always find myself wishing I could preview the results of the query without actually running it. Access very conveniently allows you to do this, but I prefer to code my SQL by hand which, sadly, Access is very poor at.
So my qu... | I would use the OUTPUT clause present in SQL SERVER 2008 onwards...
[**OUTPUT Clause (Transact-SQL)**](http://msdn.microsoft.com/en-us/library/ms177564.aspx)
Something like...
```
BEGIN TRANSACTION
DELETE [table] OUTPUT deleted.* WHERE [woof]
ROLLBACK TRANSACTION
```
INSERTs and UPDATEs can use the 'inserted' t... |
465,095 | <p>I had some sessions with developers about getting list of data with Web-Services,
they said it's depend on the type of the site, commerce, blog etc.</p>
<p>What is your opinion on the subject ?
Is using a Web-Service for getting big list of data is a smart way performance wise?</p>
| [
{
"answer_id": 465105,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 2,
"selected": false,
"text": "<p>When you are in the context of the transaction, you can rollback changes any time before the transaction is committed. (E... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1409636/"
] | I had some sessions with developers about getting list of data with Web-Services,
they said it's depend on the type of the site, commerce, blog etc.
What is your opinion on the subject ?
Is using a Web-Service for getting big list of data is a smart way performance wise? | I would use the OUTPUT clause present in SQL SERVER 2008 onwards...
[**OUTPUT Clause (Transact-SQL)**](http://msdn.microsoft.com/en-us/library/ms177564.aspx)
Something like...
```
BEGIN TRANSACTION
DELETE [table] OUTPUT deleted.* WHERE [woof]
ROLLBACK TRANSACTION
```
INSERTs and UPDATEs can use the 'inserted' t... |
465,096 | <p>Hello we have an SQL server application running over a low bandwith connection.
We use ADO.NET.</p>
<p>I was wondering if anybody has any tips on minimizing traffic over the channel.
Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient.
Not obvious answers like "dont fetch many rec... | [
{
"answer_id": 465105,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 2,
"selected": false,
"text": "<p>When you are in the context of the transaction, you can rollback changes any time before the transaction is committed. (E... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44894/"
] | Hello we have an SQL server application running over a low bandwith connection.
We use ADO.NET.
I was wondering if anybody has any tips on minimizing traffic over the channel.
Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient.
Not obvious answers like "dont fetch many records".
E... | I would use the OUTPUT clause present in SQL SERVER 2008 onwards...
[**OUTPUT Clause (Transact-SQL)**](http://msdn.microsoft.com/en-us/library/ms177564.aspx)
Something like...
```
BEGIN TRANSACTION
DELETE [table] OUTPUT deleted.* WHERE [woof]
ROLLBACK TRANSACTION
```
INSERTs and UPDATEs can use the 'inserted' t... |
465,099 | <p>How would you implement a Plugin-system for your Java application?</p>
<p>Is it possible to have an easy to use (for the developer) system which achieves the following:</p>
<ul>
<li>Users put their plugins into a subdirectory of the app</li>
<li>The Plugin can provide a configuration screen</li>
<li>If you use a f... | [
{
"answer_id": 465139,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 5,
"selected": false,
"text": "<p>Use <a href=\"http://en.wikipedia.org/wiki/OSGi\" rel=\"nofollow noreferrer\">OSGi</a>. </p>\n\n<p>It is the founda... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57010/"
] | How would you implement a Plugin-system for your Java application?
Is it possible to have an easy to use (for the developer) system which achieves the following:
* Users put their plugins into a subdirectory of the app
* The Plugin can provide a configuration screen
* If you use a framework, is the license compatible... | First you need an interface that all plugins need to implement, e.g.
```
public interface Plugin {
public void load(PluginConfiguration pluginConfiguration);
public void run();
public void unload();
public JComponent getConfigurationPage();
}
```
Plugin authors should then bundle their plugins into J... |
465,107 | <p>I am trying to create my first UI page though Swing. In this page I wish to browse for a file. Can someone please help me achieve this?</p>
| [
{
"answer_id": 465125,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 2,
"selected": false,
"text": "<p>You seem to want a <a href=\"http://java.sun.com/javase/6/docs/api/javax/swing/JFileChooser.html\" rel=\"nofollow... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57499/"
] | I am trying to create my first UI page though Swing. In this page I wish to browse for a file. Can someone please help me achieve this? | Check this tutorial page from Sun: <http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html>.
Basic implementation involves:
```
//Create a file chooser
final JFileChooser fc = new JFileChooser();
...
//In response to a button click:
int returnVal = fc.showOpenDialog(aComponent);
```
The return ... |
465,111 | <p>I am writing my first taglib as part of a plugin and I would like to document it. Adding javadoc (is there any place that documents groovydoc or is it really the same thing?) Doesn't seem to work for non-methods.</p>
<p>Specifically, how to document the def mytag in:</p>
<pre><code>/**
* This doc shows up
*/
cla... | [
{
"answer_id": 470149,
"author": "Rob Hruska",
"author_id": 29995,
"author_profile": "https://Stackoverflow.com/users/29995",
"pm_score": 0,
"selected": false,
"text": "<p>Your question made me curious and I did some looking around. It doesn't seem that there's a good way to do this.</p>... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4711/"
] | I am writing my first taglib as part of a plugin and I would like to document it. Adding javadoc (is there any place that documents groovydoc or is it really the same thing?) Doesn't seem to work for non-methods.
Specifically, how to document the def mytag in:
```
/**
* This doc shows up
*/
class MyTagLib {
stati... | I just read about the new Groovy 1.6 RC, which lead me to Jira, which has a couple of open bugs concerning groovydoc, including one specifically about documenting [fields and properties](http://jira.codehaus.org/browse/GROOVY-2762), which is still open. The latest comment speaks of a partial implementation in trunk, so... |
465,118 | <p>Is it possible to search for a phrase of the kind <strong><em>Searching is fun</em></strong>, in Lucene?</p>
<p>When I try to search with this, Lucene ends up looking for the word <strong><em>fun</em></strong> alone.</p>
| [
{
"answer_id": 465121,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 2,
"selected": false,
"text": "<p>Try to put in in quotes: <em>\"Searching is fun\"</em> or add '+' to required words <em>+Searching +fun</em></p>\n\n<p>See \"... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35392/"
] | Is it possible to search for a phrase of the kind ***Searching is fun***, in Lucene?
When I try to search with this, Lucene ends up looking for the word ***fun*** alone. | If you are using a QueryParser object to parse your query, you can configure it to automatically assume the '+' operator that Aku spoke of in his answer (sorry Aku for not simply commenting, but comments apparently don't support code formatting). For example:
```
String defaultField = ...;
Analyzer analyzer = ...;
Que... |
465,122 | <p>I develop a SharePoint workflow with a Replicator activity to replicate a custom activity for every approver. The custom activity implements an approval branch for a particular user. It has classic form with CreateTask, While, OnTaskChanged and CompleteTask activities.</p>
<p>I setup UntilCondition on the replicato... | [
{
"answer_id": 1586175,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Did you try putting a code activity between the complete task and updatealltasks activity?</p>\n"
},
{
"answer_id"... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I develop a SharePoint workflow with a Replicator activity to replicate a custom activity for every approver. The custom activity implements an approval branch for a particular user. It has classic form with CreateTask, While, OnTaskChanged and CompleteTask activities.
I setup UntilCondition on the replicator to cance... | After being faced with the same problem and spending a lot of time researching and trying out different options, I think I found a really good solution. I'm posting it here for posterity.
1. Create a custom activity that extends SequenceActivity called ReviewActivity
2. The ReviewActivity includes the typical CreateTa... |
465,136 | <p>Do you prefix each field in a table with abbreviated table name?</p>
<p>Example:</p>
<pre><code>Table: User
Fields:
user_id
user_name
user_password
</code></pre>
<p>Or do you do you name your fields minimally?</p>
<pre><code>Fields:
id
name
password
</code></pre>
<p>If you have used both, then which format you... | [
{
"answer_id": 465146,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 6,
"selected": true,
"text": "<p>Don't do that. It's redundant and leads to frustration in the long run.</p>\n\n<p>The only field, where you <em>co... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50542/"
] | Do you prefix each field in a table with abbreviated table name?
Example:
```
Table: User
Fields:
user_id
user_name
user_password
```
Or do you do you name your fields minimally?
```
Fields:
id
name
password
```
If you have used both, then which format you feel helped you most in the long run?
Edit: This quest... | Don't do that. It's redundant and leads to frustration in the long run.
The only field, where you *could* apply this might be `id`, because `user_id` would obviously be the id of the user and it would simplify writing joins in SQL. But I wouldn't even do that. |
465,142 | <p>I have the following code:</p>
<pre><code> public Object RunQuery(String query) throws Exception{
System.out.println("Trying to run query");
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
System.out.println("Got Statement");
rs = stmt.execute... | [
{
"answer_id": 465174,
"author": "Andrzej Doyle",
"author_id": 45664,
"author_profile": "https://Stackoverflow.com/users/45664",
"pm_score": 1,
"selected": false,
"text": "<p>The only thing I can think of that would cause the difference is some kind of network-level timeout, and the Netb... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28772/"
] | I have the following code:
```
public Object RunQuery(String query) throws Exception{
System.out.println("Trying to run query");
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
System.out.println("Got Statement");
rs = stmt.executeQuery(query);
... | The only thing I can think of that would cause the difference is some kind of network-level timeout, and the Netbeans output would certainly point in this direction to. What is the JDBC connection string you are using; perhaps there's a timeout parameter that can be bumped up?
It might also be worth plugging in a netw... |
465,144 | <p>I need to batch create images with text. Requirements:</p>
<ol>
<li>arbitrary size of bitmap</li>
<li>PNG format</li>
<li>transparent background</li>
<li>black text anti-aliased against transparency</li>
<li>adjustable character spacing</li>
<li>adjustable text position (x and y coordinates where text begins)</li>
... | [
{
"answer_id": 465381,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 2,
"selected": false,
"text": "<p>(5) indeed looks tricky, short of inserting dummy narrow-spaces into the string (which will break kerning) or using som... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15770/"
] | I need to batch create images with text. Requirements:
1. arbitrary size of bitmap
2. PNG format
3. transparent background
4. black text anti-aliased against transparency
5. adjustable character spacing
6. adjustable text position (x and y coordinates where text begins)
7. TrueType and/or Type1 support
8. Unix command... | Here's the SVG + ImageMagick solution:
Programmatically create SVG documents based on this template, replacing "TEXT HERE" with the desired text content:
```
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE svg PUBLIC
"-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<... |
465,172 | <p>Simple idea: I have two images that I want to merge, one is 500x500 that is transparent in the middle the other one is 150x150.</p>
<p>Basic idea is this: Create an empty canvas that is 500x500, position the 150x150 image in the middle of the empty canvas and then copy the 500x500 image over so that the transparent... | [
{
"answer_id": 465195,
"author": "Dustin Brooks",
"author_id": 54617,
"author_profile": "https://Stackoverflow.com/users/54617",
"pm_score": 6,
"selected": false,
"text": "<p>This will add an image to another. </p>\n\n<pre><code>using (Graphics grfx = Graphics.FromImage(image))\n{\n g... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/452521/"
] | Simple idea: I have two images that I want to merge, one is 500x500 that is transparent in the middle the other one is 150x150.
Basic idea is this: Create an empty canvas that is 500x500, position the 150x150 image in the middle of the empty canvas and then copy the 500x500 image over so that the transparent middle of... | basically i use this in one of our apps:
we want to overlay a playicon over a frame of a video:
```
Image playbutton;
try
{
playbutton = Image.FromFile(/*somekindofpath*/);
}
catch (Exception ex)
{
return;
}
Image frame;
try
{
frame = Image.FromFile(/*somekindofpath*/);
}
catch (Exception ex)
{
return... |
465,180 | <p>I want to construct a transact sql script that will stop specified people from running certain commands against all databases: </p>
<pre><code>drop database, drop table or preferbly drop *
delete
update
</code></pre>
<p>Is this possible?
The user will already have access to the server.</p>
<p>Note : I am not tr... | [
{
"answer_id": 465188,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": false,
"text": "<p>(<strong>caveat</strong>, this is per-database; I don't know of anything server-wide, since the database is the ma... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36189/"
] | I want to construct a transact sql script that will stop specified people from running certain commands against all databases:
```
drop database, drop table or preferbly drop *
delete
update
```
Is this possible?
The user will already have access to the server.
Note : I am not trying to develop a security model ... | If you're on SQL Server 2005 or 2008, the best answer is one that's already been given, and that's DDL triggers. A properly written DDL trigger will stop even someone who has sysadmin rights from performing any sort of DDL operation. A sysadmin can disable a trigger to perform work, or the trigger can be written to all... |
465,216 | <p>Could someone help me translate the following pseudo-code into code understood by <a href="http://www.isapirewrite.com/" rel="nofollow noreferrer">Helicon Tech's ISAPI_Rewrite module</a>:</p>
<pre><code>if (domain == something.com OR domain == www.something.com)
{
// The rules inside this scope will only apply ... | [
{
"answer_id": 465233,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 2,
"selected": false,
"text": "<p>If ISAPI_Rewrite works the same as Apache’s mod_rewrite, try this:</p>\n\n<pre><code>RewriteCond %{HTTP_HOST} ^(www\\.)?s... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20946/"
] | Could someone help me translate the following pseudo-code into code understood by [Helicon Tech's ISAPI\_Rewrite module](http://www.isapirewrite.com/):
```
if (domain == something.com OR domain == www.something.com)
{
// The rules inside this scope will only apply to the domain:
// something.com / www.somethin... | Thanks for the effort Gumbo and Tomalak. Really appreciate it.
I've figured out another approach though: you put a file (httpd.ini) holding specific rewrite's to a specific virtual directory/domain in the root folder of that virtual directory/domain.
This eliminates polluting the global config file as well. |
465,222 | <p>I want to install Bugzilla on my linux server. The installation was successful, but it gives this error:</p>
<pre>
TEST-FAILED Web Server is not executing CGI files
</pre>
<p>How to resolve this?</p>
| [
{
"answer_id": 465230,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": -1,
"selected": false,
"text": "<p>You might try to read the <a href=\"http://httpd.apache.org/docs/2.2/\" rel=\"nofollow noreferrer\">Apache documentation... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to install Bugzilla on my linux server. The installation was successful, but it gives this error:
```
TEST-FAILED Web Server is not executing CGI files
```
How to resolve this? | From the [Bugzilla configuration guide](http://www.bugzilla.org/docs/2.18/html/configuration.html):
**2.2.4.1. Apache httpd**
To configure your Apache web server to work with Bugzilla, do the following:
1. Load httpd.conf in your editor. In Fedora and Red Hat Linux, this file is found in /etc/httpd/conf.
2. Apache u... |
465,225 | <p>I am attempting to download images saved in a url to a local folder, and have made the following attempt at doing so with curl. I would like to know if it is necessary to include curl or download it seperateley, or if my function will just work. I would like to know if there are any obvious problems with my implemen... | [
{
"answer_id": 465410,
"author": "Anthony",
"author_id": 18641,
"author_profile": "https://Stackoverflow.com/users/18641",
"pm_score": 0,
"selected": false,
"text": "<p>I'd take the function definition out of the while block.</p>\n\n<p>In my opinion your using curl for the sake of using ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I am attempting to download images saved in a url to a local folder, and have made the following attempt at doing so with curl. I would like to know if it is necessary to include curl or download it seperateley, or if my function will just work. I would like to know if there are any obvious problems with my implementat... | You’ll get an error if you declare a function inside a loop when the loop is run more than one time. So you should declare the `savePicture` function outside `while`. |
465,234 | <p>I want to develop an iPhone application using the utility template, where the flip side is semi-transparent displaying the contents of the main view, flipped horizontally.</p>
<blockquote>
<p>Edit: To create the illusion of semi-transparent flip side, I'd display the same content on the flip view as in the main v... | [
{
"answer_id": 465326,
"author": "August",
"author_id": 30966,
"author_profile": "https://Stackoverflow.com/users/30966",
"pm_score": 0,
"selected": false,
"text": "<p>In the Utility template, the flipside isn't shown semi-transparent. This is most likely for performance reasons on the i... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57513/"
] | I want to develop an iPhone application using the utility template, where the flip side is semi-transparent displaying the contents of the main view, flipped horizontally.
>
> Edit: To create the illusion of semi-transparent flip side, I'd display the same content on the flip view as in the main view, but mirror the ... | As August said, I'm not sure of your use case on this, but there's a reasonably straightforward way to do it using Core Animation. First, you'll need to add the QuartzCore framework to your project and do a
```
#import <QuartzCore/QuartzCore.h>
```
somewhere in your headers.
Then, you can apply a rotational transf... |
465,238 | <p>I have a List of Customers </p>
<pre><code>List<Customers> cust = new List<Customers>();
cust.Add(new Customers(){ID=1, Name="Sam", PurchaseDate=DateTime.Parse("01/12/2008")});
cust.Add(new Customers(){ID=2, Name="Lolly" PurchaseDate=DateTime.Parse("03/18/2008")});
</code></pre>
<p>I want to show 2 se... | [
{
"answer_id": 465281,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "<p>Grouping by year:</p>\n\n<pre><code>var groupByYear = customers.GroupBy(customer => customer.PurchaseDate.Year);\n\... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a List of Customers
```
List<Customers> cust = new List<Customers>();
cust.Add(new Customers(){ID=1, Name="Sam", PurchaseDate=DateTime.Parse("01/12/2008")});
cust.Add(new Customers(){ID=2, Name="Lolly" PurchaseDate=DateTime.Parse("03/18/2008")});
```
I want to show 2 seperate results like:
Purchases by Cust... | Grouping by year:
```
var groupByYear = customers.GroupBy(customer => customer.PurchaseDate.Year);
foreach (var group in groupByYear)
{
Console.WriteLine("Year: {0}", group.Key);
foreach (var customer in group)
{
Console.WriteLine("{0}: {1}", customer.ID, customer.Name);
}
}
```
Grouping by ... |
465,240 | <p>Working on an intranet where we have about 20 different web apps - some .net, some classic asp. </p>
<p>Currently each .net app is its own solution. There are advantages to this - we can build & deploy just one app, without affecting other apps, and all the apps share a session - but we can't use master pages,... | [
{
"answer_id": 465478,
"author": "Nic Wise",
"author_id": 2947,
"author_profile": "https://Stackoverflow.com/users/2947",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not sure you can do what you want to do, sadly. VS tends to make one DLL per unique project (not solution), and it a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4782/"
] | Working on an intranet where we have about 20 different web apps - some .net, some classic asp.
Currently each .net app is its own solution. There are advantages to this - we can build & deploy just one app, without affecting other apps, and all the apps share a session - but we can't use master pages, and there are ... | I'm not sure you can do what you want to do, sadly. VS tends to make one DLL per unique project (not solution), and it appears you have just one project, so hence, one DLL.
I'd suggest you keep one project (csproj) per application, but use NANT to build them all (ie, one at a time, together, in order), and package the... |
465,258 | <p>I want to display an HTML formatted content in my application preferably inside a Web Browser control.</p>
<p>I could create an HTML document first and then load it in the Web Browser control, but that is just too clumsy.</p>
<p>Is there any way I can load a string that contains HTML code directly into the Web Bro... | [
{
"answer_id": 465280,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 2,
"selected": false,
"text": "<p>You can open the document object in the Web Browser control then:-</p>\n\n<pre><code>document.write(\"<b>He... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57175/"
] | I want to display an HTML formatted content in my application preferably inside a Web Browser control.
I could create an HTML document first and then load it in the Web Browser control, but that is just too clumsy.
Is there any way I can load a string that contains HTML code directly into the Web Browser?
```
String... | You can do this by dragging a `WebBrowser` control onto your application and then adding the following code:
```
webBrowser1.DocumentText = "<b>Hello</b> World";
``` |
465,271 | <p>I have several A4 PDF documents which I would like (two into one) "glue" together into A3 format PDF document. So I will get from 2PDFs <strong>A4</strong> a single one sided PDF <strong>A3</strong>.
I have found the excellent utility <a href="http://www.pdfhacks.com/pdftk/" rel="noreferrer">PDFToolkit</a> and some ... | [
{
"answer_id": 465368,
"author": "mouviciel",
"author_id": 45249,
"author_profile": "https://Stackoverflow.com/users/45249",
"pm_score": 1,
"selected": false,
"text": "<p>On the Postscript side, a tool named <em>pstops</em> is able to rearrange pages of a Postscript file in any way you c... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6482/"
] | I have several A4 PDF documents which I would like (two into one) "glue" together into A3 format PDF document. So I will get from 2PDFs **A4** a single one sided PDF **A3**.
I have found the excellent utility [PDFToolkit](http://www.pdfhacks.com/pdftk/) and some others but none of them can be used to "glue" side by sid... | Found the [following](http://multivalent.sourceforge.net/index.html) (free and open-source) tool for doing Imposition called [Impose](http://multivalent.sourceforge.net/Tools/pdf/Impose.html) (thanks [danio](https://stackoverflow.com/users/12663/danio) for the tip). This solved my problem perfectly.
EDIT:
Here is how... |
465,313 | <p>Here the context for my question:</p>
<p>A common technique is to declare the parameter of a method as a Lambda expression rather than a delegate. This is so that the method can examine the expression to do interesting things like find out the names of method calls in the body of the delegate instance.</p>
<p>Prob... | [
{
"answer_id": 465467,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 0,
"selected": false,
"text": "<p>I don't believe it's possible to achieve what you'd like here. From the comments in your code it looks like you are a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here the context for my question:
A common technique is to declare the parameter of a method as a Lambda expression rather than a delegate. This is so that the method can examine the expression to do interesting things like find out the names of method calls in the body of the delegate instance.
Problem is that you l... | Everywhere that you're using the term "lambda expression" you actually mean "expression tree".
A lambda expression is the bit in source code which is
```
parameters => code
```
e.g.
```
x => x * 2
```
Expression trees are instances of the [System.Linq.Expressions.Expression](http://msdn.microsoft.com/en-us/libra... |
465,325 | <p>How can I find out which FORM an HTML element is contained within, using a simple/small bit of JavaScript? In the example below, if I have already got hold of the SPAN called 'message', how can I easily get to the FORM element?</p>
<pre><code><form name="whatever">
<div>
<span id="message... | [
{
"answer_id": 465338,
"author": "Aron Rotteveel",
"author_id": 11568,
"author_profile": "https://Stackoverflow.com/users/11568",
"pm_score": 5,
"selected": true,
"text": "<p><strong>The form a form element belongs to can be accessed through <code>element.form</code>.</strong> </p>\n\n<p... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11461/"
] | How can I find out which FORM an HTML element is contained within, using a simple/small bit of JavaScript? In the example below, if I have already got hold of the SPAN called 'message', how can I easily get to the FORM element?
```
<form name="whatever">
<div>
<span id="message"></span>
</div>
</form>
... | **The form a form element belongs to can be accessed through `element.form`.**
When the element you are using as reference is not a form element, you'd still have to iterate through the `parentElement` or use some other kind of selector.
Using prototype, you could simplify this by using [Element.up()](http://www.pro... |
465,348 | <p>On Unix, I can either use <code>\r</code> (carriage return) or <code>\b</code> (backspace) to overwrite the current line (print over text already visible) in the shell.</p>
<p>Can I achieve the same effect in a Windows command line from a Python script?</p>
<p>I tried the curses module but it doesn't seem to be av... | [
{
"answer_id": 465475,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 5,
"selected": false,
"text": "<p>yes:</p>\n\n<pre><code>import sys\nimport time\n\ndef restart_line():\n sys.stdout.write('\\r')\n sys.stdout.flush... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34088/"
] | On Unix, I can either use `\r` (carriage return) or `\b` (backspace) to overwrite the current line (print over text already visible) in the shell.
Can I achieve the same effect in a Windows command line from a Python script?
I tried the curses module but it doesn't seem to be available on Windows. | yes:
```
import sys
import time
def restart_line():
sys.stdout.write('\r')
sys.stdout.flush()
sys.stdout.write('some data')
sys.stdout.flush()
time.sleep(2) # wait 2 seconds...
restart_line()
sys.stdout.write('other different data')
sys.stdout.flush()
``` |
465,364 | <p>If I already have an image that exists, can I create an image based on the existing one, except I want to make changes to the exisiting one (mainly configurations). </p>
| [
{
"answer_id": 465374,
"author": "Mark Brittingham",
"author_id": 15592,
"author_profile": "https://Stackoverflow.com/users/15592",
"pm_score": 1,
"selected": false,
"text": "<p>Yes, you can just copy the image off to external storage. Just find the image file(s) on your drive and do the... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55057/"
] | If I already have an image that exists, can I create an image based on the existing one, except I want to make changes to the exisiting one (mainly configurations). | I do this all the time. I actually keep each of my VMs in a separate directory and duplicate the entire directory to make a copy. All references within the VMX file (configuration) are relative to the current directory.
One thing you need to watch out for. The VMX file has a line with the MAC address of the virtual ne... |
465,398 | <p>I am generating a document from HTML. Is there any way to force the HTML page to be one rendered as one printed page long?</p>
<p>I've done most of the page with <code><table></code> and <code><div></code> tags.</p>
| [
{
"answer_id": 465423,
"author": "Eppz",
"author_id": 48478,
"author_profile": "https://Stackoverflow.com/users/48478",
"pm_score": 2,
"selected": false,
"text": "<p>You can use CSS to style the page and set it to a certain height / width... There's a good tutorial <a href=\"http://marty... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13244/"
] | I am generating a document from HTML. Is there any way to force the HTML page to be one rendered as one printed page long?
I've done most of the page with `<table>` and `<div>` tags. | Not exactly, but you can use a print-stylesheet:
```
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
```
To set font sizes, paddings, etc. to physical units like 'pt' (that should never be used in a screen-stylesheet!) so that it ends up being more or less an A4 page, when rendered in a typi... |
465,404 | <p>I'm running PHP 5.2.4 with ibm_db2 v1.8.0 on Ubuntu 8.04.1 Server. I am trying to hit an IBM iSeries running OS/400 v5R3 but I'm not sure at all how to actually connect without a DSN. I've looked at <a href="http://www.connectionstrings.com/" rel="nofollow noreferrer">http://www.connectionstrings.com/</a> but none o... | [
{
"answer_id": 465423,
"author": "Eppz",
"author_id": 48478,
"author_profile": "https://Stackoverflow.com/users/48478",
"pm_score": 2,
"selected": false,
"text": "<p>You can use CSS to style the page and set it to a certain height / width... There's a good tutorial <a href=\"http://marty... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/204/"
] | I'm running PHP 5.2.4 with ibm\_db2 v1.8.0 on Ubuntu 8.04.1 Server. I am trying to hit an IBM iSeries running OS/400 v5R3 but I'm not sure at all how to actually connect without a DSN. I've looked at <http://www.connectionstrings.com/> but none of the DB2 or AS/400 connection strings seem to work. All I end up with is:... | Not exactly, but you can use a print-stylesheet:
```
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
```
To set font sizes, paddings, etc. to physical units like 'pt' (that should never be used in a screen-stylesheet!) so that it ends up being more or less an A4 page, when rendered in a typi... |
465,421 | <p>I've looked at <a href="https://stackoverflow.com/questions/316007/what-is-the-best-way-to-make-the-output-of-one-stream-the-input-to-another">this</a> and it wasn't much help.</p>
<p>I have a Ruby program that puts a question to the cmd line and I would like to write a Python program that can return an answer. Do... | [
{
"answer_id": 465438,
"author": "Ben",
"author_id": 11522,
"author_profile": "https://Stackoverflow.com/users/11522",
"pm_score": 2,
"selected": false,
"text": "<p>If you're on unix / linux you can use piping:</p>\n\n<pre><code>question.rb | answer.py\n</code></pre>\n\n<p>Then the outpu... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41718/"
] | I've looked at [this](https://stackoverflow.com/questions/316007/what-is-the-best-way-to-make-the-output-of-one-stream-the-input-to-another) and it wasn't much help.
I have a Ruby program that puts a question to the cmd line and I would like to write a Python program that can return an answer. Does anyone know of any ... | ```
p = subprocess.Popen(['ruby', 'ruby_program.rb'], stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
ruby_question = p.stdout.readline()
answer = calculate_answer(ruby_question)
p.stdin.write(answer)
print p.communicate()[0] # prints further info ruby may show.
```
The last... |
465,436 | <p>take a look at this example code:</p>
<pre><code>public class Comment
{
private Comment()
{ }
public Comment(string text, DateTime creationDate, string authorEmail)
{
Text = text;
CreationDate = creationDate;
AuthorEmail = authorEmail;
}
public virtual string Text {... | [
{
"answer_id": 465451,
"author": "Mark Rogers",
"author_id": 25847,
"author_profile": "https://Stackoverflow.com/users/25847",
"pm_score": 4,
"selected": true,
"text": "<p>I'm pretty sure this is fine, but if your worried you could always just assign the properties after a parameter less... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43355/"
] | take a look at this example code:
```
public class Comment
{
private Comment()
{ }
public Comment(string text, DateTime creationDate, string authorEmail)
{
Text = text;
CreationDate = creationDate;
AuthorEmail = authorEmail;
}
public virtual string Text { get; private ... | I'm pretty sure this is fine, but if your worried you could always just assign the properties after a parameter less constructor call. |
465,437 | <p>I'm trying to build my own inversion of control container. Right now I store the objects with their types in a dictionary and resolve a reference when asked. But I want to make it possible to resolve a reference or a new instance. I can create a new instance with the Activator class. But, what if the constructor of... | [
{
"answer_id": 465465,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 0,
"selected": false,
"text": "<p>Activator can create an instance of a class having constructors with parameters.</p>\n\n<p>Have a look at this overload of <a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31722/"
] | I'm trying to build my own inversion of control container. Right now I store the objects with their types in a dictionary and resolve a reference when asked. But I want to make it possible to resolve a reference or a new instance. I can create a new instance with the Activator class. But, what if the constructor of the... | I decided to split it in to methods. A Resolve, that gives back the instance stored in the container. And a Create that instanciate a new instance.
something like:
```
public T Create<T>()
{
if (registeredTypes.ContainsKey(typeof(T)))
return (T)Activator.CreateInstance(register... |
465,483 | <p>I'm having some problems getting my object to gracefully fail out if an invalid parameter is given during instantiation. I have a feeling it's a small syntax thing somewhere that I simply need fresh eyes on. Any help is more than appreciated.</p>
<pre><code>class bib {
protected $bibid;
public function __cons... | [
{
"answer_id": 465499,
"author": "Simon",
"author_id": 33036,
"author_profile": "https://Stackoverflow.com/users/33036",
"pm_score": 2,
"selected": true,
"text": "<p>You can't return in a constructor in PHP - the object is still created as normal.</p>\n\n<p>You could use a factory or som... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22216/"
] | I'm having some problems getting my object to gracefully fail out if an invalid parameter is given during instantiation. I have a feeling it's a small syntax thing somewhere that I simply need fresh eyes on. Any help is more than appreciated.
```
class bib {
protected $bibid;
public function __construct($new_bib... | You can't return in a constructor in PHP - the object is still created as normal.
You could use a factory or something similar;
```
if(!$bib = Bib_Factory::loadValidBib('612e436')){
echo 'Error Message';
} else {
//do what I intend to do with the object
}
```
Or throw an exception in the constructor and use... |
465,488 | <p>Is it possible to instantiate an object at runtime if I only have the DLL name and the class name, without adding a reference to the assembly in the project? The class implements a interface, so once I instantiate the class, I will then cast it to the interface.</p>
<p>Assembly name:</p>
<blockquote>
<p>library.... | [
{
"answer_id": 465497,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 4,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx\" rel=\"noreferrer\">Activato... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/279238/"
] | Is it possible to instantiate an object at runtime if I only have the DLL name and the class name, without adding a reference to the assembly in the project? The class implements a interface, so once I instantiate the class, I will then cast it to the interface.
Assembly name:
>
> library.dll
>
>
>
Type name:
... | Yes. You need to use [`Assembly.LoadFrom`](http://msdn.microsoft.com/en-us/library/system.reflection.assembly.loadfrom.aspx) to load the assembly into memory, then you can use [`Activator.CreateInstance`](http://msdn.microsoft.com/en-us/library/d133hta4.aspx) to create an instance of your preferred type. You'll need to... |
465,492 | <p>I have a method which constructs an object, calls an Execute method, and frees the object. The type of object is determined by a TClass descendant passed into the method.
Note this is Delphi for Win32 I am talking about, not .NET.</p>
<p><em>Edit: I should point out that this is Delphi 2006, as it has been noted in... | [
{
"answer_id": 465521,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 5,
"selected": true,
"text": "<p>You should put the create out of the try finally block.</p>\n\n<p>But a better solution is:</p>\n\n<pre><code>type ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11820/"
] | I have a method which constructs an object, calls an Execute method, and frees the object. The type of object is determined by a TClass descendant passed into the method.
Note this is Delphi for Win32 I am talking about, not .NET.
*Edit: I should point out that this is Delphi 2006, as it has been noted in answers belo... | You should put the create out of the try finally block.
But a better solution is:
```
type
TMyClass = class ()
public
constructor Create(...); virtual;
function Execute: Boolean; virtual;
end;
TMyClassClass = class of TMyClass;
procedure CreateExecute(const AClass: TMyClassClass): Boolean;
var
the... |
465,494 | <p>How can I determine if location information returned by CLLocationManager is valid?</p>
| [
{
"answer_id": 465521,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 5,
"selected": true,
"text": "<p>You should put the create out of the try finally block.</p>\n\n<p>But a better solution is:</p>\n\n<pre><code>type ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49739/"
] | How can I determine if location information returned by CLLocationManager is valid? | You should put the create out of the try finally block.
But a better solution is:
```
type
TMyClass = class ()
public
constructor Create(...); virtual;
function Execute: Boolean; virtual;
end;
TMyClassClass = class of TMyClass;
procedure CreateExecute(const AClass: TMyClassClass): Boolean;
var
the... |
465,504 | <p>I am getting an undefined index on my config page and it reads:</p>
<blockquote>
<p><b>Notice</b>: Undefined index: SERVER_ADDR in <b>inc/config
.inc.php</b> on line <b>3</b><br /></p>
</blockquote>
<p>Any idea on how I can fix that? I know its warning, but would still like to get at it. I am using it to che... | [
{
"answer_id": 465514,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 3,
"selected": false,
"text": "<p>Have you tried <a href=\"http://docs.php.net/manual/en/function.getenv.php\" rel=\"noreferrer\"><code>getenv</code></a>?<... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am getting an undefined index on my config page and it reads:
>
> **Notice**: Undefined index: SERVER\_ADDR in **inc/config
> .inc.php** on line **3**
>
>
>
>
Any idea on how I can fix that? I know its warning, but would still like to get at it. I am using it to check for the address whether to use my local... | If you haven't done so, make sure you're accessing SERVER\_ADDR using the $\_SERVER array to obtain the value of SERVER\_ADDR, which is an element of this array.
```
$_SERVER['SERVER_ADDR'];
```
If that doesn't work, it may mean that your server doesn't provide that information.
From [PHP.net](http://ca.php.net/man... |
465,507 | <p>I have two XML files. They are similar, but there are two nodes of which either of the file have only one. I want to merge two sets of such documents in one single document where first the node of side A is taken, followed by the nodes of side B.</p>
<p>I'm not an experienced user of diff tools and downloaded KDiff... | [
{
"answer_id": 465529,
"author": "mouviciel",
"author_id": 45249,
"author_profile": "https://Stackoverflow.com/users/45249",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://www.sourcegear.com/diffmerge/\" rel=\"nofollow noreferrer\">DiffMerge</a>. It is free and works for ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | I have two XML files. They are similar, but there are two nodes of which either of the file have only one. I want to merge two sets of such documents in one single document where first the node of side A is taken, followed by the nodes of side B.
I'm not an experienced user of diff tools and downloaded KDiff3 to start... | This might be very problematic to do with a standard diff tool if the xml "nodes" are in any way similar. For example:
file1:
```
1 <node id="1" />
2 <node id="2a">
3 <content item="1"/>
4 <content item="2a"/>
5 </node>
6 <node id="3" />
```
file2:
```
1 <node id="1" />
2 <node id="2b">
3 <content item="1"/>... |
465,517 | <p>In his The C++ Programming Language Stroustrup gives the following example for inc/dec overloading:</p>
<pre><code>class Ptr_to_T {
T* p;
T* array ;
int size;
public:
Ptr_to_T(T* p, T* v, int s); // bind to array v of size s, initial value p
Ptr_to_T(T* p); // bind to single object, initial valu... | [
{
"answer_id": 465532,
"author": "Timo Geusch",
"author_id": 29068,
"author_profile": "https://Stackoverflow.com/users/29068",
"pm_score": 4,
"selected": false,
"text": "<p>The postfix operator returns a copy of the value before it was incremented, so it pretty much has to return a tempo... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48461/"
] | In his The C++ Programming Language Stroustrup gives the following example for inc/dec overloading:
```
class Ptr_to_T {
T* p;
T* array ;
int size;
public:
Ptr_to_T(T* p, T* v, int s); // bind to array v of size s, initial value p
Ptr_to_T(T* p); // bind to single object, initial value p
Ptr_to... | To understand better, you have to imagine (or look at) how are these operators implemented. Typically, the prefix operator++ will be written more or less like this:
```
MyType& operator++()
{
// do the incrementation
return *this;
}
```
Since `this` has been modified "in-place", we can return a reference to ... |
465,522 | <p>instead of doing</p>
<pre><code> session("myvar1") = something
session("myvar2") = something
session("myvar3") = something
session("myvar4") = something
</code></pre>
<p>is doing</p>
<pre><code>enum sessionVar
myvar1
myvar2
myvar3
myvar4
end enum
session(sessionVar.myvar1.tostring) = something
... | [
{
"answer_id": 465528,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 3,
"selected": false,
"text": "<p>Only if those values are related. Otherwise use plain old constants.</p>\n"
},
{
"answer_id": 465566,
... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40868/"
] | instead of doing
```
session("myvar1") = something
session("myvar2") = something
session("myvar3") = something
session("myvar4") = something
```
is doing
```
enum sessionVar
myvar1
myvar2
myvar3
myvar4
end enum
session(sessionVar.myvar1.tostring) = something
session(sessionVar.myvar2.tostring) = ... | Instead of using constants for the session keys, I'm using my own type-safe session object, which looks like this (sorry this is in C#, see below for a VB version):
```
public class MySession
{
// Private constructor (use MySession.Current to access the current instance).
private MySession() {}
// Gets the curr... |
465,526 | <p>What JS/CSS trick can I use to prevent copy&paste of numbers in an ordered list?</p>
<pre><code><OL>
<LI>A
<LI>B
<LI>C
</OL>
</code></pre>
<p><OL>
<LI>A
<LI>B
<LI>C
</OL></p>
<p>If it's not doable, what alternative are available?</p>
<p>thanks</p>
| [
{
"answer_id": 465559,
"author": "Joao da Silva",
"author_id": 46329,
"author_profile": "https://Stackoverflow.com/users/46329",
"pm_score": 2,
"selected": false,
"text": "<p>My guess is it's browser-dependant. I tried with IE 7, Firefox 3 and Chrome and none of them copy the numbers (Ch... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1277510/"
] | What JS/CSS trick can I use to prevent copy&paste of numbers in an ordered list?
```
<OL>
<LI>A
<LI>B
<LI>C
</OL>
```
1. A
- B
- C
If it's not doable, what alternative are available?
thanks | What about using a table like in
<http://bugzilla.gnome.org/attachment.cgi?id=127131> |
465,543 | <p>I was looking at the System.Net Namespace and it has an IPAddress instance you can use. This has a Parse method which you can use to parse a string into an IPInstance then use the Address property to give you the long value.</p>
<p>However...</p>
<p>The number returned is NOT the true conversion.</p>
<p>e.g. For ... | [
{
"answer_id": 465554,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>Please see <a href=\"https://stackoverflow.com/questions/461742/how-to-convert-an-ip-address-into-an-integer-in-c\"... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42434/"
] | I was looking at the System.Net Namespace and it has an IPAddress instance you can use. This has a Parse method which you can use to parse a string into an IPInstance then use the Address property to give you the long value.
However...
The number returned is NOT the true conversion.
e.g. For IP 58.0.0.0 , the System... | This might work, will try it and see.
```
public double IPAddressToNumber(string IPaddress)
{
int i;
string [] arrDec;
double num = 0;
if (IPaddress == "")
{
return 0;
}
else
{
arrDec = IPaddress.Split('.');
for(i ... |
465,548 | <p>I've already asked a related question, but sadly the answers, whilst correct, didn't actually solve my problem.</p>
<p>I'm using the ManagementClass/ManagementObject WMI API (because it's better at handling remote administration than the DirectoryEntry API). I'd like to completely remove the existing script maps f... | [
{
"answer_id": 779725,
"author": "Richard Berg",
"author_id": 74439,
"author_profile": "https://Stackoverflow.com/users/74439",
"pm_score": 2,
"selected": true,
"text": "<p>I find it's very difficult to create WMI objects from scratch. Easier to Clone() an existing object you've queried... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29408/"
] | I've already asked a related question, but sadly the answers, whilst correct, didn't actually solve my problem.
I'm using the ManagementClass/ManagementObject WMI API (because it's better at handling remote administration than the DirectoryEntry API). I'd like to completely remove the existing script maps from a
Usi... | I find it's very difficult to create WMI objects from scratch. Easier to Clone() an existing object you've queried from the system and then modify it. Here's a function I wrote recently to deal with ScriptMaps. It's in Powershell, not C#, but the idea is the same:
```
function Add-AspNetExtension
{
[CmdletBinding(... |
465,602 | <p>I am testing a web service with soapUI. One of the responses looks like this:</p>
<pre><code> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getInputConfigFilesResponse xmlns:ns2="http://ws.pdb.ericsson.se/">
<return>UEsDBBQACAAIAO1GNToAA... | [
{
"answer_id": 508464,
"author": "Nathan",
"author_id": 53963,
"author_profile": "https://Stackoverflow.com/users/53963",
"pm_score": 0,
"selected": false,
"text": "<p>You're going to have to use some groovy.</p>\n\n<ol>\n<li>output the byte array to a file.</li>\n<li>execute some comman... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20498/"
] | I am testing a web service with soapUI. One of the responses looks like this:
```
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getInputConfigFilesResponse xmlns:ns2="http://ws.pdb.ericsson.se/">
<return>UEsDBBQACAAIAO1GNToAAAAAAAAAAAAAAAANAAAAc2NyaXB0cy9lbGxza [.... | Although semantically correct, I believe Nathan's proposed solution is somewhat incomplete.
I guess he forgot do Base64 decode the extracted text prior to step 1. I would also include an improvement so that no human intervention is needed by verifying the temporary file using 3rd party ZIP utilities.
That would tran... |
465,605 | <p>When an object has hundreds of methods, tab completion is hard to use. More often than not the interesting methods are the ones defined or overridden by the inspected object's class and not its base classes.</p>
<p>How can I get IPython to group its tab completion possibilities so the methods and properties defined... | [
{
"answer_id": 467430,
"author": "Brian",
"author_id": 9493,
"author_profile": "https://Stackoverflow.com/users/9493",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think this can be accomplished easily. There's no mechanism in Ipython to perform it in any case.</p>\n\n<p>Initia... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36330/"
] | When an object has hundreds of methods, tab completion is hard to use. More often than not the interesting methods are the ones defined or overridden by the inspected object's class and not its base classes.
How can I get IPython to group its tab completion possibilities so the methods and properties defined in the in... | Since I am not using Python 2.6 or 3.0 yet and don't have `readline.set_completion_display_matches_hook()`, I can use ctypes to set `completion_display_func` like so:
```
from ctypes import *
rl = cdll.LoadLibrary('libreadline.so')
def completion_display_func(matches, num_matches, max_length):
print "Hello from ... |
465,620 | <p>I am writing my first project that will use autoconf and teaching it to myself as I go. For the most part, things are going extremely well. I have one last significant hurdle. I am having trouble locating library and header files that may be named differently from one system to the next.</p>
<p>For example, I need ... | [
{
"answer_id": 465632,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 0,
"selected": false,
"text": "<p>I'd go with an option: <code>--with-spidermonkey-library= --with-spidermonkey-include=</code></p>\n\n<p>And then p... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10093/"
] | I am writing my first project that will use autoconf and teaching it to myself as I go. For the most part, things are going extremely well. I have one last significant hurdle. I am having trouble locating library and header files that may be named differently from one system to the next.
For example, I need to compile... | In addition to adding an option to specify the path/name explicitly, if there are a few well-known names or locations, you can just try them in order until one succeeds, using something like this:
```
AC_TRY_LINK([#include "mpi.h"],[MPI_Init(0, 0);], [mpi_link="yes"], [mpi_link="no"]);
```
Or just use test. I used ... |
465,627 | <p>I've read on articles and books that the use of <code>String s = new String("...");</code> should be avoided pretty much all the time. I understand why that is, but is there any use for using the String(String) constructor whatsoever? I don't think there is, and don't see any evidence otherwise, but I'm wondering ... | [
{
"answer_id": 465637,
"author": "Martin Thurau",
"author_id": 20247,
"author_profile": "https://Stackoverflow.com/users/20247",
"pm_score": -1,
"selected": false,
"text": "<p>You use it if you need a <em>copy</em> of the original String if you don't want to give a handle to your origina... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1459442/"
] | I've read on articles and books that the use of `String s = new String("...");` should be avoided pretty much all the time. I understand why that is, but is there any use for using the String(String) constructor whatsoever? I don't think there is, and don't see any evidence otherwise, but I'm wondering if anyone in the... | This is a good article: [String constructor considered useless turns out to be useful after all!](http://kjetilod.blogspot.com/2008/09/string-constructor-considered-useless.html)
>
> It turns out that this constructor can actually be useful in at least one circumstance. If you've ever peeked at the String source code... |
465,653 | <p>I was wondering what you would use to scrub a database of all test data (leaving the structure intact) prior to going into production?</p>
<p>I use something like:</p>
<pre><code>-- disable referential integrity
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
GO
EXEC sp_MSForEachTable '
IF OBJECTPR... | [
{
"answer_id": 465664,
"author": "gkrogers",
"author_id": 54501,
"author_profile": "https://Stackoverflow.com/users/54501",
"pm_score": 2,
"selected": false,
"text": "<p>I normally generate the DDL statements from the dev database and then create the database from scratch on the producti... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38317/"
] | I was wondering what you would use to scrub a database of all test data (leaving the structure intact) prior to going into production?
I use something like:
```
-- disable referential integrity
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
GO
EXEC sp_MSForEachTable '
IF OBJECTPROPERTY(object_id(''?'... | The common approach is to have a set-up script that drops all tables and then recreates them. This has the benefit over just wiping the data of persisting any changes too. |
465,659 | <p>Take a string such as: </p>
<blockquote>
<p>In C#: How do I add "Quotes" around string in a comma delimited list of strings?</p>
</blockquote>
<p>and convert it to:</p>
<blockquote>
<p>in-c-how-do-i-add-quotes-around-string-in-a-comma-delimited-list-of-strings </p>
</blockquote>
<p>Requirements:</p>
<ul... | [
{
"answer_id": 465726,
"author": "Allain Lalonde",
"author_id": 2443,
"author_profile": "https://Stackoverflow.com/users/2443",
"pm_score": 2,
"selected": false,
"text": "<p>Here's a solution for php:</p>\n\n<pre><code>function make_uri($input, $max_length) {\n if (function_exists('icon... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26/"
] | Take a string such as:
>
> In C#: How do I add "Quotes" around string in a comma delimited list of strings?
>
>
>
and convert it to:
>
> in-c-how-do-i-add-quotes-around-string-in-a-comma-delimited-list-of-strings
>
>
>
Requirements:
* Separate each word by a dash and remove all punctuation (taking into a... | Here is my solution in C#
```
private string ToSeoFriendly(string title, int maxLength) {
var match = Regex.Match(title.ToLower(), "[\\w]+");
StringBuilder result = new StringBuilder("");
bool maxLengthHit = false;
while (match.Success && !maxLengthHit) {
if (result.Length + match.Value.Length ... |
465,660 | <p>I need to perform 9 different operations on a coordinate, depending on the position of the coordinate. I have a function that returns the coordinates of a position around the given coordinate (down, up, left, right or diagonals). The 9 different operations are the different possible 'types' of coordinate; if I'm dea... | [
{
"answer_id": 465691,
"author": "unwind",
"author_id": 28169,
"author_profile": "https://Stackoverflow.com/users/28169",
"pm_score": 2,
"selected": false,
"text": "<p>You can't do this, in C. There are no array literals for you to assign, there are only array initialization expressions.... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19927/"
] | I need to perform 9 different operations on a coordinate, depending on the position of the coordinate. I have a function that returns the coordinates of a position around the given coordinate (down, up, left, right or diagonals). The 9 different operations are the different possible 'types' of coordinate; if I'm dealin... | ```
static const int Library0[] = {2, 3, 4, -1};
static const int Library1[] = {4, 5, 6, -1};
static const int Library2[] = {2, 3, 4, 5, 6, -1};
static const int Library3[] = {0, 1, 2, 3, 4, 5, 6, 7, -1};
static const int Library4[] = {0, 1, 2, -1};
static const int Library5[] = {0, 6, 7, -1};
static const int Library6... |
465,668 | <p>I am looking for a way to search through every users profile using the standard ASP.Net Profile Provider. Is this possible, or should I create a new Profile Provider?</p>
<p>Here is the scenario:</p>
<ul>
<li>User registers</li>
<li>User sets up their profile (favorite color, favorite book, country, etc)</li>
<li... | [
{
"answer_id": 465780,
"author": "nshaw",
"author_id": 29426,
"author_profile": "https://Stackoverflow.com/users/29426",
"pm_score": 0,
"selected": false,
"text": "<p>I believe the standard provider will only work for the current user. You would need a custom profile provider to retrieve... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48943/"
] | I am looking for a way to search through every users profile using the standard ASP.Net Profile Provider. Is this possible, or should I create a new Profile Provider?
Here is the scenario:
* User registers
* User sets up their profile (favorite color, favorite book, country, etc)
* User is then able to browse other u... | The functionality you want is included in the Profile API.
You can get an individual users profile using:
```
HttpProfile profile = Profile.GetProfile("Fred");
```
You can get all the profiles using:
```
var allUsers = Membership.GetAllUsers();
foreach (MembershipUser user in allUsers)
{
var prof = ProfileBase... |
465,669 | <p>For part of a web application the user needs to import some data from a spreadsheet. Such as a list of names and email addresses. Currently we do this by asking the user to browse for and upload a CSV file.</p>
<p>Unfortunately, this isn't always possible as various corporate IT systems only allow users to access f... | [
{
"answer_id": 465713,
"author": "abatishchev",
"author_id": 41956,
"author_profile": "https://Stackoverflow.com/users/41956",
"pm_score": 0,
"selected": false,
"text": "<p>try find something helpful in <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard_memb... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40655/"
] | For part of a web application the user needs to import some data from a spreadsheet. Such as a list of names and email addresses. Currently we do this by asking the user to browse for and upload a CSV file.
Unfortunately, this isn't always possible as various corporate IT systems only allow users to access files from ... | This looks like a "delimited values" list to me, so basically the same as CSV with TAB as the field delimiter and line break as the row delimiter. You could try it with the [CSV Reader library from CodeProject](http://www.codeproject.com/KB/database/CsvReader.aspx), it should be handle to handle different delimiters, n... |
465,692 | <p>I am implementing a small queue to handle which process gets to run first. I am using a table in a database to do this. Here is the structure of the table (I'm mocking it up in SQLite):</p>
<pre><code> "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,
"identifier" VARCHAR NOT NULL ,
"prio... | [
{
"answer_id": 465700,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 2,
"selected": false,
"text": "<pre><code>select * from queue_manager order by priority_number, timestamp LIMIT 1;\n</code></pre>\n\n<p>As for such call... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40619/"
] | I am implementing a small queue to handle which process gets to run first. I am using a table in a database to do this. Here is the structure of the table (I'm mocking it up in SQLite):
```
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ,
"identifier" VARCHAR NOT NULL ,
"priority_number" INT... | See if this works:
```
select * from queue_manager where priority_number =
(select min(priority_number) from queue_manager) and
timestamp = (select min(timestamp)
from queue_manager qm2
where qm2.priority_number = queue_manager.priority_number)
``` |
465,699 | <p>Ok, this might be an impossible question but I am adding a user control to an existing cms system (Kentico using their InlineControl base class) and I added a label that I have overriden the click event to show a div area below it. What I am having problems with is inheriting the already set css attribute of color,... | [
{
"answer_id": 465714,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>Instead of an <code><asp:Label ></code> control, use an <code><asp:HyperLink ></code>. This will rende... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Ok, this might be an impossible question but I am adding a user control to an existing cms system (Kentico using their InlineControl base class) and I added a label that I have overriden the click event to show a div area below it. What I am having problems with is inheriting the already set css attribute of color, fon... | OK, if I understand correctly you want the label text to render like the links on the page? Depending on the browser you're developing in it may not be able to understand things like `:link` or `:hover`. If you have the following CSS:
```
a, label { color: blue; } // NOT a:link as only <a> tags can have href
a:hover, ... |
465,706 | <p>Should the programmer be aware of operator precedence thoroughly?
Using braces to group expressions should be okay, isn't? I always uses braces to be on safer side. And when asked a question on precedence, I cannot answer readily.</p>
| [
{
"answer_id": 465720,
"author": "Jon B",
"author_id": 27414,
"author_profile": "https://Stackoverflow.com/users/27414",
"pm_score": 3,
"selected": false,
"text": "<p>Yes, it's important to understand operator precedence. However, I think there's value in using parentheses to be perfectl... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44111/"
] | Should the programmer be aware of operator precedence thoroughly?
Using braces to group expressions should be okay, isn't? I always uses braces to be on safer side. And when asked a question on precedence, I cannot answer readily. | For very common operators - yes, it's worth knowing it. If you put brackets round *everything* that would otherwise rely on operator precedence, your code would be unreadable (or easily confused with Lisp).
For more obscure operators - I've explicitly *avoided* learning them. If I start taking too many things for gran... |
465,727 | <p>I've created a MySQL function and would like to raise an error if the values passed for the parameters are invalid. What are my options for raising an error within a MySQL function?</p>
| [
{
"answer_id": 466826,
"author": "Jorge Niedbalski R.",
"author_id": 477612,
"author_profile": "https://Stackoverflow.com/users/477612",
"pm_score": 0,
"selected": false,
"text": "<p>You have to define exception handlers . Take a look at <a href=\"http://dev.mysql.com/doc/refman/5.0/en/d... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648/"
] | I've created a MySQL function and would like to raise an error if the values passed for the parameters are invalid. What are my options for raising an error within a MySQL function? | MySQL 5.5 introduces signals, which are similar to exceptions in other languages:
<http://dev.mysql.com/doc/refman/5.5/en/signal.html>
For example, in the `mysql` command line client:
```
mysql> SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Custom error';
ERROR 1644 (45000): Custom error
``` |
465,760 | <p>I have the following code in a MVC User Control (the field names have been changed to protect the innocent):</p>
<p>These are to be displayed in a list beneath a header on the page that calls this control.</p>
<p>Given that I blow at CSS, how do I apply tags to the header and these fields so that e... | [
{
"answer_id": 465781,
"author": "Ryan Lanciaux",
"author_id": 1385358,
"author_profile": "https://Stackoverflow.com/users/1385358",
"pm_score": 0,
"selected": false,
"text": "<p>You may want to look at the <a href=\"http://960.gs/\" rel=\"nofollow noreferrer\">960 Grid System</a>. It wi... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13139/"
] | I have the following code in a MVC User Control (the field names have been changed to protect the innocent):
These are to be displayed in a list beneath a header on the page that calls this control.
Given that I blow at CSS, how do I apply tags to the header and these fields so that everything lines up properly?
Man... | It appears, from your sample code, but you are just directly outputting string properties into the web page. In this case, you would need to surround the output string with a span or a div in order to assign it a class, like this:
```
<div class="foo"><%=ViewData.Model.foo %></div>
```
On the other hand, you might, ... |
465,777 | <p>I'm defining a report configuration in my parent pom which will be run in each child and grandchild project. </p>
<p>Like so:</p>
<pre><code><reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin&... | [
{
"answer_id": 465798,
"author": "Romain Linsolas",
"author_id": 26457,
"author_profile": "https://Stackoverflow.com/users/26457",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure if this can solve your problem, but I have two ideas that you can try:</p>\n\n<p><em>1st idea</em... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4893/"
] | I'm defining a report configuration in my parent pom which will be run in each child and grandchild project.
Like so:
```
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.2</version>
... | **The short version:** The solution to your problem is described in the [documentation of the findbugs-maven-plugin](http://mojo.codehaus.org/findbugs-maven-plugin/examples/multi-module-config.html). You simply have to create a separate (top-level) project for the build configuration that contains your `findbugsFilter.... |
465,788 | <p>On install I want to optionally copy some .ini files from SOURCEDIR to TARGETDIR which means from the directory the .msi file is located to the destination folder the app is setup to.</p>
<p>I did <code><CopyFile Id="CopyIniFile" DestinationProperty="INSTALLDIR" SourceProperty="SOURCEDIR" SourceName="Dreem15.ini... | [
{
"answer_id": 465844,
"author": "CheGueVerra",
"author_id": 17787,
"author_profile": "https://Stackoverflow.com/users/17787",
"pm_score": 1,
"selected": false,
"text": "<p>Can you use <code>DestinationDirectory=\"INSTALLDIR\"</code> instead, or you have to create the properties on the f... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40691/"
] | On install I want to optionally copy some .ini files from SOURCEDIR to TARGETDIR which means from the directory the .msi file is located to the destination folder the app is setup to.
I did `<CopyFile Id="CopyIniFile" DestinationProperty="INSTALLDIR" SourceProperty="SOURCEDIR" SourceName="Dreem15.ini" Delete="no" />` ... | According to the windows installer documentation for the [sourcedir property](http://msdn.microsoft.com/en-us/library/aa371857(VS.85).aspx), it points to "the root directory that contains the source cabinet file or the source file tree of the installation package".
So either you were not aware that SourceDir is a pred... |
465,825 | <p>I have an XML document from an external source. </p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<ns0:Info xmlns:ns0="http://www.ZomboCorp.com/">
<Name>Anthony</Name>
<Job>Developer</Job>
</ns0:Info>
</code></pre>
<p>I need to deserialize it into an object like t... | [
{
"answer_id": 466098,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 3,
"selected": false,
"text": "<p>You have to add the XmlElement attribute to each property as well, setting the Namespace property to an empty string ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3619/"
] | I have an XML document from an external source.
```
<?xml version="1.0" encoding="utf-8"?>
<ns0:Info xmlns:ns0="http://www.ZomboCorp.com/">
<Name>Anthony</Name>
<Job>Developer</Job>
</ns0:Info>
```
I need to deserialize it into an object like this.
```
public class Info
{
public String Name { get; set; }
... | I used [xsd.exe](http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.71).aspx) (a VS tool) and generated a schema from the XML file and then a class file from the schema. It suggested
```
[XmlType(AnonymousType = true, Namespace = "http://www.ZomboCorp.com/")]
[XmlRoot(Namespace = "http://www.ZomboCorp.com/", IsNullab... |
465,852 | <p>When clicking on the text box part of an <code><input type="file" /></code> in FireFox3, a file browsing window opens.</p>
<p>This doesn't happen in IE7. You have to click the "browse" button to open the file browsing window.</p>
<p>How can I prevent the file browsing window from opening in FireFox when a u... | [
{
"answer_id": 465865,
"author": "Adam Peck",
"author_id": 26658,
"author_profile": "https://Stackoverflow.com/users/26658",
"pm_score": 4,
"selected": false,
"text": "<p>Why can't you leave expected behavior alone? Most people who use FireFox will expect it to happen. Unless there is ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19471/"
] | When clicking on the text box part of an `<input type="file" />` in FireFox3, a file browsing window opens.
This doesn't happen in IE7. You have to click the "browse" button to open the file browsing window.
How can I prevent the file browsing window from opening in FireFox when a user clicks on the textbox area? I'd... | >
> How can I prevent the file browsing window from opening in FireFox when a user clicks on the textbox area?
>
>
>
Obscure it with another element.
```
<div style="position: relative">
<input type="file" />
<div style="position: absolute; top: 0; left: 0; width: 11em; height: 2em;"> </div>
</div>
```
... |
465,866 | <p>I have the same expression in Javascript but it won't work in PHP for server side validation. Here's the code</p>
<pre><code>if (ereg('/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\\.([a-zA-Z])+([a-zA-Z])+/',$_POST['email-address']))
echo "valid email";
else
echo "invalid email";
</code></pre>
| [
{
"answer_id": 465880,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 2,
"selected": false,
"text": "<p>I use the following. I also would run TRIM() on the input string before comparing it:</p>\n\n<pre><code>function is_ema... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428190/"
] | I have the same expression in Javascript but it won't work in PHP for server side validation. Here's the code
```
if (ereg('/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\\.([a-zA-Z])+([a-zA-Z])+/',$_POST['email-address']))
echo "valid email";
else
echo "invalid email";
``` | use preg\_match, not ereg. ereg regex strings do not use an enclosing slash character.
Also the double-backslash may not be necessary in a single-quoted string in PHP (not sure about that, though) |
465,872 | <p>I have an application that shows a list of items.</p>
<p>The user can click on an item and see its details in a modal popup (centered DIV, shown using JavaScript). I need to have a button on that popup that will allow the user to print out the contents of the modal popup only.</p>
<p>This is for an internal applic... | [
{
"answer_id": 466038,
"author": "bchhun",
"author_id": 48500,
"author_profile": "https://Stackoverflow.com/users/48500",
"pm_score": 0,
"selected": false,
"text": "<p>You could redirect to a printable page that has the content of the modal popup. Make sure that page has window.print() i... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39709/"
] | I have an application that shows a list of items.
The user can click on an item and see its details in a modal popup (centered DIV, shown using JavaScript). I need to have a button on that popup that will allow the user to print out the contents of the modal popup only.
This is for an internal application that needs ... | You could add a 'noprint' class name to a div wrapping everything you do not wish to print.
If you also want the main page to be printable without the dialog you can add class name to the wrapper DIV when the user presses the PRINT button and remove the class name after.
```
@media print {
.noprint {
display:none
}
... |
465,882 | <p>I have some applications (some native, some .NET) which use manifest files so that they can be <a href="http://msdn.microsoft.com/en-us/library/fh1h056h.aspx" rel="noreferrer">deployed in complete isolation</a>, without requiring any global COM registration. For example, the dependency on the dbgrid32.ocx com server... | [
{
"answer_id": 465919,
"author": "jdve",
"author_id": 44681,
"author_profile": "https://Stackoverflow.com/users/44681",
"pm_score": 3,
"selected": false,
"text": "<p><a href=\"http://mmm4vb6.atom5.com/\" rel=\"noreferrer\">Make My Manifest (MMM)</a> is a nice tool for doing this. It's a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52626/"
] | I have some applications (some native, some .NET) which use manifest files so that they can be [deployed in complete isolation](http://msdn.microsoft.com/en-us/library/fh1h056h.aspx), without requiring any global COM registration. For example, the dependency on the dbgrid32.ocx com server is declared as follows in the ... | It looks like the perfect solution does not yet exist. To summarize some research:
**Make My Manifest** ([link](http://mmm4vb6.atom5.com/))
This tool scans a VB6 project to look for COM dependencies, but it also supports manual declaration of late-bound COM dependencies (i.e. those used via CreateObject).
Interestin... |
465,886 | <p>Is it possible to determine which submit button was used? I have a confirmation form with 2 submit buttons. The first would confirm the order, do some DB tasks, then redirect. The second, which is a Cancel button, will just redirect to the same page, without doing any DB tasks.</p>
<p>Is it possible in the servl... | [
{
"answer_id": 465908,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 4,
"selected": true,
"text": "<pre><code><button name=\"someName\" value=\"someValue\" type=\"submit\">Submit</button>\n<button name=\"ot... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13435/"
] | Is it possible to determine which submit button was used? I have a confirmation form with 2 submit buttons. The first would confirm the order, do some DB tasks, then redirect. The second, which is a Cancel button, will just redirect to the same page, without doing any DB tasks.
Is it possible in the servlet, preferabl... | ```
<button name="someName" value="someValue" type="submit">Submit</button>
<button name="otherName" value="otherValue" type="submit">Cancel</button>
```
You'll have `someName=someValue` or `otherName=otherValue` in your request data |
465,889 | <p>is it possible to use Eval or similar syntax in the SeparatorTemplate of a Repeater?</p>
<p>Id' like to display some info of the last item in the separator template like this:</p>
<pre><code><table>
<asp:Repeater>
<ItemTemplate>
<tr>
<td><%# ... | [
{
"answer_id": 466026,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Hey, I'll settle with a way to identify the last item in the repeater so that I can avoid generating the separator there:</... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | is it possible to use Eval or similar syntax in the SeparatorTemplate of a Repeater?
Id' like to display some info of the last item in the separator template like this:
```
<table>
<asp:Repeater>
<ItemTemplate>
<tr>
<td><%# Eval("DepartureDateTime") %></td>
<td>... | Try this:
Add a private variable (or two) in the class of your WebForm that you can use to increment/track what the flight information is while you are performing your databinding at the item level.
Then in the ItemDatabound event, you can perform a simple evaluation if the item being databound is the ListItemType.Se... |
465,913 | <p>I wrote the code below which doesn't seem to work, but If I delete the
last if statement, it does work, obviously for the first two use cases
only. Is there a better way to write this code? In my routes file I have</p>
<pre><code>map.resources :galleries
map.resources :users, :has_many => :galleries
</code></pre... | [
{
"answer_id": 466070,
"author": "PetriW",
"author_id": 1604,
"author_profile": "https://Stackoverflow.com/users/1604",
"pm_score": 3,
"selected": true,
"text": "<p>The ins and outs of working with TMetaFile/Canvas are more related to meta files than to the TMetaFile and TMetaFileCanvas ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I wrote the code below which doesn't seem to work, but If I delete the
last if statement, it does work, obviously for the first two use cases
only. Is there a better way to write this code? In my routes file I have
```
map.resources :galleries
map.resources :users, :has_many => :galleries
```
A user clicks on the li... | The ins and outs of working with TMetaFile/Canvas are more related to meta files than to the TMetaFile and TMetaFileCanvas implementations from my traumatic experience of working with it. Aka, you should rather look for information on how EMF (or WMF) works. The Delphi implementation simply calls windows to do everythi... |
465,923 | <p>I have some AJAX work that brings across an additional form element that I don't need in the DOM. I don't have the ability to remove it server side, so I'm looking for some jQuery or classic JavaScript that will allow me to capture all the child elements of the form, remove the form I don't need and finally re-appe... | [
{
"answer_id": 465941,
"author": "Prestaul",
"author_id": 5628,
"author_profile": "https://Stackoverflow.com/users/5628",
"pm_score": 4,
"selected": true,
"text": "<p>Rather than using the <code>.html()</code> method (which will cause you to lose any events associated with form elements)... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2701/"
] | I have some AJAX work that brings across an additional form element that I don't need in the DOM. I don't have the ability to remove it server side, so I'm looking for some jQuery or classic JavaScript that will allow me to capture all the child elements of the form, remove the form I don't need and finally re-append t... | Rather than using the `.html()` method (which will cause you to lose any events associated with form elements) you should move the child nodes:
```
// grab the child nodes
var children = $('#badForm').children();
// or var children = $('#badForm > *');
// move them to the body
$(body).append(children);
// remove the... |
465,953 | <p>Consider this code (Java, specifically):</p>
<pre><code>public int doSomething()
{
doA();
try {
doB();
} catch (MyException e) {
return ERROR;
}
doC();
return SUCCESS;
}
</code></pre>
<p>Where <code>doB()</code> is defined as:</p>
<pre><code>private void doB() throws MyEx... | [
{
"answer_id": 465968,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 3,
"selected": false,
"text": "<p>I've never liked using exceptions for control flow (in some languages, like the CLR, they're expensive).</p>\n\n<p>If yo... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24545/"
] | Consider this code (Java, specifically):
```
public int doSomething()
{
doA();
try {
doB();
} catch (MyException e) {
return ERROR;
}
doC();
return SUCCESS;
}
```
Where `doB()` is defined as:
```
private void doB() throws MyException
```
Basically, `MyException` exists on... | It entirely depends on what that error condition is, and what the method's job is. If returning `ERROR` is a valid way of handling that error for the calling function, why would it be bad?
Often, however, it *is* a smell. Consider this:
```
bool isDouble(string someString) {
try {
double d = Convert.Pars... |
465,979 | <p>I am trying to match multiple CSS style code blocks in a HTML document. This code will match the first one but won't match the second. What code would I need to match the second. Can I just get a list of the groups that are inside of my 'style' brackets? Should I call the 'find' method to get the next match?</p>... | [
{
"answer_id": 466218,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 5,
"selected": true,
"text": "<blockquote>\n <p>I am trying to match multiple CSS style code blocks in a HTML document.</p>\n</blockquote>\n\n<p>Standar... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10522/"
] | I am trying to match multiple CSS style code blocks in a HTML document. This code will match the first one but won't match the second. What code would I need to match the second. Can I just get a list of the groups that are inside of my 'style' brackets? Should I call the 'find' method to get the next match?
Here is m... | >
> I am trying to match multiple CSS style code blocks in a HTML document.
>
>
>
Standard Answer: don't use regex to parse HTML. regex cannot parse HTML reliably, no matter how complicated and clever you make your expression. Unless you are absolutely sure the exact format of the target document is totally fixed,... |
465,984 | <p>I'm having some problems with the following code:</p>
<pre><code>private class ClientPluginLoader : MarshalByRefObject
{
public bool IsPluginAssembly(string filename)
{
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomainReflectionOnlyAssemblyResolve);
... | [
{
"answer_id": 466028,
"author": "Vilx-",
"author_id": 41360,
"author_profile": "https://Stackoverflow.com/users/41360",
"pm_score": 2,
"selected": false,
"text": "<p>I've had a similar problem. I also had this architecture - a .DLL that contains ClientPlugin base class; several plugins ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/82121/"
] | I'm having some problems with the following code:
```
private class ClientPluginLoader : MarshalByRefObject
{
public bool IsPluginAssembly(string filename)
{
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomainReflectionOnlyAssemblyResolve);
Assembly a... | This is due to loading into a different context. How you load an assembly (Load / LoadFrom / ReflectionOnlyLoad) determines which context it is loaded into. This simple example also demonstrates the problem:
```
using System;
using System.Reflection;
class Foo
{
public static void Main()
{
var type = ... |
465,990 | <p>I rewrite URLs to include the title of user generated travelblogs.</p>
<p>I do this for both readability of URLs and SEO purposes. </p>
<pre>
http://www.example.com/gallery/280-Gorges_du_Todra/
</pre>
<p>The first integer is the id, the rest is for us humans (but is irrelevant for requesting the resource).</p>
... | [
{
"answer_id": 466016,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 2,
"selected": false,
"text": "<p>To me the third is most readable.</p>\n\n<p>You could use a little dictionary e.g. <code>ï -> i</code> and <code>ü -&... | 2009/01/21 | [
"https://Stackoverflow.com/questions/465990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22674/"
] | I rewrite URLs to include the title of user generated travelblogs.
I do this for both readability of URLs and SEO purposes.
```
http://www.example.com/gallery/280-Gorges_du_Todra/
```
The first integer is the id, the rest is for us humans (but is irrelevant for requesting the resource).
Now people can write tit... | Ultimately, you're going to have to give up on the idea of "correct", for this problem. Translating the string, no matter how you do it, destroys accuracy in the name of compatibility and readability. All three options are equally compatible, but #1 and #2 suffer in terms of readability. So just run with it and go for ... |
466,041 | <p>I'm just starting on the road the learning C, and ran into some difficulty:</p>
<p>The code listed below is giving me the following error:</p>
<p>Attaching to program: `/workfolder/cocoa/c_stuff/bookshelf/build/Debug/bookshelf', process 1674.<br/>
Cannot access memory at address 0xa0df194<br/>
Cannot access memory... | [
{
"answer_id": 466060,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 3,
"selected": false,
"text": "<p>You've only ever allocated memory for the first book in main - after that it tries to write to the next slot in the array... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm just starting on the road the learning C, and ran into some difficulty:
The code listed below is giving me the following error:
Attaching to program: `/workfolder/cocoa/c\_stuff/bookshelf/build/Debug/bookshelf', process 1674.
Cannot access memory at address 0xa0df194
Cannot access memory at address 0xa0df19... | You've only ever allocated memory for the first book in main - after that it tries to write to the next slot in the array, which doesn't point to an allocated block of memory, giving you a seg-fault. You're going to have to allocate memory for each book you want to read in.
In addition, since C doesn't know how long a... |
466,042 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/3213/c-convert-integers-into-written-numbers">C# Convert Integers into Written Numbers</a> </p>
</blockquote>
<p>I need to take an integer value and convert it to its english word equivalent (i.e. 4 => "four", 18... | [
{
"answer_id": 466054,
"author": "Randolpho",
"author_id": 12716,
"author_profile": "https://Stackoverflow.com/users/12716",
"pm_score": 0,
"selected": false,
"text": "<p>There isn't anything built in that I'm aware of. You're just going to have to do some digit-parsing and replacing. </... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17573/"
] | >
> **Possible Duplicate:**
>
> [C# Convert Integers into Written Numbers](https://stackoverflow.com/questions/3213/c-convert-integers-into-written-numbers)
>
>
>
I need to take an integer value and convert it to its english word equivalent (i.e. 4 => "four", 1879 => "one thousand, eight hundred seventy-nine")... | string s being the input number
```
const string input = "1023";
string[] placement = { "thousand", "hundred", "ten", "" };
string[] numbersToLetters = { "", "one", "two", "tre", "four", "five", "six", "seven", "eight", "nine" };
for (int i = 0; i < input.Length; i++)
{
... |
466,045 | <p>I just posted one question and got it answered very quickly, thank you.</p>
<p>I have a new problem, being I have a asp label which gets text dynamically set on it during instanation and then I have a onmousedown function tied to it call a javascript function to enable a table area that sitting below that is displa... | [
{
"answer_id": 466096,
"author": "Henk",
"author_id": 47354,
"author_profile": "https://Stackoverflow.com/users/47354",
"pm_score": 0,
"selected": false,
"text": "<p>Just a quick idea, do the tables both have the same ID? so the script only picks the first it finds?</p>\n\n<p>make the ID... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I just posted one question and got it answered very quickly, thank you.
I have a new problem, being I have a asp label which gets text dynamically set on it during instanation and then I have a onmousedown function tied to it call a javascript function to enable a table area that sitting below that is display - none b... | Have the table runat server, and let the user control implement INamingContainer.
Construct the ID for the table, and set it programmatically (HtmlTable) in an overridden CreateChildControls, to for instance string.Concat(ID, "table").
EDIT: You also need dynamic ID references in the javascript.
You could use some <as... |
466,048 | <p>I find this line in the ZenTest source code:</p>
<pre><code>result = @test_mappings.find { |file_re, ignored| filename =~ file_re }
</code></pre>
<p>The <code>@test_mappings</code> and <code>result</code> here are both Array object, but I didn't found 'find' method on Array class in ruby doc. I also tried it on ir... | [
{
"answer_id": 466078,
"author": "Gordon Wilson",
"author_id": 23071,
"author_profile": "https://Stackoverflow.com/users/23071",
"pm_score": 4,
"selected": true,
"text": "<p><code>Array</code> includes the <code>Enumerable</code> module, which adds the <a href=\"http://www.ruby-doc.org/c... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44512/"
] | I find this line in the ZenTest source code:
```
result = @test_mappings.find { |file_re, ignored| filename =~ file_re }
```
The `@test_mappings` and `result` here are both Array object, but I didn't found 'find' method on Array class in ruby doc. I also tried it on irb:
```
irb(main):014:0> Array.respond_to? :find... | `Array` includes the `Enumerable` module, which adds the [`find`](http://www.ruby-doc.org/core/classes/Enumerable.html#M003153) method.
In your example you tested `Array.respond_to`. This will only return true for class methods of `Array`. `find` is an instance method, so `respond_to?` must be invoked on an instance o... |
466,053 | <p>In some regex flavors, [negative] zero-width assertions (look-ahead/look-behind) are not supported. </p>
<p>This makes it extremely difficult (impossible?) to state an exclusion. For example "every line that <em>does not</em> have "foo" on it", like this:</p>
<pre><code>^((?!foo).)*$
</code></pre>
<p>Can the same... | [
{
"answer_id": 466079,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>You can usually look for foo and invert the result of the regex match from the client code.</p>\n\n<p>For a simple ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18771/"
] | In some regex flavors, [negative] zero-width assertions (look-ahead/look-behind) are not supported.
This makes it extremely difficult (impossible?) to state an exclusion. For example "every line that *does not* have "foo" on it", like this:
```
^((?!foo).)*$
```
Can the same thing be achieved without using look-ar... | **UPDATE:** It fails "with two ff before oo" as [@Ciantic pointed out in the comments.](https://stackoverflow.com/questions/466053/regex-matching-by-exclusion-without-look-ahead-is-it-possible/466167#comment80765384_466167)
---
```
^(f(o[^o]|[^o])|[^f])*$
```
**NOTE:** It is much much easier just to negate a match ... |
466,069 | <p>If a flag IsAdmin, cast as AdminUser otherwise cast as NormalUser.</p>
<p>Was just curious about this but not sure how to do it. I do see that you can create a child object based on a table value and another table like:</p>
<p>SiteUser is from the table Site_User
AdminUser is from the table Site_User and Admin_Us... | [
{
"answer_id": 466084,
"author": "Wookai",
"author_id": 56761,
"author_profile": "https://Stackoverflow.com/users/56761",
"pm_score": 0,
"selected": false,
"text": "<p>As a rule of thumb, checking if an object is an instance of a given class is not good practice. Try using a method or pr... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21691/"
] | If a flag IsAdmin, cast as AdminUser otherwise cast as NormalUser.
Was just curious about this but not sure how to do it. I do see that you can create a child object based on a table value and another table like:
SiteUser is from the table Site\_User
AdminUser is from the table Site\_User and Admin\_User when Site\_U... | Entity framework supports Table-Per-Type and Table-Per-Hierarchy inheritance.
Table-Per-Type means that a new table is used for each class, including the abstract type. Table-Per-Hierarchy means that a single table is used to store data for multiple types, and only the columns necessary for that type are pulled from t... |
466,071 | <p>The Win32 GetTimeZoneInformation function returns your systems local time zone as set up in the control panel. How do I get another specific time zone? Is there a call that does this?</p>
<p>Tony</p>
| [
{
"answer_id": 466107,
"author": "CalvinR",
"author_id": 55990,
"author_profile": "https://Stackoverflow.com/users/55990",
"pm_score": 4,
"selected": true,
"text": "<p>According to <a href=\"http://msdn.microsoft.com/en-us/library/ms725481(VS.85).aspx\" rel=\"noreferrer\">this</a> the in... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31762/"
] | The Win32 GetTimeZoneInformation function returns your systems local time zone as set up in the control panel. How do I get another specific time zone? Is there a call that does this?
Tony | According to [this](http://msdn.microsoft.com/en-us/library/ms725481(VS.85).aspx) the information for the different timezones is stored in the registry, so you will have to retrieve the information from there and populate the TIME\_ZONE\_INFORMATION struct yourself.
Quote from the msdn article
```
Remarks
Settings ... |
466,130 | <p>SQL Server Server 2005. I'm staring at a database that has 500+ stored procedures, and trying to glean the intricacies of how they interact with the data - particularly in regards to how they insert/modify data. I was hoping to find a search" or "find" functionality that would look at the content of the actual pro... | [
{
"answer_id": 466139,
"author": "Owen",
"author_id": 2109,
"author_profile": "https://Stackoverflow.com/users/2109",
"pm_score": 2,
"selected": false,
"text": "<p>Mass export to text files then index them with Google Desktop.</p>\n"
},
{
"answer_id": 466144,
"author": "Georg... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17803/"
] | SQL Server Server 2005. I'm staring at a database that has 500+ stored procedures, and trying to glean the intricacies of how they interact with the data - particularly in regards to how they insert/modify data. I was hoping to find a search" or "find" functionality that would look at the content of the actual procedur... | There is an Information\_Schema.Routines view that you can use.
```
select *
FROM INFORMATION_SCHEMA.ROUTINES
WHERE OBJECTPROPERTY(OBJECT_ID(SPECIFIC_NAME),'IsMSShipped') =0
and OBJECT_DEFINITION(OBJECT_ID(SPECIFIC_NAME)) like '%search term here%'
AND ROUTINE_TYPE='PROCEDURE'
``` |
466,133 | <p>I have a .Net service that has begun to refuse to start - the system log shows that it "was successfully sent a start control" and then five seconds later the "service entered the stop state". I have the Main() function of my service class wrapped in a try/catch block -- but when this situation occurs, no errors ap... | [
{
"answer_id": 466227,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 1,
"selected": false,
"text": "<p>The Run method is not going to throw here. Rather, you need to wrap the code in the overload of the OnStart method o... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525/"
] | I have a .Net service that has begun to refuse to start - the system log shows that it "was successfully sent a start control" and then five seconds later the "service entered the stop state". I have the Main() function of my service class wrapped in a try/catch block -- but when this situation occurs, no errors appear... | In this situation, I was writing the to the Windows Application log -- in the production environment, the log was full. I'm unsure of what the debugging technique should be to 'catch' this class of a problem - but that was the problem for us. |
466,135 | <p>One of the functionalities in a Django project I am writing is sending a newsletter. I have a model, <code>Newsletter</code> and a function, <code>send_newsletter</code>, which I have registered to listen to <code>Newsletter</code>'s <code>post_save</code> signal. When the newsletter object is saved via the admin in... | [
{
"answer_id": 466641,
"author": "muhuk",
"author_id": 42188,
"author_profile": "https://Stackoverflow.com/users/42188",
"pm_score": 3,
"selected": false,
"text": "<p>You can check if it is creation or update in the model's <code>save</code> method:</p>\n\n<pre><code>def save(self, *args... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19922/"
] | One of the functionalities in a Django project I am writing is sending a newsletter. I have a model, `Newsletter` and a function, `send_newsletter`, which I have registered to listen to `Newsletter`'s `post_save` signal. When the newsletter object is saved via the admin interface, `send_newsletter` checks if `created` ... | You can check if it is creation or update in the model's `save` method:
```
def save(self, *args, **kwargs):
if self.pk:
raise StandardError('Can\'t modify bla bla bla.')
super(Payment, self).save(*args, **kwargs)
```
Code above will raise an exception if you try to save an existing object. **Objects... |
466,140 | <p>i need help with disk_total_space function..</p>
<p>i have this on my code</p>
<pre><code><?php
$sql="select * from users order by id";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)) {
?>
Name : <?php echo $row['name']; ?>
Email : <?php echo $row['ema... | [
{
"answer_id": 466168,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 3,
"selected": false,
"text": "<p><a href=\"http://us2.php.net/disk_total_space\" rel=\"nofollow noreferrer\">http://us2.php.net/disk_total_space</a> say... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i need help with disk\_total\_space function..
i have this on my code
```
<?php
$sql="select * from users order by id";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)) {
?>
Name : <?php echo $row['name']; ?>
Email : <?php echo $row['email']; ?>
Diskspace Available : <?p... | I think what you want is something like this:
```
function foldersize($path) {
$total_size = 0;
$files = scandir($path);
foreach($files as $t) {
if (is_dir(rtrim($path, '/') . '/' . $t)) {
if ($t<>"." && $t<>"..") {
$size = foldersize(rtrim($path, '/') . '/' . $t);
... |
466,159 | <p>In a .NET Datatable, the columns are Object types, which can include a datatable as a valid type for a column. So you can create a fairly complex structure:</p>
<pre><code>CompanyID (Integer) | CompanyName (String) | OrderRecords (DataTable)
-------------------------------------------------------------------------... | [
{
"answer_id": 466236,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>While the type is <code>Object</code> as you say, .Net does try to use more strongly-typed values. The columns hav... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18893/"
] | In a .NET Datatable, the columns are Object types, which can include a datatable as a valid type for a column. So you can create a fairly complex structure:
```
CompanyID (Integer) | CompanyName (String) | OrderRecords (DataTable)
---------------------------------------------------------------------------
1 ... | I needed to do something similar once, and ended up returning them all as OUT REF CURSOR's, one for each result set.
This could be loaded into a DataSet if preferred. |
466,165 | <p>I have two <code>DataGridView</code>s in a tab and the <code>DataSource</code> of the second grid is based on the row selection in first grid. The problem is I cannot get the grid to refresh after some values have been inserted or updated in the prior tabs. It works fine if I click on the row but it is not working i... | [
{
"answer_id": 466236,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>While the type is <code>Object</code> as you say, .Net does try to use more strongly-typed values. The columns hav... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57587/"
] | I have two `DataGridView`s in a tab and the `DataSource` of the second grid is based on the row selection in first grid. The problem is I cannot get the grid to refresh after some values have been inserted or updated in the prior tabs. It works fine if I click on the row but it is not working if I select the row progra... | I needed to do something similar once, and ended up returning them all as OUT REF CURSOR's, one for each result set.
This could be loaded into a DataSet if preferred. |
466,180 | <p>I'm a little confused about one aspect of the .NET ThreadPool: namely, how you can tell how many of its 'Available' threads are idle ones waiting to be reused, and how many haven't yet been created.</p>
<p>The summary for the <code>GetAvailableThreads()</code> method states that it:</p>
<blockquote>
<p>Retrieves... | [
{
"answer_id": 466258,
"author": "Jim Mischel",
"author_id": 56778,
"author_profile": "https://Stackoverflow.com/users/56778",
"pm_score": 2,
"selected": false,
"text": "<p>The ThreadPool does not have a way to determine how many threads are currently idle. That is, created but not actu... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm a little confused about one aspect of the .NET ThreadPool: namely, how you can tell how many of its 'Available' threads are idle ones waiting to be reused, and how many haven't yet been created.
The summary for the `GetAvailableThreads()` method states that it:
>
> Retrieves the difference between the
> maximum... | The ThreadPool does not have a way to determine how many threads are currently idle. That is, created but not actually doing anything.
My experience with the ThreadPool shows that it's pretty good about keeping threads around. I don't know if they've put logic in there to keep track of the average number of threads in... |