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 |
|---|---|---|---|---|---|---|
197,307 | <p>What would you recommend to search a sql server table (varchar(max) column) for a term?</p>
<p>Let's say, like in ebay, if you search for "wii brand new", you get results like "Brand New Nintendo Wii Fit Game + Balance Board Bundle", "Wii Fit (Wii) BRAND NEW WII FIT GAME + BALANCE BOARD".</p>
<p>I think it basical... | [
{
"answer_id": 197313,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 4,
"selected": true,
"text": "<p>You are looking for fulltext indexing, it allows you to do more advanced querying than regular expressions or like... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] | What would you recommend to search a sql server table (varchar(max) column) for a term?
Let's say, like in ebay, if you search for "wii brand new", you get results like "Brand New Nintendo Wii Fit Game + Balance Board Bundle", "Wii Fit (Wii) BRAND NEW WII FIT GAME + BALANCE BOARD".
I think it basically searches every... | You are looking for fulltext indexing, it allows you to do more advanced querying than regular expressions or like.
Check [this](http://www.developer.com/db/article.php/3446891) article for a quick introduction, the instructions are for SQL Server 2000, where it is a little harder to setup than in 2005 or 2008.
Relev... |
197,310 | <p>I want to do this (no particular language):</p>
<pre><code>print(foo.objects.bookdb.books[12].title);
</code></pre>
<p>or this:</p>
<pre><code>book = foo.objects.bookdb.book.new();
book.title = 'RPC for Dummies';
book.save();
</code></pre>
<p>Where foo actually is a service connected to my program via some IPC, ... | [
{
"answer_id": 197322,
"author": "workmad3",
"author_id": 16035,
"author_profile": "https://Stackoverflow.com/users/16035",
"pm_score": 2,
"selected": false,
"text": "<p>I think the way to do what you are requesting is to have all object communication regarded as message passing. This is... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2077/"
] | I want to do this (no particular language):
```
print(foo.objects.bookdb.books[12].title);
```
or this:
```
book = foo.objects.bookdb.book.new();
book.title = 'RPC for Dummies';
book.save();
```
Where foo actually is a service connected to my program via some IPC, and to access its methods and objects, some layer... | You shouldn't do it! It is very important for programmers to see and feel the difference between an IPC/RPC and a local method call in the code. If you make it so, that they don't have to think about it, they won't think about it, and that will lead to very poorly performing code.
Think of:
```
foreach o, o.isGreen i... |
197,319 | <p>I'm trying to create and retrieve a BLOB in a MySQL table via Kohana's ORM library.</p>
<p>The code looks something like:</p>
<pre><code>$attachment = new Attachment_Model();
$attachment->name = $info['FileName'];
$attachment->size = strlen($info['Data']);
$attachment->data = $info['Data'];
$attachment-&g... | [
{
"answer_id": 197349,
"author": "thr",
"author_id": 452521,
"author_profile": "https://Stackoverflow.com/users/452521",
"pm_score": 0,
"selected": false,
"text": "<p>Wild guess, but: probably because the kohana model layer inserts all data as character data instead of binary, which will... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to create and retrieve a BLOB in a MySQL table via Kohana's ORM library.
The code looks something like:
```
$attachment = new Attachment_Model();
$attachment->name = $info['FileName'];
$attachment->size = strlen($info['Data']);
$attachment->data = $info['Data'];
$attachment->mime_type = $info['content-type... | It turns out that, in this case, I was using the BLOB data type.
The BLOB data type truncates data at 65535 characters (silently, without throwing an error!)
I've upped it to a MEDIUMBLOB (which has a max length of 16777215 characters), and it seems to work OK! |
197,362 | <p>I have a products table that contains a FK for a category, the Categories table is created in a way that each category can have a parent category, example:</p>
<pre><code>Computers
Processors
Intel
Pentium
Core 2 Duo
AMD
Athlon
</code></pre>
<p>I need to make... | [
{
"answer_id": 197373,
"author": "Draemon",
"author_id": 26334,
"author_profile": "https://Stackoverflow.com/users/26334",
"pm_score": 0,
"selected": false,
"text": "<p>I have done similar things in the past, first querying for the category ids, then querying for the products \"IN\" thos... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17648/"
] | I have a products table that contains a FK for a category, the Categories table is created in a way that each category can have a parent category, example:
```
Computers
Processors
Intel
Pentium
Core 2 Duo
AMD
Athlon
```
I need to make a select query that if th... | The best solution for this is at the database design stage. Your categories table needs to be a *Nested Set*. The article [Managing Hierarchical Data in MySQL](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/) is not that MySQL specific (despite the title), and gives a great overview of the differen... |
197,372 | <p>I have a JUnit 3.x TestCase which I would like to be able to parameterize. I'd like to parametrize the entire <code>TestCase</code> (including the fixture). However, the <code>TestSuite.addTestSuite()</code> method does not allow be to pass a <code>TestCase</code> object, just a class:</p>
<pre><code> TestSuite s... | [
{
"answer_id": 197374,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 3,
"selected": true,
"text": "<p>If this is Java 5 or higher, you might want to consider switching to JUnit 4, which has support for parameterized test... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13051/"
] | I have a JUnit 3.x TestCase which I would like to be able to parameterize. I'd like to parametrize the entire `TestCase` (including the fixture). However, the `TestSuite.addTestSuite()` method does not allow be to pass a `TestCase` object, just a class:
```
TestSuite suite = new TestSuite("suite");
suite.addTest... | If this is Java 5 or higher, you might want to consider switching to JUnit 4, which has support for parameterized test cases built in. |
197,375 | <p>I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as well?) supports <code>for each</code> syntax on stl lists et al to facilitate iteration.
For example:</p>
<pre><code>list<Object> myList;
for each (Object o in myList)
{
o.foo();
}
</code></pre>
<p>I was very happy to di... | [
{
"answer_id": 197382,
"author": "Peter Kühne",
"author_id": 27351,
"author_profile": "https://Stackoverflow.com/users/27351",
"pm_score": 6,
"selected": true,
"text": "<p>For each is not standard C or C++ syntax. If you want to be able to compile this code in gcc or g++, you will need t... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25731/"
] | I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as well?) supports `for each` syntax on stl lists et al to facilitate iteration.
For example:
```
list<Object> myList;
for each (Object o in myList)
{
o.foo();
}
```
I was very happy to discover it, but I'm concerned about portabil... | For each is not standard C or C++ syntax. If you want to be able to compile this code in gcc or g++, you will need to create an iterator and use a standard for loop.
QuantumPete
[edit]
This seems to be a new feature introduced into MS Visual C++, so this is definitely not portable. Ref: <http://msdn.microsoft.com/en-... |
197,379 | <p>I am looking to create symlinks (soft links) from Java on a Windows Vista/ 2008 machine. I'm happy with the idea that I need to call out to the JNI to do this. I am after help on the actual C code though. What is the appropriate system call to create the link? Pointers to some good documentation on this subject woul... | [
{
"answer_id": 197386,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 2,
"selected": false,
"text": "<p>Couldn't you just call out to the command line and use <strong>mklink</strong>?</p>\n"
},
{
"answer_id": 197420,
... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7122/"
] | I am looking to create symlinks (soft links) from Java on a Windows Vista/ 2008 machine. I'm happy with the idea that I need to call out to the JNI to do this. I am after help on the actual C code though. What is the appropriate system call to create the link? Pointers to some good documentation on this subject would b... | Symbolic links in Windows are created using the [CreateSymbolicLink API Function](http://msdn.microsoft.com/en-us/library/aa363866.aspx), which takes parameters very similar to the command line arguments accepted by [the Mklink command line utility](http://technet.microsoft.com/en-us/library/cc753194.aspx).
Assuming y... |
197,381 | <p>I am dealing with MySQL tables that are essentially results of raytracing simulations on a simulated office room with a single venetian blind. I usually need to retrieve the simulation's result for a unique combination of time and blind's settings. So I end up doing a lot of</p>
<pre><code>SELECT result FROM result... | [
{
"answer_id": 197408,
"author": "mlarsen",
"author_id": 17700,
"author_profile": "https://Stackoverflow.com/users/17700",
"pm_score": 3,
"selected": true,
"text": "<p>The answer is most definately a yes. If you define a unique index on timestamp, opening and slatangle MySQL should be ab... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1428/"
] | I am dealing with MySQL tables that are essentially results of raytracing simulations on a simulated office room with a single venetian blind. I usually need to retrieve the simulation's result for a unique combination of time and blind's settings. So I end up doing a lot of
```
SELECT result FROM results WHERE timest... | The answer is most definately a yes. If you define a unique index on timestamp, opening and slatangle MySQL should be able to find your row with very few disc seeks.
You might experiment with creating an index on timestamp, opening, slateangle and result. MySQL may be able to fetch your data from the index without tou... |
197,383 | <p>I want to create a bundle from an arbitrary bundle identifier<br>
e.g. <code>com.apple.iokit.IOStorageFamily</code> </p>
<p>It's not an unreasonable thing to do as bundle IDs are supposed<br>
to be unique, however the obvious code does not work:</p>
<pre><code>NSString* bID = @"com.apple.iokit.IOStorageFamily";
N... | [
{
"answer_id": 198195,
"author": "Dave Verwer",
"author_id": 4496,
"author_profile": "https://Stackoverflow.com/users/4496",
"pm_score": 3,
"selected": false,
"text": "<p>Use this</p>\n\n<pre><code>NSString *path = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@\"... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22147/"
] | I want to create a bundle from an arbitrary bundle identifier
e.g. `com.apple.iokit.IOStorageFamily`
It's not an unreasonable thing to do as bundle IDs are supposed
to be unique, however the obvious code does not work:
```
NSString* bID = @"com.apple.iokit.IOStorageFamily";
NSBundle* bundle = [NSBundle bundleW... | Just recently [Andrew Myrick answered a similar question](http://lists.apple.com/archives/darwin-dev/2009/Oct/msg00088.html) on the darwin-dev mailing list:
>
> `KextManagerCreateURLForBundleIdentifier()`
> in `<IOKit/kext/KextManager.h>` may be
> of use, though I believe it only works
> for kexts that are either ... |
197,387 | <p>Is there a way to describe the module's data in a similar way that a docstring describes a module or a funcion?</p>
<pre><code>class MyClass(object):
def my_function():
"""This docstring works!"""
return True
my_list = []
"""This docstring does not work!"""
</code></pre>
| [
{
"answer_id": 197499,
"author": "codeape",
"author_id": 3571,
"author_profile": "https://Stackoverflow.com/users/3571",
"pm_score": 5,
"selected": true,
"text": "<p>To my knowledge, it is not possible to assign docstrings to module data members.</p>\n\n<p><a href=\"http://www.python.org... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985/"
] | Is there a way to describe the module's data in a similar way that a docstring describes a module or a funcion?
```
class MyClass(object):
def my_function():
"""This docstring works!"""
return True
my_list = []
"""This docstring does not work!"""
``` | To my knowledge, it is not possible to assign docstrings to module data members.
[PEP 224](http://www.python.org/dev/peps/pep-0224/) suggests this feature, but the PEP was rejected.
I suggest you document the data members of a module in the module's docstring:
```
# module.py:
"""About the module.
module.data: cont... |
197,407 | <p>I need to define a calculated member in MDX (this is SAS OLAP, but I'd appreciate answers from people who work with different OLAP implementations anyway).</p>
<p>The new measure's value should be calculated from an existing measure by applying an additional filter condition. I suppose it will be clearer with an ex... | [
{
"answer_id": 200913,
"author": "Magnus Smith",
"author_id": 11461,
"author_profile": "https://Stackoverflow.com/users/11461",
"pm_score": 4,
"selected": true,
"text": "<p>To begin with, you can define a new calculated measure in your MDX, and tell it to use the value of another measure... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1026/"
] | I need to define a calculated member in MDX (this is SAS OLAP, but I'd appreciate answers from people who work with different OLAP implementations anyway).
The new measure's value should be calculated from an existing measure by applying an additional filter condition. I suppose it will be clearer with an example:
* ... | To begin with, you can define a new calculated measure in your MDX, and tell it to use the value of another measure, but with a filter applied:
```
WITH MEMBER [Measures].[Incoming Traffic] AS
'([Measures].[Total traffic], [Direction].[(All)].[In])'
```
Whenever you show the new measure on a report, it will behave a... |
197,441 | <p>I'm a new user of Matlab, can you please help:<br>
I have the following code in an .M file:</p>
<pre><code>function f = divrat(w, C)
S=sqrt(diag(diag(C)));
s=diag(S);
f=sqrt(w'*C*w)/(w'*s);
</code></pre>
<p>I have stored this file (divrat.M) in the normal Matlab path, and therefore I'm assuming that Matlab will re... | [
{
"answer_id": 197543,
"author": "hakan",
"author_id": 3993,
"author_profile": "https://Stackoverflow.com/users/3993",
"pm_score": 2,
"selected": false,
"text": "<p>The error code indicates the function definition cannot be found. Make sure you're calling the function from the same works... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm a new user of Matlab, can you please help:
I have the following code in an .M file:
```
function f = divrat(w, C)
S=sqrt(diag(diag(C)));
s=diag(S);
f=sqrt(w'*C*w)/(w'*s);
```
I have stored this file (divrat.M) in the normal Matlab path, and therefore I'm assuming that Matlab will read the function when it's s... | You get this error when the function isn't on the MATLAB path or in pwd.
First, make sure that you are able to find the function using:
```
>> which divrat
c:\work\divrat\divrat.m
```
If it returns:
```
>> which divrat
'divrat' not found.
```
It is not on the MATLAB path or in PWD.
Second, make sure that the di... |
197,444 | <p>I'm using libcurl in a Win32 C++ application.</p>
<p>I have the curllib.vcproj project added to my solution and set my other projects to depend on it.</p>
<p>How do I build it with SSL support enabled?</p>
| [
{
"answer_id": 199052,
"author": "sharkin",
"author_id": 7891,
"author_profile": "https://Stackoverflow.com/users/7891",
"pm_score": 7,
"selected": true,
"text": "<p>Well, since this post failed badly, I had to dig into the matter myself. </p>\n\n<p><strong><em>Also check out the other a... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7891/"
] | I'm using libcurl in a Win32 C++ application.
I have the curllib.vcproj project added to my solution and set my other projects to depend on it.
How do I build it with SSL support enabled? | Well, since this post failed badly, I had to dig into the matter myself.
***Also check out the other answers and comments for additional info regarding other versions etc.***
**EDIT: Since I posted this Q there seems to be ready-built binaries made available from the curl homepage. Check out [James' answer](https://... |
197,468 | <p>I'm just starting up a new ATL/WTL project and I was wondering if the global _Module variable is still required? </p>
<p>Back a few years when I started working with WTL it was required (at least for ATL 3.0) that you define a global variable such as:</p>
<pre><code>CAppModule _Module;
</code></pre>
<p>To get ATL... | [
{
"answer_id": 200210,
"author": "Johann Gerell",
"author_id": 6345,
"author_profile": "https://Stackoverflow.com/users/6345",
"pm_score": 1,
"selected": false,
"text": "<p>In the sample projects of the latest WTL version, this is still used.</p>\n\n<p>In stdafx.h:</p>\n\n<pre><code>exte... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3719/"
] | I'm just starting up a new ATL/WTL project and I was wondering if the global \_Module variable is still required?
Back a few years when I started working with WTL it was required (at least for ATL 3.0) that you define a global variable such as:
```
CAppModule _Module;
```
To get ATL to work correctly. But recently... | Technically you do not need a global `_Module` instance since ATL/WTL version 7. Earlier ATL/WTL code referenced `_Module` by this specific name and expected you to declare a single instance of this object. This has since been replaced by a single instance object named `_AtlBaseModule` that is automatically declared fo... |
197,482 | <p>What are the guidelines for when to create a new exception type instead of using one of the built-in exceptions in .Net?</p>
<p>The problem that got me thinking is this. I have a WCF service, which is a basic input-output service. If the service is unable to create an output, because the input is invalid, I want to... | [
{
"answer_id": 197488,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 4,
"selected": false,
"text": "<p>Avoid throwing <code>System.Exception</code> or <code>System.ApplicationException</code> yourself, as they are too general.</... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44726/"
] | What are the guidelines for when to create a new exception type instead of using one of the built-in exceptions in .Net?
The problem that got me thinking is this. I have a WCF service, which is a basic input-output service. If the service is unable to create an output, because the input is invalid, I want to throw an ... | Avoid throwing `System.Exception` or `System.ApplicationException` yourself, as they are too general.
For WCF services there are Fault Contracts - a generic exception that you can tell subscibers to handle.
Flag the interface with:
```
[FaultContract( typeof( LogInFault ) )]
void LogIn( string userName, string passw... |
197,489 | <p>I am using the jQuery library to implement drag and drop. </p>
<p>How do I get at the element that is being dragged when it is dropped?</p>
<p>I want to get the id of the image inside the div. The following element is dragged:</p>
<pre><code><div class="block">
<asp:Image ID="Image9" AlternateText="1... | [
{
"answer_id": 197505,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": 6,
"selected": true,
"text": "<p>Is it not the ui.draggable?</p>\n\n<p>If you go here (in Firefox and assuming you have firebug) and look in the firebug ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23066/"
] | I am using the jQuery library to implement drag and drop.
How do I get at the element that is being dragged when it is dropped?
I want to get the id of the image inside the div. The following element is dragged:
```
<div class="block">
<asp:Image ID="Image9" AlternateText="10/12/2008 - Retina" Width=81 Height=8... | Is it not the ui.draggable?
If you go here (in Firefox and assuming you have firebug) and look in the firebug console youll see I am doing a console.dir of the ui.draggable object which is the div being dragged
<http://jsbin.com/ixizi>
Therefore the code you need in the drop function is
```
drop: function(ev... |
197,497 | <p>What is the best way to determine how many window handles an application is using? Is there a tool or a WMI performance counter that I could use?</p>
<p>I would like to run up an app and watch a counter of some sort and see that the number of window handles is increasing. </p>
<pre><code>for (int i=0; i < 1000... | [
{
"answer_id": 197504,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 5,
"selected": true,
"text": "<p>Perfmon, which comes with your computer can do it. You can also add a column to your task manager processes tab (Handl... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/324/"
] | What is the best way to determine how many window handles an application is using? Is there a tool or a WMI performance counter that I could use?
I would like to run up an app and watch a counter of some sort and see that the number of window handles is increasing.
```
for (int i=0; i < 1000; i++)
{
System.Threa... | Perfmon, which comes with your computer can do it. You can also add a column to your task manager processes tab (Handle Count).
Instructions for Perfmon
1. Add a counter (click the +)
2. Choose Process under Performance object
3. Choose Handle Count under the counter list
4. Choose your process from the instance list... |
197,508 | <p>I know mime_content_type() is deprecated, but it seemed to me the alternative is worse at the moment. <code>Finfo</code> seems to require adding files and changing ini directions on windows; I don't want to require this for the script I am making.</p>
<p>I need to find the mimetype of files, but when calling <code>... | [
{
"answer_id": 197538,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 1,
"selected": false,
"text": "<p>This may be related to <a href=\"http://bugs.php.net/bug.php?id=38235\" rel=\"nofollow noreferrer\">this bug report</a>. ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6752/"
] | I know mime\_content\_type() is deprecated, but it seemed to me the alternative is worse at the moment. `Finfo` seems to require adding files and changing ini directions on windows; I don't want to require this for the script I am making.
I need to find the mimetype of files, but when calling `mime_content_type($filen... | This may be related to [this bug report](http://bugs.php.net/bug.php?id=38235). Do you have any errors in your error log when you call the script along the lines of `'FOO' is not a valid mimetype, entry skipped`?
Unfortunately the final response in that particular thread was to go ahead and use `[Fileinfo](http://pecl... |
197,521 | <p>I must implement a web service which expose a list of values (integers, custom classes etc).
My working solution returns a <code>List<T></code>, and according to FxCop it is better to return a <code>Collection<T></code> or <code>ReadOnlyCollection<T></code>.</p>
<p>If I choose to return a <code>Re... | [
{
"answer_id": 197530,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "<p>List<T> or Collection<T> are fine in this case.</p>\n\n<p>In terms of the original question, you can wr... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197521",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19756/"
] | I must implement a web service which expose a list of values (integers, custom classes etc).
My working solution returns a `List<T>`, and according to FxCop it is better to return a `Collection<T>` or `ReadOnlyCollection<T>`.
If I choose to return a `ReadOnlyCollection<T>`, the web service shows an error like:
>
> T... | List<T> or Collection<T> are fine in this case.
In terms of the original question, you can wrap a List<T> in a Collection<T> very simply:
```
List<Foo> list = new List<Foo>();
// ...
Collection<Foo> col = new Collection<Foo>(list);
```
This is a true wrapper; add an item to the wrapper (col), and it gets added to t... |
197,606 | <p>I'm exploring various options for mapping common C# code constructs to C++ CUDA code for running on a GPU. The structure of the system is as follows (arrows represent method calls):</p>
<p>C# program -> C# GPU lib -> C++ CUDA implementation lib</p>
<p>A method in the GPU library could look something like this:</p>... | [
{
"answer_id": 197630,
"author": "Pop Catalin",
"author_id": 4685,
"author_profile": "https://Stackoverflow.com/users/4685",
"pm_score": 3,
"selected": false,
"text": "<p>There's <a href=\"http://www.gass-ltd.co.il/en/products/cuda.net/\" rel=\"nofollow noreferrer\">CUDA.Net</a> if you w... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4055/"
] | I'm exploring various options for mapping common C# code constructs to C++ CUDA code for running on a GPU. The structure of the system is as follows (arrows represent method calls):
C# program -> C# GPU lib -> C++ CUDA implementation lib
A method in the GPU library could look something like this:
```
public static v... | There's [CUDA.Net](http://www.gass-ltd.co.il/en/products/cuda.net/) if you want some reference how C# can be run on GPU. |
197,614 | <p>In chapter 2, the section on bitwise operators (section 2.9), I'm having trouble understanding how one of the sample methods works.</p>
<p>Here's the method provided:</p>
<pre><code>unsigned int getbits(unsigned int x, int p, int n) {
return (x >> (p + 1 - n)) & ~(~0 << n);
}
</code></pre>
<p>... | [
{
"answer_id": 197652,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 6,
"selected": true,
"text": "<p>Let's use 16 bits for our example. In that case, <code>~0</code> is equal to</p>\n<pre><code>1111111111111111\n</code>... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14048/"
] | In chapter 2, the section on bitwise operators (section 2.9), I'm having trouble understanding how one of the sample methods works.
Here's the method provided:
```
unsigned int getbits(unsigned int x, int p, int n) {
return (x >> (p + 1 - n)) & ~(~0 << n);
}
```
The idea is that, for the given number *x*, it wi... | Let's use 16 bits for our example. In that case, `~0` is equal to
```
1111111111111111
```
When we left-shift this `n` bits (3 in your case), we get:
```
1111111111111000
```
because the `1`s at the left are discarded and `0`s are fed in at the right. Then re-complementing it gives:
```
0000000000000111
```
so... |
197,624 | <p>Is it possible to integrate my PHP web-based ecommerce application with Quickbook Online Edition?</p>
<p>When I make a sale on my web site, I would like to be able to make the corresponding journal entry in my accounting books.</p>
<p>Note, I'm referring to Quickbook <strong>Online Edition</strong>, <strong>not</s... | [
{
"answer_id": 197836,
"author": "inxilpro",
"author_id": 12549,
"author_profile": "https://Stackoverflow.com/users/12549",
"pm_score": 2,
"selected": false,
"text": "<p>It looks like Quickbooks OE has an XML-based SDK, available at:</p>\n\n<p><a href=\"http://developer.intuit.com/techni... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible to integrate my PHP web-based ecommerce application with Quickbook Online Edition?
When I make a sale on my web site, I would like to be able to make the corresponding journal entry in my accounting books.
Note, I'm referring to Quickbook **Online Edition**, **not** the desktop software. | I now have built a set of PHP classes that facilitates communication with QuickBooks Online Edition. It makes communicating with QuickBooks Online Edition as easy as:
```
// Create the connection to QuickBooks
$API = new QuickBooks_API(...);
// Build the Customer object
$Customer = new QuickBooks_Object_Customer();
... |
197,634 | <p>With ASP.NET's view engine/template aspx/ashx pages the way to spit to screen seems to be: </p>
<pre><code><%= Person.Name %>
</code></pre>
<p>Which was fine with webforms as alot of model data was bound to controls programatically. But with MVC we are now using this syntax more oftern. </p>
<p>The issue I ... | [
{
"answer_id": 197641,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 5,
"selected": true,
"text": "<p>Consider something like this, instead:</p>\n\n<pre><code><% foreach(var Person in People) { \n Response.Write(Pe... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425/"
] | With ASP.NET's view engine/template aspx/ashx pages the way to spit to screen seems to be:
```
<%= Person.Name %>
```
Which was fine with webforms as alot of model data was bound to controls programatically. But with MVC we are now using this syntax more oftern.
The issue I have with it is quite trivial, but anno... | Consider something like this, instead:
```
<% foreach(var Person in People) {
Response.Write(Person.Name);
} %>
```
I believe that'll work. (Although I haven't tested it; I've only just begun with MVC and don't have the toolset here at the office.)
EDIT: I apparently missed the actual question ... :)
Microso... |
197,649 | <p>While working on SVG implementation for Internet Explorer to be based on its own VML format I came to a problem of translation of an SVG elliptical arc to an VML elliptical arc.</p>
<p>In VML an arc is given by: two angles for two points on ellipse and lengths of radiuses,
In SVG an arc is given by: two pairs of co... | [
{
"answer_id": 197664,
"author": "tzot",
"author_id": 6899,
"author_profile": "https://Stackoverflow.com/users/6899",
"pm_score": 2,
"selected": false,
"text": "<p>An ellipse cannot be defined by only two points. Even a circle (a special cased ellipse) is defined by three points.</p>\n\n... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23815/"
] | While working on SVG implementation for Internet Explorer to be based on its own VML format I came to a problem of translation of an SVG elliptical arc to an VML elliptical arc.
In VML an arc is given by: two angles for two points on ellipse and lengths of radiuses,
In SVG an arc is given by: two pairs of coordinates ... | So the solution is here:
The parametrized formula of an ellipse:
```
x = x0 + a * cos(t)
y = y0 + b * sin(t)
```
Let's put known coordinates of two points to it:
```
x1 = x0 + a * cos(t1)
x2 = x0 + a * cos(t2)
y1 = y0 + b * sin(t1)
y2 = y0 + b * sin(t2)
```
Now we have a system of equations with 4 variables: c... |
197,675 | <pre><code>Foo* set = new Foo[100];
// ...
delete [] set;
</code></pre>
<p>You don't pass the array's boundaries to <code>delete[]</code>. But where is that information stored? Is it standardised?</p>
| [
{
"answer_id": 197689,
"author": "jeffm",
"author_id": 1544,
"author_profile": "https://Stackoverflow.com/users/1544",
"pm_score": 2,
"selected": false,
"text": "<p>This isn't something that's in the spec -- it's implementation dependent.</p>\n"
},
{
"answer_id": 197698,
"aut... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4833/"
] | ```
Foo* set = new Foo[100];
// ...
delete [] set;
```
You don't pass the array's boundaries to `delete[]`. But where is that information stored? Is it standardised? | When you allocate memory on the heap, your allocator will keep track of how much memory you have allocated. This is usually stored in a "head" segment just before the memory that you get allocated. That way when it's time to free the memory, the de-allocator knows exactly how much memory to free. |
197,678 | <p>I want to do some checking in a writer accessor. My first idea was returning a boolean.</p>
<pre><code>class MyClass
def var=(var)
@var = var
# some checking
return true
end
end
m = MyClass.new
retval = (m.var = 'foo')
=> "foo"
</code></pre>
<p>Can I set a return value in a writer accessor? If... | [
{
"answer_id": 197704,
"author": "epochwolf",
"author_id": 16204,
"author_profile": "https://Stackoverflow.com/users/16204",
"pm_score": 3,
"selected": false,
"text": "<p>I would use set_var(var) instead of what you are trying to do, an attribute writer is assumed to just work. What you ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341/"
] | I want to do some checking in a writer accessor. My first idea was returning a boolean.
```
class MyClass
def var=(var)
@var = var
# some checking
return true
end
end
m = MyClass.new
retval = (m.var = 'foo')
=> "foo"
```
Can I set a return value in a writer accessor? If yes, how can I get this valu... | I would use set\_var(var) instead of what you are trying to do, an attribute writer is assumed to just work. What you are trying to do is nonstandard and non-obvious to the next poor person to use your code. (It may just be yourself) I would throw an exception if bad input is sent or something rather exceptional happen... |
197,712 | <pre><code>echo "<td><a href='delete.php?id=$row[id]&&category=$a' onclick='return confirm(\'are you sure you wish to delete this record\');'>delete</a></td>";
</code></pre>
<p>Above is the code I am trying to use. Every time it does nothing and I cannot see how I can use 'proper' JavaS... | [
{
"answer_id": 197723,
"author": "ceejayoz",
"author_id": 1902010,
"author_profile": "https://Stackoverflow.com/users/1902010",
"pm_score": 1,
"selected": false,
"text": "<pre><code>echo \"<td><a href='delete.php?id=$row[id]&&category=$a' onclick='return confirm(&quo... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
echo "<td><a href='delete.php?id=$row[id]&&category=$a' onclick='return confirm(\'are you sure you wish to delete this record\');'>delete</a></td>";
```
Above is the code I am trying to use. Every time it does nothing and I cannot see how I can use 'proper' JavaScript methods. What is the reason? | It is also a bad idea to use GET methods to change state - take a look at the guidelines on when to use GET and when to use POST ( <http://www.w3.org/2001/tag/doc/whenToUseGet.html#checklist> ) |
197,720 | <p>I am importing the CreateICeeFileGen() function from the unmanaged DLL mscorpe.dll in a C# application, in order to generate a PE file. This function returns a pointer to an C++ object <a href="http://msdn.microsoft.com/en-us/library/ms404463.aspx" rel="nofollow noreferrer">defined here</a>, is there any way I can ... | [
{
"answer_id": 197736,
"author": "Rob Walker",
"author_id": 3631,
"author_profile": "https://Stackoverflow.com/users/3631",
"pm_score": 3,
"selected": true,
"text": "<p>You need a wrapper library to be able to use the class from C#. </p>\n\n<p>The best bet would be to create the wrapper... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3394/"
] | I am importing the CreateICeeFileGen() function from the unmanaged DLL mscorpe.dll in a C# application, in order to generate a PE file. This function returns a pointer to an C++ object [defined here](http://msdn.microsoft.com/en-us/library/ms404463.aspx), is there any way I can access fields from this class via C# or d... | You need a wrapper library to be able to use the class from C#.
The best bet would be to create the wrapper using C++/CLI, which can directly call the unmanaged function and expose the details with a managed class. This will eliminate the need to use P/Invoke for anything.
(Well, technically if you know the class la... |
197,725 | <p>I'm writing an winforms app that needs to set internet explorer's proxy settings and then open a new browser window. At the moment, I'm applying the proxy settings by going into the registry:</p>
<pre><code>RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Interne... | [
{
"answer_id": 197985,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 3,
"selected": false,
"text": "<p>Check out this KB article specifically tagged at what you're trying to do. </p>\n\n<p><a href=\"http://support.micros... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17623/"
] | I'm writing an winforms app that needs to set internet explorer's proxy settings and then open a new browser window. At the moment, I'm applying the proxy settings by going into the registry:
```
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", t... | This depends somewhat on your exact needs. If you are writing a C# app and simply want to set the default proxy settings that your app will use, use the class System.Net.GlobalProxySelection (<http://msdn.microsoft.com/en-us/library/system.net.globalproxyselection.aspx>). You can also set the proxy for any particular c... |
197,747 | <p>I want to create a new row in my database on a table that has a couple of foreign key relationships and I haven't been able to get a handle on what order and what calls need to be made. This is what I have so far:</p>
<pre><code>db.Models.Order order = DB.Models.Order.CreateOrder( apple );
order.CustomerReference.A... | [
{
"answer_id": 197842,
"author": "Jared",
"author_id": 24841,
"author_profile": "https://Stackoverflow.com/users/24841",
"pm_score": 4,
"selected": true,
"text": "<p><em>(Thanks John for the grammar fixes)</em></p>\n\n<p>So I figured it out. This is what you have to do:</p>\n\n<pre><code... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24841/"
] | I want to create a new row in my database on a table that has a couple of foreign key relationships and I haven't been able to get a handle on what order and what calls need to be made. This is what I have so far:
```
db.Models.Order order = DB.Models.Order.CreateOrder( apple );
order.CustomerReference.Attach( ( from ... | *(Thanks John for the grammar fixes)*
So I figured it out. This is what you have to do:
```
db.Models.Order order = DB.Models.Order.CreateOrder( apple );
order.Customer = (from c in db.Customer where c.Id == custId select c).First();
db.SaveChanges();
```
I hope that helps people. |
197,748 | <p>Anyone know a simple method to swap the background color of a webpage using JavaScript?</p>
| [
{
"answer_id": 197761,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 9,
"selected": true,
"text": "<p>Modify the JavaScript property <code>document.body.style.background</code>.</p>\n\n<p>For example:</p>\n\n<pre><code>functio... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | Anyone know a simple method to swap the background color of a webpage using JavaScript? | Modify the JavaScript property `document.body.style.background`.
For example:
```
function changeBackground(color) {
document.body.style.background = color;
}
window.addEventListener("load",function() { changeBackground('red') });
```
Note: this does depend a bit on how your page is put together, for example if... |
197,753 | <p>I have 2 classes with a LINQ association between them i.e.:</p>
<pre><code>Table1: Table2:
ID ID
Name Description
ForiegnID
</code></pre>
<p>The association here is between <strong>Table1.ID -> Table2.ForiegnID</strong></p>
<p>I need to be able to change the value of Table2... | [
{
"answer_id": 197814,
"author": "Zote",
"author_id": 20683,
"author_profile": "https://Stackoverflow.com/users/20683",
"pm_score": 0,
"selected": false,
"text": "<p>You wanna to associate with another record in table1 or change table1.id?\nif it's option 1, you need to remove that assoc... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11989/"
] | I have 2 classes with a LINQ association between them i.e.:
```
Table1: Table2:
ID ID
Name Description
ForiegnID
```
The association here is between **Table1.ID -> Table2.ForiegnID**
I need to be able to change the value of Table2.ForiegnID, however I can't and think it is be... | Check out the designer.cs file. This is the key's property
```
[Column(Storage="_ParentKey", DbType="Int")]
public System.Nullable<int> ParentKey
{
get
{
return this._ParentKey;
}
set
{
if ((this._ParentKey != value))
{
//This code is added by the association
... |
197,757 | <p>I was trying to understand something with pointers, so I wrote this code:</p>
<pre><code>#include <stdio.h>
int main(void)
{
char s[] = "asd";
char **p = &s;
printf("The value of s is: %p\n", s);
printf("The direction of s is: %p\n", &s);
printf("The value of p is: %p\n", p);
... | [
{
"answer_id": 197768,
"author": "selwyn",
"author_id": 16314,
"author_profile": "https://Stackoverflow.com/users/16314",
"pm_score": 0,
"selected": false,
"text": "<p>You have used:</p>\n\n<pre><code>char s[] = \"asd\";\n</code></pre>\n\n<p>Here s actually points to the bytes \"asd\". ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27267/"
] | I was trying to understand something with pointers, so I wrote this code:
```
#include <stdio.h>
int main(void)
{
char s[] = "asd";
char **p = &s;
printf("The value of s is: %p\n", s);
printf("The direction of s is: %p\n", &s);
printf("The value of p is: %p\n", p);
printf("The direction of p... | "s" is not a "char\*", it's a "char[4]". And so, "&s" is not a "char\*\*", but actually "a pointer to an array of 4 characater". Your compiler may treat "&s" as if you had written "&s[0]", which is roughly the same thing, but is a "char\*".
When you write "char\*\* p = &s" you are trying to say "I want p to be set to ... |
197,758 | <p>I have a bunch of XML that has lines that look like this</p>
<pre><code><_char font_name="/ITC Stone Serif Std Bold" italic="true" />
</code></pre>
<p>but sometimes look like this</p>
<pre><code><_char font_size="88175" italic="true" font_name="/ITC Stone Serif Std Bold" />
</code></pre>
<p>Here's wh... | [
{
"answer_id": 197804,
"author": "zigdon",
"author_id": 4913,
"author_profile": "https://Stackoverflow.com/users/4913",
"pm_score": 1,
"selected": false,
"text": "<p>Well, in general, using RE for XML parsing isn't a great idea. But if you really wanted, the easiest way would be to just... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305/"
] | I have a bunch of XML that has lines that look like this
```
<_char font_name="/ITC Stone Serif Std Bold" italic="true" />
```
but sometimes look like this
```
<_char font_size="88175" italic="true" font_name="/ITC Stone Serif Std Bold" />
```
Here's what I need to do
* Replace **italic="true"** with **italic="f... | Does the simple use of '|' operator satisfy you ?
```
name="/ITC Stone Sans Std Bold"[^>]italic="(true)"|italic="(true)"[^>]font_name="/ITC Stone Serif Std Bold"
```
That should detect any line with the attribute name before of after attribute italic with value true. |
197,759 | <p>I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me. </p>
<p>I'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My problem is with the strings, as they... | [
{
"answer_id": 197786,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 2,
"selected": false,
"text": "<p>I would write a codec that incrementally scanned the string and decoded the bytes as they came along. Essentially, ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27059/"
] | I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me.
I'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My problem is with the strings, as they include m... | There's no built-in functionality for decoding a string like this, since it is really its own custom codec. You simply need to split up the string on those control characters and decode it accordingly.
Here's a (very slow) example of such a function that handles latin1 and shift-JIS:
```
latin1 = "latin-1"
japanese =... |
197,793 | <p>I'm building my first flex app and am currently bussy splitting it up in multiple components to make it maintainable.
I have a screen which holds a list that is displayed and filled after a succesfull login attempt:</p>
<p>Part of the main app:</p>
<pre><code><mx:ViewStack id="vsAdmin" height="100%" width="100%... | [
{
"answer_id": 198034,
"author": "Brandon",
"author_id": 23133,
"author_profile": "https://Stackoverflow.com/users/23133",
"pm_score": 1,
"selected": false,
"text": "<p>I would make sure the component exists that you are calling before calling the next function. This could be done by for... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21238/"
] | I'm building my first flex app and am currently bussy splitting it up in multiple components to make it maintainable.
I have a screen which holds a list that is displayed and filled after a succesfull login attempt:
Part of the main app:
```
<mx:ViewStack id="vsAdmin" height="100%" width="100%">
<mx:TabNavigator i... | I would make sure the component exists that you are calling before calling the next function. This could be done by forcing creationPolicy=all as you figured out. You could also add an event listener for the CreationComplete to call the function you want:
```
private function doThisFirst():void{
mainViewstack.... |
197,802 | <p>I have an Access DB that I would like to extract the source code from so I can put it into Source control. </p>
<p>I have tried to extract the data using the Primary Interop Assemblies(PIA), but I am getting issues as it is not picking up all of the modules and forms. </p>
<p>There are 140 Forms and Modules in the... | [
{
"answer_id": 197825,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 1,
"selected": false,
"text": "<p>There is a better way. You can use Visual Sourcesafe (and possibly other SCCs) to version control code and objects ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2806/"
] | I have an Access DB that I would like to extract the source code from so I can put it into Source control.
I have tried to extract the data using the Primary Interop Assemblies(PIA), but I am getting issues as it is not picking up all of the modules and forms.
There are 140 Forms and Modules in the code(Don't ask, ... | There is a better way. You can use Visual Sourcesafe (and possibly other SCCs) to version control code and objects in place: see this [MSDN article](http://msdn.microsoft.com/en-us/library/ms181088(VS.80).aspx) |
197,834 | <p>In particular from this web.config:</p>
<pre><code><configuration>
<configSections>
<section name="RStrace" type="Microsoft.ReportingServices.Diagnostics.RSTraceSectionHandler,Microsoft.ReportingServices.Diagnostics" />
</configSections>
<system.diagnostics>
<switches&... | [
{
"answer_id": 197906,
"author": "Dean Hill",
"author_id": 3106,
"author_profile": "https://Stackoverflow.com/users/3106",
"pm_score": 1,
"selected": false,
"text": "<p>You get this error when you are missing an entry in the configSections area. In the above example, you probably need t... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11604/"
] | In particular from this web.config:
```
<configuration>
<configSections>
<section name="RStrace" type="Microsoft.ReportingServices.Diagnostics.RSTraceSectionHandler,Microsoft.ReportingServices.Diagnostics" />
</configSections>
<system.diagnostics>
<switches>
<add name="DefaultTraceSwitch" value="3"... | It looks like .NET was installed using a corporate re-packaging technology and not all the bits were there. We installed from the original Microsoft image and all is fine. |
197,839 | <p>This question was inspired by a similar question: <a href="https://stackoverflow.com/questions/197675/how-does-delete-know-the-size-of-the-operand-array">How does delete[] “know” the size of the operand array?</a></p>
<p>My question is a little different: <strong>Is there any way to determine the size of a C++ arr... | [
{
"answer_id": 197857,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 3,
"selected": false,
"text": "<p>Common way to handle this is to either use a vector</p>\n\n<pre><code>int main()\n{\n std::vector<int> v(256);\n ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18511/"
] | This question was inspired by a similar question: [How does delete[] “know” the size of the operand array?](https://stackoverflow.com/questions/197675/how-does-delete-know-the-size-of-the-operand-array)
My question is a little different: **Is there any way to determine the size of a C++ array programmatically? And if ... | `delete []` does know the size that was allocated. However, that knowledge resides in the runtime or in the operating system's memory manager, meaning that it is not available to the compiler during compilation. And `sizeof()` is not a real function, it is actually evaluated to a constant by the compiler, which is some... |
197,845 | <p>I'm trying to show/hide a movieclip (or graphic) symbol that is on a layer of a button symbol using actionscript 2. Here's what I tried</p>
<p>in the actions for the button:</p>
<pre><code>on (release) {
this.button_name.movieclip_name._alpha = 0;
trace(this.button_name.movieclip_name);
}
</code></pre>
<p>and t... | [
{
"answer_id": 198043,
"author": "Jiaaro",
"author_id": 2908,
"author_profile": "https://Stackoverflow.com/users/2908",
"pm_score": 0,
"selected": false,
"text": "<p>found: <a href=\"http://www.actionscript.org/forums/archive/index.php3/t-99018.html\" rel=\"nofollow noreferrer\">this</a>... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2908/"
] | I'm trying to show/hide a movieclip (or graphic) symbol that is on a layer of a button symbol using actionscript 2. Here's what I tried
in the actions for the button:
```
on (release) {
this.button_name.movieclip_name._alpha = 0;
trace(this.button_name.movieclip_name);
}
```
and the trace returns ***undefined***.... | For AS2, it's not a good idea to put MovieClips inside buttons. The easiest and most direct approach is to restructure things so that your button and the movieclip you had inside it are at the same level, perhaps within a new MC created to contain them. You should think of the Button symbol as a thing that only provide... |
197,855 | <p>I have 2 columns in a Grid. When I click a button, I want the first column to animate to the left from it's current position to 0. So, in effect, it collapses and I'm left with just viewing a single column.</p>
| [
{
"answer_id": 197935,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "<p>Shouldn't be too hard. You'd need to create an EventTrigger that has a BeginStoryboard that targets the grid and uses a Do... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3047/"
] | I have 2 columns in a Grid. When I click a button, I want the first column to animate to the left from it's current position to 0. So, in effect, it collapses and I'm left with just viewing a single column. | Shouldn't be too hard. You'd need to create an EventTrigger that has a BeginStoryboard that targets the grid and uses a DoubleAnimation to shrink the column width. [The example here has a similar setup.](http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimation.aspx) The EventTrigger would ... |
197,864 | <p>OK, so instead of writing a whole bunch of access control specs, and duplicating them across many of my spec files, I'm looking to create a custom matcher. So instead of this:</p>
<pre><code>describe "access control" do
it "should prevent access by non-logged-in users"
it "should prevent access by normal users"... | [
{
"answer_id": 200595,
"author": "Codebeef",
"author_id": 12037,
"author_profile": "https://Stackoverflow.com/users/12037",
"pm_score": 3,
"selected": true,
"text": "<p>OK, <a href=\"http://matthall.wordpress.com/2008/10/14/a-helper-for-testing-access-control-with-rspec/\" rel=\"nofollow... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12037/"
] | OK, so instead of writing a whole bunch of access control specs, and duplicating them across many of my spec files, I'm looking to create a custom matcher. So instead of this:
```
describe "access control" do
it "should prevent access by non-logged-in users"
it "should prevent access by normal users"
it "should ... | OK, [I have found a method of achieving this](http://matthall.wordpress.com/2008/10/14/a-helper-for-testing-access-control-with-rspec/), though it doesn't use a custom matcher. Include the following code in your spec\_helper.rb:
```
def access_control (code, options={})
options = {:allow => [], :disallow => []}.merg... |
197,867 | <p>I'm running into a mental roadblock here and I'm hoping that I'm missing something obvious.</p>
<p>Anyway, assume I have a table that looks like this:</p>
<pre>
ID LookupValue SortOrder
============================================
1 A 1000
2 B ... | [
{
"answer_id": 197930,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 3,
"selected": true,
"text": "<p>Key is a string.</p>\n\n<p>Key.Count counts the characters in the string.</p>\n\n<hr>\n\n<p>Change the select to include the... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108/"
] | I'm running into a mental roadblock here and I'm hoping that I'm missing something obvious.
Anyway, assume I have a table that looks like this:
```
ID LookupValue SortOrder
============================================
1 A 1000
2 B 2000
3 ... | Key is a string.
Key.Count counts the characters in the string.
---
Change the select to include the group
```
Select Key, SortOrder, Group
```
and change the where clause to count the group
```
KeySortPairs.Where(Function(t) t.Group.Count() > 1)
```
Alternatively, counting the group might be overkill. "Any" c... |
197,876 | <p>How do I uninstall a .NET Windows Service if the service files do not exist anymore?</p>
<p>I installed a .NET Windows Service using InstallUtil. I have since deleted the files but forgot to run</p>
<pre><code> InstallUtil /u
</code></pre>
<p>first, so the service is still listed in the Services MMC.</p>
<p>Do I hav... | [
{
"answer_id": 197885,
"author": "Dean Hill",
"author_id": 3106,
"author_profile": "https://Stackoverflow.com/users/3106",
"pm_score": 7,
"selected": false,
"text": "<p>From the command prompt, use the Windows "sc.exe" utility. You will run something like this:</p>\n<pre><code... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8547/"
] | How do I uninstall a .NET Windows Service if the service files do not exist anymore?
I installed a .NET Windows Service using InstallUtil. I have since deleted the files but forgot to run
```
InstallUtil /u
```
first, so the service is still listed in the Services MMC.
Do I have to go into the registry? Or is the... | You have at least three options. I have presented them in order of usage preference.
**Method 1** - You can use the [SC tool](http://support.microsoft.com/kb/251192) (Sc.exe) included in the Resource Kit.
(included with Windows 7/8)
Open a Command Prompt and enter
```
sc delete <service-name>
```
Tool help snippe... |
197,893 | <p>A curious thing happens in Java when you use an abstract class to implement an interface: some of the interface's methods can be completely missing (i.e. neither an abstract declaration or an actual implementation is present), but the compiler does not complain.</p>
<p>For example, given the interface:</p>
<pre><c... | [
{
"answer_id": 197902,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 7,
"selected": false,
"text": "<p>That's because if a class is abstract, then by definition you are required to create subclasses of it to instanti... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22904/"
] | A curious thing happens in Java when you use an abstract class to implement an interface: some of the interface's methods can be completely missing (i.e. neither an abstract declaration or an actual implementation is present), but the compiler does not complain.
For example, given the interface:
```
public interface ... | That's because if a class is abstract, then by definition you are required to create subclasses of it to instantiate. The subclasses will be required (by the compiler) to implement any interface methods that the abstract class left out.
Following your example code, try making a subclass of `AbstractThing` without impl... |
197,904 | <p>I'm in a Microsoft IE environment, but I want to use cygwin for a number of quick scripting tasks.</p>
<p>How would I configure it to use my windows proxy information? Ruby gems, ping, etc are all trying to make direct connections. How can I get them to respect the proxy information that IE and firefox use?</p>
| [
{
"answer_id": 197934,
"author": "Steve Moyer",
"author_id": 17008,
"author_profile": "https://Stackoverflow.com/users/17008",
"pm_score": 3,
"selected": false,
"text": "<p>I doubt that your corporate firewall allows PING, but the others all appear to be one form of http or another. On ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13774/"
] | I'm in a Microsoft IE environment, but I want to use cygwin for a number of quick scripting tasks.
How would I configure it to use my windows proxy information? Ruby gems, ping, etc are all trying to make direct connections. How can I get them to respect the proxy information that IE and firefox use? | Just for the records if you need to authenticate to the Proxy use:
```
export http_proxy=http://username:password@host:port/
```
Taken from: <http://samueldotj.blogspot.com/2008/06/configuring-cygwin-to-use-proxy-server.html> |
197,929 | <p>What do you think of this kind of code-to-files-mapping?</p>
<pre><code>~/proj/MyClass.ext
~/proj/MyClass:constructors.ext
~/proj/MyClass:properties.ext
~/proj/MyClass:method-one.ext
~/proj/MyClass:method-two:int.ext
~/proj/MyClass:method-two:string.ext
</code></pre>
<p>In a language which is more function... | [
{
"answer_id": 197950,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 0,
"selected": false,
"text": "<p>Personally I would find that that type of separation, although possible in some languages, would be a nightmare... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25167/"
] | What do you think of this kind of code-to-files-mapping?
```
~/proj/MyClass.ext
~/proj/MyClass:constructors.ext
~/proj/MyClass:properties.ext
~/proj/MyClass:method-one.ext
~/proj/MyClass:method-two:int.ext
~/proj/MyClass:method-two:string.ext
```
In a language which is more functional-oriented:
```
~/proj/d... | Perhaps the better question to ask in response is: What is the problem you would hope to solve with this approach?
The .NET languages support some level of this idea with partial classes, although I've never seen it carried to that extreme and the editing experience is not as seamless as you describe in your "perfect ... |
197,933 | <p>Ideally, something cross-platform.</p>
| [
{
"answer_id": 197953,
"author": "zigdon",
"author_id": 4913,
"author_profile": "https://Stackoverflow.com/users/4913",
"pm_score": 5,
"selected": true,
"text": "<p>The CPAN is probably the best way to go. Take a look at <a href=\"http://search.cpan.org/~tpaba/Term-Screen-Uni-0.04/lib/T... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7598/"
] | Ideally, something cross-platform. | The CPAN is probably the best way to go. Take a look at [Term::Screen:Uni](http://search.cpan.org/~tpaba/Term-Screen-Uni-0.04/lib/Term/Screen/Uni.pm):
```
require Term::Screen::Uni;
my $scr = new Term::Screen::Uni;
$scr->clrscr()
``` |
197,939 | <p>I have implemented what I thought was a pretty decent representation of MVC in several web applications but since having joined crackoverflow, I'm finding that perhaps my initial definitions were a bit simplistic and thus I'd really like some clarification on the differences between the Data Access Layer and the Mod... | [
{
"answer_id": 198032,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 6,
"selected": true,
"text": "<p>The <strong>model</strong> classes stand alone as a good, clean, high-fidelity model of real-world entities. If it's a b... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20178/"
] | I have implemented what I thought was a pretty decent representation of MVC in several web applications but since having joined crackoverflow, I'm finding that perhaps my initial definitions were a bit simplistic and thus I'd really like some clarification on the differences between the Data Access Layer and the Model ... | The **model** classes stand alone as a good, clean, high-fidelity model of real-world entities. If it's a business domain, they might be customers, plans, products, payments, all that kind of stuff. Your application works with these classes. The idea is that your application is a model of real-world handling of the dom... |
197,940 | <p>I can't seem to find an easy to use, .net native way to get Comboboxes on .net winforms to display one value and return another based on the selection without creating my own helper class, with the knowledge that winforms is going to display the ToString method on the object that you put in it.</p>
<p>This is how I... | [
{
"answer_id": 197966,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 1,
"selected": false,
"text": "<p>For lack of better understanding about your application architecture, you're probably taking a good approach.</p>\n\n... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15769/"
] | I can't seem to find an easy to use, .net native way to get Comboboxes on .net winforms to display one value and return another based on the selection without creating my own helper class, with the knowledge that winforms is going to display the ToString method on the object that you put in it.
This is how I'm doing i... | This is a bit of a hack, but it means you don't have to write your own Name-Value pair class - not a big deal (could be there's something better already in the framework). But what you could do is use the DictionaryEntry class - which is effectively a name value pair. Add the items to a list, then use the DataMember an... |
197,948 | <p>I'm using GDI+ in a C++/MFC application and I just can't seem to avoid flickering whenever the window is resized.</p>
<p>I have already tried these steps:</p>
<ul>
<li>returned TRUE on <code>OnEraseBkGnd()</code>;</li>
<li>returned NULL on <code>OnCtlColor()</code>;</li>
<li>used double buffering according to this... | [
{
"answer_id": 198068,
"author": "Mark Ransom",
"author_id": 5987,
"author_profile": "https://Stackoverflow.com/users/5987",
"pm_score": 2,
"selected": false,
"text": "<p>You might try using old-fashioned GDI rather than GDI+ to write to the DC, especially since you're already buffering ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4880/"
] | I'm using GDI+ in a C++/MFC application and I just can't seem to avoid flickering whenever the window is resized.
I have already tried these steps:
* returned TRUE on `OnEraseBkGnd()`;
* returned NULL on `OnCtlColor()`;
* used double buffering according to this code:
```
void vwView::OnDraw(CDC* pDC)
{
CRect rcC... | To completely avoid flicker, you would need to complete *all* drawing in the interval between screen updates. Windows does not provide any easy means of accomplishing this for normal window painting (Vista provides composite drawing via the [DWM](https://en.wikipedia.org/wiki/Desktop_Window_Manager), but this cannot be... |
197,951 | <p>I have a need to work with Windows executables which are made for x86, x64, and IA64. I'd like to programmatically figure out the platform by examining the files themselves.</p>
<p>My target language is PowerShell but a C# example will do. Failing either of those, if you know the logic required that would be great... | [
{
"answer_id": 197974,
"author": "Sec",
"author_id": 20555,
"author_profile": "https://Stackoverflow.com/users/20555",
"pm_score": 0,
"selected": false,
"text": "<p>Unix OS have a utility called \"file\" which identifies files. The rules for identifying are kept in a description file cal... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6637/"
] | I have a need to work with Windows executables which are made for x86, x64, and IA64. I'd like to programmatically figure out the platform by examining the files themselves.
My target language is PowerShell but a C# example will do. Failing either of those, if you know the logic required that would be great. | (from another Q, since removed)
Machine type: This is a quick little bit of code I based on some that gets the linker timestamp. This is in the same header, and it seems to work - it returns I386 when compiled -any cpu-, and x64 when compiled with that as the target platform.
The Exploring PE Headers (K. Stanton,MSDN... |
197,957 | <p>Hoi!</p>
<p>I have a form I wish to submit, but I need to add the PHPSESSID, because some clients allow no cookies.</p>
<p>There are several javascript functions on my page which displays a list of users (search, sort, open details), the page is generated by PHP.</p>
<p>Now I am looking for an elegant way to have... | [
{
"answer_id": 197974,
"author": "Sec",
"author_id": 20555,
"author_profile": "https://Stackoverflow.com/users/20555",
"pm_score": 0,
"selected": false,
"text": "<p>Unix OS have a utility called \"file\" which identifies files. The rules for identifying are kept in a description file cal... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371953/"
] | Hoi!
I have a form I wish to submit, but I need to add the PHPSESSID, because some clients allow no cookies.
There are several javascript functions on my page which displays a list of users (search, sort, open details), the page is generated by PHP.
Now I am looking for an elegant way to have the PHPSESSID included ... | (from another Q, since removed)
Machine type: This is a quick little bit of code I based on some that gets the linker timestamp. This is in the same header, and it seems to work - it returns I386 when compiled -any cpu-, and x64 when compiled with that as the target platform.
The Exploring PE Headers (K. Stanton,MSDN... |
197,976 | <p>I'm trying to write a Windows cmd script to perform several tasks in series.
However, it always stops after the first command in the script.</p>
<p>The command it stops after is a maven build (not sure if that's relevant).</p>
<p>How do I make it carry on and run each task in turn please?</p>
<p>Installing any so... | [
{
"answer_id": 197997,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 8,
"selected": true,
"text": "<p>When you call another .bat file, I think you need \"call\" in front of the call:</p>\n\n<pre><code>call otherCommand.ba... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151/"
] | I'm trying to write a Windows cmd script to perform several tasks in series.
However, it always stops after the first command in the script.
The command it stops after is a maven build (not sure if that's relevant).
How do I make it carry on and run each task in turn please?
Installing any software or configuring th... | When you call another .bat file, I think you need "call" in front of the call:
```
call otherCommand.bat
``` |
197,986 | <p>For example:</p>
<pre><code>javac Foo.java
Note: Foo.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
</code></pre>
| [
{
"answer_id": 197993,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 10,
"selected": true,
"text": "<p>This comes up in Java 5 and later if you're using collections without type specifiers (e.g., <code>Arraylist()</c... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23987/"
] | For example:
```
javac Foo.java
Note: Foo.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
``` | This comes up in Java 5 and later if you're using collections without type specifiers (e.g., `Arraylist()` instead of `ArrayList<String>()`). It means that the compiler can't check that you're using the collection in a type-safe way, using [generics](http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html).
T... |
197,987 | <p>I have a main frame with a splitter. On the left I have my (imaginatively named) CAppView_Leftand on the right I have CAppView_Right_1and CAppView_Right_2. Through the following code I initialise the two primary views correctly:</p>
<pre><code>if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to Cre... | [
{
"answer_id": 198142,
"author": "SmacL",
"author_id": 22564,
"author_profile": "https://Stackoverflow.com/users/22564",
"pm_score": 0,
"selected": false,
"text": "<p>You can't create a second right hand view because your </p>\n\n<pre><code>m_wndSplitter.CreateStatic(this, 1, 2) \n</code... | 2008/10/13 | [
"https://Stackoverflow.com/questions/197987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | I have a main frame with a splitter. On the left I have my (imaginatively named) CAppView\_Leftand on the right I have CAppView\_Right\_1and CAppView\_Right\_2. Through the following code I initialise the two primary views correctly:
```
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStatic... | There is a CodeProject article that should help you achieve what you want:
<http://www.codeproject.com/KB/splitter/usefulsplitter.aspx>
I have replaced views in a splitter before, so if the above doesn't help I'll post some of my own code. |
198,006 | <p>I need a way to do key-value lookups across (potentially) hundreds of GB of data. Ideally something based on a distributed hashtable, that works nicely with Java. It should be fault-tolerant, and open source.</p>
<p>The store should be persistent, but would ideally cache data in memory to speed things up.</p>
<p... | [
{
"answer_id": 198017,
"author": "carson",
"author_id": 25343,
"author_profile": "https://Stackoverflow.com/users/25343",
"pm_score": 1,
"selected": false,
"text": "<p>You should probably specify if it needs to be persistent or not, in memory or not, etc. You could try: <a href=\"http://... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16050/"
] | I need a way to do key-value lookups across (potentially) hundreds of GB of data. Ideally something based on a distributed hashtable, that works nicely with Java. It should be fault-tolerant, and open source.
The store should be persistent, but would ideally cache data in memory to speed things up.
It should be able ... | You might want to check out [Hazelcast](http://www.hazelcast.com). It is distributed/partitioned, super lite, easy and free.
```
java.util.Map map = Hazelcast.getMap ("mymap");
map.put ("key1", "value1");
```
Regards,
-talip |
198,007 | <p>I'm using the PHP function imagettftext() to convert text into a GIF image. The text I am converting has Unicode characters including Japanese. Everything works fine on my local machine (Ubuntu 7.10), but on my webhost server, the Japanese characters are mangled. What could be causing the difference? Everything shou... | [
{
"answer_id": 198054,
"author": "Treb",
"author_id": 22114,
"author_profile": "https://Stackoverflow.com/users/22114",
"pm_score": 0,
"selected": false,
"text": "<p>My prime suspect is the font you are using for rendering.</p>\n\n<p>According to <a href=\"http://fr3.php.net/imagettftext... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27478/"
] | I'm using the PHP function imagettftext() to convert text into a GIF image. The text I am converting has Unicode characters including Japanese. Everything works fine on my local machine (Ubuntu 7.10), but on my webhost server, the Japanese characters are mangled. What could be causing the difference? Everything should ... | Here's the solution that finally worked for me:
```
$text = "你好";
// Convert UTF-8 string to HTML entities
$text = mb_convert_encoding($text, 'HTML-ENTITIES',"UTF-8");
// Convert HTML entities into ISO-8859-1
$text = html_entity_decode($text,ENT_NOQUOTES, "ISO-8859-1");
// Convert characters > 127 into their hexidecim... |
198,024 | <p>How do I go about doing this with jQuery?</p>
<p>Basically the structure:</p>
<pre><code><form id="myForm">
<iframe>
<!-- Normal HTML headers omitted -->
<input type=radio name="myRadio" value=1>First
<input type=radio name="myRadio" value=2>Second
<input type=rad... | [
{
"answer_id": 198094,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": 5,
"selected": true,
"text": "<p>Try <code>$('#myForm iframe').contents().find('input[name=myradio]').val()</code></p>\n\n<p>I'll assume that the iframe ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15345/"
] | How do I go about doing this with jQuery?
Basically the structure:
```
<form id="myForm">
<iframe>
<!-- Normal HTML headers omitted -->
<input type=radio name="myRadio" value=1>First
<input type=radio name="myRadio" value=2>Second
<input type=radio name="myRadio" value=3>Third
</iframe>
<input t... | Try `$('#myForm iframe').contents().find('input[name=myradio]').val()`
I'll assume that the iframe contents have already been loaded and are accessible e.g same domain. |
198,041 | <p>Is there a way to tell the debugger to stop just before returning, on whichever statement exits from the method, be it return, exception, or fall out the bottom? I am inspired by the fact that the Java editor shows me all the places that my method <em>can</em> exit - it highlights them when you click on the return t... | [
{
"answer_id": 198072,
"author": "MBCook",
"author_id": 18189,
"author_profile": "https://Stackoverflow.com/users/18189",
"pm_score": 0,
"selected": false,
"text": "<p>Good question. Off the top of my head, I'd do this:</p>\n\n<pre><code>public void method(Object stuff) {\n try {\n ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14749/"
] | Is there a way to tell the debugger to stop just before returning, on whichever statement exits from the method, be it return, exception, or fall out the bottom? I am inspired by the fact that the Java editor shows me all the places that my method *can* exit - it highlights them when you click on the return type of the... | Put a breakpoint on the line of the method signature. That is where you write
```
public void myMethod() {
```
Then right-click on the breakpoint and select "Breakpoint Properties". At the bottom of the pop-up there are two checkboxes: "Method Entry", "Method Exit". Check the latter. |
198,045 | <p>I've got a spreadsheet with plenty of graphs in it and one sheet with loads of data feeding those graphs.</p>
<p>I've plotted the data on each graph using </p>
<pre><code>=Sheet1!$C5:$C$3000
</code></pre>
<p>This basically just plots the values in C5 to C3000 on a graph.</p>
<p>Regularly though I just want to lo... | [
{
"answer_id": 198118,
"author": "Dave DuPlantis",
"author_id": 8174,
"author_profile": "https://Stackoverflow.com/users/8174",
"pm_score": 1,
"selected": false,
"text": "<p>You can set the range for a chart dynamically in Excel. You can use something like the following VBA code to do it... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4014/"
] | I've got a spreadsheet with plenty of graphs in it and one sheet with loads of data feeding those graphs.
I've plotted the data on each graph using
```
=Sheet1!$C5:$C$3000
```
This basically just plots the values in C5 to C3000 on a graph.
Regularly though I just want to look at a subset of the data i.e. I might ... | OK, I had to do a little more research, here's how to make it work,
completely within the spreadsheet (without VBA):
Using A1 as the end of your desired range,
and the chart being on the same sheet as the data:
Name the first cell of the data (C5) as a named range, say TESTRANGE.
Created a named range MYDATA as t... |
198,049 | <p>So I made some timers for a quiz. The thing is, I just realized when I put </p>
<pre><code>javascript: alert("blah");
</code></pre>
<p>in the address, the popup alert box <strong>pauses</strong> my timer. Which is very unwanted in a quiz.</p>
<p>I don't think there is any way to stop this behaviour... but I'll as... | [
{
"answer_id": 198056,
"author": "Sergey Ilinsky",
"author_id": 23815,
"author_profile": "https://Stackoverflow.com/users/23815",
"pm_score": 3,
"selected": false,
"text": "<p>No, there is no way to prevent alert from stopping the single thread in JavaScript. Probably you can use some ot... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15345/"
] | So I made some timers for a quiz. The thing is, I just realized when I put
```
javascript: alert("blah");
```
in the address, the popup alert box **pauses** my timer. Which is very unwanted in a quiz.
I don't think there is any way to stop this behaviour... but I'll ask anyway.
If there is not, mind suggesting wh... | Apparently the preview rendering differs from the posted rendering. This paragraph is here to make sure the next two lines show up as code.
```
// Preserve native alert() if you need it for something special
window.nativeAlert = window.alert;
window.alert = function(msg) {
// Do something with msg here. I always ... |
198,051 | <p>I was always wondering if there is operator for deleting multi dimensional arrays in the standard C++ language.</p>
<p>If we have created a pointer to a single dimensional array</p>
<pre><code>int *array = new int[size];
</code></pre>
<p>the delete looks like:</p>
<pre><code>delete [] array;
</code></pre>
<p>Th... | [
{
"answer_id": 198059,
"author": "Dan Hewett",
"author_id": 17975,
"author_profile": "https://Stackoverflow.com/users/17975",
"pm_score": 0,
"selected": false,
"text": "<p>delete[] applies to any non-scalar (array).</p>\n"
},
{
"answer_id": 198064,
"author": "shsteimer",
... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446104/"
] | I was always wondering if there is operator for deleting multi dimensional arrays in the standard C++ language.
If we have created a pointer to a single dimensional array
```
int *array = new int[size];
```
the delete looks like:
```
delete [] array;
```
That's great. But if we have two dimension array, we can n... | Technically, there aren't two dimensional arrays in C++. What you're using as a two dimensional array is a one dimensional array with each element being a one dimensional array. Since it doesn't technically exist, C++ can't delete it. |
198,058 | <p>I'd like to show a div that has a background-color with the height and width set to 100% but no content. Is it possible to do that without putting a &nbsp; inside?</p>
<p>Edit: Thanks to Mark Biek for pointing out that empty div with width and height styles shows how I'd expect. My div is in a table cell, where... | [
{
"answer_id": 198083,
"author": "Mark Biek",
"author_id": 305,
"author_profile": "https://Stackoverflow.com/users/305",
"pm_score": 4,
"selected": true,
"text": "<p>This seems to work in Firefox, Safari, IE6, & IE7.</p>\n\n<pre><code><html>\n <head>\n <style... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23427/"
] | I'd like to show a div that has a background-color with the height and width set to 100% but no content. Is it possible to do that without putting a inside?
Edit: Thanks to Mark Biek for pointing out that empty div with width and height styles shows how I'd expect. My div is in a table cell, where it does not s... | This seems to work in Firefox, Safari, IE6, & IE7.
```
<html>
<head>
<style>
#foo{
background: #ff0000;
width: 100%;
height: 100%;
border: 2px dashed black;
}
</style>
</head>
<body onload="">
... |
198,071 | <p>Greetings!</p>
<p>I am trying to check directory write-permissions from within a Windows MFC/ATL program using C++. My first guess is to use the C-standard _access function, e.g.:</p>
<pre><code>if (_access("C:\mydir", 2) == -1)
// Directory is not writable.
</code></pre>
<p>But apparently on Windows 2000 and ... | [
{
"answer_id": 198092,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Use sec api.\nYou can ask on Adv. Win32 api newsgroup :\nnews://194.177.96.26/comp.os.ms-windows.programmer.win32\nwhere it... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27493/"
] | Greetings!
I am trying to check directory write-permissions from within a Windows MFC/ATL program using C++. My first guess is to use the C-standard \_access function, e.g.:
```
if (_access("C:\mydir", 2) == -1)
// Directory is not writable.
```
But apparently on Windows 2000 and XP, \_access can't determine dir... | You can call CreateFile with GENERIC\_WRITE access to check this.
<http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx>
It's not a C++ library but it still counts as elegant because it directly does what you want... |
198,082 | <p>How to find out size of session in ASP.NET from web application?</p>
| [
{
"answer_id": 198158,
"author": "Rafe",
"author_id": 27497,
"author_profile": "https://Stackoverflow.com/users/27497",
"pm_score": 0,
"selected": false,
"text": "<p>I think you can find that information by adding <strong>Trace=\"true\"</strong> to the page directive of a aspx page. Then... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23280/"
] | How to find out size of session in ASP.NET from web application? | If you're trying to get the size of Session during runtime rather than in debug tracing, you might want to try something like this:
```
long totalSessionBytes = 0;
BinaryFormatter b = new BinaryFormatter();
MemoryStream m;
foreach(var obj in Session)
{
m = new MemoryStream();
b.Serialize(m, obj);
totalSessionBy... |
198,087 | <p>
We recently switched our Windows software packages from RPM (cygwin) to MSI (wix). Having a native packaging is a much welcome change and we intend to stick with it. However, MSI feels overly complicated for what it does and doesn't seem to provide some basic abilities. But I'm probably mistaken.
</p>
<p>
Is there ... | [
{
"answer_id": 198130,
"author": "Node",
"author_id": 7190,
"author_profile": "https://Stackoverflow.com/users/7190",
"pm_score": 5,
"selected": true,
"text": "<p>Mabybe <a href=\"http://msdn.microsoft.com/en-us/library/aa394378(VS.85).aspx\" rel=\"noreferrer\">this</a> is a good startin... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11892/"
] | We recently switched our Windows software packages from RPM (cygwin) to MSI (wix). Having a native packaging is a much welcome change and we intend to stick with it. However, MSI feels overly complicated for what it does and doesn't seem to provide some basic abilities. But I'm probably mistaken.
Is there a way to lis... | Mabybe [this](http://msdn.microsoft.com/en-us/library/aa394378(VS.85).aspx) is a good starting point for you example VB Script from MSDN:
```
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & _
strComputer & _
"\root\cimv2")
Set colSoftware = objWMISe... |
198,114 | <p>To do an unattended installation of any MSI package, one can simply use the following command:</p>
<pre><code>msiexec /qn /i package.msi
</code></pre>
<p>However, this triggers an asynchronous installation: if you happen to chain 2 dependent installations, you will have to wait somehow for the 1st installation to ... | [
{
"answer_id": 198121,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 2,
"selected": false,
"text": "<p>We'd run into this a number of times with various products and I'd ended up using a small outer program that launches ea... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11892/"
] | To do an unattended installation of any MSI package, one can simply use the following command:
```
msiexec /qn /i package.msi
```
However, this triggers an asynchronous installation: if you happen to chain 2 dependent installations, you will have to wait somehow for the 1st installation to complete.
Is there a way ... | I've had luck with this:
```
start /wait msiexec /i MyInstaller.msi ...
```
Found in [this blog post](http://blogs.msdn.com/b/heaths/archive/2005/11/15/493236.aspx) from 2005. Hope you found it way back in '08. |
198,119 | <p>I have a flash project that I'm trying to export as a single SWF. There's a main SWF file that loads about 6 other SWFs, and both the main and the child SWFs reference other external assets (images, sounds, etc). I'd like to package everything as a single .swf file so I don't have to tote the other assets around w... | [
{
"answer_id": 198149,
"author": "Rafe",
"author_id": 27497,
"author_profile": "https://Stackoverflow.com/users/27497",
"pm_score": -1,
"selected": false,
"text": "<p>HI Justin,</p>\n\n<p>It sounds like you need to look into using shared libraries. Check out:</p>\n\n<p><a href=\"http://k... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a flash project that I'm trying to export as a single SWF. There's a main SWF file that loads about 6 other SWFs, and both the main and the child SWFs reference other external assets (images, sounds, etc). I'd like to package everything as a single .swf file so I don't have to tote the other assets around with t... | You *might* be able to decompile your swfs into XML with swfmill/mtasc and use a fancy XSLT to recombine them and recompile with swfmill/mtasc.
If that doesn't work and if you're using MovieClip.loadMovie or MovieClipLoader.loadMovie you can overload their methods and intercept the url:
```
var realLoadMovie:Function... |
198,135 | <p>Which is faster? someCondition has the same probability of being true as it has of being false.</p>
<p>Insertion:</p>
<pre><code>arrayList = Array("apple", "pear","grape")
if someCondition then
' insert "banana" element
end if
</code></pre>
<p>Deletion:</p>
<pre><code>arrayList = Array("apple","banana","pea... | [
{
"answer_id": 198144,
"author": "ilitirit",
"author_id": 9825,
"author_profile": "https://Stackoverflow.com/users/9825",
"pm_score": 0,
"selected": false,
"text": "<p>I've found an example showing that one can delete without looping as well. It looks simpler than the code to insert.</p... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9825/"
] | Which is faster? someCondition has the same probability of being true as it has of being false.
Insertion:
```
arrayList = Array("apple", "pear","grape")
if someCondition then
' insert "banana" element
end if
```
Deletion:
```
arrayList = Array("apple","banana","pear","grape")
if not someCondition then
' r... | For a delete, every item after the removed item must be shifted down.
For an Insert, space must be found for the new item. If there is empty space after the array that it can annex, then this takes no time, and the only time spend is more each item after the new item up, to make room in the middle.
If there is no ava... |
198,141 | <p>I have a postgres table. I need to delete some data from it. I was going to create a temporary table, copy the data in, recreate the indexes and the delete the rows I need. I can't delete data from the original table, because this original table is the source of data. In one case I need to get some results that depe... | [
{
"answer_id": 198192,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Create a new table using a select to grab the data you want. Then swap the old table with the new one.</p>\n\n<pre><code>c... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161922/"
] | I have a postgres table. I need to delete some data from it. I was going to create a temporary table, copy the data in, recreate the indexes and the delete the rows I need. I can't delete data from the original table, because this original table is the source of data. In one case I need to get some results that depends... | New PostgreSQL ( since 8.3 according to docs ) can use "INCLUDING INDEXES":
```
# select version();
version
-------------------------------------------------------------------------------------------------
PostgreSQL 8.3.7 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) 4... |
198,153 | <pre><code><html>
<head>
<style type="text/css">
div {
border:1px solid #000;
min-width: 50%;
}
</style>
</head>
<body>
<div>This is some text. </div>
</body>
</html&g... | [
{
"answer_id": 198165,
"author": "Chris Serra",
"author_id": 13435,
"author_profile": "https://Stackoverflow.com/users/13435",
"pm_score": 4,
"selected": true,
"text": "<p>If you provide <code>absolute</code> positioning to the element, it will be <code>50%</code> in Firefox. However, I... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] | ```
<html>
<head>
<style type="text/css">
div {
border:1px solid #000;
min-width: 50%;
}
</style>
</head>
<body>
<div>This is some text. </div>
</body>
</html>
```
I believe the div should be 50 percent of the page, unless... | If you provide `absolute` positioning to the element, it will be `50%` in Firefox. However, IE doesn't like the `min-width` or `min-height` attributes, so you will have to define width as `50%` also for it to work in IE. |
198,157 | <p>I'm trying to verify if a schema matches the objects I'm initializing.</p>
<p>Is there a way to get the TableName of a class other than simply reflecting the class name?</p>
<p>I am using some class with explicit TableNames</p>
<p>Edit: using Joe's solution I added the case where you don't specify the table name,... | [
{
"answer_id": 198263,
"author": "user27529",
"author_id": 27529,
"author_profile": "https://Stackoverflow.com/users/27529",
"pm_score": 3,
"selected": true,
"text": "<p>If you have something like the following:</p>\n\n<pre><code>[ActiveRecord(Table = \"NewsMaster\")]\npublic class Artic... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/253/"
] | I'm trying to verify if a schema matches the objects I'm initializing.
Is there a way to get the TableName of a class other than simply reflecting the class name?
I am using some class with explicit TableNames
Edit: using Joe's solution I added the case where you don't specify the table name, it could probably use a... | If you have something like the following:
```
[ActiveRecord(Table = "NewsMaster")]
public class Article
{
[PrimaryKey(Generator = PrimaryKeyType.Identity)]
public int NewsId { get; set; }
[Property(Column = "NewsHeadline")]
public string Headline { get; set; }
[Property(Column = "EffectiveStartDa... |
198,174 | <p>I have found jQuery to be a great tool to simplify my MVC Views.</p>
<p>For example, instead of including complicated logic to add alternating styles to my tables I just do this...</p>
<pre><code>$(document).ready(function() {
$("table.details tr:odd").addClass("detailsAlternatingRow");
$("table.details tr:e... | [
{
"answer_id": 198186,
"author": "roundcrisis",
"author_id": 162325,
"author_profile": "https://Stackoverflow.com/users/162325",
"pm_score": 2,
"selected": false,
"text": "<p>Implementing an observer <a href=\"http://google-ajax-examples.googlecode.com/svn/trunk/customevents/jquery.html\... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4481/"
] | I have found jQuery to be a great tool to simplify my MVC Views.
For example, instead of including complicated logic to add alternating styles to my tables I just do this...
```
$(document).ready(function() {
$("table.details tr:odd").addClass("detailsAlternatingRow");
$("table.details tr:even").addClass("detai... | MVC Framework has a JsonResult that can be very nice to eliminate server round trips and might be able to get rid of some of the logic in your view page. I wrote a tutorial on this available at :
<http://www.dev102.com/2008/08/19/jquery-and-the-aspnet-mvc-framework/> |
198,196 | <p>I'm curious to know how people are using table aliases. The other developers where I work always use table aliases, and always use the alias of a, b, c, etc.</p>
<p>Here's an example:</p>
<pre><code>SELECT a.TripNum, b.SegmentNum, b.StopNum, b.ArrivalTime
FROM Trip a, Segment b
WHERE a.TripNum = b.TripNum
</code>... | [
{
"answer_id": 198207,
"author": "Adam Caviness",
"author_id": 9130,
"author_profile": "https://Stackoverflow.com/users/9130",
"pm_score": 0,
"selected": false,
"text": "<p>I feel that you should use them as often as possible but I do agree that t & s represent the entities better th... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28281/"
] | I'm curious to know how people are using table aliases. The other developers where I work always use table aliases, and always use the alias of a, b, c, etc.
Here's an example:
```
SELECT a.TripNum, b.SegmentNum, b.StopNum, b.ArrivalTime
FROM Trip a, Segment b
WHERE a.TripNum = b.TripNum
```
I disagree with them, a... | There are two reasons for using table aliases.
The first is cosmetic. The statements are easier to write, and perhaps also easier to read when table aliases are used.
The second is more substantive. If a table appears more than once in the FROM clause, you need table aliases in order to keep them distinct. Self join... |
198,199 | <p>How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string?</p>
| [
{
"answer_id": 198200,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "<pre><code>#include <cstdio>\n#include <cstdlib>\n#include <string>\n\nvoid strrev(char *str)\n{\n if... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string? | The standard algorithm is to use pointers to the start / end, and walk them inward until they meet or cross in the middle. Swap as you go.
---
Reverse ASCII string, i.e. a 0-terminated array where every character fits in 1 `char`. (Or other non-multibyte character sets).
```
void strrev(char *head)
{
if (!head) re... |
198,215 | <pre><code>int main()
{
HandPhone A,B;
A>>B;//overloading operator>> to simulate sending sms to another handphone(object)
return 0;
}
</code></pre>
<p>How should I declare the istream operator to simulate sending sms to another handphone(object)?</p>
| [
{
"answer_id": 198227,
"author": "luke",
"author_id": 16434,
"author_profile": "https://Stackoverflow.com/users/16434",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://www.cplusplus.com/reference/iostream/istream/\" rel=\"nofollow noreferrer\">std::istream</a> is a class, ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
int main()
{
HandPhone A,B;
A>>B;//overloading operator>> to simulate sending sms to another handphone(object)
return 0;
}
```
How should I declare the istream operator to simulate sending sms to another handphone(object)? | This is how to define the >> operator:
```
void operator >> (HandPhone& a, HandPhone& b)
{
// Add code here.
}
```
I have set the return type to void as I am not sure chaining would make sense.
But it is considered bad design (in the C++ world) to overload operators to do random tasks as it makes the code hard ... |
198,233 | <p>How can I make my window not have a title bar but appear in the task bar with some descriptive text?
If you set the Form's .Text property then .net gives it a title bar, which I don't want.</p>
<pre><code> this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialo... | [
{
"answer_id": 198287,
"author": "amcoder",
"author_id": 26898,
"author_profile": "https://Stackoverflow.com/users/26898",
"pm_score": 2,
"selected": false,
"text": "<p>Just set the border style to None.</p>\n\n<pre><code>this.FormBorderStyle = FormBorderStyle.None;\n</code></pre>\n"
}... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8479/"
] | How can I make my window not have a title bar but appear in the task bar with some descriptive text?
If you set the Form's .Text property then .net gives it a title bar, which I don't want.
```
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
thi... | One approach to look into might be to set the `FormBorderStyle` property of your `Form` to `None` (instead of `FixedDialog`).
The drawback to this approach is that you lose the borders of your window as well as the Titlebar. A result of this is that you lose the form repositioning/resizing logic that you normally get... |
198,240 | <p>I'm looking to use Java to parse an ongoing stream of event drive XML generated by a remote device. Here's a simplified sample of two events:</p>
<pre><code><?xml version="1.0"?>
<Event> DeviceEventMsg
<Param1>SomeParmValue</Param1>
</Event>
<?xml version="1.0"?>
<Event> D... | [
{
"answer_id": 198304,
"author": "eishay",
"author_id": 16201,
"author_profile": "https://Stackoverflow.com/users/16201",
"pm_score": 1,
"selected": false,
"text": "<p>Try to use <a href=\"http://en.wikipedia.org/wiki/StAX\" rel=\"nofollow noreferrer\">StAX</a> instead of SAX. StAX allow... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27524/"
] | I'm looking to use Java to parse an ongoing stream of event drive XML generated by a remote device. Here's a simplified sample of two events:
```
<?xml version="1.0"?>
<Event> DeviceEventMsg
<Param1>SomeParmValue</Param1>
</Event>
<?xml version="1.0"?>
<Event> DeviceEventMsg
<Param1>SomeParmValue</Param1>
</Event>
``... | Try to use [StAX](http://en.wikipedia.org/wiki/StAX) instead of SAX. StAX allows much more flexibility and it is a better solution for streaming XML. There are few implementations of StAX, I am very happy with the [codehaus](http://stax.codehaus.org/Download) one, but there is also one from [Sun](https://sjsxp.dev.java... |
198,244 | <p>I have a checkstyle suppression filter setup (e.g. ignore magic numbers in unit test code).</p>
<p>The suppression xml file resides in the same folder as the checkstyle xml file. However, where this file actually is varies:
on my windows dev box it is in d:\dev\shared\checkstyle\config
on the Linux CI server it wil... | [
{
"answer_id": 199291,
"author": "Greg Mattes",
"author_id": 13940,
"author_profile": "https://Stackoverflow.com/users/13940",
"pm_score": 5,
"selected": true,
"text": "<p>I had this same problem with the Checkstyle suppression configuration when I was going back and forth between Linux ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27522/"
] | I have a checkstyle suppression filter setup (e.g. ignore magic numbers in unit test code).
The suppression xml file resides in the same folder as the checkstyle xml file. However, where this file actually is varies:
on my windows dev box it is in d:\dev\shared\checkstyle\config
on the Linux CI server it will be in /r... | I had this same problem with the Checkstyle suppression configuration when I was going back and forth between Linux and Windows. Here's how I solved it in my Ant-based build system:
Basically, I inject the proper, platform-specific directory value into the main Checkstyle configuration file by configuring a Checkstyle... |
198,266 | <p>Can anyone provide and example of downloading a PDF file using Watin? I tried the SaveAsDialogHandler but I couldn't figure it out. Perhaps a MemoryStream could be used?</p>
<p>Thanks,</p>
<p>--jb</p>
| [
{
"answer_id": 201464,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>This code will do the trick. The UsedialogOnce class can be found in the WatiN.UnitTests code and will be part of the WatiN... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can anyone provide and example of downloading a PDF file using Watin? I tried the SaveAsDialogHandler but I couldn't figure it out. Perhaps a MemoryStream could be used?
Thanks,
--jb | This code will do the trick. The UsedialogOnce class can be found in the WatiN.UnitTests code and will be part of the WatiN 1.3 release (which will probably be released tonigh 14 october).
FileDownloadHandler fileDownloadHandler = new FileDownloadHandler(file.FullName);
using (new UseDialogOnce(ie.DialogWatcher, fileD... |
198,279 | <p>I am a complete beginner trying to develop for FCKeditor so please bear with me here. I have been tasked with developing a custom plugin that will allow users to browse a specific set of images that the user uploads. Essentially the user first attaches images, then uses the FCKeditor to insert those images.</p>
<p>... | [
{
"answer_id": 198311,
"author": "Patrick McElhaney",
"author_id": 437,
"author_profile": "https://Stackoverflow.com/users/437",
"pm_score": 2,
"selected": true,
"text": "<p>You don't need the lang directory unless you're planning on supporting multiple languages. But even then, I would ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/285/"
] | I am a complete beginner trying to develop for FCKeditor so please bear with me here. I have been tasked with developing a custom plugin that will allow users to browse a specific set of images that the user uploads. Essentially the user first attaches images, then uses the FCKeditor to insert those images.
So I have ... | You don't need the lang directory unless you're planning on supporting multiple languages. But even then, I would get the plugin working in one language first.
I would probably put mybrowser.asp in the plugin directory.
Here's some code for fckplugin.js to get you started.
```
// Register the related command.
// R... |
198,285 | <p>I'm using the following code, using the <a href="http://www.sharpziplib.com/" rel="noreferrer">SharpZipLib</a> library, to add files to a .zip file, but each file is being stored with its full path. I need to only store the file, in the 'root' of the .zip file.</p>
<pre><code>string[] files = Directory.GetFiles(fo... | [
{
"answer_id": 198301,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 4,
"selected": false,
"text": "<p>How about using <a href=\"http://msdn.microsoft.com/en-us/library/system.io.path.getfilename.aspx\" rel=\"noreferre... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | I'm using the following code, using the [SharpZipLib](http://www.sharpziplib.com/) library, to add files to a .zip file, but each file is being stored with its full path. I need to only store the file, in the 'root' of the .zip file.
```
string[] files = Directory.GetFiles(folderPath);
using (ZipFile zipFile = ZipFile... | My solution was to set the `NameTransform` object property of the `ZipFile` to a `ZipNameTransform` with its `TrimPrefix` set to the directory of the file. This causes the directory part of the entry names, which are full file paths, to be removed.
```
public static void ZipFolderContents(string folderPath, string zip... |
198,295 | <p>I'm setting the cookie expiration using the following code:</p>
<hr>
<pre><code>// remove existing cookies.
request.Cookies.Clear();
response.Cookies.Clear();
// ... serialize and encrypt my data ...
// now set the cookie.
HttpCookie cookie = new HttpCookie(AuthCookieName, encrypted);
cookie.Expires = DateTime.N... | [
{
"answer_id": 406205,
"author": "Shankar",
"author_id": 20818,
"author_profile": "https://Stackoverflow.com/users/20818",
"pm_score": 0,
"selected": false,
"text": "<p>The version problem discussed in the link was not helpful. Basically ASP.NET cookie sucks. I had to store the expiratio... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20818/"
] | I'm setting the cookie expiration using the following code:
---
```
// remove existing cookies.
request.Cookies.Clear();
response.Cookies.Clear();
// ... serialize and encrypt my data ...
// now set the cookie.
HttpCookie cookie = new HttpCookie(AuthCookieName, encrypted);
cookie.Expires = DateTime.Now.Add(TimeSpan... | The problem here doesn't really lie with ASP.NET but with the amount of information that is provided in the http request by browsers. The expiry date would be unobtainable regardless of the platform you are using on the server side.
As you have summarised yourself in your question the Expires property of the HttpCooki... |
198,312 | <p>I'm learning how to make a firefox extension.
I have created a xul and overlay file that makes a sidebar in my browser. I'm trying to put buttons in my sidebar that load different pages within the main browser window. I'm not sure how to access the main browser window and load a new url within it. I have here a simp... | [
{
"answer_id": 198685,
"author": "Sergey Ilinsky",
"author_id": 23815,
"author_profile": "https://Stackoverflow.com/users/23815",
"pm_score": 1,
"selected": false,
"text": "<p>You should be able to access active tab window context in the following way:</p>\n\n<pre>\nfunction loadURL(url)... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27538/"
] | I'm learning how to make a firefox extension.
I have created a xul and overlay file that makes a sidebar in my browser. I'm trying to put buttons in my sidebar that load different pages within the main browser window. I'm not sure how to access the main browser window and load a new url within it. I have here a simple ... | You should be able to access active tab window context in the following way:
```
function loadURL(url) {
content.wrappedJSObject.location = url;
}
``` |
198,320 | <p>As far as I can understand, when I new up a <em>Linq to SQL class</em>, it is the equivalent of new'ing up a <em>SqlConnection object</em>.</p>
<p>Suppose I have an object with two methods: <code>Delete()</code> and <code>SubmitChanges()</code>. Would it be wise of me to new up the <em>Linq to SQL class</em> in eac... | [
{
"answer_id": 198609,
"author": "Jacob Proffitt",
"author_id": 1336,
"author_profile": "https://Stackoverflow.com/users/1336",
"pm_score": 0,
"selected": false,
"text": "<p>I assume that you mean holding a value for the DataContext class? Personally, my preference is to default to a \"u... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20946/"
] | As far as I can understand, when I new up a *Linq to SQL class*, it is the equivalent of new'ing up a *SqlConnection object*.
Suppose I have an object with two methods: `Delete()` and `SubmitChanges()`. Would it be wise of me to new up the *Linq to SQL class* in each of the methods, or would a private variable holding... | Having now reviewed the code sample you edited to post, I would definitely refactor your class to take advantage of LINQ-to-SQL's built in functionality. (I won't edit my previous comment because it's a better answer to the general question)
Your class's fields appear to be a pretty direct mapping of the columns on ... |
198,322 | <p>Let's say I'm working on a little batch-processing console app in VB.Net. I want to be able to structure the app like this:</p>
<pre class="lang-vb prettyprint-override"><code>Sub WorkerMethod()
'Do some work
Trace.WriteLine("Work progress")
'Do more work
Trace.WriteLine("Another progress update")
... | [
{
"answer_id": 198326,
"author": "harpo",
"author_id": 4525,
"author_profile": "https://Stackoverflow.com/users/4525",
"pm_score": 8,
"selected": true,
"text": "<p>You can add the following to your exe's .config file.</p>\n\n<pre><code><?xml version=\"1.0\"?>\n<configuration>... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] | Let's say I'm working on a little batch-processing console app in VB.Net. I want to be able to structure the app like this:
```vb
Sub WorkerMethod()
'Do some work
Trace.WriteLine("Work progress")
'Do more work
Trace.WriteLine("Another progress update")
'...
End Sub
Sub Main()
'Do any setup, like ... | You can add the following to your exe's .config file.
```
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add name="logListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="cat.log" />
<add na... |
198,337 | <p>When hiring a front-end developer, what specific skills and practices should you test for? What is a good metric for evaluating their skill in HTML, CSS and Javascript?</p>
<p>Obviously, table-less semantic HTML and pure CSS layout are probably the key skills. But what about specific techniques? Should he/she be ab... | [
{
"answer_id": 198344,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": -1,
"selected": false,
"text": "<p>I wouldn't put too much weight on it, as proper HTML/CSS is so simple that anyone can learn it in a week.</p>\n\n<p>That... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4636/"
] | When hiring a front-end developer, what specific skills and practices should you test for? What is a good metric for evaluating their skill in HTML, CSS and Javascript?
Obviously, table-less semantic HTML and pure CSS layout are probably the key skills. But what about specific techniques? Should he/she be able to effo... | When I interview people for a position of Client-Side developer I try to figure out:
```
1) Understanding DOM (what is that, how is it related to HTML etc)
2) Understanding XML/namespaces
3) Understanding JavaScript (object-oriented? what otherwise)
4) Knowing approaches to componentization (XBL, HTC) - plus
5) Under... |
198,341 | <p>I would like to create a window with a progressbar which shows the current status of Spring's object instantiation. From Spring.Net's <a href="http://www.springframework.net/docs/1.1.2/reference/html/objects.html#objects-factory-customizing" rel="nofollow noreferrer">documentation</a> it seems that <code>IObjectPos... | [
{
"answer_id": 198344,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": -1,
"selected": false,
"text": "<p>I wouldn't put too much weight on it, as proper HTML/CSS is so simple that anyone can learn it in a week.</p>\n\n<p>That... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27083/"
] | I would like to create a window with a progressbar which shows the current status of Spring's object instantiation. From Spring.Net's [documentation](http://www.springframework.net/docs/1.1.2/reference/html/objects.html#objects-factory-customizing) it seems that `IObjectPostProcessors` is the right point to start and t... | When I interview people for a position of Client-Side developer I try to figure out:
```
1) Understanding DOM (what is that, how is it related to HTML etc)
2) Understanding XML/namespaces
3) Understanding JavaScript (object-oriented? what otherwise)
4) Knowing approaches to componentization (XBL, HTC) - plus
5) Under... |
198,343 | <p>We're working with a fixed transaction log size on our databases, and I'd like to put together an application to monitor the log sizes so we can see when things are getting too tight and we need to grow the fixed trn log. </p>
<p>Is there any TSQL command that I can run which will tell me the current size of the tr... | [
{
"answer_id": 198363,
"author": "Eric Z Beard",
"author_id": 1219,
"author_profile": "https://Stackoverflow.com/users/1219",
"pm_score": 4,
"selected": false,
"text": "<p>A quick google search revealed this:</p>\n\n<pre><code>DBCC SQLPERF ( LOGSPACE )\n</code></pre>\n\n<p>Why aren't you... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21973/"
] | We're working with a fixed transaction log size on our databases, and I'd like to put together an application to monitor the log sizes so we can see when things are getting too tight and we need to grow the fixed trn log.
Is there any TSQL command that I can run which will tell me the current size of the transaction ... | I used your code but, there was an error converting to an int.
"Msg 8115, Level 16, State 2, Line 1 Arithmetic overflow error converting expression to data type int." So wherever there was an "\*8" I changed it to \*8.0 and the code works perfectly.
```
SELECT (size * 8.0)/1024.0 AS size_in_mb
, CASE
WHEN max_... |
198,346 | <p>I've found a few samples online but I'd like to get feedback from people who use PHP daily as to potential security or performance considerations and their solutions.</p>
<p>Note that I am only interested in uploading a single file at a time.</p>
<p>Ideally no browser plugin would be required (Flash/Java), althoug... | [
{
"answer_id": 198361,
"author": "eyelidlessness",
"author_id": 17964,
"author_profile": "https://Stackoverflow.com/users/17964",
"pm_score": 2,
"selected": false,
"text": "<p>The main benefit of Flash is it allows you to upload multiple files. The main benefit of Java is it allows drag-... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24874/"
] | I've found a few samples online but I'd like to get feedback from people who use PHP daily as to potential security or performance considerations and their solutions.
Note that I am only interested in uploading a single file at a time.
Ideally no browser plugin would be required (Flash/Java), although it would be int... | File Upload Tutorial
====================
HTML
----
```
<form enctype="multipart/form-data" action="action.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input name="userfile" type="file" />
<input type="submit" value="Go" />
</form>
```
* `action.php` is the name of a PHP f... |
198,357 | <p>A lot of programming languages and frameworks do/allow/require something that I can't seem to find the name for, even though there probably is one in computer science. What they basically do is bind to a variable/object/class/function by name. </p>
<p><a href="http://www.adobe.com/products/flex/" rel="noreferrer">F... | [
{
"answer_id": 198364,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "<p>What makes you think that <code>Class.forName</code> isn't reflection?</p>\n"
},
{
"answer_id": 198368,
... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13041/"
] | A lot of programming languages and frameworks do/allow/require something that I can't seem to find the name for, even though there probably is one in computer science. What they basically do is bind to a variable/object/class/function by name.
[Flex](http://www.adobe.com/products/flex/) example ("selectAll()"):
```
... | It's called "late binding", "dynamic binding", or "runtime binding". The fact that it binds by a string is just an implementation detail, although it does imply that the string-to-symbol mapping exists at runtime (which some languages, like c++, don't provide).
"Introspection" or "reflection", on the other hand, refer... |
198,360 | <p>I would like to host a silverlight control in winforms via a winforms browser, but for it to work I need some way for the forms to talk to the silverlight, and also the other way around. Would it be possible to somehow have the two interact with each other using JavaScript as a middleman? I.e., have the form speak... | [
{
"answer_id": 198378,
"author": "smaclell",
"author_id": 22914,
"author_profile": "https://Stackoverflow.com/users/22914",
"pm_score": 0,
"selected": false,
"text": "<p>Silverlight in a winform app just sounds like bad news. It would mean you are running to different CLR's in a single a... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3291/"
] | I would like to host a silverlight control in winforms via a winforms browser, but for it to work I need some way for the forms to talk to the silverlight, and also the other way around. Would it be possible to somehow have the two interact with each other using JavaScript as a middleman? I.e., have the form speak to t... | I think using the Windows Forms WebBrowser control is your best bet. To do this, you'll need your Silverlight app on a webpage, then you point your WebBrowser at the page's URI.
To keep your WebBrowser control from acting like IE, I'd recommend setting the following:
```
webBrowser.AllowNavigation = false;
webBrowser... |
198,365 | <p>in Config.groovy I see this:</p>
<pre><code>// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
}
</code></pre>
<p>what is the correct way to access that at runtime?</p>
| [
{
"answer_id": 198466,
"author": "danb",
"author_id": 2031,
"author_profile": "https://Stackoverflow.com/users/2031",
"pm_score": 4,
"selected": false,
"text": "<p>here it is:</p>\n\n<pre><code>import org.codehaus.groovy.grails.commons.ConfigurationHolder\nprintln ConfigurationHolder.con... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2031/"
] | in Config.groovy I see this:
```
// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
}
```
what is the correct way to access that at runtime? | In more recent versions of grails ConfigurationHolder has been deprecated.
Instead you should use the grailsApplication object.
```
grailsApplication.config.grails.serverURL
```
If in a Controller or Service then use dependency injection of grailsApplication object.
e.g.
```
class MyController{
def grailsAppli... |
198,409 | <p>Is there code in VBA I can wrap a function with that will let me know the time it took to run, so that I can compare the different running times of functions?</p>
| [
{
"answer_id": 198702,
"author": "Mike Woodhouse",
"author_id": 1060,
"author_profile": "https://Stackoverflow.com/users/1060",
"pm_score": 7,
"selected": true,
"text": "<p>Unless your functions are very slow, you're going to need a very high-resolution timer. The most accurate one I kno... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13295/"
] | Is there code in VBA I can wrap a function with that will let me know the time it took to run, so that I can compare the different running times of functions? | Unless your functions are very slow, you're going to need a very high-resolution timer. The most accurate one I know is `QueryPerformanceCounter`. Google it for more info. Try pushing the following into a class, call it `CTimer` say, then you can make an instance somewhere global and just call `.StartCounter` and `.Tim... |
198,431 | <p>Is there a standard idiom for comparing version numbers? I can't just use a straight String compareTo because I don't know yet what the maximum number of point releases there will be. I need to compare the versions and have the following hold true:</p>
<pre><code>1.0 < 1.1
1.0.1 < 1.1
1.9 < 1.10
</code><... | [
{
"answer_id": 198442,
"author": "gizmo",
"author_id": 9396,
"author_profile": "https://Stackoverflow.com/users/9396",
"pm_score": 7,
"selected": true,
"text": "<p>Tokenize the strings with the dot as delimiter and then compare the integer translation side by side, beginning from the lef... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | Is there a standard idiom for comparing version numbers? I can't just use a straight String compareTo because I don't know yet what the maximum number of point releases there will be. I need to compare the versions and have the following hold true:
```
1.0 < 1.1
1.0.1 < 1.1
1.9 < 1.10
``` | Tokenize the strings with the dot as delimiter and then compare the integer translation side by side, beginning from the left. |
198,460 | <p>How do I generate a random number between <code>0</code> and <code>n</code>?</p>
| [
{
"answer_id": 198469,
"author": "Mark A. Nicolosi",
"author_id": 1103052,
"author_profile": "https://Stackoverflow.com/users/1103052",
"pm_score": 5,
"selected": false,
"text": "<p>Well, I figured it out. Apparently there is a builtin (?) function called rand:</p>\n\n<pre><code>rand(n +... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1103052/"
] | How do I generate a random number between `0` and `n`? | Use [`rand(range)`](http://www.ruby-doc.org/core-2.1.3/Kernel.html#method-i-rand)
From [Ruby Random Numbers](http://www.codeodor.com/index.cfm/2007/3/25/Ruby-random-numbers/1042):
>
> If you needed a random integer to simulate a roll of a six-sided die, you'd use: `1 + rand(6)`. A roll in craps could be simulated wi... |
198,465 | <p>Is there any way to access the file object used by a CSV writer/reader object after it has been instantiated? I openned up the csv module, and it appears it's contest are builtin. I also tried setting the file object as a property but I get the following error:</p>
<pre><code>AttributeError: '_csv.writer' object ... | [
{
"answer_id": 198553,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 3,
"selected": true,
"text": "<p><code>csv.writer</code> is a \"builtin\" function. That is, it is written in compiled C code rather than Python. So... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9940/"
] | Is there any way to access the file object used by a CSV writer/reader object after it has been instantiated? I openned up the csv module, and it appears it's contest are builtin. I also tried setting the file object as a property but I get the following error:
```
AttributeError: '_csv.writer' object has no attribute... | `csv.writer` is a "builtin" function. That is, it is written in compiled C code rather than Python. So its internal variables can't be accessed from Python code.
That being said, I'm not sure **why** you would need to inspect the csv.writer object to find out the file object. That object is specified when creating the... |
198,493 | <p>I'm developing a system that needs to execute Intersystems Cache Terminal Scripts.</p>
<p>When I run a routine inside the regular Caché terminal or a telnet terminal, Cache executes the routine until the end with no problems. But when I try to run the same routine, but this time calling the routine within a Caché t... | [
{
"answer_id": 198655,
"author": "Clayton",
"author_id": 22201,
"author_profile": "https://Stackoverflow.com/users/22201",
"pm_score": 1,
"selected": false,
"text": "<p>Is there a chance it's not a timeout, but some other problem? Possibly a runtime error that's not being trapped/logged... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24165/"
] | I'm developing a system that needs to execute Intersystems Cache Terminal Scripts.
When I run a routine inside the regular Caché terminal or a telnet terminal, Cache executes the routine until the end with no problems. But when I try to run the same routine, but this time calling the routine within a Caché terminal Sc... | After a while I finally discovered why the session was being terminated. You must wait for something at the end or the script just terminates. But you must be sure that the string you are waiting for is not something that will be printed until the code finishes.
So, I've just changed the program to print "Operation fi... |
198,496 | <p>What’s the difference between the <code>System.Array.CopyTo()</code> and <code>System.Array.Clone()</code>?</p>
| [
{
"answer_id": 198500,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 7,
"selected": true,
"text": "<p>The <strong><a href=\"http://msdn.microsoft.com/en-us/library/system.array.clone.aspx\" rel=\"noreferrer\">Cl... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14441/"
] | What’s the difference between the `System.Array.CopyTo()` and `System.Array.Clone()`? | The **[Clone()](http://msdn.microsoft.com/en-us/library/system.array.clone.aspx)** method returns a new array (a shallow copy) object containing all the elements in the original array. The **[CopyTo()](http://msdn.microsoft.com/en-us/library/system.array.copyto.aspx)** method copies the elements into another existing a... |