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 |
|---|---|---|---|---|---|---|
283,202 | <p>we are writing tests for a COM library written in VB 6.0.The problem we are facing is that, we are unable to access events declared in VB( withevents). We get exception, "object does not support set of events". How can we overcome this problem?</p>
| [
{
"answer_id": 295316,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>For example, we have a class in VB 6.0 called DatabaseCommand.</p>\n\n<pre><code>Option Explicit\n\nPublic Event SavedSucce... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | we are writing tests for a COM library written in VB 6.0.The problem we are facing is that, we are unable to access events declared in VB( withevents). We get exception, "object does not support set of events". How can we overcome this problem? | Your mocking framework is the problem here. The mock object returned by this call:
```
repository.DynamicMock<PersonLib.DatabaseCommand>();
```
implements the `DatabaseCommand` class's interface, but does not mock its events. Therefore, when you pass an instance of this mock object to your VB6 code, which expects to... |
283,209 | <p>do I have to register the HttpVerb constraint in my route definition (when i'm registering routes) if i have decorated my action method with the [AcceptVerbs(..)] attribute already?</p>
<p>eg. i have this.</p>
<pre><code>[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(FormCollection formCollection)
{ .. }... | [
{
"answer_id": 284020,
"author": "anonymous",
"author_id": 36602,
"author_profile": "https://Stackoverflow.com/users/36602",
"pm_score": 2,
"selected": false,
"text": "<p>Nope -- Create will only respond to POST requests.</p>\n\n<p>You can have other implementations of Create with differ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30674/"
] | do I have to register the HttpVerb constraint in my route definition (when i'm registering routes) if i have decorated my action method with the [AcceptVerbs(..)] attribute already?
eg. i have this.
```
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(FormCollection formCollection)
{ .. }
```
do i need to a... | The difference between the two is the following: Let's assume the `Create` method in question is on the `HomeController`.
Using the `AcceptVerbs` attribute does not affect routing. It's actually something used by the action invoker. What it allows you to do is have 2 action methods on a controller with the same name t... |
283,222 | <p>What's the best way to take some plain text (not PHP code) which contains PHP-style variables, and then substitute in the value of the variable. This is kinda hard to describe, so here's an example.</p>
<pre><code>// -- myFile.txt --
Mary had a little $pet.
// -- parser.php --
$pet = "lamb";
// open myFile.txt and... | [
{
"answer_id": 283231,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 2,
"selected": false,
"text": "<p>Here's what I've just come up with, but I'd still be interested to know if there's a better way. Cheers.</p>\n\n<pre><code>... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | What's the best way to take some plain text (not PHP code) which contains PHP-style variables, and then substitute in the value of the variable. This is kinda hard to describe, so here's an example.
```
// -- myFile.txt --
Mary had a little $pet.
// -- parser.php --
$pet = "lamb";
// open myFile.txt and transform it ... | If it's from a trusted source you can use (dramatic pause) [eval()](http://www.php.net/eval) (gasps of horror from the audience).
```
$text = 'this is a $test'; // single quotes to simulate getting it from a file
$test = 'banana';
$text = eval('return "' . addslashes($text) . '";');
echo $text; // this is a banana
``... |
283,251 | <p>I need to read account number from Maestro/Mastercard with smart card reader. I am using Java 1.6 and its javax.smartcardio package. I need to send APDU command which will ask EMV application stored on card's chip for PAN number. Problem is, I cannot find regular byte array to construct APDU command which will retur... | [
{
"answer_id": 283452,
"author": "Rasmus Faber",
"author_id": 5542,
"author_profile": "https://Stackoverflow.com/users/5542",
"pm_score": 0,
"selected": false,
"text": "<p>You need to do construct a CommandAPDU object and pass it to the transmit()-command.</p>\n\n<p>You should be able to... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to read account number from Maestro/Mastercard with smart card reader. I am using Java 1.6 and its javax.smartcardio package. I need to send APDU command which will ask EMV application stored on card's chip for PAN number. Problem is, I cannot find regular byte array to construct APDU command which will return n... | You shouldn't need to wrap the APDU further. The API layer should take care of that.
It looks like the 0x6D00 response just means that the application did not support the INS.
Just troubleshooting now, but you did start out by selecting the MasterCard application, right?
I.e. something like this:
```
void selectApp... |
283,284 | <p>When I create a TFS report of a query with the Excel integration features (we are using Excel 2003), Excel resets formatting of all cells after clicking the "Refresh" button in the TFS Toolbar.</p>
<p>Our team likes to print this report and drag it into our weekly meeting as it accurately lists all our open tasks. ... | [
{
"answer_id": 291674,
"author": "user37826",
"author_id": 37826,
"author_profile": "https://Stackoverflow.com/users/37826",
"pm_score": 1,
"selected": false,
"text": "<p>My guess is that since Microsoft is playing up this feature in the VS 2010 CTP, it's not currently supported.</p>\n\n... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2260/"
] | When I create a TFS report of a query with the Excel integration features (we are using Excel 2003), Excel resets formatting of all cells after clicking the "Refresh" button in the TFS Toolbar.
Our team likes to print this report and drag it into our weekly meeting as it accurately lists all our open tasks. Bad format... | I ended up doing this:
* `tfpt.exe` ([Team Foundation Power Tools](http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx))
* query for xml: `tfpt query /format:xml` (add your query name here etc.)
* convert that to a html table with XSL
* write a simple batch script to do above steps
* (Profit!!!)
This is the XSL scr... |
283,294 | <p>I found a lot of info about how to debug simple Python programs with Emacs. But what if I want to debug a Django application?
I run the development server and I would like to somehow attach to the process from Emacs and then set breakpoints, etc. Similar to Visual Studio's "attach to process". How to do that?</p>
| [
{
"answer_id": 284058,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 0,
"selected": false,
"text": "<p>I don't really know anything about it, but putting \"debugging Python with emacs\" into Google gave me this page... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5475/"
] | I found a lot of info about how to debug simple Python programs with Emacs. But what if I want to debug a Django application?
I run the development server and I would like to somehow attach to the process from Emacs and then set breakpoints, etc. Similar to Visual Studio's "attach to process". How to do that? | Start pdb like this:
`M-x` `pdb`
Then, start the Django development server:
```
python manage.py runserver --noreload
```
Once you have the (Pdb) prompt, you need to do this:
```
import sys
sys.path.append('/path/to/directory/containing/views.py')
```
Once you've done this, you should be able to set breakpoints... |
283,295 | <p>According to MSDN</p>
<blockquote>
<p>The return value specifies the result
of the message processing; it depends
on the message sent.</p>
</blockquote>
<p>I know it is defined as </p>
<pre><code>typedef LONG_PTR LRESULT;
</code></pre>
<p>Meaning it will be 8 bytes on 64bit machine but it doesn't!</p>
<p>... | [
{
"answer_id": 283337,
"author": "James Ogden",
"author_id": 3198,
"author_profile": "https://Stackoverflow.com/users/3198",
"pm_score": 3,
"selected": true,
"text": "<p>No it's not safe, because the return value is defined by the message being sent and the handler.</p>\n\n<p>If you cont... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14587/"
] | According to MSDN
>
> The return value specifies the result
> of the message processing; it depends
> on the message sent.
>
>
>
I know it is defined as
```
typedef LONG_PTR LRESULT;
```
Meaning it will be 8 bytes on 64bit machine but it doesn't!
Does anyone know if it is safe to assume that only the lower... | No it's not safe, because the return value is defined by the message being sent and the handler.
If you control the handler and the message then it'd be possible, it's not safe in the general case.
James |
283,297 | <p>I have a dll that must be useable from C etc, so I cant use string objects etc as a normal would, but I'm not sure on how to do this safely..</p>
<pre><code>const char *GetString()
{
std::stringstream ss;
ss << "The random number is: " << rand();
return ss.str().c_str();
}
</code></pre>
<p>... | [
{
"answer_id": 283308,
"author": "shoosh",
"author_id": 9611,
"author_profile": "https://Stackoverflow.com/users/9611",
"pm_score": 1,
"selected": false,
"text": "<p>The first would actually not work because the stringstream deallocates it's space on destruction. So if you try to de-refe... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6266/"
] | I have a dll that must be useable from C etc, so I cant use string objects etc as a normal would, but I'm not sure on how to do this safely..
```
const char *GetString()
{
std::stringstream ss;
ss << "The random number is: " << rand();
return ss.str().c_str();
}
```
could the c string be destroyed when s... | The first variant doesn't work because you're returning a pointer into a stack object, which will get destroyed. (More presisely, you return a pointer to a heap memory, whch will have been deleted().) Worse still, it may even work for some time, if nobody's overwriting the memory, making it very hard to debug.
Next, y... |
283,300 | <p>I have a django project pro1 with several apps: app1, app2, app3 and so on. I want to display some top level template that contains blocks from each and every app:</p>
<p>example_base_template.html:</p>
<pre><code>[header /]
[left nav bar]{{ app1 rendered template }}[/left nav bar]
[right nav bar]{{ app2 rendered ... | [
{
"answer_id": 284870,
"author": "Alex Koshelev",
"author_id": 19772,
"author_profile": "https://Stackoverflow.com/users/19772",
"pm_score": 2,
"selected": false,
"text": "<p>You can use a <a href=\"http://docs.djangoproject.com/en/dev/ref/templates/builtins/#include\" rel=\"nofollow nor... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36832/"
] | I have a django project pro1 with several apps: app1, app2, app3 and so on. I want to display some top level template that contains blocks from each and every app:
example\_base\_template.html:
```
[header /]
[left nav bar]{{ app1 rendered template }}[/left nav bar]
[right nav bar]{{ app2 rendered template }}[/right ... | We had a problem similar to this and the key is getting the correct data into the Context. What we did was breakout the data creation/Context filling for each view into a separate build-the-context routine. The original views just call their respective routine and then render their template. The composite view calls ea... |
283,316 | <p>I'm having a problem where a jQuery setting against an .html() property on a selected element is returning the error 'nodeName' is null or not an object. This only occurs on IE6 and IE7, but not FF2, FF3, Opera (latest Nov 12,2008) or Safari (again, latest).</p>
| [
{
"answer_id": 283328,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>I resolved the problem. The example looks like this:</p>\n\n<p>$('#section #detail .data').html(data);</p>\n\n<p>...where d... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm having a problem where a jQuery setting against an .html() property on a selected element is returning the error 'nodeName' is null or not an object. This only occurs on IE6 and IE7, but not FF2, FF3, Opera (latest Nov 12,2008) or Safari (again, latest). | I resolved the problem. The example looks like this:
$('#section #detail .data').html(data);
...where data is HTML returned from an AJAX call, and this bug only occurs on IE6 and IE7 on the second attempt AJAX call, not the first. It's inexplicable. The error returned is:
```
'nodeName' is null or not an object
```... |
283,348 | <p>I'm trying to use the Visitor Pattern and I have as follows:</p>
<pre><code>public class EnumerableActions<T> : IEnumerableActions<T>
{
private IEnumerable<T> itemsToActOn;
public EnumerableActions ( IEnumerable<T> itemsToActOn )
{
this.itemsToActOn = itemsToActOn;
}
public void VisitAl... | [
{
"answer_id": 283359,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": true,
"text": "<p>For that to work, firstly \"newItem\" would have to be \"ref\". Secondly, you'd need to do something with the updat... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5246/"
] | I'm trying to use the Visitor Pattern and I have as follows:
```
public class EnumerableActions<T> : IEnumerableActions<T>
{
private IEnumerable<T> itemsToActOn;
public EnumerableActions ( IEnumerable<T> itemsToActOn )
{
this.itemsToActOn = itemsToActOn;
}
public void VisitAllItemsUsing ( IVisitor<T> visitor )
{
... | For that to work, firstly "newItem" would have to be "ref". Secondly, you'd need to do something with the updated value after the delegate invoke (an enumerator doesn't offer any ability to update contents). But most updates to collections will break enumerators anyway!
Your replacing "newItem" will not be visible to ... |
283,350 | <p>In Erlang, every process has a group leader, and when a process wants to print something (i.e. it calls the io library or does something similar), it will send a message to its group leader.</p>
<p>My question is, where can I find the specification of these messages? Or in general, the specification of what a group... | [
{
"answer_id": 296496,
"author": "archaelus",
"author_id": 9040,
"author_profile": "https://Stackoverflow.com/users/9040",
"pm_score": 4,
"selected": true,
"text": "<p><a href=\"https://erlangcentral.org/erlang-rationale-2/\" rel=\"nofollow noreferrer\">The Erlang Rationale (video)</a> o... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17916/"
] | In Erlang, every process has a group leader, and when a process wants to print something (i.e. it calls the io library or does something similar), it will send a message to its group leader.
My question is, where can I find the specification of these messages? Or in general, the specification of what a group leader sh... | [The Erlang Rationale (video)](https://erlangcentral.org/erlang-rationale-2/) or [(slides)](http://www.erlang-factory.com/upload/presentations/329/EFKR10-ErlangRationale.pdf); is a good source of information, as is the source code for [user.erl](http://github.com/mfoemmel/erlang-otp/tree/master/lib/kernel/src/user.erl#... |
283,374 | <p>To recap for those .NET gurus who might not know the Java API:</p>
<p><a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ConcurrentHashMap.html" rel="nofollow noreferrer">ConcurrentHashMap</a> in Java has atomic methods (i.e. require no external locking) for common Map modification operations such ... | [
{
"answer_id": 283400,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>EDIT: This was written prior to .NET 4 being released, when obviously there's <code>ConcurrentDictionary</code>. I'm ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1853/"
] | To recap for those .NET gurus who might not know the Java API:
[ConcurrentHashMap](http://java.sun.com/javase/6/docs/api/java/util/concurrent/ConcurrentHashMap.html) in Java has atomic methods (i.e. require no external locking) for common Map modification operations such as:
```
putIfAbsent(K key, V value)
remove(Obj... | Not that I know of. The closest thing to what you're looking for would probably be the Synchronized method of the Hashtable, which returns a (sort of) thread-safe wrapper around the hashtable. It's only thread-safe for multiple writers or multiple readers, though. If I recall correctly, a mixture of writers and readers... |
283,377 | <p>Consider the following signature in C#:</p>
<pre><code>double Divide(int numerator, int denominator);
</code></pre>
<p>Is there a performance difference between the following implementations?</p>
<pre><code>return (double)numerator / denominator;
return numerator / (double)denominator;
return (double)numerator ... | [
{
"answer_id": 283386,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "<p>Have you tried comparing the IL (for example, with <a href=\"http://www.red-gate.com/products/reflector/\" rel=\"no... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24874/"
] | Consider the following signature in C#:
```
double Divide(int numerator, int denominator);
```
Is there a performance difference between the following implementations?
```
return (double)numerator / denominator;
return numerator / (double)denominator;
return (double)numerator / (double)denominator;
```
I'm assu... | Have you tried comparing the IL (for example, with [Reflector](http://www.red-gate.com/products/reflector/))?
```
static double A(int numerator, int denominator)
{ return (double)numerator / denominator; }
static double B(int numerator, int denominator)
{ return numerator / (double)denominator; }
static double C(int... |
283,392 | <p>At the moment I have a set of divs, generated dynamically by php and all having their ids starting with 'itembox', with a count number appended. I have a droppable garbage bin area on the page so that the user can delete an individual itembox by fdragging and dropping on to the bin.</p>
<p>My problem is that the dr... | [
{
"answer_id": 283978,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 2,
"selected": true,
"text": "<p>I guess the problem must lie in the accept option of your droppable initializer. Just try the following:</p>\n\n<pre... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28527/"
] | At the moment I have a set of divs, generated dynamically by php and all having their ids starting with 'itembox', with a count number appended. I have a droppable garbage bin area on the page so that the user can delete an individual itembox by fdragging and dropping on to the bin.
My problem is that the droppable wo... | I guess the problem must lie in the accept option of your droppable initializer. Just try the following:
```
$('#mydroppable').droppable(
{
accept: function() { return true; },
drop: function () { alert("Dropped!"); }
});
```
Now this will accept everything, so you should probably implement some filtering in... |
283,417 | <p>I have a toolstrip containing, among other things, a ToolStripComboBox and a ToolStripButton. I want to add a ContextMenuStrip to both of them, but I don't have direct access to the toolstrip or its other contents, so I can't set the context menu of the toolstrip.</p>
<p>Setting the ContextMenuStrip for the ToolSt... | [
{
"answer_id": 283429,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 0,
"selected": false,
"text": "<p>It's because a ToolStripComboBox contains \"System.Windows.Forms.ComboBox\" control, but \"ToolStripButton\" does not cont... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | I have a toolstrip containing, among other things, a ToolStripComboBox and a ToolStripButton. I want to add a ContextMenuStrip to both of them, but I don't have direct access to the toolstrip or its other contents, so I can't set the context menu of the toolstrip.
Setting the ContextMenuStrip for the ToolStripComboBox... | What Jeff Yates has suggested should work.
However, another alternative is to create your own derived classes (MyToolSTripButton, MyToolStripTextBox ...etc) give these items a ContextMenuStrip property that you can set at design time, and have your derived classes detect the right mouse down, or whatever other events... |
283,431 | <p>My record sheet app has a menu option for creating a new, blank record sheet. When I open a sheet window, I can open new windows without a problem, using subprocess.Popen() to do it.</p>
<p>However, under Windows (I haven't tested it on other OSes yet), if I open a new window then use the "open file" dialog to popu... | [
{
"answer_id": 283545,
"author": "Ali Afshar",
"author_id": 28380,
"author_profile": "https://Stackoverflow.com/users/28380",
"pm_score": 3,
"selected": true,
"text": "<p>From the error message, it looks like you need to pass the full path of \"foo.py\" to your Popen call. Normally just ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18676/"
] | My record sheet app has a menu option for creating a new, blank record sheet. When I open a sheet window, I can open new windows without a problem, using subprocess.Popen() to do it.
However, under Windows (I haven't tested it on other OSes yet), if I open a new window then use the "open file" dialog to populate the f... | From the error message, it looks like you need to pass the full path of "foo.py" to your Popen call. Normally just having "foo.py" will search in your current working directory, but this can be a bit unpredictable on Windows, I have found. Yours seems to be jumping around with the open file dialog.
Secondly, just for ... |
283,435 | <p>I have been banging my head against a brick wall trying to deploy my MVC app on IIS6 (<a href="https://stackoverflow.com/questions/275920/aspnet-mvc-on-iis-6-wildcard-mapping-the-incoming-request-does-not-match-any-ro">linked question</a>)</p>
<p>I have scrapped wildcard mapping for the time being and am trying to ... | [
{
"answer_id": 283938,
"author": "anonymous",
"author_id": 36602,
"author_profile": "https://Stackoverflow.com/users/36602",
"pm_score": 0,
"selected": false,
"text": "<blockquote>\n <p>I have not made any changes to the\n default Web.config and all my routes\n are configured with ext... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31412/"
] | I have been banging my head against a brick wall trying to deploy my MVC app on IIS6 ([linked question](https://stackoverflow.com/questions/275920/aspnet-mvc-on-iis-6-wildcard-mapping-the-incoming-request-does-not-match-any-ro))
I have scrapped wildcard mapping for the time being and am trying to get the .mvc extensio... | My [original problem](https://stackoverflow.com/questions/275920/aspnet-mvc-on-iis-6-wildcard-mapping-the-incoming-request-does-not-match-any-ro) has been solved by [Oli](https://stackoverflow.com/users/36849/oli) who pointed out that the Global.asax file is needed with the website. I was using NAnt/MSBuild to deploy m... |
283,447 | <p>When my IronPython program gets to the line </p>
<pre><code>import wx
</code></pre>
<p>I get this message:</p>
<pre><code>A first chance exception of type
'IronPython.Runtime.Exceptions.PythonImportErrorException' occurred in IronPython.dll
Additional information: No module named _core_
</code></pre>
<p>althou... | [
{
"answer_id": 283520,
"author": "Ali Afshar",
"author_id": 28380,
"author_profile": "https://Stackoverflow.com/users/28380",
"pm_score": 4,
"selected": true,
"text": "<p>No, this won't work. Wx bindings (like most other \"python bindings\") are actually compiled against CPython.</p>\n\n... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11677/"
] | When my IronPython program gets to the line
```
import wx
```
I get this message:
```
A first chance exception of type
'IronPython.Runtime.Exceptions.PythonImportErrorException' occurred in IronPython.dll
Additional information: No module named _core_
```
although I do have the file wx\\_core\_.pyd. Also, befor... | No, this won't work. Wx bindings (like most other "python bindings") are actually compiled against CPython.
In this regards they are not just packages on sys.path to be found, as you have tried. They actually depend on CPython itself. [This rather dry document explains the process.](http://www.python.org/doc/2.5.2/ext... |
283,454 | <p>I have been working with hibernate/JPA on JBoss for some months now and have one question that I can't find an answer or solution for.</p>
<p>It seems like when creating new entity beans I'm not able to do a query before I at least have called EntityManager.persist(entityBean), or else I get the following error:</p... | [
{
"answer_id": 283628,
"author": "Georgy Bolyuba",
"author_id": 4052,
"author_profile": "https://Stackoverflow.com/users/4052",
"pm_score": 2,
"selected": false,
"text": "<p>It seems logical that you cannot query for something which is not in the database yet, no? What you can do is to s... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16152/"
] | I have been working with hibernate/JPA on JBoss for some months now and have one question that I can't find an answer or solution for.
It seems like when creating new entity beans I'm not able to do a query before I at least have called EntityManager.persist(entityBean), or else I get the following error:
`TransientO... | It seems logical that you cannot query for something which is not in the database yet, no? What you can do is to start using transactions. In a simple case your session will have one transaction which will be open until you close your session. At that moment transaction will be commited and all your changes will be per... |
283,456 | <p>Anyone know a good and effective way to search/match for a byte pattern in an byte[] array and then return the positions.</p>
<p>For example</p>
<pre><code>byte[] pattern = new byte[] {12,3,5,76,8,0,6,125};
byte[] toBeSearched = new byte[] {23,36,43,76,125,56,34,234,12,3,5,76,8,0,6,125,234,56,211,122,22,4,7,89,76... | [
{
"answer_id": 283469,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": -1,
"selected": false,
"text": "<p>You can put the byte array into <a href=\"http://msdn.microsoft.com/en-us/library/ezh7k8d5.aspx\" rel=\"nofollow n... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36504/"
] | Anyone know a good and effective way to search/match for a byte pattern in an byte[] array and then return the positions.
For example
```
byte[] pattern = new byte[] {12,3,5,76,8,0,6,125};
byte[] toBeSearched = new byte[] {23,36,43,76,125,56,34,234,12,3,5,76,8,0,6,125,234,56,211,122,22,4,7,89,76,64,12,3,5,76,8,0,6,1... | May I suggest something that doesn't involve creating strings, copying arrays or unsafe code:
```
using System;
using System.Collections.Generic;
static class ByteArrayRocks
{
static readonly int[] Empty = new int[0];
public static int[] Locate (this byte[] self, byte[] candidate)
{
if (IsEmp... |
283,460 | <p>While connecting .NET to sybase server I got this error message:</p>
<blockquote>
<p>[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified</p>
</blockquote>
<p>This has worked properly before. System DSN with same details worked and data connection through vs.net also worked.</p... | [
{
"answer_id": 292261,
"author": "user37887",
"author_id": 37887,
"author_profile": "https://Stackoverflow.com/users/37887",
"pm_score": -1,
"selected": false,
"text": "<p>Perform the following steps:</p>\n\n<ol>\n<li>Start the Registry Editor by typing <code>regedit</code> in the Run wi... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | While connecting .NET to sybase server I got this error message:
>
> [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
>
>
>
This has worked properly before. System DSN with same details worked and data connection through vs.net also worked.
I am using VS.NET 2005.
Any ... | If you're working with an x64 server, keep in mind that there are different ODBC settings for x86 and x64 applications. The "Data Sources (ODBC)" tool in the Administrative Tools list takes you to the x64 version. To view/edit the x86 ODBC settings, you'll need to run that version of the tool manually:
```
%windir%\Sy... |
283,464 | <p>Is there any such thing as a virtual Lineprinter.I mean a software emulation of a printer, that outputs to screen.</p>
<p>I have a project to change the output of print job. My past experience with a lineprinter was tedious rounds of</p>
<pre><code>loop:
print
walk down two flights
check the output
wal... | [
{
"answer_id": 292261,
"author": "user37887",
"author_id": 37887,
"author_profile": "https://Stackoverflow.com/users/37887",
"pm_score": -1,
"selected": false,
"text": "<p>Perform the following steps:</p>\n\n<ol>\n<li>Start the Registry Editor by typing <code>regedit</code> in the Run wi... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15710/"
] | Is there any such thing as a virtual Lineprinter.I mean a software emulation of a printer, that outputs to screen.
I have a project to change the output of print job. My past experience with a lineprinter was tedious rounds of
```
loop:
print
walk down two flights
check the output
walk back up two flights... | If you're working with an x64 server, keep in mind that there are different ODBC settings for x86 and x64 applications. The "Data Sources (ODBC)" tool in the Administrative Tools list takes you to the x64 version. To view/edit the x86 ODBC settings, you'll need to run that version of the tool manually:
```
%windir%\Sy... |
283,465 | <p>What's your preferred way of wrapping lines of code, especially when it comes to long argument lists?</p>
<p>There has been several questions relating to wrapping lines (such as <a href="https://stackoverflow.com/questions/268284/when-writing-code-do-you-wrap-text-or-not">When writing code do you wrap text or not?<... | [
{
"answer_id": 283483,
"author": "Dheer",
"author_id": 17266,
"author_profile": "https://Stackoverflow.com/users/17266",
"pm_score": 4,
"selected": false,
"text": "<p>The option 3 suggested</p>\n\n<pre><code>int SomeReturnValue = SomeMethodWithLotsOfArguments(\n Argument1,\n Argume... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17172/"
] | What's your preferred way of wrapping lines of code, especially when it comes to long argument lists?
There has been several questions relating to wrapping lines (such as [When writing code do you wrap text or not?](https://stackoverflow.com/questions/268284/when-writing-code-do-you-wrap-text-or-not) and [Line width f... | The option 3 suggested
```
int SomeReturnValue = SomeMethodWithLotsOfArguments(
Argument1,
Argument2,
Argument3,
Argument4
);
```
is a better way as it gives a good feel.
If the lengths of arguments are more or less same, then we can put them together so that they line up as a table for example
```
... |
283,468 | <p>In C# you can use verbatim strings like this:</p>
<pre><code>@"\\server\share\file.txt"
</code></pre>
<p>Is there something similar in JavaScript?</p>
| [
{
"answer_id": 283642,
"author": "Timothy Khouri",
"author_id": 11917,
"author_profile": "https://Stackoverflow.com/users/11917",
"pm_score": 5,
"selected": true,
"text": "<p>No, there isn't support for that in JavaScript. And that workaround seems very problematic as you now lose the ab... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4830/"
] | In C# you can use verbatim strings like this:
```
@"\\server\share\file.txt"
```
Is there something similar in JavaScript? | No, there isn't support for that in JavaScript. And that workaround seems very problematic as you now lose the ability to have forward slashes.
I've run into this issue myself when I needed to build an alert message or something from an ASP.NET back end, and stick it in a JavaScript alert on the front end. The issue w... |
283,470 | <p>i get the following error when trying to run a flex application (which has been working fine!). I was playing around with some different setttings trying to optimize the compiled size. I've put these settings back to the defaults as much as I thought but still getting issues.</p>
<p>I remember getting this error be... | [
{
"answer_id": 283642,
"author": "Timothy Khouri",
"author_id": 11917,
"author_profile": "https://Stackoverflow.com/users/11917",
"pm_score": 5,
"selected": true,
"text": "<p>No, there isn't support for that in JavaScript. And that workaround seems very problematic as you now lose the ab... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | i get the following error when trying to run a flex application (which has been working fine!). I was playing around with some different setttings trying to optimize the compiled size. I've put these settings back to the defaults as much as I thought but still getting issues.
I remember getting this error before but c... | No, there isn't support for that in JavaScript. And that workaround seems very problematic as you now lose the ability to have forward slashes.
I've run into this issue myself when I needed to build an alert message or something from an ASP.NET back end, and stick it in a JavaScript alert on the front end. The issue w... |
283,471 | <p>I know you can do it file by file.</p>
<p>Is there any way to do this in one step for all files in a project?</p>
| [
{
"answer_id": 283474,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "<p>Do you mean using statements? First, note that they generally do no harm other that take space.\nTools like <a href... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | I know you can do it file by file.
Is there any way to do this in one step for all files in a project? | Do you mean using statements? First, note that they generally do no harm other that take space.
Tools like [ReSharper](http://www.jetbrains.com/resharper/) offer automated tricks to do this, however: there was a [link in the VS feed](http://blogs.msdn.com/djpark/archive/2008/08/16/organize-usings-across-your-entire-sol... |
283,476 | <p>I am wondering what is the "best practice" to break long strings in C# source code. Is this string </p>
<pre><code>"string1"+
"string2"+
"string3"
</code></pre>
<p>concatenated during compiling or in run time?</p>
| [
{
"answer_id": 283488,
"author": "Maxam",
"author_id": 15310,
"author_profile": "https://Stackoverflow.com/users/15310",
"pm_score": 2,
"selected": false,
"text": "<p>The concatenation is done at compile time, so there is no runtime overhead.</p>\n"
},
{
"answer_id": 283491,
... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11256/"
] | I am wondering what is the "best practice" to break long strings in C# source code. Is this string
```
"string1"+
"string2"+
"string3"
```
concatenated during compiling or in run time? | It's done at compile time. That's exactly equivalent to "string1string2string3".
Suppose you have:
```
string x = "string1string2string3"
string y = "string1" + "string2" + "string3"
```
The compiler will perform appropriate interning such that x and y refer to the same objects.
EDIT: There's a lot of talk about `... |
283,477 | <p>Suppose I have the following directory layout in a Maven project:</p>
<pre><code>src/
|-- main
| |-- bin
| | |-- run.cmd
| | `-- run.sh
| |-- etc
| | |-- common-spring.xml
| | |-- log4j.xml
| | `-- xml-spring.xml
| `-- java
| `-- com
...
</code></pre>
<p>I would like to build a zip ... | [
{
"answer_id": 283564,
"author": "jassuncao",
"author_id": 1009,
"author_profile": "https://Stackoverflow.com/users/1009",
"pm_score": 5,
"selected": true,
"text": "<p>I use the <a href=\"http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/\" rel=\"noreferrer\">AppAssembler p... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1428/"
] | Suppose I have the following directory layout in a Maven project:
```
src/
|-- main
| |-- bin
| | |-- run.cmd
| | `-- run.sh
| |-- etc
| | |-- common-spring.xml
| | |-- log4j.xml
| | `-- xml-spring.xml
| `-- java
| `-- com
...
```
I would like to build a zip file that, when unzipped, ... | I use the [AppAssembler plugin](http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/) to get something similar. Example:
```
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<configuration>
<programs>
<program... |
283,484 | <p>Is there anything similar to getElementById in actionscript? </p>
<p>I'm trying to make a prototype of a flash page wich gets it's data from a xhtml file. I want to have both an accessible html version (for search engines, textreaders and people without flash) and a flash version (because the customer insists to us... | [
{
"answer_id": 283552,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": true,
"text": "<p>Since you said your input would be XHTML, you can do it with XPath:</p>\n\n<pre><code>import mx.xpath.XPathAPI;\n\nvar e... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26115/"
] | Is there anything similar to getElementById in actionscript?
I'm trying to make a prototype of a flash page wich gets it's data from a xhtml file. I want to have both an accessible html version (for search engines, textreaders and people without flash) and a flash version (because the customer insists to use flash ev... | Since you said your input would be XHTML, you can do it with XPath:
```
import mx.xpath.XPathAPI;
var elementId:String = "flashdataTitle";
var elementPath:String = "//h1[@id'" + elementId + "']";
found_elements = XPathAPI.selectNodeList(xhtml.firstChild, elementPath);
if (found_elements.length == 1) {
trace(found_... |
283,486 | <p>We are experiencing a strange bug on our website which we think is related to the software installed on user's computers. We have an e-mail link on a lot of pages, which is created using Javascript (so spambots won't get it).</p>
<p>It seems the link is "clicked" automatically on some user's machines. Some users th... | [
{
"answer_id": 283874,
"author": "Jeroen Heijmans",
"author_id": 30748,
"author_profile": "https://Stackoverflow.com/users/30748",
"pm_score": 0,
"selected": false,
"text": "<p>My only suggestion would indeed be that some program (browser, extension, bot, indexer) reads the page and then... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1606/"
] | We are experiencing a strange bug on our website which we think is related to the software installed on user's computers. We have an e-mail link on a lot of pages, which is created using Javascript (so spambots won't get it).
It seems the link is "clicked" automatically on some user's machines. Some users then discard... | Could something in the browser be prefetching the links? For example, the Firefox extension [Fasterfox](http://fasterfox.mozdev.org/) does that (which is the reason why I don't use it). I seem to remember Google at one time also had brought out a browser accelerator using the same concept. And the AVG antivirus' Linksc... |
283,492 | <p>I'm tring to build a library for simplifing late binding calls in C#, and I'm getting trouble tring with reference parameteres. I have the following method to add a parameter used in a method call</p>
<pre><code> public IInvoker AddParameter(ref object value)
{
//List<object> _parameters = new ... | [
{
"answer_id": 283499,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 1,
"selected": false,
"text": "<p>Your method isn't changing <code>value</code> anyway - why are you passing it by reference? It may make sense, but it... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10136/"
] | I'm tring to build a library for simplifing late binding calls in C#, and I'm getting trouble tring with reference parameteres. I have the following method to add a parameter used in a method call
```
public IInvoker AddParameter(ref object value)
{
//List<object> _parameters = new List<object>();
... | If the value is changing *inside the method*, you will need to declare a temp (`object`) variable to pass (`ref`) to the method, and unbox it yourself afterwards:
```
int i = 3;
//...
object obj = i;
Foo(ref obj);
i = (int)obj;
```
Note that this will not allow you to update the value after the e... |
283,513 | <p>We just shifted from VB to C# and I am having some troubles..!</p>
<p>Why can't I create a private static const void?? </p>
<p>why is it not working?</p>
<pre><code> private static const void MyVoid(void void)
{
try
{
this.void void = new void(void + void);
return this.void;
}
catch (voi... | [
{
"answer_id": 283517,
"author": "Rob Cooper",
"author_id": 832,
"author_profile": "https://Stackoverflow.com/users/832",
"pm_score": 2,
"selected": false,
"text": "<p><code>void</code> is the return type of <strong>\"there is no return type\"</strong>. It is not a type in itself (as in ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36864/"
] | We just shifted from VB to C# and I am having some troubles..!
Why can't I create a private static const void??
why is it not working?
```
private static const void MyVoid(void void)
{
try
{
this.void void = new void(void + void);
return this.void;
}
catch (void)
{
Response.Write... | C# doesn't let you declare a method to be `const` whatever its return type is, so your method declaration is incorrect.
You can't catch `void` either - you can only catch exception types.
Ditto void parameters etc.
Why do you think you need this? |
283,523 | <p>I have a C# application where i want to implement a logic for a programm which will open the word document and go to a certain place in the page and create a Table and put values in that. Can any one tell me how to implement this. I am using Visual studio 2005 </p>
| [
{
"answer_id": 283536,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>Look up \"Word Automation\".</p>\n\n<p>For example, <a href=\"http://support.microsoft.com/kb/316384\" rel=\"nofol... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a C# application where i want to implement a logic for a programm which will open the word document and go to a certain place in the page and create a Table and put values in that. Can any one tell me how to implement this. I am using Visual studio 2005 | Here is code to copy datagridview to a word table:
Reference is Microsoft.Office.Interop.Word
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office12\Microsoft.Office.Interop.Word.dll
```
using word = Microsoft.Office.Interop.Word;
public static void ExportToWord(DataGridV... |
283,525 | <p>This line:</p>
<pre><code>strcat(query,*it);
</code></pre>
<p>(where <code>*it</code> is an iterator to a string)</p>
<p>Keeps giving me this error:</p>
<blockquote>
<p>no matching function for call to ``strcat(char[200], const std::basic_string, std::allocator >&)`' </p>
</blockquote>
<p>I guess it's bec... | [
{
"answer_id": 283531,
"author": "tragomaskhalos",
"author_id": 31140,
"author_profile": "https://Stackoverflow.com/users/31140",
"pm_score": 3,
"selected": false,
"text": "<p><code>strcat(query,(*it).c_str())</code> should work. What's the runtime error? Are you sure that <code>query</c... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28462/"
] | This line:
```
strcat(query,*it);
```
(where `*it` is an iterator to a string)
Keeps giving me this error:
>
> no matching function for call to ``strcat(char[200], const std::basic\_string, std::allocator >&)`'
>
>
>
I guess it's because `strcat` takes in a `char*` while `*it` is a string.
How do I convert i... | `strcat(query,(*it).c_str())` should work. What's the runtime error? Are you sure that `query` is null-terminated before you make the call? |
283,537 | <p>Given a method signature:</p>
<pre><code>public bool AreTheSame<T>(Expression<Func<T, object>> exp1, Expression<Func<T, object>> exp2)
</code></pre>
<p>What would be the most efficient way to say if the two expressions are the same? This only needs to work for simple expressions, by t... | [
{
"answer_id": 283546,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 6,
"selected": true,
"text": "<p>Hmmm... I guess you'd have to parse the tree, checking the node-type and member of each. I'll knock up an example..... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32855/"
] | Given a method signature:
```
public bool AreTheSame<T>(Expression<Func<T, object>> exp1, Expression<Func<T, object>> exp2)
```
What would be the most efficient way to say if the two expressions are the same? This only needs to work for simple expressions, by this I mean all that would be "supported" would be simple... | Hmmm... I guess you'd have to parse the tree, checking the node-type and member of each. I'll knock up an example...
```
using System;
using System.Linq.Expressions;
class Test {
public string Foo { get; set; }
public string Bar { get; set; }
static void Main()
{
bool test1 = FuncTest<Test>.Fun... |
283,551 | <p>I am struggling with a creating a query. It is related to a large and complicated database but for the sake of this post I have boiled the problem down to something simpler.</p>
<p>I have three tables X, Y, Z defined as</p>
<pre><code>CREATE TABLE [dbo].[X](
[ID] [bigint] NOT NULL
)
CREATE TABLE [dbo].[Y](
[I... | [
{
"answer_id": 283586,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 0,
"selected": false,
"text": "<pre><code>SELECT\n COUNT(z.idx) count,\n x.id idx,\n y.id idy\nFROM\n (x CROSS JOIN y)\n LEFT JOIN z ON z.idx = x.id... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am struggling with a creating a query. It is related to a large and complicated database but for the sake of this post I have boiled the problem down to something simpler.
I have three tables X, Y, Z defined as
```
CREATE TABLE [dbo].[X](
[ID] [bigint] NOT NULL
)
CREATE TABLE [dbo].[Y](
[ID] [nchar](10) NOT NU... | ```
SELECT
(SELECT COUNT(*) FROM Z WHERE IDX = X.ID AND IDY = Y.ID),
X.ID,
Y.ID
FROM
X,Y
```
That's your answer... why do you possibly want that query, no clue :) |
283,556 | <p>I am trying to find the crc that works with the following results. The byte string consists of 2 bytes (ie. 0xCE1E) and the crc is an single byte (ie. 0x03)</p>
<pre>
byte crc
CE1E 03
CE20 45
CE22 6F
0000 C0
0001 D4
FFFF 95
</pre>
<p>Can anyone help?</p>
| [
{
"answer_id": 283643,
"author": "The Archetypal Paul",
"author_id": 21755,
"author_profile": "https://Stackoverflow.com/users/21755",
"pm_score": 2,
"selected": false,
"text": "<p>Assuming they are two byte (16 bit) values, I've tried a few on some online CRC generators without getting ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to find the crc that works with the following results. The byte string consists of 2 bytes (ie. 0xCE1E) and the crc is an single byte (ie. 0x03)
```
byte crc
CE1E 03
CE20 45
CE22 6F
0000 C0
0001 D4
FFFF 95
```
Can anyone help? | Assuming they are two byte (16 bit) values, I've tried a few on some online CRC generators without getting your results. So it looks like it's not a commonly used CRC algorithm.
Do you have any clues about the likely algorithm? Or is this a homework assignment and you're supposed to reverse-engineer the CRC algorithm/... |
283,561 | <p>Inspired by <a href="https://stackoverflow.com/questions/277106/looking-for-some-interesting-c-programming-problems">this question</a>, I wanted to try my hand at the latest <a href="http://domino.research.ibm.com/Comm/wwwr_ponder.nsf/Challenges/November2008.html" rel="nofollow noreferrer">ponder this challenge</a>,... | [
{
"answer_id": 283638,
"author": "Tomas Petricek",
"author_id": 33518,
"author_profile": "https://Stackoverflow.com/users/33518",
"pm_score": 4,
"selected": true,
"text": "<p>regarding your question about list traversal - you can start by writing a function that returns lists that repres... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11410/"
] | Inspired by [this question](https://stackoverflow.com/questions/277106/looking-for-some-interesting-c-programming-problems), I wanted to try my hand at the latest [ponder this challenge](http://domino.research.ibm.com/Comm/wwwr_ponder.nsf/Challenges/November2008.html), using F#
My approach is probably completely off c... | regarding your question about list traversal - you can start by writing a function that returns lists that represent the path - that's I think easier and it will be later easy to turn it into a function that returns a number.
This one takes a list as the first argument (path so far) and a tree and returns a list> type... |
283,575 | <p>I'm using the ReportViewer control to display a Report within a WebForm, i've also implemented the "Export to Excel" feature, by calling the Render method of the Server Report</p>
<p>eg</p>
<pre><code>ReportViewerControl.ServerReport.Render("Excel",etc,etc,etc);
</code></pre>
<p>My problem is that the exported re... | [
{
"answer_id": 283638,
"author": "Tomas Petricek",
"author_id": 33518,
"author_profile": "https://Stackoverflow.com/users/33518",
"pm_score": 4,
"selected": true,
"text": "<p>regarding your question about list traversal - you can start by writing a function that returns lists that repres... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30861/"
] | I'm using the ReportViewer control to display a Report within a WebForm, i've also implemented the "Export to Excel" feature, by calling the Render method of the Server Report
eg
```
ReportViewerControl.ServerReport.Render("Excel",etc,etc,etc);
```
My problem is that the exported report contains Hyperlinks that lin... | regarding your question about list traversal - you can start by writing a function that returns lists that represent the path - that's I think easier and it will be later easy to turn it into a function that returns a number.
This one takes a list as the first argument (path so far) and a tree and returns a list> type... |
283,589 | <p>is there a way to change an oracle user's default schema?</p>
<p>I found it in the FAQ that I can alter it in the session, but it's not what I want. E.G. the user at log on always sees another schema as default.</p>
<p>Thanks in advance.</p>
| [
{
"answer_id": 283814,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 6,
"selected": true,
"text": "<p>I believe a logon trigger should work:</p>\n\n<pre><code>CREATE OR REPLACE TRIGGER db_logon\nAFTER logon ON DATABAS... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11621/"
] | is there a way to change an oracle user's default schema?
I found it in the FAQ that I can alter it in the session, but it's not what I want. E.G. the user at log on always sees another schema as default.
Thanks in advance. | I believe a logon trigger should work:
```
CREATE OR REPLACE TRIGGER db_logon
AFTER logon ON DATABASE WHEN (USER = 'A')
BEGIN
execute immediate 'ALTER SESSION SET CURRENT_SCHEMA = B';
END;
``` |
283,594 | <p>I am adding membership-related schemas to an existing database (lets call it myDatabase) following <a href="https://web.archive.org/web/20210506052241/http://aspnet.4guysfromrolla.com/articles/040506-1.aspx" rel="nofollow noreferrer">those instructions</a>.</p>
<p>As a results the number of tables, views and stored... | [
{
"answer_id": 283682,
"author": "Jonas Lincoln",
"author_id": 17436,
"author_profile": "https://Stackoverflow.com/users/17436",
"pm_score": 0,
"selected": false,
"text": "<ol>\n<li>It's perfectly okay to use the same user/database as your application.</li>\n<li>I don't know, sorry. </li... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3241/"
] | I am adding membership-related schemas to an existing database (lets call it myDatabase) following [those instructions](https://web.archive.org/web/20210506052241/http://aspnet.4guysfromrolla.com/articles/040506-1.aspx).
As a results the number of tables, views and stored procedures are being created in myDatabase.
T... | I looked it up a bit,
1. The standard connection can be used
2. In terms of permissions it looks
like it is a matter of assigning the
database user to the
aspnet\_Membership\_FullAccess role ([other roles if you require privileges related to them](http://msdn.microsoft.com/en-us/library/ms164596(VS.80).aspx)) |
283,608 | <p>I have quite a large list of words in a txt file and I'm trying to do a regex find and replace in Notepad++. I need to add a string before each line and after each line.. So that:</p>
<pre>
wordone
wordtwo
wordthree
</pre>
<p>become</p>
<pre>
able:"wordone"
able:"wordtwo"
able:"wordthree"
</pre>
<p>How can I do ... | [
{
"answer_id": 283613,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 9,
"selected": true,
"text": "<p>Assuming alphanumeric words, you can use:</p>\n\n<pre><code>Search = ^([A-Za-z0-9]+)$\nReplace = able:\"\\1\"... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26823/"
] | I have quite a large list of words in a txt file and I'm trying to do a regex find and replace in Notepad++. I need to add a string before each line and after each line.. So that:
```
wordone
wordtwo
wordthree
```
become
```
able:"wordone"
able:"wordtwo"
able:"wordthree"
```
How can I do this? | Assuming alphanumeric words, you can use:
```
Search = ^([A-Za-z0-9]+)$
Replace = able:"\1"
```
Or, if you just want to highlight the lines and use "Replace All" & "In Selection" (with the same replace):
```
Search = ^(.+)$
```
`^` points to the start of the line.
`$` points to the end of the line.
`\1` will... |
283,632 | <p>I followed the commonly-linked tip for reducing an application to the system tray : <a href="http://www.developer.com/net/csharp/article.php/3336751" rel="noreferrer">http://www.developer.com/net/csharp/article.php/3336751</a> Now it works, but there is still a problem : my application is shown when it starts ; I wa... | [
{
"answer_id": 283640,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>If you are using a <code>NotifyIcon</code>, try changing ShowInTaskbar to false.</p>\n\n<p>To remove it from the A... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6776/"
] | I followed the commonly-linked tip for reducing an application to the system tray : <http://www.developer.com/net/csharp/article.php/3336751> Now it works, but there is still a problem : my application is shown when it starts ; I want it to start directly in the systray. I tried to minimize and hide it in the Load even... | In your main program you probably have a line of the form:
```
Application.Run(new Form1());
```
This will force the form to be shown. You will need to create the form but *not* pass it to `Application.Run`:
```
Form1 form = new Form1();
Application.Run();
```
Note that the program will now not terminate until yo... |
283,636 | <p>We need to set up a secure certificate on an Apache reverse proxy.
We've been advised that we need to use a virtual host directive.</p>
<p>I've looked these up in the O'Reilly book bit can't find any examples that pick up https specifically.</p>
<p>Does anyone have any examples of config snippets to do this?</p>
| [
{
"answer_id": 283663,
"author": "f4nt",
"author_id": 14838,
"author_profile": "https://Stackoverflow.com/users/14838",
"pm_score": 2,
"selected": false,
"text": "<p>Not sure if this is what you're after, but I used something like the following in the past:</p>\n\n<pre><code><IfModule... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39447/"
] | We need to set up a secure certificate on an Apache reverse proxy.
We've been advised that we need to use a virtual host directive.
I've looked these up in the O'Reilly book bit can't find any examples that pick up https specifically.
Does anyone have any examples of config snippets to do this? | I'm not exactly sure what you are asking for, but there are multiple things you need. For example, you need to get a SSL certificate, then you need to install mod\_ssl into your Apache. I suggest you install it using your system's package manager, etc..
This is an example virtualhost:
```
<VirtualHost IP.ADDRESS.HERE... |
283,645 | <p>I have a python list, say l</p>
<pre><code>l = [1,5,8]
</code></pre>
<p>I want to write a sql query to get the data for all the elements of the list, say</p>
<pre><code>select name from students where id = |IN THE LIST l|
</code></pre>
<p>How do I accomplish this?</p>
| [
{
"answer_id": 283706,
"author": "gimel",
"author_id": 6491,
"author_profile": "https://Stackoverflow.com/users/6491",
"pm_score": 4,
"selected": false,
"text": "<p><a href=\"http://docs.python.org/library/stdtypes.html#str.join\" rel=\"nofollow noreferrer\">string.join</a> the list valu... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2220518/"
] | I have a python list, say l
```
l = [1,5,8]
```
I want to write a sql query to get the data for all the elements of the list, say
```
select name from students where id = |IN THE LIST l|
```
How do I accomplish this? | Answers so far have been templating the values into a plain SQL string. That's absolutely fine for integers, but if we wanted to do it for strings we get the escaping issue.
Here's a variant using a parameterised query that would work for both:
```python
placeholder= '?' # For SQLite. See DBAPI paramstyle.
placeholde... |
283,646 | <p>I have just converted a project from Visual Studio 2003 to 2005 and although most of it 'converted' fine, I have a series of STL errors from the following line:</p>
<pre><code>void SomeFn( std::vector<CSomeObject*>::iterator it,
std::vector<CSomeObject*>::iterator itBegin = NULL,
std::vector<CSomeObj... | [
{
"answer_id": 283660,
"author": "Sunlight",
"author_id": 33650,
"author_profile": "https://Stackoverflow.com/users/33650",
"pm_score": 2,
"selected": false,
"text": "<p>In 2003, <code>std::vector<T>::iterator</code> is just <code>T *</code>. In 2005, at least in debug mode, it is ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | I have just converted a project from Visual Studio 2003 to 2005 and although most of it 'converted' fine, I have a series of STL errors from the following line:
```
void SomeFn( std::vector<CSomeObject*>::iterator it,
std::vector<CSomeObject*>::iterator itBegin = NULL,
std::vector<CSomeObject*>::iterator itEnd = NULL ... | Your program is incorrect as NULL cannot be converted as an iterator. I don't really know what you want these iterators to be initialized as. If you need an iterator guarantied not to be in a container but to be still "valid", you can use a default-constructor:
```
typedef std::vector<CSomeObject*> myvector_t;
void So... |
283,661 | <p>Since a few days ago, MySQL server on my Windows machine was not successful on closing itself. I found multiple instance of these lines in the MySQL error log:</p>
<pre><code>InnoDB: Operating system error number 32 in a file operation.
InnoDB: The error means that another program is using InnoDB's files.
InnoDB: Th... | [
{
"answer_id": 283668,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 5,
"selected": true,
"text": "<p>If the file is in use by another program then <a href=\"http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx\" rel... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8404/"
] | Since a few days ago, MySQL server on my Windows machine was not successful on closing itself. I found multiple instance of these lines in the MySQL error log:
```
InnoDB: Operating system error number 32 in a file operation.
InnoDB: The error means that another program is using InnoDB's files.
InnoDB: This might be a... | If the file is in use by another program then [Process Explorer](http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) could help you track down which one has it open. I assume you've checked you only have one copy of MySQL running. |
283,672 | <p>I have a user who gets an error from ajax calls on our site.</p>
<p>The error is pasted below. </p>
<p>They get the error in FF3 Windows, but not IE.</p>
<p>Based on some searching it seems this issue is often caused by the client protocol squid (you'll notice at the end of the error, squid is mentioned).</p>
<p... | [
{
"answer_id": 283686,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 2,
"selected": false,
"text": "<p>Save yourself some time and use <a href=\"http://jquery.com/\" rel=\"nofollow noreferrer\">jQuery</a>. It has an abstraction... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a user who gets an error from ajax calls on our site.
The error is pasted below.
They get the error in FF3 Windows, but not IE.
Based on some searching it seems this issue is often caused by the client protocol squid (you'll notice at the end of the error, squid is mentioned).
My ajax code is the same used ... | Save yourself some time and use [jQuery](http://jquery.com/). It has an abstraction for ajax, which works in all browsers and not just Internet Explorer, and maybe FF. ;-) I am assuming that the code up there is old and didn't get an update in a long while.
A simple ajax call in jQuery is as follows:
```
$.post(
'/... |
283,701 | <p>What are best practices with regards to C and C++ coding standards? Should developers be allowed to willy-nilly mix them together. Are there any complications when linking C and C++ object files.</p>
<p>Should things like socket libraries that traditionally is written in C remain in C and kept in seperate source ... | [
{
"answer_id": 283716,
"author": "Graeme Perrow",
"author_id": 1821,
"author_profile": "https://Stackoverflow.com/users/1821",
"pm_score": 3,
"selected": false,
"text": "<p>The biggest issue is calling a C function from C++ code or vice versa. In that case, you want to make sure you mark... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7362/"
] | What are best practices with regards to C and C++ coding standards? Should developers be allowed to willy-nilly mix them together. Are there any complications when linking C and C++ object files.
Should things like socket libraries that traditionally is written in C remain in C and kept in seperate source files? That ... | The biggest issue is calling a C function from C++ code or vice versa. In that case, you want to make sure you mark the function as having "C" linkage using `extern "C"`. You can do this in the header file directly using:
```
#if defined( __cplusplus )
extern "C" {
#endif
extern int myfunc( const char *param, int ano... |
283,707 | <p>Is there a way to find the size of a file object that is currently open?</p>
<p>Specifically, I am working with the tarfile module to create tarfiles, but I don't want my tarfile to exceed a certain size. As far as I know, tarfile objects are file-like objects, so I imagine a generic solution would work.</p>
| [
{
"answer_id": 283718,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 3,
"selected": false,
"text": "<p>If you have the file descriptor, you can use <code>fstat</code> to find out the size, if any. A more generic solution is ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36312/"
] | Is there a way to find the size of a file object that is currently open?
Specifically, I am working with the tarfile module to create tarfiles, but I don't want my tarfile to exceed a certain size. As far as I know, tarfile objects are file-like objects, so I imagine a generic solution would work. | ```
$ ls -la chardet-1.0.1.tgz
-rwxr-xr-x 1 vinko vinko 179218 2008-10-20 17:49 chardet-1.0.1.tgz
$ python
Python 2.5.1 (r251:54863, Jul 31 2008, 22:53:39)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open('chardet-1.0.1.tgz','rb')
>>> f.se... |
283,727 | <p>I've spent hours trying to get my code to work, its a rats nest of if/elses. Basically I want to check a country name against these two arrays:</p>
<pre><code>//if its in this array add a 'THE'
$keywords = array("bahamas","island","kingdom","republic","maldives","netherlands",
"isle of man","i... | [
{
"answer_id": 283739,
"author": "alxp",
"author_id": 19513,
"author_profile": "https://Stackoverflow.com/users/19513",
"pm_score": 1,
"selected": false,
"text": "<p>The easiest would be to split it into two steps, ad the \"the\" for the countries that match the first list, and then just... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26107/"
] | I've spent hours trying to get my code to work, its a rats nest of if/elses. Basically I want to check a country name against these two arrays:
```
//if its in this array add a 'THE'
$keywords = array("bahamas","island","kingdom","republic","maldives","netherlands",
"isle of man","ivory","philipp... | This builds on @sgehrig's answer, but note the change in your exceptions:
```
//if its in this array add a 'THE'
$keywords = array("bahamas","island","kingdom","republic","maldives","netherlands",
"isle of man","ivory","philippines","seychelles","usa");
//if its in this array, take THE off!
$exce... |
283,728 | <p>I need to create a BAT file to run an application through telnet, but as far as I know there is no way to do this on DOS. Telnet does not allow any command to be sent to the remote machine at the very instant of the connection, and each subsequent command in the BAT file would only be executed after telnet stops. Th... | [
{
"answer_id": 283741,
"author": "Frank Grimm",
"author_id": 903,
"author_profile": "https://Stackoverflow.com/users/903",
"pm_score": 2,
"selected": false,
"text": "<p>Using telnet in the way you want to is imho not possible.</p>\n\n<p>You could you secure shell (ssh), but a ssh server ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36183/"
] | I need to create a BAT file to run an application through telnet, but as far as I know there is no way to do this on DOS. Telnet does not allow any command to be sent to the remote machine at the very instant of the connection, and each subsequent command in the BAT file would only be executed after telnet stops. This ... | give [expect](http://expect.nist.gov/#windows) a try
from the webpage:
>
> Expect is a tool for automating
> interactive applications such as
> **telnet**, ftp, passwd, fsck, rlogin,
> tip, etc. Expect really makes this
> stuff trivial. Expect is also useful
> for testing these same applications.
>
>
> |
283,737 | <p>I have an ASP.NET 1.1 application that uses the following code to write out a file in the response:</p>
<pre><code>Dim objStream As Object
objStream = Server.CreateObject("ADODB.Stream")
objStream.open()
objStream.type = 1
objStream.loadfromfile(localfile)
Response.BinaryWrite(objStream.read)
</code></pre>
<p>This... | [
{
"answer_id": 288829,
"author": "Malik Daud Ahmad Khokhar",
"author_id": 1688440,
"author_profile": "https://Stackoverflow.com/users/1688440",
"pm_score": -1,
"selected": false,
"text": "<p>So the images that are being served by Asp.Net are tiff files. And it says <a href=\"http://forum... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1688440/"
] | I have an ASP.NET 1.1 application that uses the following code to write out a file in the response:
```
Dim objStream As Object
objStream = Server.CreateObject("ADODB.Stream")
objStream.open()
objStream.type = 1
objStream.loadfromfile(localfile)
Response.BinaryWrite(objStream.read)
```
This code is called by a pop u... | I have a code like this for download files from server:
```
strFilename = Server.MapPath("/App_Upload/" & strFilename)
With Response
.AddHeader("Content-Type", "binary/octet-stream")
.AddHeader("Content-Disposition", "attachment; filename=" & strFilename & ";")
.WriteFile(strFilename)
.End()
End With... |
283,740 | <p>I am using the Zend Framework.</p>
<p>I have a controller named 'UserController' that has a public function displayAction().</p>
<p>I would like to know how I can get that action method to use a different viewer than the default display.phtml.</p>
<p>Any help is appreciated.</p>
| [
{
"answer_id": 283784,
"author": "Aron Rotteveel",
"author_id": 11568,
"author_profile": "https://Stackoverflow.com/users/11568",
"pm_score": 5,
"selected": true,
"text": "<p>You can use </p>\n\n<pre><code>$this->render('actionName');\n</code></pre>\n\n<p>or, alternatively, you can ca... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15052/"
] | I am using the Zend Framework.
I have a controller named 'UserController' that has a public function displayAction().
I would like to know how I can get that action method to use a different viewer than the default display.phtml.
Any help is appreciated. | You can use
```
$this->render('actionName');
```
or, alternatively, you can call a view script directly by calling
```
$this->renderScript('path/to/viewscript.phtml');
```
For more information, you can take a look at <http://framework.zend.com/manual/en/zend.controller.actionhelpers.html>, specifically the parts... |
283,749 | <p>At work, I'm frequently working on projects where numerous properties of certain objects have to be set during their construction or early during their lifetime. For the sake of convenience and readability, I often use the <code>With</code> statement to set these properties. I find that</p>
<pre><code>With Me.Eleme... | [
{
"answer_id": 283785,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>Where it makes the code genuinely more readable, go for it. Where it makes it <em>less</em> readable, avoid it - in p... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20/"
] | At work, I'm frequently working on projects where numerous properties of certain objects have to be set during their construction or early during their lifetime. For the sake of convenience and readability, I often use the `With` statement to set these properties. I find that
```
With Me.Elements
.PropertyA = True... | If you have long variablenames and would end up with:
```
UserHandler.GetUser.First.User.FirstName="Stefan"
UserHandler.GetUser.First.User.LastName="Karlsson"
UserHandler.GetUser.First.User.Age="39"
UserHandler.GetUser.First.User.Sex="Male"
UserHandler.GetUser.First.User.Occupation="Programmer"
UserHandler.GetUser.Fir... |
283,751 | <p>I have the problem, that PHP replaces all spaces with underscores in POST and GET variables.</p>
<p>For example if I have the URL: <code>http://localhost/proxy.php?user name=Max</code>
the browser will convert it to <code>http://localhost/proxy.php?user%20name=Max</code>.</p>
<p>But if I give the $_GET parameters ou... | [
{
"answer_id": 283778,
"author": "Fred",
"author_id": 33630,
"author_profile": "https://Stackoverflow.com/users/33630",
"pm_score": 1,
"selected": false,
"text": "<p>As far as i can remember, i've never seen spaces in URL parameter names...</p>\n\n<p>I think, it would be better to conver... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30724/"
] | I have the problem, that PHP replaces all spaces with underscores in POST and GET variables.
For example if I have the URL: `http://localhost/proxy.php?user name=Max`
the browser will convert it to `http://localhost/proxy.php?user%20name=Max`.
But if I give the $\_GET parameters out, the key is not `user name` but `u... | From the [PHP manual](http://www.php.net/manual/en/language.variables.external.php):
>
> Dots in incoming variable names
>
>
> Typically, PHP does not alter the
> names of variables when they are
> passed into a script. However, it
> should be noted that the dot (period,
> full stop) is not a valid character in... |
283,752 | <p>I'm automating a web application (the Mantis bug tracker) and I'm getting an interesting response header from it, called Refresh:</p>
<pre><code>HTTP/1.x 200 OK
...
Refresh: 0;url=my_view_page.php
</code></pre>
<p>It seems to be acting the same way that <a href="http://en.wikipedia.org/wiki/Meta_refresh" rel="nore... | [
{
"answer_id": 283776,
"author": "Loki",
"author_id": 17324,
"author_profile": "https://Stackoverflow.com/users/17324",
"pm_score": 5,
"selected": false,
"text": "<p>from the W3C HTML 4.01 specification, quote:</p>\n<blockquote>\n<p>META and HTTP headers</p>\n<p>The http-equiv attribute ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15109/"
] | I'm automating a web application (the Mantis bug tracker) and I'm getting an interesting response header from it, called Refresh:
```
HTTP/1.x 200 OK
...
Refresh: 0;url=my_view_page.php
```
It seems to be acting the same way that [meta refresh](http://en.wikipedia.org/wiki/Meta_refresh) does, and the meta refresh te... | As far as I know, Refresh (along with Set-Cookie and possibly some other proprietary pseudo-headers) were created by Netscape in the very early days of the internet and have been basically (but not quite) standard since then. Because just about every browser supports it, Refresh is pretty safe to use -- and commonly is... |
283,759 | <p>I'm converting my applications to Delphi 2009 and faced an intriguing issue with some calls that need to convert a string (wide) to AnsiString.</p>
<p>Here's an example to demonstrate the issue I'm having:</p>
<pre><code>var
s: PAnsiChar;
...
s := PAnsiChar(Application.ExeName);
</code></pre>
<p>With Delphi 2... | [
{
"answer_id": 283773,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 6,
"selected": true,
"text": "<p>I have no Delphi 2009 here, so I can't check it. But maybe you have to try:</p>\n\n<pre><code>s := PAnsiChar(AnsiSt... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36544/"
] | I'm converting my applications to Delphi 2009 and faced an intriguing issue with some calls that need to convert a string (wide) to AnsiString.
Here's an example to demonstrate the issue I'm having:
```
var
s: PAnsiChar;
...
s := PAnsiChar(Application.ExeName);
```
With Delphi 2007 and previous versions, s := P... | I have no Delphi 2009 here, so I can't check it. But maybe you have to try:
```
s := PAnsiChar(AnsiString(Application.ExeName));
```
As gabr already pointed, this is not a very good practice, and you will only use it if you are 100% sure. The string only contains characters that have a direct mapping to the ANSI ran... |
283,763 | <p>I am reading a .csv file and returning its lines in string array. One of the members is manufacturer, for which I have Toyota, Ford, etc.</p>
<p>I want to sort an array (Can be another collection) of the rows, by the value in manufacturer and alphabetical order.</p>
<p>So I'd have:</p>
<pre><code>28437 Ford Fiest... | [
{
"answer_id": 283771,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>What version of .NET are you using? If you're using 3.5 - or can use C# 3.0 and <a href=\"http://www.albahari.com/nut... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32484/"
] | I am reading a .csv file and returning its lines in string array. One of the members is manufacturer, for which I have Toyota, Ford, etc.
I want to sort an array (Can be another collection) of the rows, by the value in manufacturer and alphabetical order.
So I'd have:
```
28437 Ford Fiesta
328 Honda Civic
34949 To... | What version of .NET are you using? If you're using 3.5 - or can use C# 3.0 and [LINQBridge](http://www.albahari.com/nutshell/linqbridge.aspx) - then I'd definitely go with LINQ. First transform each line into some appropriate object, and then use OrderBy:
```
var cars = lines.Select(line => Car.ParseLine(line))
... |
283,764 | <p>In a SQL Server database, I record people's date of birth. Is there an straight-forward method of working out the person's age on a given date using SQL only? </p>
<p>Using <strong>DATEDIFF(YEAR, DateOfBirth, GETDATE())</strong> does not work as this only looks at the year part of the date. For example <strong>DATE... | [
{
"answer_id": 283780,
"author": "scable",
"author_id": 8942,
"author_profile": "https://Stackoverflow.com/users/8942",
"pm_score": 6,
"selected": true,
"text": "<p>Check out this article: <a href=\"http://www.kodyaz.com/articles/calculate-age-sql-code.aspx\" rel=\"noreferrer\">How to ca... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7585/"
] | In a SQL Server database, I record people's date of birth. Is there an straight-forward method of working out the person's age on a given date using SQL only?
Using **DATEDIFF(YEAR, DateOfBirth, GETDATE())** does not work as this only looks at the year part of the date. For example **DATEDIFF(YEAR, '31 December 2007'... | Check out this article: [How to calculate age of a person using SQL codes](http://www.kodyaz.com/articles/calculate-age-sql-code.aspx)
Here is the code from the article:
```
DECLARE @BirthDate DATETIME
DECLARE @CurrentDate DATETIME
SELECT @CurrentDate = '20070210', @BirthDate = '19790519'
SELECT DATEDIFF(YY, @Birth... |
283,766 | <p>I have an application that imports data from a pickled file. It works just fine in Windows but Mac and Linux behaviour is odd.</p>
<p>In OS X, the pickled file (file extension ".char") is unavailable as a selection unless I set the file type to *.*. Then, if I select a file that has the .char extension, it won't lo... | [
{
"answer_id": 283802,
"author": "Adam Byrtek",
"author_id": 36656,
"author_profile": "https://Stackoverflow.com/users/36656",
"pm_score": 4,
"selected": true,
"text": "<p>Probably you didn't open the file in binary mode when writing and/or reading the pickled data. In this case newline ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18676/"
] | I have an application that imports data from a pickled file. It works just fine in Windows but Mac and Linux behaviour is odd.
In OS X, the pickled file (file extension ".char") is unavailable as a selection unless I set the file type to \*.\*. Then, if I select a file that has the .char extension, it won't load, givi... | Probably you didn't open the file in binary mode when writing and/or reading the pickled data. In this case newline format conversion will occur, which can break the binary data.
To open a file in binary mode you have to provide "b" as part of the mode string:
```
char_file = open('pickle.char', 'rb')
``` |
283,816 | <p>I'm working now together with others in a grails project. I have to write some Java-classes. But I need access to an searchable object created with groovy. It seems, that this object has to be placed in the default-package. </p>
<p>My question is: <strong>Is there a way to access this object in the default-package ... | [
{
"answer_id": 283828,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 8,
"selected": true,
"text": "<p><a href=\"http://mindprod.com/jgloss/import.html\" rel=\"noreferrer\">You can’t use</a> classes in the default package from a... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21005/"
] | I'm working now together with others in a grails project. I have to write some Java-classes. But I need access to an searchable object created with groovy. It seems, that this object has to be placed in the default-package.
My question is: **Is there a way to access this object in the default-package from a Java-clas... | [You can’t use](http://mindprod.com/jgloss/import.html) classes in the default package from a named package.
(*Technically* you can, as shown in Sharique Abdullah's [answer](https://stackoverflow.com/a/561183/6309) through reflection API, *but* classes from the unnamed namespace are **not in scope** in an **import d... |
283,821 | <p>Does anyone know if there is an implementation of <code>javax.jms.QueueConnectionFactory</code> for WebSphere MQ and where to get it? I Googled it and searched IBM website but couldn't find anything. I don't want to retrieve the connection or factory from Websphere MQ via JNDI, I need my own connection factory.</p>
| [
{
"answer_id": 283839,
"author": "Stroboskop",
"author_id": 23428,
"author_profile": "https://Stackoverflow.com/users/23428",
"pm_score": 4,
"selected": true,
"text": "<p>I think you need three jars</p>\n\n<pre><code>com.ibm.mq.jar\ncom.ibm.mqbind.jar\ncom.ibm.mqjms.jar\n</code></pre>\n\... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4688/"
] | Does anyone know if there is an implementation of `javax.jms.QueueConnectionFactory` for WebSphere MQ and where to get it? I Googled it and searched IBM website but couldn't find anything. I don't want to retrieve the connection or factory from Websphere MQ via JNDI, I need my own connection factory. | I think you need three jars
```
com.ibm.mq.jar
com.ibm.mqbind.jar
com.ibm.mqjms.jar
```
You instantiate a *MQQueueConnectionFactory* and i hope you can take it from there.
And here's more info:
[IBMs HOWTO](http://www.ibm.com/developerworks/websphere/techjournal/0502_woolf/0502_woolf.html)
Oh, and MQ can do "real"... |
283,824 | <p>I can't figure out why the following wont work, any ideas??
public interface IFieldSimpleItem
{ }</p>
<pre><code>public interface IFieldNormalItem : IFieldSimpleItem
{ }
public class Person
{
public virtual T Create<T>()
where T : IFieldSimpleItem
{
return default(T);
}
}
... | [
{
"answer_id": 283837,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 1,
"selected": false,
"text": "<p>I think the problem is that you override a previously defined method. So effectively you try to change the definition of ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30572/"
] | I can't figure out why the following wont work, any ideas??
public interface IFieldSimpleItem
{ }
```
public interface IFieldNormalItem : IFieldSimpleItem
{ }
public class Person
{
public virtual T Create<T>()
where T : IFieldSimpleItem
{
return default(T);
}
}
public class Bose : Perso... | I'm pretty sure you're out of luck as far as using the compiler and generics to save you some runtime checks. You can't override something that doesn't already exist, and you can't have different return types to the same methods.
I can't say I completely understand your motivation, but it has technical merit.
My fir... |
283,835 | <p>I am trying to establish a basic .NET Remoting communication between 2x 64bit windows machines. If Machine1 is acting as client and Machine2 as server, then everything works fine. The other way around the following exception occurs:</p>
<p>System.Net.Sockets.SocketException: No connection could be made because the ... | [
{
"answer_id": 283843,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 4,
"selected": false,
"text": "<p>Windows Firewall? (Question author says this is not it.)</p>\n\n<p>To track down connection issues the standard approac... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35061/"
] | I am trying to establish a basic .NET Remoting communication between 2x 64bit windows machines. If Machine1 is acting as client and Machine2 as server, then everything works fine. The other way around the following exception occurs:
System.Net.Sockets.SocketException: No connection could be made because the target mac... | Assuming that the same binaries/configs work one-way but not the other would tell me something amiss in the networking side of the house to start with.
* You're using IP addresses - double check the bound addresses on target machine against config/code with IPCONFIG /ALL.
* Does the "server" machine have multiple NIC... |
283,858 | <p>I have an XML input file and I'm trying to output the result of a call like: </p>
<pre><code><xsl:value-of select="Some/Value"/>
</code></pre>
<p>into an attribute. </p>
<pre><code><Output Attribute="Value should be put here"/>
</code></pre>
<p>My problem is, since I'm outputting XML, the XSL pro... | [
{
"answer_id": 283868,
"author": "Phil Ross",
"author_id": 5981,
"author_profile": "https://Stackoverflow.com/users/5981",
"pm_score": 5,
"selected": false,
"text": "<p>You can use an xsl:attribute element:</p>\n\n<pre><code><Output>\n <xsl:attribute name=\"Attribute\">\n ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143/"
] | I have an XML input file and I'm trying to output the result of a call like:
```
<xsl:value-of select="Some/Value"/>
```
into an attribute.
```
<Output Attribute="Value should be put here"/>
```
My problem is, since I'm outputting XML, the XSL processor won't allow me to write:
```
<Output Attribute="<xsl:v... | The easiest way is to use [attribute value templates](http://www.w3.org/TR/xslt.html#dt-attribute-value-template), like this:
```
<Output Attribute="{Some/Value}"/>
``` |
283,869 | <p>I'm trying to add a new node to an jQuery <a href="http://news.kg/wp-content/uploads/tree/" rel="nofollow noreferrer">SimpleTree</a>, but all I seem to be able to get is "sTC.addNode is not a function"... </p>
<pre><code>var simpleTreeCollection = $('.simpleTree').simpleTree({
animate:true,
drag:false,
... | [
{
"answer_id": 283914,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": 1,
"selected": false,
"text": "<p>hmm tricky one this and I have to say I dont like the plugin as it uses numerics as id's and w3c states \"The attribute... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/999/"
] | I'm trying to add a new node to an jQuery [SimpleTree](http://news.kg/wp-content/uploads/tree/), but all I seem to be able to get is "sTC.addNode is not a function"...
```
var simpleTreeCollection = $('.simpleTree').simpleTree({
animate:true,
drag:false,
autoclose: false,
afterClick:function(node){},
... | Maybe take a look at [jsTree](http://www.jstree.com/jsTree/examples/) |
283,891 | <p>How can I access the WCF Service through JavaScript?
My problem is, I have to access the operation contracts through the JavaScript (my website is not Ajax enabled).<br>
Previously for calling .asmx web services,
I am using the following code snippet</p>
<pre><code>var xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")... | [
{
"answer_id": 283921,
"author": "user32415",
"author_id": 32415,
"author_profile": "https://Stackoverflow.com/users/32415",
"pm_score": 2,
"selected": false,
"text": "<p>By using XMLHTTP you ARE using ajax.</p>\n\n<p>There's a full example here:</p>\n\n<p><a href=\"http://www.west-wind.... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I access the WCF Service through JavaScript?
My problem is, I have to access the operation contracts through the JavaScript (my website is not Ajax enabled).
Previously for calling .asmx web services,
I am using the following code snippet
```
var xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp.open(... | By using XMLHTTP you ARE using ajax.
There's a full example here:
[jQuery AJAX calls to a WCF REST Service](http://www.west-wind.com/weblog/posts/324917.aspx) |
283,893 | <p>To support multiple platforms in C/C++, one would use the preprocessor to enable conditional compiles. E.g.,</p>
<pre><code>#ifdef _WIN32
#include <windows.h>
#endif
</code></pre>
<p>How can you do this in Ada? Does Ada have a preprocessor?</p>
| [
{
"answer_id": 283920,
"author": "David Allan Finch",
"author_id": 27417,
"author_profile": "https://Stackoverflow.com/users/27417",
"pm_score": 2,
"selected": false,
"text": "<p>No but the CPP preprocessor or m4 can be called on any file on the command line or using a building tool like... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14069/"
] | To support multiple platforms in C/C++, one would use the preprocessor to enable conditional compiles. E.g.,
```
#ifdef _WIN32
#include <windows.h>
#endif
```
How can you do this in Ada? Does Ada have a preprocessor? | The answer to your question is no, Ada does not have a pre-processor that is built into the language. That means each compiler may or may not have one and there is not "uniform" syntax for pre-processing and things like conditional compilation. This was intentional: it's considered "harmful" to the Ada ethos.
There ar... |
283,894 | <p>Have you ever tried this feedback calling an external zip.py script to work? My CGITB does not show any error messages. It simply did not invoke external .py script to work. It simply skipped over to gush. I should be grateful if you can assist me in making this zip.py callable in feedback.py. </p>
<p>Regards. Da... | [
{
"answer_id": 284199,
"author": "jfs",
"author_id": 4279,
"author_profile": "https://Stackoverflow.com/users/4279",
"pm_score": 1,
"selected": false,
"text": "<ul>\n<li><p><code>zip()</code> is a built-in function in Python. Therefore it is a bad practice to use <code>zip</code> as a va... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36900/"
] | Have you ever tried this feedback calling an external zip.py script to work? My CGITB does not show any error messages. It simply did not invoke external .py script to work. It simply skipped over to gush. I should be grateful if you can assist me in making this zip.py callable in feedback.py.
Regards. David
```
#*... | * `zip()` is a built-in function in Python. Therefore it is a bad practice to use `zip` as a variable name. `zip_` can be used instead of.
* `execfile()` function reads and executes a Python script.
* It is probably that you actually need just `import zip_` in feedback.py instead of `execfile()`. |
283,925 | <p>Ok so I have an abstract base class called Product, a KitItem class that inherits Product and a PackageKitItem class that inherits KitItem. ie.</p>
<pre><code>Product
KitItem : Product
PackageKitItem : KitItem
</code></pre>
<p>I have my KitItems loaded and I need to load up a collection of PackageKitItems which ar... | [
{
"answer_id": 284021,
"author": "Leonardo Herrera",
"author_id": 7841,
"author_profile": "https://Stackoverflow.com/users/7841",
"pm_score": 0,
"selected": false,
"text": "<p>In your Product constructor you are already doing some form of shallow copy, aren't you? If you haven't overwrit... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12862/"
] | Ok so I have an abstract base class called Product, a KitItem class that inherits Product and a PackageKitItem class that inherits KitItem. ie.
```
Product
KitItem : Product
PackageKitItem : KitItem
```
I have my KitItems loaded and I need to load up a collection of PackageKitItems which are, effectively, shallow co... | The problem you have is that since ShallowCopy() is a member of KitItem, MemberwiseClone() is just copying the KitItem fields and returning a KitItem even if the original object is a PackageKitItem.
I think what you have to do in this circumstance add to KitItem:
```
public virtual KitItem ShallowCopy()
{ ... |
283,931 | <p>Could somebody please explain to me what happens here?<br>
I am creating a binding in code. </p>
<p>The target object is a UserControl<br>
The target property is a boolean DependencyProperty<br>
The source object is a FrameworkElement and implements INotifyPropertyChanged<br>
The source property is of type Observa... | [
{
"answer_id": 284303,
"author": "jarda",
"author_id": 6601,
"author_profile": "https://Stackoverflow.com/users/6601",
"pm_score": 3,
"selected": true,
"text": "<p>Alright, I found the answer myself. This is a bug in Silverlight..</p>\n\n<p>The code that does the following </p>\n\n<pre>... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601/"
] | Could somebody please explain to me what happens here?
I am creating a binding in code.
The target object is a UserControl
The target property is a boolean DependencyProperty
The source object is a FrameworkElement and implements INotifyPropertyChanged
The source property is of type ObservableCollection
... | Alright, I found the answer myself. This is a bug in Silverlight..
The code that does the following
```
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
```
must be directly on the class that you bind to, not on its ancestor. I had it inside a FireProp... |
283,943 | <p>I have a list of strings displayed by a Silverlight ItemsControl. The DataTemplate is a Border control with a TextBlock as its child. How can I access the border control corresponding to an item? For example, I might want to do this to change the background color.</p>
| [
{
"answer_id": 283972,
"author": "jarda",
"author_id": 6601,
"author_profile": "https://Stackoverflow.com/users/6601",
"pm_score": 0,
"selected": false,
"text": "<p>You can override the ItemsControl.GetContainerForItemOverride method and save the object-container pairs in a dictionary.</... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a list of strings displayed by a Silverlight ItemsControl. The DataTemplate is a Border control with a TextBlock as its child. How can I access the border control corresponding to an item? For example, I might want to do this to change the background color. | An easier way to do this is to grab the Parent of the textblock and cast it as a Border. Here is a quick example of this:
Xaml
```
<Grid>
<ItemsControl x:Name="items">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border>
<TextBlock MouseEnter="TextBlock_Mouse... |
283,950 | <p>When looking at C# code, I often see patterns like this:</p>
<pre><code>DataType[] items = GetSomeItems();
OtherDataType[] itemProps = new OtherDataType[items.Length];
int i = 0;
foreach (DataType item in items)
{
// Do some stuff with item, then finally
itemProps[i] = item.Prop;
i++;
}
</code></pre>
... | [
{
"answer_id": 283966,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<p>In this case, I don't think so. Sometimes, though, the collection doesn't implement <code>this[int index]</code> bu... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2576/"
] | When looking at C# code, I often see patterns like this:
```
DataType[] items = GetSomeItems();
OtherDataType[] itemProps = new OtherDataType[items.Length];
int i = 0;
foreach (DataType item in items)
{
// Do some stuff with item, then finally
itemProps[i] = item.Prop;
i++;
}
```
The for-loop iterates o... | If you are using C# 3.0 that will be better;
```
OtherDataType[] itemProps = items.Select(i=>i.Prop).ToArray();
``` |
283,951 | <p>This may be a painfully simply question for which I will be mocked but I am having difficulty in using filepaths in master pages. I believe this is because if a page in a sub-directory to using the master page then the filepath is incorrect.</p>
<p>To fix this I need to get the filepath from the root but I can't see... | [
{
"answer_id": 283976,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 3,
"selected": true,
"text": "<p>I'm just assuming by filepath, you actually mean url (or uri, I forget which one is partial).</p>\n\n<p>Without the ~,... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35454/"
] | This may be a painfully simply question for which I will be mocked but I am having difficulty in using filepaths in master pages. I believe this is because if a page in a sub-directory to using the master page then the filepath is incorrect.
To fix this I need to get the filepath from the root but I can't seem to get ... | I'm just assuming by filepath, you actually mean url (or uri, I forget which one is partial).
Without the ~, the first example should work. `<script type="text/javascript" src="/jQueryScripts/jquery.js"></script>` would cause the browser to request <http://www.example.com/jQueryScripts/jquery.js> (where www.example.co... |
283,956 | <p>If for example you follow the link:</p>
<p><code>data:application/octet-stream;base64,SGVsbG8=</code></p>
<p>The browser will prompt you to download a file consisting of the data held as base64 in the hyperlink itself. Is there any way of suggesting a default name in the markup? If not, is there a JavaScript sol... | [
{
"answer_id": 283982,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 5,
"selected": false,
"text": "<p>According to <a href=\"https://www.rfc-editor.org/rfc/rfc2397\" rel=\"nofollow noreferrer\">RFC 2397</a>, no, there isn't... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If for example you follow the link:
`data:application/octet-stream;base64,SGVsbG8=`
The browser will prompt you to download a file consisting of the data held as base64 in the hyperlink itself. Is there any way of suggesting a default name in the markup? If not, is there a JavaScript solution? | Use the `download` attribute:
```
<a download='FileName' href='your_url'>
```
[The `download` attribute works on](http://caniuse.com/#search=download) Chrome, Firefox, Edge, Opera, desktop Safari 10+, iOS Safari 13+, and not IE11. |
283,961 | <p>I have a problem when I try to center the div block "products" because I don't know in advance the div width. Anybody have a solution?</p>
<p>Update: The problem I have is I don't know how many products I'll display, I can have 1, 2 or 3 products, I can center them if it was a fixed number as I'd know the width of... | [
{
"answer_id": 283974,
"author": "Arief",
"author_id": 34096,
"author_profile": "https://Stackoverflow.com/users/34096",
"pm_score": -1,
"selected": false,
"text": "<p>add this css to your product_container class</p>\n\n<pre><code> margin: 0px auto;\n padding: 0px;\n border:0;\n... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a problem when I try to center the div block "products" because I don't know in advance the div width. Anybody have a solution?
Update: The problem I have is I don't know how many products I'll display, I can have 1, 2 or 3 products, I can center them if it was a fixed number as I'd know the width of the parent... | **Update 27 Feb 2015:** My original answer keeps getting voted up, but now I normally use @bobince's approach instead.
```
.child { /* This is the item to center... */
display: inline-block;
}
.parent { /* ...and this is its parent container. */
text-align: center;
}
```
**My original post for historical purpose... |
283,973 | <p>I'm looking for a table or list of standard time estimations for developments in ABAP, something customizable in some variables according to the development team, complexity of project, etc...</p>
<p>Something similar to:</p>
<pre><code>Simple Module Pool -> 10 hours
Complex Module Pool -> 30 hours
Definition ... | [
{
"answer_id": 284175,
"author": "epochwolf",
"author_id": 16204,
"author_profile": "https://Stackoverflow.com/users/16204",
"pm_score": 4,
"selected": true,
"text": "<p>If I am reading this right, you are looking for a something to estimate how long it would take someone to program an a... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36599/"
] | I'm looking for a table or list of standard time estimations for developments in ABAP, something customizable in some variables according to the development team, complexity of project, etc...
Something similar to:
```
Simple Module Pool -> 10 hours
Complex Module Pool -> 30 hours
Definition of Dictionary -> (0,4 * n... | If I am reading this right, you are looking for a something to estimate how long it would take someone to program an application. I would doubt an official table actually exists.
Development time is highly variable. Programmer experience, complexity of requirements, clarity of requirements, and dozens of other factor... |
283,977 | <p>Does the C++ STL set data structure have a set difference operator?</p>
| [
{
"answer_id": 283984,
"author": "Mr Fooz",
"author_id": 25050,
"author_profile": "https://Stackoverflow.com/users/25050",
"pm_score": 4,
"selected": false,
"text": "<p>Yes, there is a <a href=\"http://www.sgi.com/tech/stl/set_difference.html\" rel=\"noreferrer\">set_difference</a> funct... | 2008/11/12 | [
"https://Stackoverflow.com/questions/283977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28462/"
] | Does the C++ STL set data structure have a set difference operator? | Yes there is, it is in `<algorithm>` and is called: [`std::set_difference`](http://en.cppreference.com/w/cpp/algorithm/set_difference). The usage is:
```
#include <algorithm>
#include <set>
#include <iterator>
// ...
std::set<int> s1, s2;
// Fill in s1 and s2 with values
std::set<int> result;
std::set_difference(s1.be... |
284,019 | <p>What is the best way to convert a fixed length string array to a fixed lengh integer array in C++ ?</p>
| [
{
"answer_id": 284040,
"author": "luke",
"author_id": 16434,
"author_profile": "https://Stackoverflow.com/users/16434",
"pm_score": 3,
"selected": false,
"text": "<p>This will copy an array of characters into an array of ints:</p>\n\n<pre><code>#include <algorithm>\nchar foo[9] = \... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What is the best way to convert a fixed length string array to a fixed lengh integer array in C++ ? | This will copy an array of characters into an array of ints:
```
#include <algorithm>
char foo[9] = "asdfasdf";
int bar[9];
std::copy(foo, foo+9, bar);
```
[std::copy](http://www.cppreference.com/wiki/stl/algorithm/copy)
This assigns the values of a null terminated character array {'a', 's', 'd', 'f', 'a', 's', 'd'... |
284,029 | <p>I use SourceGear Vault and applyLabel="true" for a project so when it builds it will create a label in SourceGear Vault for the corresponding project.My questions are</p>
<p>I have a nightly builds so what if i don't have any changes made to that project for that day then how do I define my settings....</p>
<pre><... | [
{
"answer_id": 284068,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 2,
"selected": false,
"text": "<p>In your project definition there should be a <code><triggers></code> section. For our nightly builds we use th... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I use SourceGear Vault and applyLabel="true" for a project so when it builds it will create a label in SourceGear Vault for the corresponding project.My questions are
I have a nightly builds so what if i don't have any changes made to that project for that day then how do I define my settings....
```
<sourcecontrol ... | In your project definition there should be a `<triggers>` section. For our nightly builds we use the following:
```
<triggers>
<scheduleTrigger time="00:30" buildCondition="IfModificationExists"/>
</triggers>
```
This tells CCNet to build at 0030 hours only if changes have been checked in since the last ... |
284,038 | <p>I am currently modifying some jsf application. I have two beans.</p>
<ul>
<li>connectionBean</li>
<li>UIBean</li>
</ul>
<p>When I set my connection parameters in connectionBean the first time, the UIBean is able to read my connectionBean information and display the correct UI Tree.</p>
<p>However when I try to se... | [
{
"answer_id": 286577,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Sounds to me like it's some kind of problem with UIBean referencing an out-of-date version of ConnectionBean. This is one p... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am currently modifying some jsf application. I have two beans.
* connectionBean
* UIBean
When I set my connection parameters in connectionBean the first time, the UIBean is able to read my connectionBean information and display the correct UI Tree.
However when I try to set the connection parameters in the same se... | Sounds to me like it's some kind of problem with UIBean referencing an out-of-date version of ConnectionBean. This is one problem with JSF - if you re-create a bean, JSF will not update the references in all your other beans.
You could try getting a 'fresh' copy of the ConnectionBean each time. The following method wi... |
284,043 | <p>If I'm writing unit tests in Python (using the unittest module), is it possible to output data from a failed test, so I can examine it to help deduce what caused the error?</p>
<p>I am aware of the ability to create a customized message, which can carry some information, but sometimes you might deal with more comple... | [
{
"answer_id": 284110,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 5,
"selected": false,
"text": "<p>You can use simple print statements, or any other way of writing to standard output. You can also invoke the Py... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27415/"
] | If I'm writing unit tests in Python (using the unittest module), is it possible to output data from a failed test, so I can examine it to help deduce what caused the error?
I am aware of the ability to create a customized message, which can carry some information, but sometimes you might deal with more complex data, t... | We use the logging module for this.
For example:
```
import logging
class SomeTest( unittest.TestCase ):
def testSomething( self ):
log= logging.getLogger( "SomeTest.testSomething" )
log.debug( "this= %r", self.this )
log.debug( "that= %r", self.that )
self.assertEqual( 3.14, pi )
... |
284,049 | <p>How do you get the current directory where your app is running? </p>
| [
{
"answer_id": 284142,
"author": "Kieron",
"author_id": 5791,
"author_profile": "https://Stackoverflow.com/users/5791",
"pm_score": 5,
"selected": true,
"text": "<p>You could try this:</p>\n\n<pre><code>using System.IO;\nusing System.Reflection;\n\nnamespace Utilities\n{\n static publ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7024/"
] | How do you get the current directory where your app is running? | You could try this:
```
using System.IO;
using System.Reflection;
namespace Utilities
{
static public class DirectoryHelper
{
static public string GetCurrentDirectory ()
{
return Path.GetDirectoryName (Assembly.GetExecutingAssembly ().GetName ().CodeBase);
}
}
}
``` |
284,052 | <p>Imagine the following. </p>
<ol>
<li>Html is parsed into a dom tree</li>
<li>Dom Nodes become available programmatically </li>
<li>Dom Nodes may-or-may-not be augmented programmatically</li>
<li>Augmented nodes are reserialised to html. </li>
</ol>
<p>I have primarily a question on how one would want the <b>"scrip... | [
{
"answer_id": 284062,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 0,
"selected": false,
"text": "<p>The only thing similar I can think of is in ASP.NET's register script block functions. They all have an overload that... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15614/"
] | Imagine the following.
1. Html is parsed into a dom tree
2. Dom Nodes become available programmatically
3. Dom Nodes may-or-may-not be augmented programmatically
4. Augmented nodes are reserialised to html.
I have primarily a question on how one would want the **"script"** tag to behave.
```
my $tree = someparser(... | I'm adding my own answer here, so its more obvious what I'm trying to find out. The current idea I have settled on would perform as follows:
```
my $html=<<'EOF'
<script>
//<!--<![CDATA[
foo
//]]>-->
</script>
EOF
#/# this line is here for the syntax highlighter
my $obj = parse($html);
print $obj->text();
# foo
$obj... |
284,060 | <p>I am using a simple <a href="http://framework.zend.com/manual/en/zend.auth.html" rel="noreferrer">Zend_Auth</a> setup to authenticate users for one of my applications, using a check in the preDispatch() method in a <a href="http://framework.zend.com/manual/en/zend.controller.plugins.html" rel="noreferrer">controller... | [
{
"answer_id": 284062,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 0,
"selected": false,
"text": "<p>The only thing similar I can think of is in ASP.NET's register script block functions. They all have an overload that... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11568/"
] | I am using a simple [Zend\_Auth](http://framework.zend.com/manual/en/zend.auth.html) setup to authenticate users for one of my applications, using a check in the preDispatch() method in a [controller plugin](http://framework.zend.com/manual/en/zend.controller.plugins.html). When anonymous users navigate to
```
/users... | I'm adding my own answer here, so its more obvious what I'm trying to find out. The current idea I have settled on would perform as follows:
```
my $html=<<'EOF'
<script>
//<!--<![CDATA[
foo
//]]>-->
</script>
EOF
#/# this line is here for the syntax highlighter
my $obj = parse($html);
print $obj->text();
# foo
$obj... |
284,061 | <p>I am working on an application where I have an images folder relative to my application root. I want to be able to specify this relative path in the Properties -> Settings designer eg. "\Images\". The issue I am running into is in cases where the Environment.CurrentDirectory gets changed via an OpenFileDialog the re... | [
{
"answer_id": 284082,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 2,
"selected": true,
"text": "<p>As far as I know, there is no built-in functionality that will allow this type of path resolution. Your best option i... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20489/"
] | I am working on an application where I have an images folder relative to my application root. I want to be able to specify this relative path in the Properties -> Settings designer eg. "\Images\". The issue I am running into is in cases where the Environment.CurrentDirectory gets changed via an OpenFileDialog the relat... | As far as I know, there is no built-in functionality that will allow this type of path resolution. Your best option is to dynamically determine the applications executing directory and concatenate to it your images path. You don't want to use `Environment.CurrentDirectory` specifically for the reasons you mention - the... |
284,063 | <p>I'm currently refactoring code to replace Convert.To's to TryParse.</p>
<p>I've come across the following bit of code which is creating and assigning a property to an object.</p>
<pre><code>List<Person> list = new List<Person>();
foreach (DataRow row in dt.Rows)
{
var p = new Person{ RecordID = C... | [
{
"answer_id": 284078,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 4,
"selected": true,
"text": "<p>Write an extension method.</p>\n\n<pre><code>public static Int32? ParseInt32(this string str) {\n Int32 k;\n if(... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17692/"
] | I'm currently refactoring code to replace Convert.To's to TryParse.
I've come across the following bit of code which is creating and assigning a property to an object.
```
List<Person> list = new List<Person>();
foreach (DataRow row in dt.Rows)
{
var p = new Person{ RecordID = Convert.ToInt32(row["ContactID"]) ... | Write an extension method.
```
public static Int32? ParseInt32(this string str) {
Int32 k;
if(Int32.TryParse(str, out k))
return k;
return null;
}
``` |
284,090 | <p>My class contains a <code>Dictionary<T, S> dict</code>, and I want to expose a <code>ReadOnlyCollection<T></code> of the keys. How can I do this without copying the <code>Dictionary<T, S>.KeyCollection dict.Keys</code> to an array and then exposing the array as a <code>ReadOnlyCollection</code>? <... | [
{
"answer_id": 284129,
"author": "Jb Evain",
"author_id": 36702,
"author_profile": "https://Stackoverflow.com/users/36702",
"pm_score": 4,
"selected": true,
"text": "<p>If you really want to use ReadOnlyCollection<T>, the issue is that the constructor of ReadOnlyCollection<T>... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091/"
] | My class contains a `Dictionary<T, S> dict`, and I want to expose a `ReadOnlyCollection<T>` of the keys. How can I do this without copying the `Dictionary<T, S>.KeyCollection dict.Keys` to an array and then exposing the array as a `ReadOnlyCollection`?
I want the `ReadOnlyCollection` to be a proper wrapper, ie. to re... | If you really want to use ReadOnlyCollection<T>, the issue is that the constructor of ReadOnlyCollection<T> takes an IList<T>, while the KeyCollection of the Dictionary is only a ICollection<T>.
So if you want to wrap the KeyCollection in a ReadOnlyCollection, you'll have to create an adapter (or wrapper) type, implem... |
284,093 | <p>How do I build an escape sequence string in hexadecimal notation. </p>
<p>Example:</p>
<pre><code>string s = "\x1A"; // this will create the hex-value 1A or dec-value 26
</code></pre>
<p>I want to be able to build strings with hex-values between 00 to FF like this (in this example 1B)</p>
<pre><code>string s = "... | [
{
"answer_id": 284116,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 6,
"selected": true,
"text": "<p>You don't store hexadecimal values in strings. </p>\n\n<p>You can, but it would just be that, a string, and would have to ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36922/"
] | How do I build an escape sequence string in hexadecimal notation.
Example:
```
string s = "\x1A"; // this will create the hex-value 1A or dec-value 26
```
I want to be able to build strings with hex-values between 00 to FF like this (in this example 1B)
```
string s = "\x" + "1B"; // Unrecognized escape sequence
... | You don't store hexadecimal values in strings.
You can, but it would just be that, a string, and would have to be cast to an integer or a byte to actually read its value.
You can assign a hexadecimal value as a literal to an int or a byte though:
```
Byte value = 0x0FF;
int value = 0x1B;
```
So, its easily possib... |
284,094 | <p>I have an XML document something like :::</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microso... | [
{
"answer_id": 284123,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 3,
"selected": false,
"text": "<p>If you don't care about the namespace, you can use the XPath `local-name()' function:</p>\n\n<pre><code><xsl:for-eac... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2017/"
] | I have an XML document something like :::
```
<?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
... | Declare a namespace prefix for the namespace in your XSLT and then `select` using that prefix:
```
<xsl:stylesheet ... xmlns:os="urn:schemas-microsoft-com:office:spreadsheet">
...
<xsl:for-each select="//os:Row">
...
</xsl:for-each>
...
</xsl:stylesheet>
```
This usually results in XPaths that are eas... |
284,149 | <p>Here is my problem. I am hitting a web service (hosted on a Java based server) that will only accept text encoded Requests, but it returns MTOM Responses. What I've found is that if I set the web service to RequireMtom, it sends an Mtom request! Unfortunately, the server chokes on an Mtom request and returns a 500 e... | [
{
"answer_id": 297892,
"author": "komma8.komma1",
"author_id": 13355,
"author_profile": "https://Stackoverflow.com/users/13355",
"pm_score": 1,
"selected": false,
"text": "<p>Here is a reply I got on another forum. it basically says that the problem is with Axis2 on the Java side. Unfort... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13355/"
] | Here is my problem. I am hitting a web service (hosted on a Java based server) that will only accept text encoded Requests, but it returns MTOM Responses. What I've found is that if I set the web service to RequireMtom, it sends an Mtom request! Unfortunately, the server chokes on an Mtom request and returns a 500 erro... | Yes you can send a text message and get an mtom reply(or vise versa)with WCF.
see...
<http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/480f1bc4-1fc4-40e9-a2ed-efcf3009d6ef> |
284,164 | <p>I am using a Flex dataGrid, and need to sort some of my columns numerically.<br>
Looking at the sortCompareFunction, it seems like i need to create a different function for each column that i want to sort, because my sort function has to know what field it is sorting on. </p>
<p>Is there any way that I can pass th... | [
{
"answer_id": 284590,
"author": "Alex",
"author_id": 32392,
"author_profile": "https://Stackoverflow.com/users/32392",
"pm_score": 1,
"selected": false,
"text": "<p>I did it using this function:</p>\n\n<pre>function fieldNumericSorter(field:String):Function {\n return function (obj1:... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32392/"
] | I am using a Flex dataGrid, and need to sort some of my columns numerically.
Looking at the sortCompareFunction, it seems like i need to create a different function for each column that i want to sort, because my sort function has to know what field it is sorting on.
Is there any way that I can pass the field to b... | I did it using this function:
```
function fieldNumericSorter(field:String):Function {
return function (obj1:Object, obj2:Object):int {
return sign( int(obj1[field]) - int(obj2[field]) );
}
}
```
and for each column that needed sorting set
```
colToBeSorted.sortCompareFunction = fieldNumericSorter("... |
284,201 | <p>I have a <a href="http://en.wikipedia.org/wiki/VBScript" rel="nofollow noreferrer">VBScript</a> script that starts a cmd prompt, telnets into a device and <a href="http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol" rel="nofollow noreferrer">TFTP</a>'s the configuration to a server. It works when I am logge... | [
{
"answer_id": 284213,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<p>Add a scheduled task that runs the script with your credentials. Remind yourself that you need to update the creden... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a [VBScript](http://en.wikipedia.org/wiki/VBScript) script that starts a cmd prompt, telnets into a device and [TFTP](http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol)'s the configuration to a server. It works when I am logged in and run it manually. I would like to automate it with Windows [Task Sche... | Add a scheduled task that runs the script with your credentials. Remind yourself that you need to update the credentials on the task every time you change your password. It be a good idea to have the script "phone home" via email or something every time it is run so that you can tell if it is being executed.
It might ... |
284,220 | <pre><code>public class Item
{
private int _rowID;
private Guid _itemGUID;
public Item() { }
public int Rid
{
get
{
return _rowID;
}
set { }
}
public Guid IetmGuid
{
get
... | [
{
"answer_id": 284235,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 1,
"selected": false,
"text": "<pre><code>foreach( object element in myList ) {\n Item itm = element as Item;\n if ( null == itm ) { continue; }\n ... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
public class Item
{
private int _rowID;
private Guid _itemGUID;
public Item() { }
public int Rid
{
get
{
return _rowID;
}
set { }
}
public Guid IetmGuid
{
get
... | Are you putting a constraint on the generic type V? You'll need to tell the runtime that V can be any type that is a subtype of your `Item` type.
```
public class MyGenericClass<V>
where V : Item //This is a constraint that requires type V to be an Item (or subtype)
{
public void DoSomething()
{
List<V> myL... |
284,234 | <p>Having played around a little with both Tkinter and wxPython, I like Tkinter much better in terms of how clean my source code looks. However, it doesn't seem to have as many features; in particular it doesn't have tabs (as in, the tabs at the top of a Firefox window).</p>
<p>A little Googling on the subject offers... | [
{
"answer_id": 284396,
"author": "sep332",
"author_id": 13652,
"author_profile": "https://Stackoverflow.com/users/13652",
"pm_score": 0,
"selected": false,
"text": "<p>\"Or is it simply the case that anyone who needs more powerful windowing components has to use wxPython?\"<br>\nShort an... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1694/"
] | Having played around a little with both Tkinter and wxPython, I like Tkinter much better in terms of how clean my source code looks. However, it doesn't seem to have as many features; in particular it doesn't have tabs (as in, the tabs at the top of a Firefox window).
A little Googling on the subject offers a few sugg... | On recent Python (> 2.7) versions, you can use the [`ttk`](https://docs.python.org/2/library/ttk.html) module, which provides access to the *Tk themed widget* set, which has been introduced in `Tk 8.5`.
Here's how you import `ttk` in Python 2:
```
import ttk
help(ttk.Notebook)
```
In Python 3, the [`ttk`](https://... |
284,246 | <p>I'm currently working on a Google Maps project and am implementing a search function. In my search function I'm trying to have content on the side listing which search makers that were just added to the map correspond to each hall. However in assembling this string I run into a problem where my <code>side_bar_html</... | [
{
"answer_id": 284265,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 3,
"selected": true,
"text": "<p>So my understanding of your problem is that <code>side_bar_html</code> is set during the <code>onreadystatechange<... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36939/"
] | I'm currently working on a Google Maps project and am implementing a search function. In my search function I'm trying to have content on the side listing which search makers that were just added to the map correspond to each hall. However in assembling this string I run into a problem where my `side_bar_html` variable... | So my understanding of your problem is that `side_bar_html` is set during the `onreadystatechange` function call, but you're not seeing it being set unless you alert it.
Here's what's probably happening: the Ajax request takes some time to happen. When you call `req.send(null)` then that kicks off the request, but you... |
284,269 | <p>If I have an xmlreader instance how can I use it to read its current node and end up with a xmlElement instance?</p>
| [
{
"answer_id": 284406,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "<p>Not tested, but how about via an <code>XmlDocument</code>:</p>\n\n<pre><code> XmlDocument doc = new XmlDocument(... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] | If I have an xmlreader instance how can I use it to read its current node and end up with a xmlElement instance? | Not tested, but how about via an `XmlDocument`:
```
XmlDocument doc = new XmlDocument();
doc.Load(reader);
XmlElement el = doc.DocumentElement;
```
Alternatively (from the cmoment), something like:
```
doc.LoadXml(reader.ReadOuterXml());
```
But actually I'm not a fan of that... it forces an addit... |
284,324 | <p>How can I generate valid XML in C#?</p>
| [
{
"answer_id": 284331,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 10,
"selected": true,
"text": "<p>It depends on the scenario. <code>XmlSerializer</code> is certainly one way and has the advantage of mapping direc... | 2008/11/12 | [
"https://Stackoverflow.com/questions/284324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19020/"
] | How can I generate valid XML in C#? | It depends on the scenario. `XmlSerializer` is certainly one way and has the advantage of mapping directly to an object model. In .NET 3.5, `XDocument`, etc. are also very friendly. If the size is very large, then `XmlWriter` is your friend.
For an `XDocument` example:
```
Console.WriteLine(
new XElement("Foo",
... |