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 |
|---|---|---|---|---|---|---|
510,319 | <p>If you haven't read the <a href="https://stackoverflow.com/questions/510138/programming-skill-tester-problem">first</a> problem do so know to catch up to speed. Now then, how do I go about clearing these check boxes? I tried using the same approach that @colithium told me to use for checking the state of all the che... | [
{
"answer_id": 510370,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 1,
"selected": false,
"text": "<p>Set <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox.checked.aspx\" rel=\"nofollow nor... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56555/"
] | If you haven't read the [first](https://stackoverflow.com/questions/510138/programming-skill-tester-problem) problem do so know to catch up to speed. Now then, how do I go about clearing these check boxes? I tried using the same approach that @colithium told me to use for checking the state of all the check boxes, but ... | I assume your method looks something like this:
```
private void clearButton_Click(object sender, EventArgs e)
{
CheckBox cb = (CheckBox)sender;
cb.Checked = false;
}
```
In this case, the "Sender" is the clear button, not a check box.
Borrowing from Stormenet's answer:
```
private void clearButt... |
510,325 | <p>If I have 10 tabs opened, I have to close each one using ":q" separately. </p>
<p>How can I close them all at once?</p>
| [
{
"answer_id": 510327,
"author": "Vagmi Mudumbai",
"author_id": 617,
"author_profile": "https://Stackoverflow.com/users/617",
"pm_score": 3,
"selected": false,
"text": "<pre><code>:qall\n</code></pre>\n\n<p>This closes all tabs and open buffers.</p>\n"
},
{
"answer_id": 510328,
... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7205/"
] | If I have 10 tabs opened, I have to close each one using ":q" separately.
How can I close them all at once? | Shortest/simplest/fastest way would be:
```
:qa
```
To save work in all tabs and quit:
```
:wqa
``` |
510,341 | <p>Say I have an interface <code>IFoo</code> and I want all subclasses of <code>IFoo</code> to override Object's <code>ToString</code> method. Is this possible? </p>
<p>Simply adding the method signature to IFoo as such doesn't work:</p>
<pre><code>interface IFoo
{
String ToString();
}
</code></pre>
<p>since all... | [
{
"answer_id": 510358,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 8,
"selected": true,
"text": "<p>I don't believe you can do it with an interface. You can use an abstract base class though:</p>\n\n<pre><code>public a... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/246/"
] | Say I have an interface `IFoo` and I want all subclasses of `IFoo` to override Object's `ToString` method. Is this possible?
Simply adding the method signature to IFoo as such doesn't work:
```
interface IFoo
{
String ToString();
}
```
since all the subclasses extend `Object` and provide an implementation that... | I don't believe you can do it with an interface. You can use an abstract base class though:
```
public abstract class Base
{
public abstract override string ToString();
}
``` |
510,343 | <p>My table is:</p>
<pre><code>CREATE TABLE A(
id serial NOT NULL,
date timestamp without time zone,
type text,
sub_type text,
filename text,
filepath text,
filesize integer,
);
</code></pre>
<p>I have an update routine:</p>
<pre><code>$Query = "UPDATE A SET type=\"" . $strType . "\" wher... | [
{
"answer_id": 510390,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 3,
"selected": true,
"text": "<p>In SQL, double-quotes are identifier delimiters. Your UPDATE statement is trying to set the <code>type</code> colum... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29505/"
] | My table is:
```
CREATE TABLE A(
id serial NOT NULL,
date timestamp without time zone,
type text,
sub_type text,
filename text,
filepath text,
filesize integer,
);
```
I have an update routine:
```
$Query = "UPDATE A SET type=\"" . $strType . "\" where id=" . intval($ID);
```
Problem: ... | In SQL, double-quotes are identifier delimiters. Your UPDATE statement is trying to set the `type` column to the value of the `"lettuce"` column, which is an error if there is no column named lettuce.
You want to use single-quotes to delimit a string literal in SQL:
```
$Query = "UPDATE A SET type='" . $strType . "' ... |
510,348 | <p>How do I put a time delay in a Python script?</p>
| [
{
"answer_id": 64486,
"author": "pobk",
"author_id": 7829,
"author_profile": "https://Stackoverflow.com/users/7829",
"pm_score": 10,
"selected": false,
"text": "<p>Use <a href=\"https://docs.python.org/library/time.html#time.sleep\" rel=\"noreferrer\"><code>sleep()</code></a> from the <c... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46646/"
] | How do I put a time delay in a Python script? | This delays for 2.5 seconds:
```
import time
time.sleep(2.5)
```
---
Here is another example where something is run approximately once a minute:
```
import time
while True:
print("This prints once a minute.")
time.sleep(60) # Delay for 1 minute (60 seconds).
``` |
510,357 | <p>Is there a way of reading one single character from the user input? For instance, they press one key at the terminal and it is returned (sort of like <code>getch()</code>). I know there's a function in Windows for it, but I'd like something that is cross-platform.</p>
| [
{
"answer_id": 510364,
"author": "tehvan",
"author_id": 61848,
"author_profile": "https://Stackoverflow.com/users/61848",
"pm_score": 9,
"selected": true,
"text": "<p>Here's a link to the ActiveState Recipes site that says how you can read a single character in Windows, Linux and OSX:</p... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49701/"
] | Is there a way of reading one single character from the user input? For instance, they press one key at the terminal and it is returned (sort of like `getch()`). I know there's a function in Windows for it, but I'd like something that is cross-platform. | Here's a link to the ActiveState Recipes site that says how you can read a single character in Windows, Linux and OSX:
[getch()-like unbuffered character reading from stdin on both Windows and Unix](https://code.activestate.com/recipes/134892/)
```
class _Getch:
"""Gets a single character from standard input.... |
510,367 | <p>What is the best way to generate random numbers using Objective-C on iOS?<br>
If I use <code>(int)((double) rand() / ((double)(RAND_MAX) + (double) 1) * 5.0)</code> to generate a number from 0 to 4, every time I start the program on the iPhone it generates the same numbers to start off with.</p>
| [
{
"answer_id": 510374,
"author": "vava",
"author_id": 6258,
"author_profile": "https://Stackoverflow.com/users/6258",
"pm_score": 2,
"selected": false,
"text": "<p>Call <code>srand()</code> at the start of your program, it'll reseed random number generator</p>\n"
},
{
"answer_id"... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21293/"
] | What is the best way to generate random numbers using Objective-C on iOS?
If I use `(int)((double) rand() / ((double)(RAND_MAX) + (double) 1) * 5.0)` to generate a number from 0 to 4, every time I start the program on the iPhone it generates the same numbers to start off with. | There is a very similar question [here on StackOverFlow](https://stackoverflow.com/questions/160890/generating-random-numbers-in-objective-c). Here is one of the better solutions (no need for seeding):
```
int r = arc4random() % 5;
``` |
510,372 | <p>We are trying to develop a small application that can monitor the programs/processes that are executing in a windows machine.</p>
<p>If the program/process is not supposed to run, it should be blocked. It works similar to an antivirus.</p>
<p>This is the basic idea.</p>
<p>I want to know the ways to hook into the... | [
{
"answer_id": 510440,
"author": "amazedsaint",
"author_id": 45956,
"author_profile": "https://Stackoverflow.com/users/45956",
"pm_score": 0,
"selected": false,
"text": "<p>I havn't tried geting real-time notification. How ever, Here is how to get running processes in C#</p>\n\n<pre><cod... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184/"
] | We are trying to develop a small application that can monitor the programs/processes that are executing in a windows machine.
If the program/process is not supposed to run, it should be blocked. It works similar to an antivirus.
This is the basic idea.
I want to know the ways to hook into the OS to get notified abou... | The easiest way is to use WMI. Specifically monitor the Win32\_ProcessStartTrace. This is better than Win32\_Process, because it is setup to use events whereas Win32\_Process requires polling which is more CPU intensive. Below is how to do it in C#. First make sure that System.Management is setup as a reference for you... |
510,373 | <p>This is my sample code:</p>
<pre><code>MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUser("root");
dataSource.setPassword("ncl");
dataSource.setDatabaseName("userdb");
dataSource.setEmulateLocators(true); //This is important because we are dealing with a blob type data field
try{
JdbcDi... | [
{
"answer_id": 510900,
"author": "itsadok",
"author_id": 7581,
"author_profile": "https://Stackoverflow.com/users/7581",
"pm_score": 2,
"selected": false,
"text": "<p>It seems like the index is locked. If you're sure it shouldn't be locked, then maybe some process crashed without proper ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is my sample code:
```
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUser("root");
dataSource.setPassword("ncl");
dataSource.setDatabaseName("userdb");
dataSource.setEmulateLocators(true); //This is important because we are dealing with a blob type data field
try{
JdbcDirectory jdbcDi... | It seems like the index is locked. If you're sure it shouldn't be locked, then maybe some process crashed without proper cleanup.
Try adding the line
```
jdbcDir.clearLock();
```
before creating the indexWriter.
Don't leave it there, tough. You generally want to let Lucene manage the locks, to disallow two IndexWr... |
510,382 | <p>Is there a built in way to create round-cornered UILabels? If the answer is no, how would one go about creating such an object? </p>
| [
{
"answer_id": 510630,
"author": "benzado",
"author_id": 10947,
"author_profile": "https://Stackoverflow.com/users/10947",
"pm_score": 9,
"selected": true,
"text": "<h2>iOS 3.0 and later</h2>\n\n<p>iPhone OS 3.0 and later supports the <code>cornerRadius</code> property on the <code>CALay... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1376/"
] | Is there a built in way to create round-cornered UILabels? If the answer is no, how would one go about creating such an object? | iOS 3.0 and later
-----------------
iPhone OS 3.0 and later supports the `cornerRadius` property on the `CALayer` class. Every view has a `CALayer` instance that you can manipulate. This means you can get rounded corners in one line:
```
view.layer.cornerRadius = 8;
```
You will need to `#import <QuartzCore/QuartzC... |
510,393 | <p>I want to pass a variable to a UIButton action, for example</p>
<pre><code>NSString *string=@"one";
[downbutton addTarget:self action:@selector(action1:string)
forControlEvents:UIControlEventTouchUpInside];
</code></pre>
<p>and my action function is like:</p>
<pre><code>-(void) action1:(NSString *)string{
}
... | [
{
"answer_id": 510515,
"author": "diciu",
"author_id": 2811,
"author_profile": "https://Stackoverflow.com/users/2811",
"pm_score": 5,
"selected": true,
"text": "<p>Change it to read:</p>\n\n<pre><code>[downbutton addTarget:self action:@selector(action1:) forControlEvents:UIControlEventTo... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35405/"
] | I want to pass a variable to a UIButton action, for example
```
NSString *string=@"one";
[downbutton addTarget:self action:@selector(action1:string)
forControlEvents:UIControlEventTouchUpInside];
```
and my action function is like:
```
-(void) action1:(NSString *)string{
}
```
However, it returns a syntax er... | Change it to read:
```
[downbutton addTarget:self action:@selector(action1:) forControlEvents:UIControlEventTouchUpInside];
```
I don't know about the Iphone SDK, but the target of a button action probably receives an id (usually named sender).
```
- (void) buttonPress:(id)sender;
```
Within the method call, send... |
510,406 | <p>Is there a way to get the current ref count of an object in Python?</p>
| [
{
"answer_id": 510411,
"author": "kquinn",
"author_id": 54486,
"author_profile": "https://Stackoverflow.com/users/54486",
"pm_score": 6,
"selected": false,
"text": "<p>Using the <code>gc</code> module, the interface to the garbage collector guts, you can call <code>gc.get_referrers(foo)<... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a way to get the current ref count of an object in Python? | According to the Python [documentation](https://docs.python.org/dev/library/sys.html#sys.getrefcount), the `sys` module contains a function:
```
import sys
sys.getrefcount(object) #-- Returns the reference count of the object.
```
Generally 1 higher than you might expect, because of object arg temp reference. |
510,420 | <p>How can I write to parallel port through Windows XP command line?</p>
| [
{
"answer_id": 510435,
"author": "Zoredache",
"author_id": 20267,
"author_profile": "https://Stackoverflow.com/users/20267",
"pm_score": 2,
"selected": false,
"text": "<p>Back in the DOS days we would frequently use a command like <strong>type filename.txt > lpt1</strong> to print our te... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13440/"
] | How can I write to parallel port through Windows XP command line? | Looking at your reply to Zoredache, your real problem is not output to the parallel port, that's trivial.
Your real problem is how to get a 0xff character on stdout. This is possible with a trivial `.com` executable which invokes the relevant soft interrupt, but to be honest it's probably easier to create a file with ... |
510,421 | <p>I noticed that Eclipse (Flex Builder) generates hundreds of metadata files. Should I check them into my source control? They seem necessary, because if I delete them Flex Builder just opens up an empty workbench...</p>
<p>Some of these files plainly do not belong in source control (like .history files and some cach... | [
{
"answer_id": 510448,
"author": "Christian Nunciato",
"author_id": 32129,
"author_profile": "https://Stackoverflow.com/users/32129",
"pm_score": 1,
"selected": false,
"text": "<p>I generally put all of my source code under src, and I check in src and all of its descendents. If my proje... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11208/"
] | I noticed that Eclipse (Flex Builder) generates hundreds of metadata files. Should I check them into my source control? They seem necessary, because if I delete them Flex Builder just opens up an empty workbench...
Some of these files plainly do not belong in source control (like .history files and some cache files). ... | Don't check in the hundreds of metadata files. If you want to be able to check out the project in a way that it can just be imported, then check in:
```
.actionScriptProperties
.project
.flexProperties
```
And "html-template" and "libs". As Christian says, any resources you depend on. I usually keep those as separat... |
510,429 | <p>I need custom behavior for tab keys in RichTextEdit control.</p>
<p>Currenty the best I have is this:</p>
<pre><code>editBox.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.field_PreviewKeyPress);
private void field_PreviewKeyPress(object sender, PreviewKeyDownEventArgs e)
{
... | [
{
"answer_id": 510439,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 0,
"selected": false,
"text": "<p>You say you're using a \"RichTextEdit\" control but I guess you mean RichTextBox. If so, you should be able to set th... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1660/"
] | I need custom behavior for tab keys in RichTextEdit control.
Currenty the best I have is this:
```
editBox.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.field_PreviewKeyPress);
private void field_PreviewKeyPress(object sender, PreviewKeyDownEventArgs e)
{
switch (e.... | Found a solution myself - override bool RichTextEdit.ProcessCmdKey(ref Message m, Keys keyData). |
510,462 | <p>As documented in the blog post <em><a href="http://www.principiaprogramatica.com/2008/04/25/beware-of-systemnanotime-in-java/" rel="noreferrer">Beware of System.nanoTime() in Java</a></em>, on x86 systems, Java's System.nanoTime() returns the time value using a <a href="http://en.wikipedia.org/wiki/Central_processin... | [
{
"answer_id": 510481,
"author": "Ric Tokyo",
"author_id": 42019,
"author_profile": "https://Stackoverflow.com/users/42019",
"pm_score": 2,
"selected": false,
"text": "<p>No, it's not... It just depends on your CPU, check <a href=\"http://en.wikipedia.org/wiki/High_Precision_Event_Timer\... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14316/"
] | As documented in the blog post *[Beware of System.nanoTime() in Java](http://www.principiaprogramatica.com/2008/04/25/beware-of-systemnanotime-in-java/)*, on x86 systems, Java's System.nanoTime() returns the time value using a [CPU](http://en.wikipedia.org/wiki/Central_processing_unit) specific counter. Now consider th... | **This answer was written in 2011 from the point of view of what the Sun JDK of the time running on operating systems of the time actually did. That was a long time ago! [leventov's answer](https://stackoverflow.com/a/54566928/116639) offers a more up-to-date perspective.**
That post is wrong, and `nanoTime` is safe. ... |
510,477 | <p>Lets consider that I have a public property called AvatarSize like the following,</p>
<pre><code>public class Foo
{
...
public Size AvatarSize
{
get { return myAvatarSize; }
set { myAvatarSize = value; }
}
...
}
</code></pre>
<p>Now if a target class wants to set this property, then they need t... | [
{
"answer_id": 510483,
"author": "Peter",
"author_id": 58553,
"author_profile": "https://Stackoverflow.com/users/58553",
"pm_score": 2,
"selected": false,
"text": "<p>You could create 2 new properties myFoo.AvatarSizeWidth and make this property change the Width same goes for Height..</p... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Lets consider that I have a public property called AvatarSize like the following,
```
public class Foo
{
...
public Size AvatarSize
{
get { return myAvatarSize; }
set { myAvatarSize = value; }
}
...
}
```
Now if a target class wants to set this property, then they need to do it the following way,... | `Size` is a structure. Being a ValueType it's immutable. If you change it's property like that, it will only modify an object instance in the stack, not the actual field. In your case `AvatarSize` property can only be set using a struct constructor: `new Size(20, 20)`. |
510,497 | <p>I'm trying to create my own error window for the project I am working on. When I show my error window I have no way to pass the error message, and user message to the Error window because the "ErrorMessage.Text" cannot be seen in the classes I make.</p>
<p>I went into the form designer generated code and tried to m... | [
{
"answer_id": 510507,
"author": "Peter",
"author_id": 58553,
"author_profile": "https://Stackoverflow.com/users/58553",
"pm_score": 0,
"selected": false,
"text": "<p>You can make the TextBox public first of.\nSecond make a static form(name of your form) variable and put the form there e... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60615/"
] | I'm trying to create my own error window for the project I am working on. When I show my error window I have no way to pass the error message, and user message to the Error window because the "ErrorMessage.Text" cannot be seen in the classes I make.
I went into the form designer generated code and tried to make the Te... | Yes! have a function made public that can receive this text:
```
pseudo: public void updateTextBox(string new_text)
```
and have the function update the textbox from there.
don't mix UI with logic. |
510,503 | <p>I Want to use <kbd>Ctrl</kbd>+<kbd>Space</kbd> for omni-completion (and keyword completion if there is no omni-completion) in vim. I've tried this which I found somewhere on the web:</p>
<pre><code>inoremap <expr> <c-space> pumvisible() ? "\<C-n>" : "\<C-x>\<C-o>\<C-n>\<C-p>... | [
{
"answer_id": 510571,
"author": "sykora",
"author_id": 53850,
"author_profile": "https://Stackoverflow.com/users/53850",
"pm_score": 6,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>inoremap <expr> <C-Space> pumvisible() \\|\\| &omnifunc == '' ?\n\\ \"\\<l... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42793/"
] | I Want to use `Ctrl`+`Space` for omni-completion (and keyword completion if there is no omni-completion) in vim. I've tried this which I found somewhere on the web:
```
inoremap <expr> <c-space> pumvisible() ? "\<C-n>" : "\<C-x>\<C-o>\<C-n>\<C-p>\<C-r>=pumvisible() ? \"\\<Down>\" : \"\\<CR>\""
```
however it's not w... | Try this:
```
inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
\ "\<lt>C-n>" :
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
imap <C-@> <C-Space>
``` |
510,506 | <p>I am trying to communicate with Excel from a Java/SWT application. I have been able to open a worksheet, open a file and save it but that's about it.</p>
<p>Can anyone point me to some documentation/examples for this? I especially need to know which commands are available. I did try to record macros to inspect. Thi... | [
{
"answer_id": 510977,
"author": "Stephan Keller",
"author_id": 25422,
"author_profile": "https://Stackoverflow.com/users/25422",
"pm_score": 2,
"selected": true,
"text": "<p>Not a documentation, but since you asked about the available commands via automation: have you tried the OLE/COM ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11249/"
] | I am trying to communicate with Excel from a Java/SWT application. I have been able to open a worksheet, open a file and save it but that's about it.
Can anyone point me to some documentation/examples for this? I especially need to know which commands are available. I did try to record macros to inspect. This was usef... | Not a documentation, but since you asked about the available commands via automation: have you tried the OLE/COM Object viewer that comes with the Windows 2000 resource kit? Download [here](http://download.microsoft.com/download/win2000platform/oleview/1.00.0.1/nt5/en-us/oleview_setup.exe). |
510,528 | <p>I'm trying to pass parameters to my static web method (which is in an asp.net page). I'm trying to pass the "test1" param with a value of "myvalue". Any ideas on what I am doing wrong?</p>
<pre><code>$.ajax({
type: "POST",
url: "WebForm1.aspx/WebMethod1",
data: {"test1": "myvalue"},
contentType: "ap... | [
{
"answer_id": 511262,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>What error are you getting?</p>\n\n<p>I've used prototype before (similar to jQuery for ajax) and with that you don't quote... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to pass parameters to my static web method (which is in an asp.net page). I'm trying to pass the "test1" param with a value of "myvalue". Any ideas on what I am doing wrong?
```
$.ajax({
type: "POST",
url: "WebForm1.aspx/WebMethod1",
data: {"test1": "myvalue"},
contentType: "application/json... | my "data" section was wrong. it needs to be "{'test1':'myvalue'}" |
510,531 | <p>With LINQ, a lot of programming problems can be solved more easily - and in fewer lines of code.</p>
<p>What are some the best real-world <strong>LINQ-to-Objects</strong> queries that you've written? </p>
<p>(Best = simplicity & elegance compared to the C# 2.0 / imperative approach).</p>
| [
{
"answer_id": 510540,
"author": "Filip Ekberg",
"author_id": 39106,
"author_profile": "https://Stackoverflow.com/users/39106",
"pm_score": 0,
"selected": false,
"text": "<p>Got me started and its awesome! </p>\n\n<pre><code>var myList = from list in myObjectList select list\n</code></p... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46223/"
] | With LINQ, a lot of programming problems can be solved more easily - and in fewer lines of code.
What are some the best real-world **LINQ-to-Objects** queries that you've written?
(Best = simplicity & elegance compared to the C# 2.0 / imperative approach). | Filter out null items in a list.
```
var nonnull = somelist.Where(a => a != null);
```
Create a dictionary where the key is the value of a property, and the value is the number of times that property appears in the list.
```
var countDictionary = somelist
.GroupBy(a => a.SomeProperty)
.ToDictionary(g => g.K... |
510,545 | <p>I have a friefox sidebar extension. If its opened by clicking on the toolbar icon I load it with a webpage ( that I have authored ). Now, if the user clicks on the link on the webpage ( thats loaded into the sidebar ) I want the linked webpage to open up in a new tab of the main window. I tried with this in my webpa... | [
{
"answer_id": 510550,
"author": "SD.",
"author_id": 59568,
"author_profile": "https://Stackoverflow.com/users/59568",
"pm_score": 0,
"selected": false,
"text": "<pre><code><a href=\"http://www.google.com\" target=\"new\">Google</a>\n</code></pre>\n\n<p>This is more dependent... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6488/"
] | I have a friefox sidebar extension. If its opened by clicking on the toolbar icon I load it with a webpage ( that I have authored ). Now, if the user clicks on the link on the webpage ( thats loaded into the sidebar ) I want the linked webpage to open up in a new tab of the main window. I tried with this in my webpage ... | Actually, there is no way to load a webpage ( whose link was in another webpage loaded into the sidebar extension ) onto a new tab in the browser. The only way is to use javascript. That has to execute under privileged conditions ( meaning as part of an extension ) like below:
```
gBrowser.addTab("http://www.google.co... |
510,559 | <p>I use Indy 9 with Delphi 5. In my application I want to communicate with a network device via UDP. So I use UDPServer comp. in a class which is derived from TThread.
When I write similar to the following code then CPU usage is 100%.</p>
<p>in the thread :</p>
<pre><code>while not terminated do begin
if GetMessag... | [
{
"answer_id": 510577,
"author": "Yuval Adam",
"author_id": 24545,
"author_profile": "https://Stackoverflow.com/users/24545",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not intimate with delphi code, but you are running a <a href=\"http://en.wikipedia.org/wiki/Busy_waiting\" rel=\... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62313/"
] | I use Indy 9 with Delphi 5. In my application I want to communicate with a network device via UDP. So I use UDPServer comp. in a class which is derived from TThread.
When I write similar to the following code then CPU usage is 100%.
in the thread :
```
while not terminated do begin
if GetMessage(Msg, 0, 0, 0) then ... | The problem you have is because you're receiving the UDP data in the GUI thread, but want to process the data in another thread.
The real problem is that your trying to use a asynchronous component in a blocking way. The better solution would be to use a real blocking UDP communication library such as [synapse](http:... |
510,574 | <p>Years ago, I created a data base in MS Excel to keep track of my photographs. The way I designed it was as follows. I had a master sheet that had a primary key with a sequenctial number ID for every photo. Then I had several sheets in the workbook that contained specific photos of the same subject, e.g. landscape... | [
{
"answer_id": 510582,
"author": "SD.",
"author_id": 59568,
"author_profile": "https://Stackoverflow.com/users/59568",
"pm_score": 0,
"selected": false,
"text": "<p>Have you looked into the different types of relationships you can form? For example, a one to many relationship. What relat... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Years ago, I created a data base in MS Excel to keep track of my photographs. The way I designed it was as follows. I had a master sheet that had a primary key with a sequenctial number ID for every photo. Then I had several sheets in the workbook that contained specific photos of the same subject, e.g. landscapes (LS)... | As you are the only person entering data, it is safe to use DMax, because no-one else can grab an identical number. You can even use DMax in the Default Value of the textboxes, which means that the number will be suggested every time you create a new record, if the record is created the suggested number becomes an actu... |
510,600 | <p>When a form is posted back to the server, is it possible to manipulate, change, set the values contained in HTTP Post in the controller action? I would like to remove certain textbox values entered by the user so that these values always have to be re-entered (e.g. password fields). By default Html helpers extract i... | [
{
"answer_id": 510868,
"author": "Olivier Payen",
"author_id": 50468,
"author_profile": "https://Stackoverflow.com/users/50468",
"pm_score": 0,
"selected": false,
"text": "<p>You can create a custom ModelBinder that will allow you to manipulate posted data.</p>\n\n<p><a href=\"http://web... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54101/"
] | When a form is posted back to the server, is it possible to manipulate, change, set the values contained in HTTP Post in the controller action? I would like to remove certain textbox values entered by the user so that these values always have to be re-entered (e.g. password fields). By default Html helpers extract init... | You don't need a custom ModelBinder.
```
[Bind(Exclude="Foo,Bar")]
public ActionResult Insert(T model)
```
Now Foo and Bar are null.
This does what you ask, but I'm not actually sure it's what you meant. :)
My guess is that your action does need to see the password (or whatever) entered by the user. But if... |
510,601 | <p>I have a similar question to this one <a href="https://stackoverflow.com/questions/501347/sql-products-productsales">SQL products/productsales</a></p>
<p>I want to do that same query but instead of just checking quantity i want to check "total" (ie. quantity * price). "price" is a field in the sales table.</p>
<p>... | [
{
"answer_id": 510614,
"author": "cagcowboy",
"author_id": 19629,
"author_profile": "https://Stackoverflow.com/users/19629",
"pm_score": 2,
"selected": true,
"text": "<pre><code>HAVING (Sum(s.quantity*s.price)) > @X\n</code></pre>\n\n<p>might do the trick?</p>\n"
},
{
"answer_... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a similar question to this one [SQL products/productsales](https://stackoverflow.com/questions/501347/sql-products-productsales)
I want to do that same query but instead of just checking quantity i want to check "total" (ie. quantity \* price). "price" is a field in the sales table.
here is the original query ... | ```
HAVING (Sum(s.quantity*s.price)) > @X
```
might do the trick? |
510,604 | <p>I'm in the process of moving a complete sharepoint install to a different server.</p>
<p>Can anyone tell me if it's possible to just move the existing Shared Services Provider rather than starting from scratch?</p>
<p>All the best</p>
| [
{
"answer_id": 510614,
"author": "cagcowboy",
"author_id": 19629,
"author_profile": "https://Stackoverflow.com/users/19629",
"pm_score": 2,
"selected": true,
"text": "<pre><code>HAVING (Sum(s.quantity*s.price)) > @X\n</code></pre>\n\n<p>might do the trick?</p>\n"
},
{
"answer_... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12318/"
] | I'm in the process of moving a complete sharepoint install to a different server.
Can anyone tell me if it's possible to just move the existing Shared Services Provider rather than starting from scratch?
All the best | ```
HAVING (Sum(s.quantity*s.price)) > @X
```
might do the trick? |
510,609 | <p>im writting an actionScript class to handle my web service calls. When i retrieve a result i want to call a setter method in my main mxml application. My problem is that i dont know how to access the methods in the actionScript section of my main mxml class from my actionscript class, any ideas? </p>
| [
{
"answer_id": 510631,
"author": "David Hanak",
"author_id": 42136,
"author_profile": "https://Stackoverflow.com/users/42136",
"pm_score": 3,
"selected": false,
"text": "<p>If your class is an UIComponent added to the component tree, then you can use its <code>parentApplication</code> at... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24481/"
] | im writting an actionScript class to handle my web service calls. When i retrieve a result i want to call a setter method in my main mxml application. My problem is that i dont know how to access the methods in the actionScript section of my main mxml class from my actionscript class, any ideas? | David is right -- while you can access the public members of your Application.mxml object statically and from anywhere in your application, design-wise that's a bit of a no-no. It's better to strive for loose coupling between your objects, and the way that's done in the Flex idiom is generally to extend EventDispatcher... |
510,610 | <p>With a JTree, assuming the root node is level 0 and there may be up to 5 levels below the root, how can I easily expand all the level 1 nodes so that all level 1 & 2 branches and leafs are visible but levels 3 and below aren't?</p>
| [
{
"answer_id": 510622,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 0,
"selected": false,
"text": "<p>Use <a href=\"http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTree.html#expandPath(javax.swing.tree.TreePath)\" rel=... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1863449/"
] | With a JTree, assuming the root node is level 0 and there may be up to 5 levels below the root, how can I easily expand all the level 1 nodes so that all level 1 & 2 branches and leafs are visible but levels 3 and below aren't? | Thanks for the quick response guys. However I have now found the simple solution I was looking for. For some reason I just couldn't see DefaultMutableTreeNode.getLevel() in the JavaDocs! FYI what I'm doing now is:
```java
DefaultMutableTreeNode currentNode = treeTop.getNextNode();
do {
if (currentNode.getLevel() =... |
510,697 | <p>I am attempting to run the following command in KornShell (ksh):</p>
<pre><code>set -A INDEXES `db2 "describe indexes for table ${TABSCHEMA}.${TABNAME} show detail" | awk '{print $1"."$2}'`
</code></pre>
<p>What I am attempting to achieve is place a list of the indexes over a particular table into an array which I... | [
{
"answer_id": 510782,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 1,
"selected": false,
"text": "<p>I doubt it's awk per se. Maybe db2 is particular about stdout being connected to a tty or console? Or at least doesn't like... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18064/"
] | I am attempting to run the following command in KornShell (ksh):
```
set -A INDEXES `db2 "describe indexes for table ${TABSCHEMA}.${TABNAME} show detail" | awk '{print $1"."$2}'`
```
What I am attempting to achieve is place a list of the indexes over a particular table into an array which I can later iterate through... | In this case, when the DB2 CLP says that it's not connected to the database, it's because the shell has opened up a sub-process that requires its own dedicated db2bp backend process, which cannot access the connection opened by the original shell process. It's not that something is becoming disconnected, it's that a ne... |
510,712 | <p>how to find first record from group in crystal reports?</p>
| [
{
"answer_id": 605443,
"author": "Anthony K",
"author_id": 1682,
"author_profile": "https://Stackoverflow.com/users/1682",
"pm_score": 3,
"selected": false,
"text": "<p>You can use the Previous(Group_Field) function in a formula to indicate the start the group. The Online formula functi... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | how to find first record from group in crystal reports? | You can use the Previous(Group\_Field) function in a formula to indicate the start the group. The Online formula function help gives an example. Basically you see if the Previous value of the field you are grouping on is different from the current value. If it is, then you have just started a new group.
```
If Previou... |
510,743 | <p>I have a case where I need to translate (lookup) several values from the same table. The first way I wrote it, was using subqueries:</p>
<pre><code>SELECT
(SELECT id FROM user WHERE user_pk = created_by) AS creator,
(SELECT id FROM user WHERE user_pk = updated_by) AS updater,
(SELECT id FROM user WHERE u... | [
{
"answer_id": 510754,
"author": "gbn",
"author_id": 27535,
"author_profile": "https://Stackoverflow.com/users/27535",
"pm_score": 6,
"selected": true,
"text": "<p>The UDF is a black box to the query optimiser so it's executed for every row.\nYou are doing a row-by-row cursor. For each r... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37083/"
] | I have a case where I need to translate (lookup) several values from the same table. The first way I wrote it, was using subqueries:
```
SELECT
(SELECT id FROM user WHERE user_pk = created_by) AS creator,
(SELECT id FROM user WHERE user_pk = updated_by) AS updater,
(SELECT id FROM user WHERE user_pk = owne... | The UDF is a black box to the query optimiser so it's executed for every row.
You are doing a row-by-row cursor. For each row in an asset, look up an id three times in another table. This happens when you use scalar or multi-statement UDFs (In-line UDFs are simply macros that expand into the outer query)
One of many a... |
510,748 | <p>I tried to send email from c# using SmtpClient.Send() but it always goes to the junk box. It works fine if I send it from Outlook. Is there anyway to solve this? Someone told me to modify the email header but I don't know how.
Thanks in advance.
Here is my code</p>
<pre><code>SmtpClient client = new SmtpClient();
c... | [
{
"answer_id": 510757,
"author": "Rinat Abdullin",
"author_id": 47366,
"author_profile": "https://Stackoverflow.com/users/47366",
"pm_score": 1,
"selected": false,
"text": "<p>Spam filters may discard messages that have invalid entries.</p>\n\n<p>Try putting in valid (existing) addresses... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39635/"
] | I tried to send email from c# using SmtpClient.Send() but it always goes to the junk box. It works fine if I send it from Outlook. Is there anyway to solve this? Someone told me to modify the email header but I don't know how.
Thanks in advance.
Here is my code
```
SmtpClient client = new SmtpClient();
client.Host = "... | a) The code sample doesn't actually use the mailReply address.
b) The problem will probably disappear when you send a more realistic message. If it doesn't then you will have to find out why the message is being marked junk, fishing a message from the spambox and looking at the headers or something like that. |
510,751 | <p>I am trying to do a CVS login from Python by calling the cvs.exe process.
When calling cvs.exe by hand, it prints a message to the console and then waits for the user to input the password. </p>
<p>When calling it with subprocess.Popen, I've noticed that the call blocks. The code is </p>
<pre><code>subprocess.Pope... | [
{
"answer_id": 510889,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 3,
"selected": true,
"text": "<ul>\n<li>Remove the <code>shell=True</code> part. Your shell has nothing to do with it. Using <code>shell=True</code> is a... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62343/"
] | I am trying to do a CVS login from Python by calling the cvs.exe process.
When calling cvs.exe by hand, it prints a message to the console and then waits for the user to input the password.
When calling it with subprocess.Popen, I've noticed that the call blocks. The code is
```
subprocess.Popen(cvscmd, shell = Tru... | * Remove the `shell=True` part. Your shell has nothing to do with it. Using `shell=True` is a common cause of trouble.
* Use a list of parameters for cmd.
Example:
```
cmd = ['cvs',
'-d:pserver:anonymous@bayonne.cvs.sourceforge.net:/cvsroot/bayonne',
'login']
p = subprocess.Popen(cmd, stdin=subprocess... |
510,761 | <p>I want to delete an DOM element right after fading out. What I did so far is</p>
<pre><code>$(element).click(function()
{
$(this).fadeOut(500, function() { $().remove(this); });
});
</code></pre>
<p>But now I always get this error in Firebug: <a href="http://dl.getdropbox.com/u/5912/Jing/2009-02-04_1109.png" r... | [
{
"answer_id": 510785,
"author": "Georg Schölly",
"author_id": 24587,
"author_profile": "https://Stackoverflow.com/users/24587",
"pm_score": 8,
"selected": true,
"text": "<p>You're using the <a href=\"http://docs.jquery.com/Manipulation/remove\" rel=\"noreferrer\"><code>remove()</code></... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9535/"
] | I want to delete an DOM element right after fading out. What I did so far is
```
$(element).click(function()
{
$(this).fadeOut(500, function() { $().remove(this); });
});
```
But now I always get this error in Firebug: <http://dl.getdropbox.com/u/5912/Jing/2009-02-04_1109.png>
I guess it is because the fadeOut ... | You're using the [`remove()`](http://docs.jquery.com/Manipulation/remove) function wrongly.
```
$(element).click(function() {
$(this).fadeOut(500, function() { $(this).remove(); });
});
``` |
510,765 | <p>I have a winforms application in which I am using 2 Forms to display all the necessary controls. The first Form is a splash screen in which it tells the user that it it loading etc. So I am using the following code:</p>
<pre><code>Application.Run( new SplashForm() );
</code></pre>
<p>Once the application has compl... | [
{
"answer_id": 510786,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 6,
"selected": true,
"text": "<p>Probably you just want to close the splash form, and not send it to back. </p>\n\n<p>I run the splash form on a separate t... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | I have a winforms application in which I am using 2 Forms to display all the necessary controls. The first Form is a splash screen in which it tells the user that it it loading etc. So I am using the following code:
```
Application.Run( new SplashForm() );
```
Once the application has completed loading I want the Sp... | Probably you just want to close the splash form, and not send it to back.
I run the splash form on a separate thread (this is class SplashForm):
```
class SplashForm
{
//Delegate for cross thread call to close
private delegate void CloseDelegate();
//The type of form to be displayed as the splash screen... |
510,767 | <p>I've got a client/server application, written in WCF / C#3.5.</p>
<p>The server is in my local TimeZone, and clients are spreaded accross the world.</p>
<p>My current strategy is to use UTC DateTime everywhere on the server and in the database, and to let the clients handle correctly the UTC DateTimes they receive... | [
{
"answer_id": 511617,
"author": "Matt Davis",
"author_id": 51170,
"author_profile": "https://Stackoverflow.com/users/51170",
"pm_score": 1,
"selected": false,
"text": "<p>To my knowledge, WCF does not provide any kind of automation to aid time conversions, and personally, I wouldn't exp... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47341/"
] | I've got a client/server application, written in WCF / C#3.5.
The server is in my local TimeZone, and clients are spreaded accross the world.
My current strategy is to use UTC DateTime everywhere on the server and in the database, and to let the clients handle correctly the UTC DateTimes they receive.
This means tha... | To my knowledge, WCF does not provide any kind of automation to aid time conversions, and personally, I wouldn't expect it to.
And I agree with you. Having to manually call the conversion routine is not the ideal. It doesn't "feel" elegant.
To me, a more elegant solution would be to "lazily" evaluate the DateTime as ... |
510,769 | <p>How to write one SQL query that selects a column from a table but returns two columns where the additional one contains an index of the row (a new one, starting with 1 to n). It must be without using functions that do that (like row_number()).<br>
Any ideas? </p>
<p>Edit: it must be a one-select query</p>
| [
{
"answer_id": 510807,
"author": "Simon Hughes",
"author_id": 5884,
"author_profile": "https://Stackoverflow.com/users/5884",
"pm_score": 0,
"selected": false,
"text": "<pre><code>SET NOCOUNT ON\n\nDECLARE @item_table TABLE\n(\n row_num INT IDENTITY(1, 1) NOT NULL PRIMARY KEY, --THE IDEN... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40872/"
] | How to write one SQL query that selects a column from a table but returns two columns where the additional one contains an index of the row (a new one, starting with 1 to n). It must be without using functions that do that (like row\_number()).
Any ideas?
Edit: it must be a one-select query | You can do this on any database:
```
SELECT (SELECT COUNT (1) FROM field_company fc2
WHERE fc2.field_company_id <= fc.field_company_id) AS row_num,
fc.field_company_name
FROM field_company fc
``` |
510,773 | <p>The Windows SDK ships with a tool called signtool.exe that lets you sign a file with a certificate. I need to do the same thing but in a background service so I'm on the lookout for a library (preferably managed code, but COM will do) to do the same thing. Any ideas?</p>
<p>Found the answer. Here's how to use an X.... | [
{
"answer_id": 510823,
"author": "On Freund",
"author_id": 2150,
"author_profile": "https://Stackoverflow.com/users/2150",
"pm_score": 3,
"selected": true,
"text": "<p>SignTool is using CAPICOM which is the COM wrapper for the Crypto API. You can use either one. If you're going with CAPI... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16671/"
] | The Windows SDK ships with a tool called signtool.exe that lets you sign a file with a certificate. I need to do the same thing but in a background service so I'm on the lookout for a library (preferably managed code, but COM will do) to do the same thing. Any ideas?
Found the answer. Here's how to use an X.509 certif... | SignTool is using CAPICOM which is the COM wrapper for the Crypto API. You can use either one. If you're going with CAPICOM, you can check the information [here](http://msdn.microsoft.com/en-us/library/aa375732(VS.85).aspx#_crypto2_digital_signature_objects). |
510,778 | <p>I want to add seconds (00:00:02) or minutes (00:00:20) on datetime value (may be stored string type) but how? Examples:</p>
<pre><code>13:30+02:02:02= 15:32:02 ,
13:30+00:00:01= 13:30:01 ,
13:30+00:01:00=13:31:00 or 13:30 (not important)
</code></pre>
<p>Can you help me? I need your cool algorithm :) Thanks again... | [
{
"answer_id": 510794,
"author": "Robin Day",
"author_id": 40655,
"author_profile": "https://Stackoverflow.com/users/40655",
"pm_score": 2,
"selected": false,
"text": "<p>Not really sure what you're after, but can you not just use the built in functions to C#'s DateTime object?</p>\n\n<p... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52420/"
] | I want to add seconds (00:00:02) or minutes (00:00:20) on datetime value (may be stored string type) but how? Examples:
```
13:30+02:02:02= 15:32:02 ,
13:30+00:00:01= 13:30:01 ,
13:30+00:01:00=13:31:00 or 13:30 (not important)
```
Can you help me? I need your cool algorithm :) Thanks again... | If you choose to use the TimeSpan, be aware about the Days part:
```
TimeSpan t1 = TimeSpan.Parse("23:30");
TimeSpan t2 = TimeSpan.Parse("00:40:00");
TimeSpan t3 = t1.Add(t2);
Console.WriteLine(t3); // 1.00:10:00
```
With DateTime:
```
DateTime d1 = DateTime.Parse("23:30");
DateTime d2 = DateTime.Parse("00:40:00");... |
510,779 | <p>I have a system where I send an Ajax command, which returns a script block with a function in it. After this data is correctly inserted in the DIV, I want to be able to call this function to perform the required actions.</p>
<p>Is this possible?</p>
| [
{
"answer_id": 510792,
"author": "DanSingerman",
"author_id": 43965,
"author_profile": "https://Stackoverflow.com/users/43965",
"pm_score": 3,
"selected": false,
"text": "<p>That seems a rather weird design for your code - it generally makes more sense to have your functions called direc... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47013/"
] | I have a system where I send an Ajax command, which returns a script block with a function in it. After this data is correctly inserted in the DIV, I want to be able to call this function to perform the required actions.
Is this possible? | I think to correctly interpret your question under this form: "OK, I'm already done with all the Ajax stuff; I just wish to know if the JavaScript function my Ajax callback inserted into the DIV is callable at any time from that moment on, that is, I do not want to call it contextually to the callback return".
OK, if ... |
510,784 | <p>I'm working on a class that inherits from another class, but I'm getting a compiler error saying "Cannot find symbol constructor Account()". Basically what I'm trying to do is make a class InvestmentAccount which extends from Account - Account is meant to hold a balance with methods for withdrawing/depositing money ... | [
{
"answer_id": 510791,
"author": "Johannes Weiss",
"author_id": 55925,
"author_profile": "https://Stackoverflow.com/users/55925",
"pm_score": 6,
"selected": true,
"text": "<p>use <code>super(customer)</code> in <code>InvestmentAccount</code>s constructor.</p>\n\n<p>Java can not know how ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49128/"
] | I'm working on a class that inherits from another class, but I'm getting a compiler error saying "Cannot find symbol constructor Account()". Basically what I'm trying to do is make a class InvestmentAccount which extends from Account - Account is meant to hold a balance with methods for withdrawing/depositing money and... | use `super(customer)` in `InvestmentAccount`s constructor.
Java can not know how to call the **only** constructor `Account` has, because it's not an *empty constructor*. You can omit `super()` only if your base class has an empty constuctor.
Change
```
public InvestmentAccount(Person customer, int sharePrice)
{
... |
510,788 | <p><strong>Note:</strong></p>
<ul>
<li>Using <strong>raw Win32</strong> CreateTheard() API</li>
<li>No MFC</li>
<li>An interface is simply a pointer to a vtable</li>
</ul>
<p><strong>Question:</strong></p>
<ul>
<li>How to pass an interface pointer to a thread?</li>
</ul>
<p><strong>Illustration:</strong></p>
<pre>... | [
{
"answer_id": 510800,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 4,
"selected": true,
"text": "<p>As was stated below, passing a <code>COM</code> interface pointer between threads in not safe.</p>\n\n<p>Assuming you k... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51078/"
] | **Note:**
* Using **raw Win32** CreateTheard() API
* No MFC
* An interface is simply a pointer to a vtable
**Question:**
* How to pass an interface pointer to a thread?
**Illustration:**
```
IS8Simulation *pis8 = NULL;
...
CoCreateInstance(
clsid,
NULL,
CLSCTX_L... | As was stated below, passing a `COM` interface pointer between threads in not safe.
Assuming you know what you are doing:
```
hThread = CreateThread(
NULL,
0,
SecondaryThread,
(LPVOID) pis8
0,
... |
510,805 | <p>I have to create a console application which needs certain parameters. If they are missing or wrong I print out an error message.</p>
<p>Now the problem: If someone starts the program from the explorer by double-clicking the console window disappears immediately. (But the application is not entirely useless from th... | [
{
"answer_id": 510901,
"author": "Artelius",
"author_id": 31945,
"author_profile": "https://Stackoverflow.com/users/31945",
"pm_score": 2,
"selected": false,
"text": "<p>I believe <code>cmd.exe</code> sets the CMDCMDLINE and CMDEXTVERSION environemntal variables when it starts. So if the... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23368/"
] | I have to create a console application which needs certain parameters. If they are missing or wrong I print out an error message.
Now the problem: If someone starts the program from the explorer by double-clicking the console window disappears immediately. (But the application is not entirely useless from the explorer... | See <http://support.microsoft.com/kb/99115>, "INFO: Preventing the Console Window from Disappearing".
The idea is to use GetConsoleScreenBufferInfo to determine that the cursor has not moved from the initial 0,0 position.
Code sample from @tomlogic, based on the referenced Knowledge Base article:
```
// call in main... |
510,821 | <p>(Title was: "How to write a unit test for a DBUS service written in Python?")</p>
<p>I've started to write a DBUS service using dbus-python, but I'm having trouble writing a test case for it.</p>
<p>Here is an example of the test I am trying to create. Notice that I have put a GLib event loop in the setUp(), this ... | [
{
"answer_id": 510858,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 2,
"selected": false,
"text": "<p>Simple solution: don't unit test through dbus.</p>\n\n<p>Instead write your unit tests to call your methods direct... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43662/"
] | (Title was: "How to write a unit test for a DBUS service written in Python?")
I've started to write a DBUS service using dbus-python, but I'm having trouble writing a test case for it.
Here is an example of the test I am trying to create. Notice that I have put a GLib event loop in the setUp(), this is where the prob... | With some help from Ali A's post, I have managed to solve my problem. The blocking event loop needed to be launched into a separate process, so that it can listen for events without blocking the test.
Please be aware my question title contained some incorrect terminology, I was trying to write a functional test, as op... |
510,831 | <pre><code> <h:commandLink id="#{id}" value="#{value}" action="#{actionBean.getAction}" onclick="alert(this);"/>
</code></pre>
<p>In the previous simplified example, the 'this' keyword used in the Javascript function won't reference the generated A HREF element, but will reference to the global window, becaus... | [
{
"answer_id": 511194,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>var a=function(){alert(this)};var b=function(){if(typeof jsfcljs == 'function'){jsfcljs(document.forms[... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326206/"
] | ```
<h:commandLink id="#{id}" value="#{value}" action="#{actionBean.getAction}" onclick="alert(this);"/>
```
In the previous simplified example, the 'this' keyword used in the Javascript function won't reference the generated A HREF element, but will reference to the global window, because JSF generates the follo... | EDIT:
Go here for a small library/sample code for getting the *clientId* from the *id*: [JSF: working with component IDs](http://illegalargumentexception.blogspot.com/2009/02/jsf-working-with-component-ids.html)
---
The HTML ID emitted by JSF controls is namespaced to avoid collisions (e.g. the control is a child of... |
510,839 | <p>Is it acceptable to use the word 'Base' in a class name which is a the bottom of the inheritance tree?</p>
<p>I have always found this a bit of a cop-out, just wondering if anyone agrees with me.</p>
<p>For example, if I am refactoring certain elements from MyClassA and MyClassB into a common base class, I'd be te... | [
{
"answer_id": 510848,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 0,
"selected": false,
"text": "<p>I think it should probably be avoided where possible in favour of an identifier that actually describes what it is!... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7140/"
] | Is it acceptable to use the word 'Base' in a class name which is a the bottom of the inheritance tree?
I have always found this a bit of a cop-out, just wondering if anyone agrees with me.
For example, if I am refactoring certain elements from MyClassA and MyClassB into a common base class, I'd be tempted to create a... | I tend to add a Base suffix to the name of the base class only if it exists from technical perspective (to share some code), and doesn't really constitute any usable class on its own (so all of these classes are abstract). These are quite rare cases though, and should be avoided just as Helper classes. |
510,846 | <p>I have the following situation: my application's authorization mechanism is implemented using Spring security. The central class implements <strong>AccessDecisionManager</strong> and uses voters (each of which implements <strong>AccessDecisionVoter</strong>) to decide whether to grant access to some method or not. T... | [
{
"answer_id": 511111,
"author": "Andrzej Doyle",
"author_id": 45664,
"author_profile": "https://Stackoverflow.com/users/45664",
"pm_score": 3,
"selected": true,
"text": "<p>Well, the <code>AccesssDecisionVoter</code> interface actually returns an <code>int</code> in this situation. Gra... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62346/"
] | I have the following situation: my application's authorization mechanism is implemented using Spring security. The central class implements **AccessDecisionManager** and uses voters (each of which implements **AccessDecisionVoter**) to decide whether to grant access to some method or not. The algorithm that tallies the... | Well, the `AccesssDecisionVoter` interface actually returns an `int` in this situation. Granted, the built-in voter implementations always only return one of the three constants you mentioned (and these are what the standard access decision managers check for), but then they don't really have anything extra to return -... |
510,847 | <p>I noticed strange behavior in IE7 that does not occur in Firefox.
If you notice in "testing 2" "div",when I add 2 line breaks at the bottom of this div,
it does not respect margin set up for this div, and "test 3" div is right below it without margins. When I remove "br" then "test 2" and "test 3" divs have margins ... | [
{
"answer_id": 510918,
"author": "tehvan",
"author_id": 61848,
"author_profile": "https://Stackoverflow.com/users/61848",
"pm_score": 0,
"selected": false,
"text": "<p>Probably not the nicest solution, but adding a non-breaking space after the <br> tags help:\nChange </p>\n\n<pre><code> ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I noticed strange behavior in IE7 that does not occur in Firefox.
If you notice in "testing 2" "div",when I add 2 line breaks at the bottom of this div,
it does not respect margin set up for this div, and "test 3" div is right below it without margins. When I remove "br" then "test 2" and "test 3" divs have margins bet... | I'm not sure about why IE is doing this, but one reasonably neat solution is to wrap the contents of the "testing 2" div with another div, like so:
```
<div style="border: solid 1px black; padding: 10px; margin: 10px;">
<div>
testing 2
<br/>
<br/>
<!-- THIS LINE -->
</div>
</d... |
510,876 | <p>I created a custom sterotype @Action, and Spring has managed to detect it in the package scan I configured in the configurations.</p>
<p>The next step I would like to do is to tell Spring that all classes with @Action should be created with prototype, instead of Singleton.</p>
<p>My @Action interface is as follows... | [
{
"answer_id": 510909,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 0,
"selected": false,
"text": "<p>Unfortunately not with spring 2.5.X. Your @Component-annotation describes the <em>role</em> of the bean while the sc... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2085392/"
] | I created a custom sterotype @Action, and Spring has managed to detect it in the package scan I configured in the configurations.
The next step I would like to do is to tell Spring that all classes with @Action should be created with prototype, instead of Singleton.
My @Action interface is as follows:
```
@Target({E... | The context:component-scan can be configured with a custom scope-resolver, which implements org.springframework.context.annotation.ScopeMetadataResolver.
I created a custom scope-resolver that not only checks the bean for a @Scope annotation (with the default resolver of org.springframework.context.annotation.Annotati... |
510,903 | <p>I'm debugging my website for the dreaded IE6 but I'm officially stumped. </p>
<p>Appearance in Firefox: <a href="http://dl-client.getdropbox.com/u/5822/firefox.tiff" rel="nofollow noreferrer">http://dl-client.getdropbox.com/u/5822/firefox.tiff</a></p>
<p>Appearance in IE6: <a href="http://dl-client.getdropbox.com/... | [
{
"answer_id": 510912,
"author": "Barbaros Alp",
"author_id": 51734,
"author_profile": "https://Stackoverflow.com/users/51734",
"pm_score": 2,
"selected": false,
"text": "<p>The order of attributes are wrong as i see.\nYou need to put transparent in the beginning.</p>\n\n<pre><code>backg... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50348/"
] | I'm debugging my website for the dreaded IE6 but I'm officially stumped.
Appearance in Firefox: <http://dl-client.getdropbox.com/u/5822/firefox.tiff>
Appearance in IE6: <http://dl-client.getdropbox.com/u/5822/ie6.tiff>
Live site: [Motolistr.com](http://motolistr.com)
The following CSS works great in FF and Safari,... | Seems like this one's been pretty well answered, but I'd like to add:
Works in IE:
```
background:transparent url('../images/nav/button_bg4.gif') no-repeat;
```
Works in Firefox and Chrome but does not work in IE:
```
background:transparent url('../images/nav/button_bg4.gif')no-repeat;
```
Without knowing IE nee... |
510,916 | <p>I need to create a background job that processes a table looking for rows matching on a particular id with different statuses. It will store the row data in a string to compare the data against a row with a matching id.</p>
<p>I know the syntax to get the row data, but I have never tried comparing 2 rows from the sa... | [
{
"answer_id": 510927,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 4,
"selected": false,
"text": "<p>OK, after 2 years it's finally time to correct the syntax:</p>\n\n<pre><code>SELECT t1.value, t2.value\nFROM MyTab... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to create a background job that processes a table looking for rows matching on a particular id with different statuses. It will store the row data in a string to compare the data against a row with a matching id.
I know the syntax to get the row data, but I have never tried comparing 2 rows from the same table ... | You can join a table to itself as many times as you require, it is called a [self join](http://msdn.microsoft.com/en-us/library/ms177490.aspx).
An alias is assigned to each instance of the table (as in the example below) to differentiate one from another.
```
SELECT a.SelfJoinTableID
FROM dbo.SelfJoinTable a
... |
510,971 | <p>I have 2 objects from the same type and i would like to shallow copy one state to the other. In C++ i have memcpy which is great. How can i do it in C#? The MemberwiseClone() is not good enough because it creates & returns a new object and i like to copy to an existing object. I thought of using reflection but i... | [
{
"answer_id": 510990,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 3,
"selected": false,
"text": "<p>In <code>C#</code> (and in <code>C++</code> too), there is no difference between "new object" and "a co... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55373/"
] | I have 2 objects from the same type and i would like to shallow copy one state to the other. In C++ i have memcpy which is great. How can i do it in C#? The MemberwiseClone() is not good enough because it creates & returns a new object and i like to copy to an existing object. I thought of using reflection but i'm afra... | [edit] regarding your clarification:
As I understand, you have N objects, each has a (direct) reference to the template object. You want to write back to the template so all objects "see" these changes.
Suggestion: imlement a template broker.
```
class TemplateProvider
{
public MyData Template { get; set; }
}
```... |
510,972 | <p>How do I find out the name of the class used to create an instance of an object in Python?</p>
<p>I'm not sure if I should use the <a href="https://docs.python.org/2/library/inspect.html" rel="noreferrer" title="inspect — Inspect live objects"><code>inspect</code></a> module or parse the <code>__class__</code> attri... | [
{
"answer_id": 510988,
"author": "GHZ",
"author_id": 18138,
"author_profile": "https://Stackoverflow.com/users/18138",
"pm_score": 7,
"selected": false,
"text": "<p><a href=\"https://docs.python.org/3/library/functions.html#type\" rel=\"noreferrer\"><code>type()</code></a> ?</p>\n<pre><c... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18909/"
] | How do I find out the name of the class used to create an instance of an object in Python?
I'm not sure if I should use the [`inspect`](https://docs.python.org/2/library/inspect.html "inspect — Inspect live objects") module or parse the `__class__` attribute. | Have you tried the [`__name__` attribute](https://docs.python.org/library/stdtypes.html#definition.__name__) of the class? ie `type(x).__name__` will give you the name of the class, which I think is what you want.
```
>>> import itertools
>>> x = itertools.count(0)
>>> type(x).__name__
'count'
```
If you're still us... |
510,976 | <pre><code> class Super {
public void anotherMethod(String s) {
retValue(s)
}
public String retValue(String s) {
return "Super " + s;
}
}
class Sub extends Super {
public void anotherMethod(String s) {
retValue(s)
}
... | [
{
"answer_id": 510991,
"author": "siukurnin",
"author_id": 35273,
"author_profile": "https://Stackoverflow.com/users/35273",
"pm_score": 3,
"selected": false,
"text": "<p>Why would you ever want to do that ??</p>\n\n<p>The whole point of polymorphism is to call the right method without t... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11581/"
] | ```
class Super {
public void anotherMethod(String s) {
retValue(s)
}
public String retValue(String s) {
return "Super " + s;
}
}
class Sub extends Super {
public void anotherMethod(String s) {
retValue(s)
}
pu... | Whenever I find myself asking (or being asked) a question like this, I **know**, categorically, that I have made a mistake in my design and/or my object definitions. Go back to your object hierarchy and check, double-check and triple-check that every inheritance relationship represents an "IS-A", and not a "HAS-A" or s... |
510,995 | <p>HI all,<br>
I use jQuery to parse my xml responses.</p>
<p>I have this xml :</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<response status="ok">
<client_id>185</client_id>
</response>
</code></pre>
<p>And i want to get "client_id" value.</p>
| [
{
"answer_id": 511027,
"author": "Salty",
"author_id": 50548,
"author_profile": "https://Stackoverflow.com/users/50548",
"pm_score": 6,
"selected": true,
"text": "<p>First, make a request for the XML with $.get or however you want. \nThen:</p>\n\n<pre><code>clientID = $(myXML).find(\"cli... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32034/"
] | HI all,
I use jQuery to parse my xml responses.
I have this xml :
```
<?xml version="1.0" encoding="UTF-8"?>
<response status="ok">
<client_id>185</client_id>
</response>
```
And i want to get "client\_id" value. | First, make a request for the XML with $.get or however you want.
Then:
```
clientID = $(myXML).find("client_id").text();
``` |
510,998 | <p>What Literal control is used for in asp.net? and What is the difference between them and Label control? </p>
| [
{
"answer_id": 511008,
"author": "andynormancx",
"author_id": 46354,
"author_profile": "https://Stackoverflow.com/users/46354",
"pm_score": 2,
"selected": false,
"text": "<p>It is used to display text on the page, the text that is displayed can be set at runtime via server side code.</p>... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36446/"
] | What Literal control is used for in asp.net? and What is the difference between them and Label control? | The major difference is that the **Label** Control adds the span tag to the text (property) you set, allowing to apply a style to it:
```
<span>My Label text</span>
```
The **Literal** Control allows you to render any kind of content. You can use it to render scripts, hmtl and any other type of document content. It ... |
511,011 | <p>I'm running a python script on a shared hosting server which until this morning had MySQL version 4. Now it has version 5. My python script can no longer connect to MySQL, as it can't find libmysqlclient_r.so.14:</p>
<pre><code>$ python my_script.py
Traceback (most recent call last):
File "my_script.py", line 6, in... | [
{
"answer_id": 511045,
"author": "sykora",
"author_id": 53850,
"author_profile": "https://Stackoverflow.com/users/53850",
"pm_score": 0,
"selected": false,
"text": "<p>One solution is to set your <code>PYTHONPATH</code> environment variable to have some local directory, and copy over (or... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] | I'm running a python script on a shared hosting server which until this morning had MySQL version 4. Now it has version 5. My python script can no longer connect to MySQL, as it can't find libmysqlclient\_r.so.14:
```
$ python my_script.py
Traceback (most recent call last):
File "my_script.py", line 6, in ?
import MyS... | You can't tell the dynamic linker which version of a library to use, because the SONAME (full name of the library + interface) is part of the binary.
In your case, you can try to upload libmysqlclient\_r.so.14 to the host and set `LD_LIBRARY_PATH` accordingly, so tell the dynamic linker which directories to search add... |
511,013 | <p>I have to serialize around a million items and I get the following exception when I run my code:</p>
<pre><code>Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Unknown Source)
at java.lang.String.<init>(Unknown Source)
at java.io.BufferedReade... | [
{
"answer_id": 511023,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 0,
"selected": false,
"text": "<p>Start java with a larger value for option -Xmx, for instance -Xmx512m</p>\n"
},
{
"answer_id": 511028,
"... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have to serialize around a million items and I get the following exception when I run my code:
```
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Unknown Source)
at java.lang.String.<init>(Unknown Source)
at java.io.BufferedReader.readLine(Unknown S... | Ideally, restructure your code to use less memory. For example, perhaps you could stream the output instead of holding the whole thing in memory.
Alternatively, just give the JVM more memory with the `-Xmx` option. |
511,020 | <p>I am using Ext JS to make a popup window, here is the code:</p>
<pre><code>function popupImage(term, imageNumber){
if(currentPopupWindow!=null){
currentPopupWindow.close();
}
currentPopupWindow = new Ext.Window({
layout : 'fit',
closeAction :'hide',
... | [
{
"answer_id": 511503,
"author": "Eddie",
"author_id": 57752,
"author_profile": "https://Stackoverflow.com/users/57752",
"pm_score": 0,
"selected": false,
"text": "<p>A quick Google search tells me that you're not the only extJS user that is experiencing this. (See <a href=\"http://extjs... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3193/"
] | I am using Ext JS to make a popup window, here is the code:
```
function popupImage(term, imageNumber){
if(currentPopupWindow!=null){
currentPopupWindow.close();
}
currentPopupWindow = new Ext.Window({
layout : 'fit',
closeAction :'hide',
plain... | This is the solution, dumb as it is:
Have the same window creation, then instead of the calls to show and anchor to:
```
currentPopupWindow.render(document.body);
currentPopupWindow.alignTo(diccon, "tl", [40, 80]);
currentPopupWindow.show(false, function() {
var el = Ext.get(termi... |
511,066 | <p>I have set some style for h2 tags (color, font-size, etc.), but when I put "A" tag inside, then style becomes as link. My html:</p>
<pre><code><h2>
<a class="no-decor" href="http://localhost/xxx/">Link</a>
</h2>
</code></pre>
<p>So, as You can see, I've created "no-decor" class. It should... | [
{
"answer_id": 511090,
"author": "yoavf",
"author_id": 1011,
"author_profile": "https://Stackoverflow.com/users/1011",
"pm_score": 2,
"selected": false,
"text": "<p>A bug's a bug and there's nothing much you can do, short of workarounds.</p>\n\n<p>There's a test for inherit support <a hr... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33599/"
] | I have set some style for h2 tags (color, font-size, etc.), but when I put "A" tag inside, then style becomes as link. My html:
```
<h2>
<a class="no-decor" href="http://localhost/xxx/">Link</a>
</h2>
```
So, as You can see, I've created "no-decor" class. It should inherit h2's style for "a" tag.
```
a.no-decor {... | No, IE has never supported `inherit` for any property - sorry. This has been fixed in >= IE8.
Whilst you could use a JavaScript fix to copy the properties from `h2` to `a`, it's probably easiest just to apply the same styling rule to both elements:
```css
h2, h2 a {
font: something;
color: black;
text-dec... |
511,067 | <p>I want to use the same <strong>{% block %}</strong> twice in the same django template. I want this block to appear more than once in my base template:</p>
<pre><code># base.html
<html>
<head>
<title>{% block title %}My Cool Website{% endblock %}</title>
</head>
<... | [
{
"answer_id": 511115,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 4,
"selected": false,
"text": "<p>You probably don't actually want to use a block but rather to just use a variable:</p>\n\n<pre><code># base.html\n&... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30300/"
] | I want to use the same **{% block %}** twice in the same django template. I want this block to appear more than once in my base template:
```
# base.html
<html>
<head>
<title>{% block title %}My Cool Website{% endblock %}</title>
</head>
<body>
<h1>{% block title %}My Cool Website{% endbloc... | I think that use of the context processor is in this case an overkill. You can easily do this:
```
#base.html
<html>
<head>
<title>{% block title %}My Cool Website{% endblock %}</title>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
```
and then:
```
# blog.html
{% ... |
511,088 | <p>What is the best way (and I presume simplest way) to place the cursor at the end of the text in a input text element via JavaScript - after focus has been set to the element?</p>
| [
{
"answer_id": 736322,
"author": "Mike Berrow",
"author_id": 17251,
"author_profile": "https://Stackoverflow.com/users/17251",
"pm_score": 9,
"selected": true,
"text": "<p>I faced this same issue (after setting focus through RJS/prototype) in IE.\nFirefox was already leaving the cursor a... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47036/"
] | What is the best way (and I presume simplest way) to place the cursor at the end of the text in a input text element via JavaScript - after focus has been set to the element? | I faced this same issue (after setting focus through RJS/prototype) in IE.
Firefox was already leaving the cursor at the end when there is already a value for the field. IE was forcing the cursor to the beginning of the text.
The solution I arrived at is as follows:
```
<input id="search" type="text" value="mycurrtex... |
511,093 | <p>I've just tried the following, the idea being to concatenate the two strings, substituting an empty string for nulls.</p>
<pre><code>string a="Hello";
string b=" World";
</code></pre>
<p>-- Debug (amusing that ? is print, doesn't exactly help readability...)</p>
<pre><code> ? a ?? "" + b ?? ""
</code></pre>
<... | [
{
"answer_id": 511104,
"author": "Sam Meldrum",
"author_id": 16005,
"author_profile": "https://Stackoverflow.com/users/16005",
"pm_score": 3,
"selected": false,
"text": "<p>The operator precedence is documented on <a href=\"http://msdn.microsoft.com/en-us/library/6a71f45d.aspx\" rel=\"no... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11538/"
] | I've just tried the following, the idea being to concatenate the two strings, substituting an empty string for nulls.
```
string a="Hello";
string b=" World";
```
-- Debug (amusing that ? is print, doesn't exactly help readability...)
```
? a ?? "" + b ?? ""
```
-> "Hello"
Correct is:
```
? (a??"")+(b??"")
"H... | Aside from what you'd *like* the precedence to be, what it is according to ECMA, what it is according to the MS spec and what csc actually does, I have one bit of advice:
**Don't do this**.
I think it's *much* clearer to write:
```
string c = (a ?? "") + (b ?? "");
```
Alternatively, given that null in string conc... |
511,094 | <p>im calling an actionscript class from my main mxml file. the actionscript class is responsible for calling a web service and handling the response, however im having trouble and keep getting the following error; (im new to flex btw)</p>
<pre><code>Error #1009: Cannot access a property or method of a null object ref... | [
{
"answer_id": 511532,
"author": "cdugga",
"author_id": 24481,
"author_profile": "https://Stackoverflow.com/users/24481",
"pm_score": 0,
"selected": false,
"text": "<p>sorted it out, </p>\n\n<p>i needed to created a loadEvent and loadhandler. Once loadWsdl is called the loadhandler speci... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24481/"
] | im calling an actionscript class from my main mxml file. the actionscript class is responsible for calling a web service and handling the response, however im having trouble and keep getting the following error; (im new to flex btw)
```
Error #1009: Cannot access a property or method of a null object reference.
```
... | looks like you have it sorted, but just to add more information in case someone else comes along to this question, you generally see this error when you are trying to use something that hasn't been created yet. A lot of the time you will see it when trying to access UI components that have not yet been created (its goo... |
511,096 | <p>I am trying to understand a script generated by Asp.Net Ajax Toolkit, which is currently giving an "object expected" (error goes away if I place my PopupControlExtender in an update panel).</p>
<pre><code>document.getElementById('ctl00_ValidationSummary1').dispose = function() {
Array.remove(Page_ValidationSumm... | [
{
"answer_id": 511125,
"author": "Steerpike",
"author_id": 60598,
"author_profile": "https://Stackoverflow.com/users/60598",
"pm_score": 1,
"selected": false,
"text": "<pre><code>(function() { dosth; })(); \n</code></pre>\n\n<p>wraps dosth in an anonymous function and then runs that anon... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] | I am trying to understand a script generated by Asp.Net Ajax Toolkit, which is currently giving an "object expected" (error goes away if I place my PopupControlExtender in an update panel).
```
document.getElementById('ctl00_ValidationSummary1').dispose = function() {
Array.remove(Page_ValidationSummaries, documen... | The
```
(function() { dosth; })();
```
syntax declares an anonymous function, and then executes it immediately. It's equivalent to doing this:
```
var myFun = (function() { dosth; });
myFun();
```
but without the temporary variable.
Broadly speaking this is similar to just executing whatever `dosth` is; but crea... |
511,098 | <p>When I click the button, it should popup my module, when i click outside it will hide or remove it. This is the code I have:</p>
<pre><code>private var Showup:IFlexDisplayObject;
Showup = PopUpManager.createPopUp(this, samplemodule, false);
Showup.addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, Removewindow); ... | [
{
"answer_id": 1846356,
"author": "Barney Stimson",
"author_id": 224689,
"author_profile": "https://Stackoverflow.com/users/224689",
"pm_score": 2,
"selected": false,
"text": "<p>Please add </p>\n\n<pre><code>mouseDownOutside=\"PopUpManager.removePopUp(this)\"\n</code></pre>\n\n<p>tag in... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57404/"
] | When I click the button, it should popup my module, when i click outside it will hide or remove it. This is the code I have:
```
private var Showup:IFlexDisplayObject;
Showup = PopUpManager.createPopUp(this, samplemodule, false);
Showup.addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, Removewindow);
private func... | Please add
```
mouseDownOutside="PopUpManager.removePopUp(this)"
```
tag inside you samplemodule (Popping canvas) main Display object as tag.
This will remove the popup when you are moving outside the popup and clicking. |
511,128 | <p>Does anyone know of a good plugin for prototype which allows textareas to automatically expand / contract based on how much text there is in them (e.g. a line is added the area gets bigger, a line is removed it gets smaller)?</p>
<p>I need one thats free to use (e.g. some form of GPL type license).</p>
| [
{
"answer_id": 511149,
"author": "geowa4",
"author_id": 50214,
"author_profile": "https://Stackoverflow.com/users/50214",
"pm_score": 1,
"selected": false,
"text": "<p>It's not a plugin, but it's not long: <a href=\"http://www.codelibary.com/JavaScript/Auto%20textarea%20resize.html\" rel... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1349865/"
] | Does anyone know of a good plugin for prototype which allows textareas to automatically expand / contract based on how much text there is in them (e.g. a line is added the area gets bigger, a line is removed it gets smaller)?
I need one thats free to use (e.g. some form of GPL type license). | This uses Prototype:
```
<textarea id='t1' cols="40" rows="7" style='overflow:hidden;font-size:14px;font-family:"Times New Roman", Times, serif'></textarea>
<script type="text/javascript">
function activateResize(element) {
Event.observe(element, 'keyup', function() {
updateSize(element)
});
updateSi... |
511,133 | <p>I want to execute some code inside 'Form1' but after the dialog is closed and it's not visible. I know that I can do this outside the dialog after calling ShowDialog() but I don't like it.</p>
<p>I tried in 'FormClosed' but it seems that the dialog it's still visible when this event is fired. Also if I call 'Hide()... | [
{
"answer_id": 511241,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 2,
"selected": false,
"text": "<p>I would create a static method on the dialog, and in this method show the dialog, and execute whatever needs executing af... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to execute some code inside 'Form1' but after the dialog is closed and it's not visible. I know that I can do this outside the dialog after calling ShowDialog() but I don't like it.
I tried in 'FormClosed' but it seems that the dialog it's still visible when this event is fired. Also if I call 'Hide()' the main... | I would create a static method on the dialog, and in this method show the dialog, and execute whatever needs executing after it closes, e.g.
```
public static void ShowAndDoStuff()
{
MyDialog dialog = new MyDialog();
dialog.ShowDialog();
dialog.DoStuff();
}
``` |
511,144 | <p>I've got a caching problem with the Internet Explorer 6.0 and I want to instruct the browser <strong>not</strong> to cache the page he's requesting.</p>
<p>Further information: In my page, there's a random token that prevents reloading the site and posting the same information twice or more.</p>
<p>If you now book... | [
{
"answer_id": 511170,
"author": "Jeremy French",
"author_id": 56672,
"author_profile": "https://Stackoverflow.com/users/56672",
"pm_score": 0,
"selected": false,
"text": "<p>Check what HTTP headers your server is sending, these can over ride what is in the meta section in the HTML.</p>\... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32043/"
] | I've got a caching problem with the Internet Explorer 6.0 and I want to instruct the browser **not** to cache the page he's requesting.
Further information: In my page, there's a random token that prevents reloading the site and posting the same information twice or more.
If you now bookmark this page, the browser ha... | This is a fairly well documented googleable problem, and probably duped several times here, but fwiw this is my standard block (C#):
```
Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1
Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "no-store"); // H... |
511,148 | <p>I'm trying to do some specific stuff in an XSD XML Schema. I want to set an element as <code>use="required"</code>, only if there a specific value to an attribute of another element.</p>
<p>Example:</p>
<pre><code><udi att1="all">
<name att2="dsd"/>
<phone att3="dsd"/>
</udi>
</code><... | [
{
"answer_id": 511231,
"author": "Welbog",
"author_id": 52443,
"author_profile": "https://Stackoverflow.com/users/52443",
"pm_score": 3,
"selected": false,
"text": "<p>XML is not relational, it's hierarchical. Schemas are designed to enforce rules on nesting, not on rules between sibling... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to do some specific stuff in an XSD XML Schema. I want to set an element as `use="required"`, only if there a specific value to an attribute of another element.
Example:
```
<udi att1="all">
<name att2="dsd"/>
<phone att3="dsd"/>
</udi>
```
I want the `phone` element to be required, only if the `at... | XML is not relational, it's hierarchical. Schemas are designed to enforce rules on nesting, not on rules between siblings. It simply is not something you can do with XSD.
You can do it when you're parsing or creating documents conforming to the format, however. In this case, while you're parsing through the XML docume... |
511,180 | <p>Is there someway to get a list of activated sessions in classic ASP?</p>
<p>I want to limit the number of simultaneus activated sessions.</p>
| [
{
"answer_id": 511206,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 3,
"selected": true,
"text": "<p>Here is a good article which shows a way to do that: <a href=\"http://www.aspfree.com/c/a/asp-code/active-user-count-with... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1100/"
] | Is there someway to get a list of activated sessions in classic ASP?
I want to limit the number of simultaneus activated sessions. | Here is a good article which shows a way to do that: [Active User Count Without Global.asa by Josh Painter](http://www.aspfree.com/c/a/asp-code/active-user-count-without-global-asa-by-josh-painter/)
I guess you have to change some details, but this is the way you could approach the problem. The author doesn't use glo... |
511,186 | <p>when you run a script (such as vbscript) from 25*80 (full screen mode of dos prompt) and that your script call a windows application (such as notepad), at the end of the operation, focus remains on the desktop (although "command prompt" at the taskbar minimized and wait for only one "{enter}" to go back in 25*80 ful... | [
{
"answer_id": 511206,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 3,
"selected": true,
"text": "<p>Here is a good article which shows a way to do that: <a href=\"http://www.aspfree.com/c/a/asp-code/active-user-count-with... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | when you run a script (such as vbscript) from 25\*80 (full screen mode of dos prompt) and that your script call a windows application (such as notepad), at the end of the operation, focus remains on the desktop (although "command prompt" at the taskbar minimized and wait for only one "{enter}" to go back in 25\*80 full... | Here is a good article which shows a way to do that: [Active User Count Without Global.asa by Josh Painter](http://www.aspfree.com/c/a/asp-code/active-user-count-without-global-asa-by-josh-painter/)
I guess you have to change some details, but this is the way you could approach the problem. The author doesn't use glo... |
511,196 | <p>I'm using Eclipse Europa with Subversive SVN plugin.</p>
<p>When try to commit deleted directory SVN returns this message:</p>
<pre><code>Some of selected resources were not committed.
Item is out of date
svn: Commit failed (details follow):
svn: Item '/myProject/trunk/src/test/config' is out of date
</code></pre>... | [
{
"answer_id": 511201,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 6,
"selected": true,
"text": "<p>Try updating first, <em>then</em> delete and commit.</p>\n"
},
{
"answer_id": 10068634,
"author": "Kurru... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32090/"
] | I'm using Eclipse Europa with Subversive SVN plugin.
When try to commit deleted directory SVN returns this message:
```
Some of selected resources were not committed.
Item is out of date
svn: Commit failed (details follow):
svn: Item '/myProject/trunk/src/test/config' is out of date
```
Content of the folder has be... | Try updating first, *then* delete and commit. |
511,204 | <p>Suppose my string is:</p>
<pre><code>' Hai Hello\nGood eve\n'
</code></pre>
<p>How do I eliminate the <code>'\n'</code> in between and make a string print like :</p>
<pre><code> Hai Hello Good eve
</code></pre>
<p>?</p>
| [
{
"answer_id": 511208,
"author": "Torsten Marek",
"author_id": 9567,
"author_profile": "https://Stackoverflow.com/users/9567",
"pm_score": 4,
"selected": false,
"text": "<p>You can use the <code>replace</code> method:</p>\n\n<pre><code>>>> a = \"1\\n2\"\n>>> print a\n1\... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46646/"
] | Suppose my string is:
```
' Hai Hello\nGood eve\n'
```
How do I eliminate the `'\n'` in between and make a string print like :
```
Hai Hello Good eve
```
? | If you don't want the newline at the end of the print statement:
```
import sys
sys.stdout.write("text")
``` |
511,224 | <p>I have a very large CSV file and I need to write an app that will parse it but using the >6GB file to test against is painful, is there a simple way to extract the first hundred or two lines without having to load the entire file into memory?</p>
<p>The file resides on a Debian server.</p>
| [
{
"answer_id": 511233,
"author": "Stephen Darlington",
"author_id": 2998,
"author_profile": "https://Stackoverflow.com/users/2998",
"pm_score": 4,
"selected": true,
"text": "<p>Did you try the <code>head</code> command?</p>\n\n<pre><code>head -200 inputfile > outputfile\n</code></pre>... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115/"
] | I have a very large CSV file and I need to write an app that will parse it but using the >6GB file to test against is painful, is there a simple way to extract the first hundred or two lines without having to load the entire file into memory?
The file resides on a Debian server. | Did you try the `head` command?
```
head -200 inputfile > outputfile
``` |
511,232 | <p>What is the cleverest CSS technique that lets you use less HTML?</p>
<p>One of the advantages of using CSS well is that it can let you simplify your HTML, and produce look-and-feel effects entirely in the CSS. In the beginning this was just replacing deprecated HTML presentation mark-up and spacer-GIFs with CSS, bu... | [
{
"answer_id": 511274,
"author": "Kezzer",
"author_id": 39693,
"author_profile": "https://Stackoverflow.com/users/39693",
"pm_score": 4,
"selected": true,
"text": "<p>Specificity can be omitted by not nesting elements in divs, and instead just giving elements themselves unique identifier... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2670/"
] | What is the cleverest CSS technique that lets you use less HTML?
One of the advantages of using CSS well is that it can let you simplify your HTML, and produce look-and-feel effects entirely in the CSS. In the beginning this was just replacing deprecated HTML presentation mark-up and spacer-GIFs with CSS, but recent y... | Specificity can be omitted by not nesting elements in divs, and instead just giving elements themselves unique identifiers.
```
<div id="mylist">
<ul>
<li>ListItem1</li>
<li>ListItem2</li>
</ul>
</div>
```
Replace with
```
<ul id="mylist">
<li>ListItem1</li>
<li>ListItem2</li>
</ul>
`... |
511,238 | <p>I have used a 'Union' to combine two reports showing different dates. When I open the report on it's own it works fine with the two dates shown. However when I drill to the (union) report from another on the dashboard it only shows one date. Is there a dashboard filter that I may need to un apply or is there some ot... | [
{
"answer_id": 511274,
"author": "Kezzer",
"author_id": 39693,
"author_profile": "https://Stackoverflow.com/users/39693",
"pm_score": 4,
"selected": true,
"text": "<p>Specificity can be omitted by not nesting elements in divs, and instead just giving elements themselves unique identifier... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have used a 'Union' to combine two reports showing different dates. When I open the report on it's own it works fine with the two dates shown. However when I drill to the (union) report from another on the dashboard it only shows one date. Is there a dashboard filter that I may need to un apply or is there some other... | Specificity can be omitted by not nesting elements in divs, and instead just giving elements themselves unique identifiers.
```
<div id="mylist">
<ul>
<li>ListItem1</li>
<li>ListItem2</li>
</ul>
</div>
```
Replace with
```
<ul id="mylist">
<li>ListItem1</li>
<li>ListItem2</li>
</ul>
`... |
511,247 | <p>it's my first question here, glad to have found this site.</p>
<p>My question deals with the new Generics feature in Delphi 2009. Basically I tried to write a generic wrapper class for an existing hash map implementation. The existing implementation stores (String, Pointer) pairs, so in the wrapper class I have to ... | [
{
"answer_id": 511373,
"author": "Heinrich Ulbricht",
"author_id": 56658,
"author_profile": "https://Stackoverflow.com/users/56658",
"pm_score": 0,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>Value := TObject (Ptr)\n</code></pre>\n\n<p>No need to cast more, as assigning th... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62391/"
] | it's my first question here, glad to have found this site.
My question deals with the new Generics feature in Delphi 2009. Basically I tried to write a generic wrapper class for an existing hash map implementation. The existing implementation stores (String, Pointer) pairs, so in the wrapper class I have to cast betwe... | You need to take the address of the location of the generic type parameter type, then typecast this address to a pointer to the desired type, and then dereference this pointer and assign into the resulting location. For example:
```
PObject(@Value)^ := Ptr;
```
The reason you can't just typecast a value of type T, w... |
511,248 | <p><strong>Hi All,</strong></p>
<p>I'm thinking in this line of code</p>
<pre><code>IDataReader myReader = questDatabase.ExecuteReader(getQuest);
</code></pre>
<p>I'm using DAAB but I can't understand how and what's the meaning of the fact the method ExecuteReader(DbCommand) returns an IDataReader Interface.</p>
<p... | [
{
"answer_id": 511251,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 2,
"selected": false,
"text": "<p>It returns an interface because the implementation of the interface isn't important, just the API that the interfac... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32718/"
] | **Hi All,**
I'm thinking in this line of code
```
IDataReader myReader = questDatabase.ExecuteReader(getQuest);
```
I'm using DAAB but I can't understand how and what's the meaning of the fact the method ExecuteReader(DbCommand) returns an IDataReader Interface.
**Anyone can Explain, Please** | It allows you to you DataReader without the need of knowing which type of DataReader you are using (i.e. `SqlDataReader, OleDbDataReader, EtcDataReader`), so if someday you want to change the datareader you are using it won't impact you logic, in other words it gives you abstraction.
For example :
you can use
```
IDb... |
511,263 | <p>how to get the application pool name for a specific website IIS 6 programmatic using C#</p>
<p>EDIT:
I already used the methods of DirectoryServices namespace but the application pool name isn't retrieved correctly unless it was explicitly set by using the same code. Which means if u add a website manually using t... | [
{
"answer_id": 511294,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 2,
"selected": true,
"text": "<p>The classes in the <a href=\"http://msdn.microsoft.com/en-us/library/system.directoryservices.aspx\" rel=\"nofollow noreferr... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25240/"
] | how to get the application pool name for a specific website IIS 6 programmatic using C#
EDIT:
I already used the methods of DirectoryServices namespace but the application pool name isn't retrieved correctly unless it was explicitly set by using the same code. Which means if u add a website manually using the iis man... | The classes in the [System.DirectoryServices namespace](http://msdn.microsoft.com/en-us/library/system.directoryservices.aspx) will help you get that information.
Check [this article by Rick Strahl](http://www.west-wind.com/weblog/posts/10181.aspx) for an example:
```cs
/// <summary>
/// Returns a list of all the App... |
511,270 | <p>I am trying to developed a iPhone app by using cocos2d. I using "scheduledTimerWithTimeInterval" for calling a method that called a fixed time interval. But now time interval increases in gradually. for this reason the time is slow in gradually.
here is my code: </p>
<pre><code>- (void) methodTime: (id) sender{
... | [
{
"answer_id": 511334,
"author": "Georg Schölly",
"author_id": 24587,
"author_profile": "https://Stackoverflow.com/users/24587",
"pm_score": 0,
"selected": false,
"text": "<p>I had trouble understanding your question. You haven't even used one quotation mark in your 'question'.</p>\n\n<p... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51108/"
] | I am trying to developed a iPhone app by using cocos2d. I using "scheduledTimerWithTimeInterval" for calling a method that called a fixed time interval. But now time interval increases in gradually. for this reason the time is slow in gradually.
here is my code:
```
- (void) methodTime: (id) sender{
NSTimer *rat... | It looks like every 0.5 seconds you are adding a sprite to some list of sprites. Eventually the list is getting very large and all that data causes your method to take longer than 0.5 seconds to execute. This causes the timer to fire fast as it can, which is not all that fast since its always waiting for your method to... |
511,280 | <p>I need a good Unicode library for C++. I need:</p>
<ol>
<li>Transformations in a Unicode sensitive way. For example sort all strings in a case insensitive way and get their first characters for index. Convert various Unicode strings to upper and to lower case. Split text at a reasonable position -- words that would... | [
{
"answer_id": 511306,
"author": "Eduard - Gabriel Munteanu",
"author_id": 59655,
"author_profile": "https://Stackoverflow.com/users/59655",
"pm_score": 1,
"selected": false,
"text": "<p>The <a href=\"http://www.wxwidgets.org/\" rel=\"nofollow noreferrer\">wxWidgets</a> GUI toolkit has s... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need a good Unicode library for C++. I need:
1. Transformations in a Unicode sensitive way. For example sort all strings in a case insensitive way and get their first characters for index. Convert various Unicode strings to upper and to lower case. Split text at a reasonable position -- words that would work for Chi... | This question was asked quite a long time before by myself. There was no such library.
So I had written C++ friendly [Boost.Locale](http://lists.boost.org/Archives/boost/2010/03/162952.php) library that wraps ICU.
* Docs: <http://cppcms.sourceforge.net/boost_locale/html/>
* Sources: <https://sourceforge.net/projects/... |
511,281 | <p>What proven design patterns exist for batch operations on resources within a REST style web service?</p>
<p>I'm trying to be strike a balance between ideals and reality in terms of performance and stability. We've got an API right now where all operations either retrieve from a list resource (ie: GET /user) or on a... | [
{
"answer_id": 511397,
"author": "Christian Nunciato",
"author_id": 32129,
"author_profile": "https://Stackoverflow.com/users/32129",
"pm_score": 5,
"selected": false,
"text": "<p>Not at all -- I think the REST equivalent is (or at least one solution is) almost exactly that -- a speciali... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/758/"
] | What proven design patterns exist for batch operations on resources within a REST style web service?
I'm trying to be strike a balance between ideals and reality in terms of performance and stability. We've got an API right now where all operations either retrieve from a list resource (ie: GET /user) or on a single in... | A simple RESTful pattern for batches is to make use of a collection resource. For example, to delete several messages at once.
```
DELETE /mail?&id=0&id=1&id=2
```
It's a little more complicated to batch update partial resources, or resource attributes. That is, update each markedAsRead attribute. Basically, instead... |
511,289 | <p>I just considered using the new TDictionary type. But On QualityCentral I read about two memory leaks caused by TDictionary:</p>
<p><a href="http://qc.codegear.com/wc/qcmain.aspx?d=67355" rel="nofollow noreferrer">http://qc.codegear.com/wc/qcmain.aspx?d=67355</a></p>
<p>I just implemented the proposed workaround, ... | [
{
"answer_id": 511325,
"author": "Heinrich Ulbricht",
"author_id": 56658,
"author_profile": "https://Stackoverflow.com/users/56658",
"pm_score": 3,
"selected": true,
"text": "<p>You could call <code>inherited</code> first and check if the properties are still set:</p>\n\n<pre><code>destr... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62391/"
] | I just considered using the new TDictionary type. But On QualityCentral I read about two memory leaks caused by TDictionary:
<http://qc.codegear.com/wc/qcmain.aspx?d=67355>
I just implemented the proposed workaround, basically subclassing TDictionary, overriding the destructor and manually freing the two objects that... | You could call `inherited` first and check if the properties are still set:
```
destructor TMemCorrectedDictionary.Destroy;
begin
inherited;
Values.Free;
Keys.Free;
end;
```
And by the way: `Free` doesn't care if the instance to be freed is `nil`, so this will work if (but only if) `inherited Destroy` sets the... |
511,291 | <p>I am an experienced PHP programmer using Django for the first time, and I think it is incredible!</p>
<p>I have a project that has a lot of apps, so I wanted to group them in an apps folder.</p>
<p>So the structure of the project is:</p>
<pre><code>/project/
/project/apps/
/project/apps/app1/
/project/apps/app2
<... | [
{
"answer_id": 511371,
"author": "sykora",
"author_id": 53850,
"author_profile": "https://Stackoverflow.com/users/53850",
"pm_score": 2,
"selected": false,
"text": "<p>As long as your apps are in your PYTHONPATH, everything should work. Try setting that environment variable to the folder... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am an experienced PHP programmer using Django for the first time, and I think it is incredible!
I have a project that has a lot of apps, so I wanted to group them in an apps folder.
So the structure of the project is:
```
/project/
/project/apps/
/project/apps/app1/
/project/apps/app2
```
Then in Django settings... | Make sure that the '\_\_init\_\_.py' file is in your apps directory, if it's not there it won't be recognized as part of the package.
So each of the folders here should have '\_\_init\_\_.py' file in it. (empty is fine).
```
/project/
/project/apps/
/project/apps/app1/
/project/apps/app2
```
Then as long as your ro... |
511,309 | <p>I have text file which has lot of character entries one line after another.
I want to find all lines which start with <code>::</code> and delete all those lines.</p>
<p>What is the regular expression to do this?</p>
<p>-AD</p>
| [
{
"answer_id": 511331,
"author": "José Leal",
"author_id": 37190,
"author_profile": "https://Stackoverflow.com/users/37190",
"pm_score": 0,
"selected": false,
"text": "<p>Simple as: </p>\n\n<pre><code>^::\n</code></pre>\n"
},
{
"answer_id": 511339,
"author": "Alan Moore",
... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759376/"
] | I have text file which has lot of character entries one line after another.
I want to find all lines which start with `::` and delete all those lines.
What is the regular expression to do this?
-AD | Regular expressions don't "do" anything. They only match text.
What you want is some tools that uses regular expressions to identify a line and then apply some command to those tools.
One such tools is `sed` (there's also `awk` and many others). You'd use it like this:
```
sed -e "/^::/d" < input.txt > output.txt
`... |
511,315 | <p>My application is processing IList's. ILists of different user defined types. I'm thinking that i can use reflection to to see what type of object the IList contains and then create a new instance of that type and subsequently add that to the IList itself?</p>
<p>So at any one time I might be processing </p>
<pre>... | [
{
"answer_id": 511365,
"author": "mqp",
"author_id": 55943,
"author_profile": "https://Stackoverflow.com/users/55943",
"pm_score": 0,
"selected": false,
"text": "<p>The big problem here is: If you don't know the type, how do you know how to make a new one? Not every type in the world h... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48408/"
] | My application is processing IList's. ILists of different user defined types. I'm thinking that i can use reflection to to see what type of object the IList contains and then create a new instance of that type and subsequently add that to the IList itself?
So at any one time I might be processing
```
IList<Customer>... | Try this:
```
public static void AddNewElement<T>(IList<T> l, int i, string s)
{
T obj = (T)Activator.CreateInstance(typeof(T), new object[] { i, s });
l.Add(obj);
}
```
Usage:
```
IList<Customer> l = new List<Customer>();
l.Add(new Customer(1,"Hi there ..."));
AddNewElement... |
511,320 | <p>I'm filling the background of some VB.NET 2005 WinForms form with a nice pretty gradient fill (by overriding the OnPaint event). This works fine but the various labels etc on the form show with a solid background even after I set the BackColor to Color.Transparent. Setting the transparency key of the form itself see... | [
{
"answer_id": 517961,
"author": "Hans Passant",
"author_id": 17034,
"author_profile": "https://Stackoverflow.com/users/17034",
"pm_score": 2,
"selected": false,
"text": "<p>Add a new class to your project and paste the code shown below. Build. Drop the new control from the top of your... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20048/"
] | I'm filling the background of some VB.NET 2005 WinForms form with a nice pretty gradient fill (by overriding the OnPaint event). This works fine but the various labels etc on the form show with a solid background even after I set the BackColor to Color.Transparent. Setting the transparency key of the form itself seems ... | Add a new class to your project and paste the code shown below. Build. Drop the new control from the top of your toolbox onto your form.
```
Public Class TransparentLabel
Inherits Label
Public Sub New()
Me.SetStyle(ControlStyles.Opaque, True)
Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, Fa... |
511,322 | <p>Aloha,</p>
<p>I have a 8MB XML file that I wish to deserialize.
I'm using this code:</p>
<pre><code>public static T Deserialize<T>(string xml)
{
TextReader reader = new StringReader(xml);
Type type = typeof(T);
XmlSerializer serializer = new XmlSerializer(type);
T obj = (T)serializer.Deseri... | [
{
"answer_id": 511352,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 3,
"selected": true,
"text": "<p>The XmlSerializer uses reflection and is therefore not the best choice if performance is an issue. </p>\n\n<p>You c... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6399/"
] | Aloha,
I have a 8MB XML file that I wish to deserialize.
I'm using this code:
```
public static T Deserialize<T>(string xml)
{
TextReader reader = new StringReader(xml);
Type type = typeof(T);
XmlSerializer serializer = new XmlSerializer(type);
T obj = (T)serializer.Deserialize(reader);
return o... | The XmlSerializer uses reflection and is therefore not the best choice if performance is an issue.
You could build up a DOM of your XML document using the `XmlDocument` or `XDocument` classes and work with that, or, even faster use an `XmlReader`. The `XmlReader` however requires you to write any object mapping - if ... |
511,336 | <p>I have this URL:</p>
<pre><code>http://hostX.site.com/some_path_here/filename.jpg
</code></pre>
<p>and need to rewrite it to:</p>
<pre><code>http://host.site.com/same_path_here/filenameX.jpg
</code></pre>
<p>Can you please tell me if this is possible?
Basically I am trying to move "<strong>X</strong>" (it is a n... | [
{
"answer_id": 511387,
"author": "Ulf",
"author_id": 51208,
"author_profile": "https://Stackoverflow.com/users/51208",
"pm_score": 2,
"selected": false,
"text": "<p>(Without testing,) something like this should work:</p>\n\n<pre><code>RewriteCond %{HTTP_HOST} host(\\d).site.com\nRewriteR... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62408/"
] | I have this URL:
```
http://hostX.site.com/some_path_here/filename.jpg
```
and need to rewrite it to:
```
http://host.site.com/same_path_here/filenameX.jpg
```
Can you please tell me if this is possible?
Basically I am trying to move "**X**" (it is a number) from the subdomain to the end of the filename, just bef... | Something like this should do it:
```
RewriteCond %{HTTP_HOST} ^host(\d)\.example\.com$
RewriteRule (.*)\.([^/.]+)$ http://host.example.com/$1%1.$2
```
But since the host is different, this will cause an external redirect. |
511,345 | <p>Does anybody knows, if there is a way to use a property that is animated as source for a binding?
As far as I found out, is that an animation doesn't "really" set the value on the property, and therefore doesn't fire the changed events, which is needed to trigger the binding.</p>
<p>tia
Martin</p>
| [
{
"answer_id": 511557,
"author": "Szymon Rozga",
"author_id": 7583,
"author_profile": "https://Stackoverflow.com/users/7583",
"pm_score": 3,
"selected": true,
"text": "<p>I don't know if what you are saying is exactly true. In the XAML below, the TextBlock will display the Width of the R... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58275/"
] | Does anybody knows, if there is a way to use a property that is animated as source for a binding?
As far as I found out, is that an animation doesn't "really" set the value on the property, and therefore doesn't fire the changed events, which is needed to trigger the binding.
tia
Martin | I don't know if what you are saying is exactly true. In the XAML below, the TextBlock will display the Width of the Rectangle. When you click on the Rectangle, the Width property is animated from 50 to 300. Along every increment, the TextBlock changes in value. Am I not understanding your question?
```
<Grid>
<Grid.... |
511,355 | <p>I have around 10 buttons on my form and I want them to call the same Click event handler.</p>
<p>But for that I need the Event handler to be generalized and we don't have "this" keyword in VB.NET to refer to the control that caused the event.</p>
<p>How do I implement the functionality of "this" keyword in VB.NET?... | [
{
"answer_id": 511359,
"author": "Mark A Johnson",
"author_id": 45720,
"author_profile": "https://Stackoverflow.com/users/45720",
"pm_score": 1,
"selected": false,
"text": "<p>In <a href=\"http://en.wikipedia.org/wiki/Visual_Basic_.NET\" rel=\"nofollow noreferrer\">VB.NET</a>, <code>Me</... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have around 10 buttons on my form and I want them to call the same Click event handler.
But for that I need the Event handler to be generalized and we don't have "this" keyword in VB.NET to refer to the control that caused the event.
How do I implement the functionality of "this" keyword in VB.NET?
I want to be ab... | >
> How do I implement the functionality of "this" keyword in VB.NET?
>
>
>
`this` is called `Me` in VB. However, this has got nothing to do with your code and refers to the containing class, in your case most probably the current `Form`. You need to access the `sender` object parameter, after casting it to `Contr... |
511,358 | <p>i want to use doPostBack function in my link.When user clicks it,it wont redirect to another page and page will be postback.I am using this code but it doesnt function.Where do i miss?</p>
<pre><code>< a id="Sample" href="javascript:__doPostBack('__PAGE','');">
function __doPostBack(eventTarget, eventArgu... | [
{
"answer_id": 511382,
"author": "Sergio",
"author_id": 32037,
"author_profile": "https://Stackoverflow.com/users/32037",
"pm_score": 1,
"selected": false,
"text": "<p>__doPostBack is an auto-generated function that ensures that the page posts-back to the server to maintain page state. I... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i want to use doPostBack function in my link.When user clicks it,it wont redirect to another page and page will be postback.I am using this code but it doesnt function.Where do i miss?
```
< a id="Sample" href="javascript:__doPostBack('__PAGE','');">
function __doPostBack(eventTarget, eventArgument)
{
... | Try this :
```
System.Web.UI.HtmlControls.HtmlAnchor myAnchor = new System.Web.UI.HtmlControls.HtmlAnchor();
string postbackRef = Page.GetPostBackEventReference(myAnchor);
myAnchor.HRef = postbackRef;
``` |
511,361 | <p>I have a database of components. Each component is of a specific type. That means there is a many-to-one relationship between a component and a type. When I delete a type, I would like to delete all the components which has a foreign key of that type. But if I'm not mistaken, cascade delete will delete the type when... | [
{
"answer_id": 511390,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 7,
"selected": true,
"text": "<p>Here's what you'd include in your components table.</p>\n\n<pre><code>CREATE TABLE `components` (\n `id` int(10) unsigned... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1585/"
] | I have a database of components. Each component is of a specific type. That means there is a many-to-one relationship between a component and a type. When I delete a type, I would like to delete all the components which has a foreign key of that type. But if I'm not mistaken, cascade delete will delete the type when th... | Here's what you'd include in your components table.
```
CREATE TABLE `components` (
`id` int(10) unsigned NOT NULL auto_increment,
`typeId` int(10) unsigned NOT NULL,
`moreInfo` VARCHAR(32),
-- etc
PRIMARY KEY (`id`),
KEY `type` (`typeId`)
CONSTRAINT `myForeignKey` FOREIGN KEY (`typeId`)
... |
511,367 | <p>I click update in eclipse and I get an error, it's because I updated eclipse more than once. Is there any way to fix eclipse and have the ability to use update?</p>
<pre>
An error occurred while collecting items to be installed
No repository found containing: org.eclipse.jem/osgi.bundle/2.0.202.v200810282000
No... | [
{
"answer_id": 511404,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 6,
"selected": true,
"text": "<p>What version of eclipse are you using ?</p>\n<p>It has been <a href=\"https://bugs.eclipse.org/bugs/show_bug.cgi?id=251716\" ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30453/"
] | I click update in eclipse and I get an error, it's because I updated eclipse more than once. Is there any way to fix eclipse and have the ability to use update?
```
An error occurred while collecting items to be installed
No repository found containing: org.eclipse.jem/osgi.bundle/2.0.202.v200810282000
No reposit... | What version of eclipse are you using ?
It has been [fixed in 3.4.1](https://bugs.eclipse.org/bugs/show_bug.cgi?id=251716), but in your case, it could be [this bug instead](https://bugs.eclipse.org/bugs/show_bug.cgi?id=236437).
>
> It turns out the cause is one or more artifact repositories being lost from the list ... |
511,381 | <p>Specifically, Sql Server 2005/T-Sql. I have a field that is mostly a series of two characters, and they're all supposed to be upper case but there's some legacy data that predates the current DB/System, and I need to figure out which records are in violation of the upper casing covenant.</p>
<p>I thought this woul... | [
{
"answer_id": 511398,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 2,
"selected": false,
"text": "<p>The ascii() function will only return the ascii number for the first character in an expression if you pass it a multiple... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1734/"
] | Specifically, Sql Server 2005/T-Sql. I have a field that is mostly a series of two characters, and they're all supposed to be upper case but there's some legacy data that predates the current DB/System, and I need to figure out which records are in violation of the upper casing covenant.
I thought this would work:
``... | if all the date should have been in upper case just do an update
```
update tbl
set field1 = upper(field1)
```
but to answer your original question this query should give you the results that you expect:
```
select * from tbl
where field1 COLLATE Latin1_General_CS_AS <> upper(field1)
```
Edit: just noticed that t... |
511,396 | <p>I would like to get a user's group memberships in an ActiveDirectory, without being in the domain. When I run this inside the domain, all is well.</p>
<pre><code>var context = new PrincipalContext(ContextType.Domain);
var principal = UserPrincipal.FindByIdentity(context, IdentityType.Name, "administrator");
foreac... | [
{
"answer_id": 511451,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 2,
"selected": false,
"text": "<p>Looks like a DNS problem.</p>\n\n<p>DC locator works by doing DNS queries for SRV records to find the appropriate D... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30971/"
] | I would like to get a user's group memberships in an ActiveDirectory, without being in the domain. When I run this inside the domain, all is well.
```
var context = new PrincipalContext(ContextType.Domain);
var principal = UserPrincipal.FindByIdentity(context, IdentityType.Name, "administrator");
foreach (var authori... | Looks like a DNS problem.
DC locator works by doing DNS queries for SRV records to find the appropriate DC in your current site. If that stuff isn't in DNS, DC locator will fail, which is happening in your stack trace. |
511,439 | <p>How can I specify a custom date formate to be validated with the <a href="http://docs.jquery.com/Plugins/Validation" rel="noreferrer">Validation Plugin</a> for jQuery?</p>
| [
{
"answer_id": 511471,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 8,
"selected": true,
"text": "<p>You can create your own custom validation method using the <a href=\"http://docs.jquery.com/Plugins/Validation/Validator/add... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] | How can I specify a custom date formate to be validated with the [Validation Plugin](http://docs.jquery.com/Plugins/Validation) for jQuery? | You can create your own custom validation method using the [`addMethod`](http://docs.jquery.com/Plugins/Validation/Validator/addMethod#namemethodmessage) function. Say you wanted to validate "dd/mm/yyyy":
```
$.validator.addMethod(
"australianDate",
function(value, element) {
// put your own logic here... |