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 |
|---|---|---|---|---|---|---|
295,067 | <p>I am a COM object written in ATL that is used from a C++ application, and I want to pass an array of BYTEs between the two. My experience of COM/IDL so far is limited to passing simple types (BSTRs, LONGs, etc.).</p>
<p>Is there a relatively easy way to have the COM object pass an array to the caller? For example... | [
{
"answer_id": 295070,
"author": "jpoh",
"author_id": 4368,
"author_profile": "https://Stackoverflow.com/users/4368",
"pm_score": 0,
"selected": false,
"text": "<p>Check out using <a href=\"http://msdn.microsoft.com/en-us/library/ms221482.aspx\" rel=\"nofollow noreferrer\">safearrays</a>... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] | I am a COM object written in ATL that is used from a C++ application, and I want to pass an array of BYTEs between the two. My experience of COM/IDL so far is limited to passing simple types (BSTRs, LONGs, etc.).
Is there a relatively easy way to have the COM object pass an array to the caller? For example, I want to ... | Try passing a safearray variant to the COM Object. Something like this to put a BYTE array inside a safearray variant....
```
bool ArrayToVariant(CArray<BYTE, BYTE>& array, VARIANT& vtResult)
{
SAFEARRAY FAR* psarray;
SAFEARRAYBOUND sabounds[1];
sabounds[0].lLbound=0;
sabounds[0].cElements = (ULONG)array.GetSize();... |
295,071 | <p>When we write in a Javascript expression : </p>
<pre><code>expression < <%=variableJsp%>
</code></pre>
<p>the double "<" seems to be a problem and the JSP is not interpreted ?</p>
<p>Is it a fault of the other servers that should not accept this type of expression ? Or WebSphere that bugs ?</p>
| [
{
"answer_id": 295074,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 0,
"selected": false,
"text": "<p>I find it generally a bad idea to inline javascript on jsp pages.Your problem is only one of the reasons to make jav... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19281/"
] | When we write in a Javascript expression :
```
expression < <%=variableJsp%>
```
the double "<" seems to be a problem and the JSP is not interpreted ?
Is it a fault of the other servers that should not accept this type of expression ? Or WebSphere that bugs ? | Your small code-sample looks like something we do without problems.
Try creating a JSP that illustrates the problem, and nothing else. Either create a new from scratch, or remove everything not relevant to the problem.
Chances are, you will find that the error is not in your code-sample. But if you can make a small J... |
295,073 | <p>When trying to use GraphicsBuilder, I get a <code>java.lang.NoClassDefFoundError</code> for <code>groovy.swing.factory.BindProxyFactory</code>.</p>
<p>This is my environment:</p>
<pre><code>% java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (buil... | [
{
"answer_id": 331478,
"author": "shemnon",
"author_id": 8020,
"author_profile": "https://Stackoverflow.com/users/8020",
"pm_score": 1,
"selected": false,
"text": "<p>It's in the Groovy 1.6 builds, not the 1.5.7 builds. Apparently GfxBuilder 6.1 was built against the Groovy 1.6 codebase... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When trying to use GraphicsBuilder, I get a `java.lang.NoClassDefFoundError` for `groovy.swing.factory.BindProxyFactory`.
This is my environment:
```
% java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
% groovy --version
... | It's in the Groovy 1.6 builds, not the 1.5.7 builds. Apparently GfxBuilder 6.1 was built against the Groovy 1.6 codebase. |
295,085 | <p>Is there a way to specify the font size for a class to be, say, 70% of the inherited font size?</p>
<p>I have a general "button" class that sets up my buttons with the appropriate borders, background, etc. I use it in multiple places, including one where the font size is fairly small and another where the font size... | [
{
"answer_id": 295087,
"author": "Jason Anderson",
"author_id": 5142,
"author_profile": "https://Stackoverflow.com/users/5142",
"pm_score": 2,
"selected": false,
"text": "<p>Try:</p>\n\n<pre><code>font-size: 0.7em;\n</code></pre>\n\n<p>Here's some more information: <a href=\"http://www.a... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13055/"
] | Is there a way to specify the font size for a class to be, say, 70% of the inherited font size?
I have a general "button" class that sets up my buttons with the appropriate borders, background, etc. I use it in multiple places, including one where the font size is fairly small and another where the font size is quite ... | EMs do work like percentages in that the base font size is always 1em and .7em would be 70% of that (in the same way 1.2em would be equivalent of 120% of base font size). For this to work properly though you need to define a base font-size on the document body. Through experimentation I've found that font-size: 77%; gi... |
295,091 | <p>The ListChanged event for an IBindingList fires a type ListChangedType.ItemDeleted when items are deleted, perhaps by a user deleting a row in a datagrid control bound to the list. The problem is that the NewIndex into the list is invalid in this event, it's been deleted, and the item that was deleted is not availab... | [
{
"answer_id": 295468,
"author": "Sunlight",
"author_id": 33650,
"author_profile": "https://Stackoverflow.com/users/33650",
"pm_score": 2,
"selected": false,
"text": "<p>It's not really intended for that purpose. <code>NewIndex</code> is the index where the item was when it was deleted, ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28343/"
] | The ListChanged event for an IBindingList fires a type ListChangedType.ItemDeleted when items are deleted, perhaps by a user deleting a row in a datagrid control bound to the list. The problem is that the NewIndex into the list is invalid in this event, it's been deleted, and the item that was deleted is not available.... | Yeah it's pretty annoying, but there is an easy workaround. I create a `BindingListBase<T>` class that I use for all of my lists instead of using a normal `BindingList<T>`. Because my class inherits from the `BindingList<T>`, I have access to all of it's protected members, including the `RemovedItem` method.
This ena... |
295,094 | <p>is there any known pattern/algorithm on how to perform sorting or filtering a list of records (from database) in the correct way? My current attempt involves usage of a form that provides some filtering and sorting options, and then append these criteria and sorting algorithm to my existing SQL. However, I find it c... | [
{
"answer_id": 295115,
"author": "Stein G. Strindhaug",
"author_id": 26115,
"author_profile": "https://Stackoverflow.com/users/26115",
"pm_score": 0,
"selected": false,
"text": "<p>It's hard to understand that query, because I have to scroll massively and since I don't know the database.... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5742/"
] | is there any known pattern/algorithm on how to perform sorting or filtering a list of records (from database) in the correct way? My current attempt involves usage of a form that provides some filtering and sorting options, and then append these criteria and sorting algorithm to my existing SQL. However, I find it can ... | First off, this query will look and perform better if you use joins:
```
SELECT *
FROM
app_event._event_view EV
INNER JOIN app_event.calendar C
ON EV.calendar_id = C.calendar.id
INNER JOIN app_event._ical_class IC
ON C.class_id = EV.class_id
WHERE
C.is_personal = 't'
AN... |
295,095 | <p>I have a textbox whose value I want to set based on the inner text of an anchor tag. In other words, when someone clicks on this anchor:</p>
<pre><code><a href="javascript:void();" class="clickable">Blah</a>
</code></pre>
<p>I want my textbox to populate with the text "Blah". Here is the code I am cu... | [
{
"answer_id": 295099,
"author": "Falco Foxburr",
"author_id": 37266,
"author_profile": "https://Stackoverflow.com/users/37266",
"pm_score": 7,
"selected": true,
"text": "<p>I wrote this code snippet and it works fine:</p>\n\n<pre><code><a href=\"#\" class=\"clickable\">Blah</a&... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1574/"
] | I have a textbox whose value I want to set based on the inner text of an anchor tag. In other words, when someone clicks on this anchor:
```
<a href="javascript:void();" class="clickable">Blah</a>
```
I want my textbox to populate with the text "Blah". Here is the code I am currently using:
```
<script type="text/j... | I wrote this code snippet and it works fine:
```
<a href="#" class="clickable">Blah</a>
<input id="textbox">
<script type="text/javascript">
$(document).ready(function(){
$("a.clickable").click(function(event){
event.preventDefault();
$("input#textbox").val($(this).html());
... |
295,104 | <p>In C#, what makes a field different from a property, and when should a field be used instead of a property?</p>
| [
{
"answer_id": 295109,
"author": "Cory",
"author_id": 8207,
"author_profile": "https://Stackoverflow.com/users/8207",
"pm_score": 11,
"selected": true,
"text": "<p>Properties expose fields. Fields should (almost always) be kept private to a class and accessed via get and set properties.... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In C#, what makes a field different from a property, and when should a field be used instead of a property? | Properties expose fields. Fields should (almost always) be kept private to a class and accessed via get and set properties. Properties provide a level of abstraction allowing you to change the fields while not affecting the external way they are accessed by the things that use your class.
```
public class MyClass
{
... |
295,110 | <p>I'm looking to use: </p>
<pre><code>#define
</code></pre>
<p>and</p>
<pre><code>#if
</code></pre>
<p>to allow me to simulate potentially absent hardware during unit tests. What are the rules for using the <code>#define</code> statements? </p>
<p>i.e. what is its default scope? can I change the scope of the dire... | [
{
"answer_id": 295117,
"author": "Chris Kimpton",
"author_id": 48310,
"author_profile": "https://Stackoverflow.com/users/48310",
"pm_score": 2,
"selected": false,
"text": "<p>From <a href=\"http://msdn.microsoft.com/en-us/library/yt3yck0x(VS.71).aspx\" rel=\"nofollow noreferrer\">MSDN</a... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | I'm looking to use:
```
#define
```
and
```
#if
```
to allow me to simulate potentially absent hardware during unit tests. What are the rules for using the `#define` statements?
i.e. what is its default scope? can I change the scope of the directive? | As Chris said, the scope of #define is just the file. (It's worth noting that this isn't the same as "the class" - if you have a partial type, it may consist of two files, one of which has symbol defined and one of which doesn't!
You can also define a symbol project-wide, but that's done with [project properties](http... |
295,112 | <p>How would I get the last item (or any specific item for that matter) in a simplexml object? Assume you don't know how many nodes there will be.</p>
<p>ex.</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/xsl.xml"?>
<obj
href="http://xml.foo.com/"
di... | [
{
"answer_id": 295127,
"author": "Stein G. Strindhaug",
"author_id": 26115,
"author_profile": "https://Stackoverflow.com/users/26115",
"pm_score": 0,
"selected": false,
"text": "<p>I think SimpleXML loads the whole XML anyway and (if I remember correctly) you can use the SimpleXML nodes ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11252/"
] | How would I get the last item (or any specific item for that matter) in a simplexml object? Assume you don't know how many nodes there will be.
ex.
```
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/xsl.xml"?>
<obj
href="http://xml.foo.com/"
display="com.foo.bar"
xmlns:xsi="ht... | Use XPath's `last()` function, which solves this very problem:
```
<?php
$xml = simplexml_load_file('HistoryRecord.xml');
$xml->registerXPathNamespace('o', 'http://obix.org/ns/schema/1.0');
$xpath = "/o:obj/o:list/o:obj[last()]/o:int[@name = 'energy_in_kwh']";
$last_kwh = $xml->xpath($xpath);
?>
```
Here it loo... |
295,114 | <p>Ok, I'm getting my version control processes in order for my web team.</p>
<p>I know ideally each user would have a full working copy of their code on their local machine.</p>
<p>Unfortunately for a lot of our web apps they have additional server specific DB or other system integration requirements that cannot be ... | [
{
"answer_id": 295122,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "<p>You may find that the performance of Subversion operations over the network is much slower than the performance of the... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22837/"
] | Ok, I'm getting my version control processes in order for my web team.
I know ideally each user would have a full working copy of their code on their local machine.
Unfortunately for a lot of our web apps they have additional server specific DB or other system integration requirements that cannot be replicated on a u... | You may find that the performance of Subversion operations over the network is much slower than the performance of the same Subversion operation locally. I've run into this problem in Unix land with working directories mounted over NFS, but I suspect you may run into the same situation using Windows shares.
It would b... |
295,120 | <p>I have a method in an interface that I want to deprecate with portable C++.
When I Googled for this all I got was a Microsoft specific solution; <a href="https://learn.microsoft.com/en-us/cpp/preprocessor/deprecated-c-cpp?view=vs-2017" rel="noreferrer"><code>#pragma deprecated</code></a> and <a href="https://learn.m... | [
{
"answer_id": 295149,
"author": "Terje Mikal",
"author_id": 37570,
"author_profile": "https://Stackoverflow.com/users/37570",
"pm_score": 5,
"selected": false,
"text": "<p>In GCC you can declare your function with the attribute deprecated like this:</p>\n\n<pre><code>void myfunc() __att... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8524/"
] | I have a method in an interface that I want to deprecate with portable C++.
When I Googled for this all I got was a Microsoft specific solution; [`#pragma deprecated`](https://learn.microsoft.com/en-us/cpp/preprocessor/deprecated-c-cpp?view=vs-2017) and [`__declspec(deprecated)`](https://learn.microsoft.com/en-us/cpp/c... | In C++14, you can mark a function as deprecated using the `[[deprecated]]` attribute (see section 7.6.5 [dcl.attr.deprecated]).
>
> The *attribute-token* `deprecated` can be used to mark names and entities whose use is still allowed, but is discouraged for some reason.
>
>
>
For example, the following function `f... |
295,128 | <p>I have an app which consists of several different assemblies, one of which holds the various interfaces which the classes obey, and by which the classes communicate across assembly boundaries. There are several classes firing events, and several which are interested in these events. </p>
<p>My question is as follow... | [
{
"answer_id": 295139,
"author": "Cristian Libardo",
"author_id": 16526,
"author_profile": "https://Stackoverflow.com/users/16526",
"pm_score": 1,
"selected": false,
"text": "<p>I'd probably try to massage the domain so that each class can directly depend on the appropriate event source.... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091/"
] | I have an app which consists of several different assemblies, one of which holds the various interfaces which the classes obey, and by which the classes communicate across assembly boundaries. There are several classes firing events, and several which are interested in these events.
My question is as follows: is it g... | You could put the event itself in an interface, so that A didn't need to know about C directly, but only that it has the relevant event. However, perhaps you mean that the instance of A doesn't have sight of an instance of C...
I would try to steer clear of a centralised event system. It's likely to make testing harde... |
295,135 | <p>I have a string that I want to use as a filename, so I want to remove all characters that wouldn't be allowed in filenames, using Python.</p>
<p>I'd rather be strict than otherwise, so let's say I want to retain only letters, digits, and a small set of other characters like <code>"_-.() "</code>. What's the most el... | [
{
"answer_id": 295146,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 7,
"selected": false,
"text": "<p>This whitelist approach (ie, allowing only the chars present in valid_chars) will work if there aren't limits on ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37134/"
] | I have a string that I want to use as a filename, so I want to remove all characters that wouldn't be allowed in filenames, using Python.
I'd rather be strict than otherwise, so let's say I want to retain only letters, digits, and a small set of other characters like `"_-.() "`. What's the most elegant solution?
The ... | You can look at the [Django framework](http://www.djangoproject.com) for how they create a "slug" from arbitrary text. A slug is URL- and filename- friendly.
The Django text utils define a function, [`slugify()`](https://docs.djangoproject.com/en/4.0/ref/utils/#django.utils.text.slugify), that's probably the gold stan... |
295,141 | <p>I have a List of custom object, which consist of a custom list.</p>
<pre><code>class person{
string name;
int age;
List<friend> allMyFriends;
}
class friend{
string name;
string address;
}
</code></pre>
<p>I'trying to bind a list of these objects to a GridView and the Grid should create for each fri... | [
{
"answer_id": 295551,
"author": "HectorMac",
"author_id": 1400,
"author_profile": "https://Stackoverflow.com/users/1400",
"pm_score": 1,
"selected": false,
"text": "<p>It sounds like you are trying to display a matrix / crosstab in GridView. You might find it easier to grab your retriev... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36475/"
] | I have a List of custom object, which consist of a custom list.
```
class person{
string name;
int age;
List<friend> allMyFriends;
}
class friend{
string name;
string address;
}
```
I'trying to bind a list of these objects to a GridView and the Grid should create for each friend a column and write the nam... | I was able to solve this using a DataTable as your datasource for the Grid. I don't like the idea of moving from a nice clean object to a DataTable, but it provides support for the dynamic binding you need. I modified your friend object to have a few constructors. This allowed me to cleanup the static code declaration ... |
295,156 | <p>What are others ASP.NET Security Best Practices?</p>
<p>So far identified are listed here:</p>
<ul>
<li><p>Always generate new encryption keys and admin passwords whenever you are moving an application to production.</p></li>
<li><p>Never store passwords directly or in encrypted form. Always stored one way hashed ... | [
{
"answer_id": 295442,
"author": "Jonas Kongslund",
"author_id": 37548,
"author_profile": "https://Stackoverflow.com/users/37548",
"pm_score": 2,
"selected": false,
"text": "<p>Microsoft has a lot to say about this subject:</p>\n\n<ul>\n<li><a href=\"http://msdn.microsoft.com/en-us/libra... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/191/"
] | What are others ASP.NET Security Best Practices?
So far identified are listed here:
* Always generate new encryption keys and admin passwords whenever you are moving an application to production.
* Never store passwords directly or in encrypted form. Always stored one way hashed passwords.
* Always store connection s... | I found Microsoft's [Developer Highway Code](https://download.microsoft.com/documents/uk/msdn/security/The%20Developer%20Highway%20Code.pdf) to be a useful security checklist. |
295,161 | <p>If you try to launch a .NET 3.5 application on a Windows computer which does not have this version of the .NET framework installed, you get a <code>FileNotFoundException</code> for some system assemblies (for example System.Core 3.5.0.0).</p>
<p>Is it possible to catch this exception and tell the user to upgrade th... | [
{
"answer_id": 295168,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>The simplest thing would just be to try it. (I don't have any non-3.5 machines to test it on, but I assume you do.)</... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11963/"
] | If you try to launch a .NET 3.5 application on a Windows computer which does not have this version of the .NET framework installed, you get a `FileNotFoundException` for some system assemblies (for example System.Core 3.5.0.0).
Is it possible to catch this exception and tell the user to upgrade their .NET framework or... | How are you currently deploying the app? ClickOnce can do assembly (GAC) checks before launch, and with msi you should have a whole range of pre-check options available... although not always feasible, you might consider one of these deployment options?
Re catching the exception - just be sure to split the Main up so ... |
295,165 | <p>I have some special cells in my Excel workbooks which are managed by my Excel Add-in. I want to prevent users from changing content of those cells, but I also want to know, what value users wanted to enter to those cells. On the SheetChange event I can check what users entered to my special cells, but how do I deter... | [
{
"answer_id": 295176,
"author": "Dheer",
"author_id": 17266,
"author_profile": "https://Stackoverflow.com/users/17266",
"pm_score": 1,
"selected": false,
"text": "<p>If you need to prevent the users from changing the values, why not lock the cells (right click, format-cell, locked) and ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37266/"
] | I have some special cells in my Excel workbooks which are managed by my Excel Add-in. I want to prevent users from changing content of those cells, but I also want to know, what value users wanted to enter to those cells. On the SheetChange event I can check what users entered to my special cells, but how do I determin... | How about something like this, which is in VBA, but should be fairly easy to translate to C#
```
Option Explicit
' We are monitoring cell B2...
Private initialB2Value As Variant ' holds the value for reinstatement when the user changes it
Private Sub Worksheet_Activate()
' record the value before the user makes an... |
295,182 | <p>I have a producer-consumer pattern working for one product. What is the best implementation when the producer produce many products? For example a DataBaseEvent, GuiEvent and ControlEvent that the consumer shall consume. The code below shows the pattern for one product (a DataBaseEvent). Should each event type be en... | [
{
"answer_id": 295187,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 0,
"selected": false,
"text": "<p>I think that it would be better enqueue all of the request to one queue if they have the same priority and will be handle... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36922/"
] | I have a producer-consumer pattern working for one product. What is the best implementation when the producer produce many products? For example a DataBaseEvent, GuiEvent and ControlEvent that the consumer shall consume. The code below shows the pattern for one product (a DataBaseEvent). Should each event type be enque... | Multiple queues would be useful if you want to actively separate the work - i.e. have different threads/pools for different types of event. If you want to share the load, there is another option - use an interface (rather than a base-class). Base-class is fine, but I can't think of anything that would mandate a base-cl... |
295,195 | <p>The problem is simple:</p>
<p>Using bash, I want to add a directory to my PYTHONPATH for ease of script execution. Unfortunately, the directory I want to use has a : in it. So I try each of the following</p>
<pre><code>export PYTHONPATH=${PYTHONPATH}:/home/shane/mywebsite.com:3344/
export PYTHONPATH=${PYTHONPATH}:... | [
{
"answer_id": 295226,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 2,
"selected": false,
"text": "<p>There is only one you didn't try: </p>\n\n<pre><code>export PYTHONPATH=${PYTHONPATH}:\"/home/shane/mywebsite.com\\... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10264/"
] | The problem is simple:
Using bash, I want to add a directory to my PYTHONPATH for ease of script execution. Unfortunately, the directory I want to use has a : in it. So I try each of the following
```
export PYTHONPATH=${PYTHONPATH}:/home/shane/mywebsite.com:3344/
export PYTHONPATH=${PYTHONPATH}:/home/shane/mywebsite... | The problem is not with bash. It should be setting your environment variable correctly, complete with the `:` character.
The problem, instead, is with Python's parsing of the `PYTHONPATH` variable. Following the example set by the [`PATH` variable](http://sourceware.org/cgi-bin/cvsweb.cgi/libc/posix/execvp.c?rev=1.27&... |
295,200 | <p><em>Short:</em> how does modelbinding pass objects from view to controller?</p>
<p><em>Long:</em><br>
First, based on the parameters given by the user through a search form, some objects are retrieved from the database.
These objects are given meta data that are visible(but not defining) to the customer (e.g: namin... | [
{
"answer_id": 295489,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 3,
"selected": true,
"text": "<p>The default model binding takes form parameters by name and matches them up with the properties of the type specified... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | *Short:* how does modelbinding pass objects from view to controller?
*Long:*
First, based on the parameters given by the user through a search form, some objects are retrieved from the database.
These objects are given meta data that are visible(but not defining) to the customer (e.g: naming and pricing of the obje... | The default model binding takes form parameters by name and matches them up with the properties of the type specified in the argument list. For example, your model has properties "Price" and "Name", then the form would need to contain inputs with ids/names "Price" and "Name" (I suspect it does a case insensitive match)... |
295,201 | <p>When I use `gqap' command to reflow a paragraph in vim, vim seems to try to be smart and adds indentation automatically, e.g.</p>
<ul>
<li>When a line ends with a ',':</li>
</ul>
<pre>
We protect your rights with two steps: (1) copyright the software, and (2),
offer you this license which gives you legal permis... | [
{
"answer_id": 295208,
"author": "gx.",
"author_id": 21580,
"author_profile": "https://Stackoverflow.com/users/21580",
"pm_score": 3,
"selected": true,
"text": "<p>What filetype do you do this in? And what is the output of ':set'?</p>\n\n<p>If you copy your texts to an empty file, it for... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When I use `gqap' command to reflow a paragraph in vim, vim seems to try to be smart and adds indentation automatically, e.g.
* When a line ends with a ',':
```
We protect your rights with two steps: (1) copyright the software, and (2),
offer you this license which gives you legal permission to copy, distribute
... | What filetype do you do this in? And what is the output of ':set'?
If you copy your texts to an empty file, it formats it the way you want it. I have smartindent and autoindent enabled, so you could try that. (set si, set ai) |
295,209 | <p>I'd like to call caspol from within a script inside a custom action in
an msi (setup project). I'd prefer a standard msi to ClickOnce,
because with a standard msi I can install drivers & associate
filetypes with our application whereas with ClickOnce I can't.</p>
<p>When I execute the caspol command from the co... | [
{
"answer_id": 295208,
"author": "gx.",
"author_id": 21580,
"author_profile": "https://Stackoverflow.com/users/21580",
"pm_score": 3,
"selected": true,
"text": "<p>What filetype do you do this in? And what is the output of ':set'?</p>\n\n<p>If you copy your texts to an empty file, it for... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15608/"
] | I'd like to call caspol from within a script inside a custom action in
an msi (setup project). I'd prefer a standard msi to ClickOnce,
because with a standard msi I can install drivers & associate
filetypes with our application whereas with ClickOnce I can't.
When I execute the caspol command from the command line it ... | What filetype do you do this in? And what is the output of ':set'?
If you copy your texts to an empty file, it formats it the way you want it. I have smartindent and autoindent enabled, so you could try that. (set si, set ai) |
295,216 | <p>My Facebook application contains Javascript that works in Firefox and IE, but aborts in Chrome.</p>
<p>In the Javascript console it gives several errors.including:</p>
<pre><code>Uncaught TypeError: Object onloadhooks has no method 'replace'
</code></pre>
<p>There are similar errors complaining about a missing me... | [
{
"answer_id": 295217,
"author": "Oddthinking",
"author_id": 8014,
"author_profile": "https://Stackoverflow.com/users/8014",
"pm_score": 3,
"selected": true,
"text": "<p>According to the Chrome developers (<a href=\"http://code.google.com/p/chromium/issues/detail?id=1717\" rel=\"nofollow... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8014/"
] | My Facebook application contains Javascript that works in Firefox and IE, but aborts in Chrome.
In the Javascript console it gives several errors.including:
```
Uncaught TypeError: Object onloadhooks has no method 'replace'
```
There are similar errors complaining about a missing method for 'toLowerCase'.
**Stop P... | According to the Chrome developers ([Issue 1717](http://code.google.com/p/chromium/issues/detail?id=1717)), this is an issue with the Facebook FBJS library, and something they plan to escalate to Facebook.
I don't have a workaround for this in the meantime. |
295,234 | <p>I'm currently maintaining some flex code and noticed very many functions which are declared like:</p>
<pre><code>private function exampleFunc():void {
....
}
</code></pre>
<p>These functions are in the <em>global scope</em>, and aren't part of any specific class, so it's a bit unclear to me what effect declari... | [
{
"answer_id": 295536,
"author": "Christophe Herreman",
"author_id": 17255,
"author_profile": "https://Stackoverflow.com/users/17255",
"pm_score": 0,
"selected": false,
"text": "<p>What do you mean by global scope? Are these functions declared in the main MXML file?</p>\n\n<p>In general,... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14302/"
] | I'm currently maintaining some flex code and noticed very many functions which are declared like:
```
private function exampleFunc():void {
....
}
```
These functions are in the *global scope*, and aren't part of any specific class, so it's a bit unclear to me what effect declaring them as private would have. Wh... | The actionscript functions that are included in your mxmlc code will we available as a part of your mxmlc component, which behind the scenes is compiled into a class. Therefore marking them as private makes them inaccessible.
Here is an example to make that clear, say you have the following component, we'll call it F... |
295,251 | <p>I have tried, 'PreviousPage', 'PreviousPage.IsCrossPagePostBack' 'Page.previousPage', page.title</p>
<p>It causes the client to stop rendering the page after this line.</p>
<p>simple example</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
response.write("I can see this");
string test = Previ... | [
{
"answer_id": 295253,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 0,
"selected": false,
"text": "<p>Have you checked PreviousPage for null?</p>\n\n<p>From <a href=\"http://msdn.microsoft.com/en-us/library/system.we... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have tried, 'PreviousPage', 'PreviousPage.IsCrossPagePostBack' 'Page.previousPage', page.title
It causes the client to stop rendering the page after this line.
simple example
```
protected void Page_Load(object sender, EventArgs e)
{
response.write("I can see this");
string test = PreviousPage.IsCrossPagePostBack.... | ANSWER
Well it ended up it was something stupid. code smell over.
The button i was using to fire the PostBack had a handler that fired to redirect, i just deleted the handler, keeping the PostBackUrl setting and magic. |
295,257 | <p>How can I search for specific value in the registry keys?</p>
<p>For example I want to search for XXX in </p>
<pre><code>HKEY_CLASSES_ROOT\Installer\Products
</code></pre>
<p>any code sample in C# will be appreciated,</p>
<p>thanks</p>
| [
{
"answer_id": 295265,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 4,
"selected": false,
"text": "<p>Help <a href=\"http://bytes.com/forum/thread279622.html\" rel=\"nofollow noreferrer\">here</a>...</p>\n\n<p>Microsoft h... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I search for specific value in the registry keys?
For example I want to search for XXX in
```
HKEY_CLASSES_ROOT\Installer\Products
```
any code sample in C# will be appreciated,
thanks | Help [here](http://bytes.com/forum/thread279622.html)...
Microsoft has a great (but not well known) tool for this - called [LogParser](https://www.microsoft.com/en-us/download/details.aspx?id=24659)
It uses a SQL engine to query all kind of text based data like the Registry,
the Filesystem, the eventlog, AD etc...
To... |
295,266 | <p>I'm trying to wrap my head around how to search for something that appears in the middle of a word / expression - something like searching for "LIKE %book% " - but in SQL Server (2005) full text catalog.</p>
<p>How can I do that? It almost appears as if both <code>CONTAINS</code> and <code>FREETEXT</code> really do... | [
{
"answer_id": 295274,
"author": "Craig",
"author_id": 27294,
"author_profile": "https://Stackoverflow.com/users/27294",
"pm_score": 2,
"selected": false,
"text": "<p>If you want to do some serious full text searching then I would (and have) use Lucene.Net. MS SQL Full Text search never ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to wrap my head around how to search for something that appears in the middle of a word / expression - something like searching for "LIKE %book% " - but in SQL Server (2005) full text catalog.
How can I do that? It almost appears as if both `CONTAINS` and `FREETEXT` really don't support wildcard at the **be... | unfortunately CONTAINS only supports prefix wildcards:
```
CONTAINS(*, '"book*"')
``` |
295,287 | <p>Is there any way to 'hide' the name of a class, whose sole purpose is to provide extension methods, from Intellisense? </p>
<p>I would like to remove the class name from the Intellisense list but need the extension methods of the class to be available to external assemblies via Intellisense in the usual way.</p>
| [
{
"answer_id": 295293,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 1,
"selected": false,
"text": "<p>Do you mean you want to hide the class, or the extension methods?</p>\n\n<p>If you put the static class in its own na... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27805/"
] | Is there any way to 'hide' the name of a class, whose sole purpose is to provide extension methods, from Intellisense?
I would like to remove the class name from the Intellisense list but need the extension methods of the class to be available to external assemblies via Intellisense in the usual way. | Ok, I have the answer to this. Hallgrim's suggestion of marking the class with..
```
[EditorBrowsable(EditorBrowsableState.Never)]
```
..does actually work but only where the **assembly** is being referenced, rather than the project, as would be the case in my own VS solution whilst writing the assembly that provide... |
295,291 | <p>I'm currently doing the following to use typed datasets in vs2008: </p>
<p>Right click on "app_code" add new dataset, name it tableDS.</p>
<p>Open tableDS, right click, add "table adapter"</p>
<p>In the wizard, choose a pre defined connection string, "use SQL statements"</p>
<p>select * from tablename and next +... | [
{
"answer_id": 295324,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": true,
"text": "<p>A bit of a shift, but you ask about different patterns - how about LINQ? Since you are using VS2008, it is possible... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37083/"
] | I'm currently doing the following to use typed datasets in vs2008:
Right click on "app\_code" add new dataset, name it tableDS.
Open tableDS, right click, add "table adapter"
In the wizard, choose a pre defined connection string, "use SQL statements"
select \* from tablename and next + next to finish. (I generate ... | A bit of a shift, but you ask about different patterns - how about LINQ? Since you are using VS2008, it is possible (although not guaranteed) that you might also be able to use .NET 3.5.
A LINQ-to-SQL data-context provides much more managed access to data (filtered, etc). Is this an option? I'm not sure I'd go "Entity... |
295,307 | <p>Is this the best way to handle file moving in a windows service? we have many files that get matched and moved, but an end user may have the file opened at the time of moving.</p>
<p>This is what the code currently says:</p>
<pre><code>Do While IO.File.Exists(OriginalFilePath)
Try
IO.File.Move(Origina... | [
{
"answer_id": 295304,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 5,
"selected": true,
"text": "<p>No. You will need to use SQL Profiler. A standard trace with the <strong>Lock Timeout</strong> event and <strong>Dea... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1500/"
] | Is this the best way to handle file moving in a windows service? we have many files that get matched and moved, but an end user may have the file opened at the time of moving.
This is what the code currently says:
```
Do While IO.File.Exists(OriginalFilePath)
Try
IO.File.Move(OriginalFilePath, BestMatchP... | No. You will need to use SQL Profiler. A standard trace with the **Lock Timeout** event and **Deadlock Graph** events should do it.
* [Lock:Timeout Event Class](http://msdn.microsoft.com/en-us/library/ms189107.aspx)
* [Deadlock Graph Event Class](http://msdn.microsoft.com/en-us/library/ms177409.aspx)
Hardware aside (... |
295,313 | <p>I create a DropDown with the Html.DropDownList(string NameSelectListInViewData) method.
This generates a valid Select input with the correct values. And all is well.</p>
<p>Upon submit however, the value in the source SelectList is not bound. </p>
<p><em>Case:</em>
ViewData.SearchBag.FamilyCodes:</p>
<pre><code>... | [
{
"answer_id": 295304,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 5,
"selected": true,
"text": "<p>No. You will need to use SQL Profiler. A standard trace with the <strong>Lock Timeout</strong> event and <strong>Dea... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | I create a DropDown with the Html.DropDownList(string NameSelectListInViewData) method.
This generates a valid Select input with the correct values. And all is well.
Upon submit however, the value in the source SelectList is not bound.
*Case:*
ViewData.SearchBag.FamilyCodes:
```
public SelectList FamilyCodes { get;... | No. You will need to use SQL Profiler. A standard trace with the **Lock Timeout** event and **Deadlock Graph** events should do it.
* [Lock:Timeout Event Class](http://msdn.microsoft.com/en-us/library/ms189107.aspx)
* [Deadlock Graph Event Class](http://msdn.microsoft.com/en-us/library/ms177409.aspx)
Hardware aside (... |
295,315 | <p>I have this java code:</p>
<pre><code><script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.2.6");
$("a#more").click(function() {
$("#info_box").show("blind", { direction: "vertical" }, 800);
});
</script>
</code></pre>
<p>And this l... | [
{
"answer_id": 295331,
"author": "DisgruntledGoat",
"author_id": 37947,
"author_profile": "https://Stackoverflow.com/users/37947",
"pm_score": 1,
"selected": false,
"text": "<p>Are you sure you're calling the right function? According to the docs at <a href=\"http://docs.jquery.com/Effec... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26823/"
] | I have this java code:
```
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.2.6");
$("a#more").click(function() {
$("#info_box").show("blind", { direction: "vertical" }, 800);
});
</script>
```
And this link:
```
<a href="#" id="more">More Info...</a>
... | You may use the `ready()` function and `display: none` in the initial CSS
Working HTML:
```
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$("a#more").click... |
295,321 | <p>When using gdb and Vim, often I want to stop on a particular line. Normally in Vim I copy-paste the line number showing on the rule area to the gdb session. It'd save me a lot of hassle if I could use something like <code>"+<magic-incantation></code> to copy the line number of the current cursor position into ... | [
{
"answer_id": 295335,
"author": "Rob Wells",
"author_id": 2974,
"author_profile": "https://Stackoverflow.com/users/2974",
"pm_score": -1,
"selected": false,
"text": "<p>Not sure if this is what you're after but have you tried using markers?</p>\n\n<p>Put the cursor on the line you want,... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4596/"
] | When using gdb and Vim, often I want to stop on a particular line. Normally in Vim I copy-paste the line number showing on the rule area to the gdb session. It'd save me a lot of hassle if I could use something like `"+<magic-incantation>` to copy the line number of the current cursor position into the xclipboard buffe... | put this in your vimrc
```
map ,n <Esc>:let @*=line(".")<CR>
```
then using `,``n` will copy the current line number into the clipboard |
295,333 | <p>If you put up an <code>NSAlert</code> while your app is in the background your dock icon starts bouncing and keeps on bouncing until you switch back. </p>
<p>I find this annoying. </p>
<p>Does anyone know how disable that for a single app? </p>
| [
{
"answer_id": 295372,
"author": "Matthew Schinckel",
"author_id": 188,
"author_profile": "https://Stackoverflow.com/users/188",
"pm_score": 0,
"selected": false,
"text": "<p>Not that I'd recommend it, but there is a Haxie that may help: <a href=\"http://unsanity.com/haxies/dockdetox\" r... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22147/"
] | If you put up an `NSAlert` while your app is in the background your dock icon starts bouncing and keeps on bouncing until you switch back.
I find this annoying.
Does anyone know how disable that for a single app? | Create your own subclass of NSApplication, and implement something like this:
```
- (int)requestUserAttention:(NSRequestUserAttentionType)requestType
{
if (dontDoThatBouncyThing) {
return 0;
}
return [super requestUserAttention:requestType];
}
```
Don't forget to change "N... |
295,336 | <p>I'm still working on groking the F# thing - trying to work out how to 'think' in F# rather than just translating from other languages I know.</p>
<p>I've recently been thinking about the cases where you don't have a 1:1 map between before and after. Cases where List.map falls down.</p>
<p>One example of this is mo... | [
{
"answer_id": 295537,
"author": "xtofl",
"author_id": 6610,
"author_profile": "https://Stackoverflow.com/users/6610",
"pm_score": -1,
"selected": false,
"text": "<p>As far as I can see, your code is full of <code>let</code> statements. I'm not familiar with F# but did do some Haskell. ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11410/"
] | I'm still working on groking the F# thing - trying to work out how to 'think' in F# rather than just translating from other languages I know.
I've recently been thinking about the cases where you don't have a 1:1 map between before and after. Cases where List.map falls down.
One example of this is moving averages, wh... | If you don't care too much about performance, here is a very simple solution:
```
#light
let MovingAverage n s =
Seq.windowed n s
|> Seq.map Array.average
let avgs = MovingAverage 5000 (Seq.map float [|1..999999|])
for avg in avgs do
printfn "%f" avg
System.Console.ReadKey() |> ignore
```
This recom... |
295,337 | <p>i'm currently experimenting using PixelShaders introduced with .net 3.5 sp1 to improve image processing performance. everything is much faster , but til yet i just had effects applied to some elements in my wpf forms, that i actually want to avoid.</p>
<p>we have a bunch of image processing functionality and i'd li... | [
{
"answer_id": 299924,
"author": "Suma",
"author_id": 16673,
"author_profile": "https://Stackoverflow.com/users/16673",
"pm_score": 2,
"selected": false,
"text": "<p>What is generally done in C++ / DirectX to achive this is:</p>\n<p>Preparation (done once)</p>\n<ul>\n<li>Create render ta... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20227/"
] | i'm currently experimenting using PixelShaders introduced with .net 3.5 sp1 to improve image processing performance. everything is much faster , but til yet i just had effects applied to some elements in my wpf forms, that i actually want to avoid.
we have a bunch of image processing functionality and i'd like to repl... | For who still needs this:
I just created this article here that shows how to do it in WPF.
<http://www.codeproject.com/Articles/642151/Pixel-shaders-in-a-background-thread-in-WPF>
The relevant code copied below. it is from a class with some stored variables
* Source: an ImageSource
* DpiX, DpiY: doubles containing Dp... |
295,345 | <p>I need to encrypt a small block of data (16 bytes) using 512 bit RSA public key -- quite an easy task for most cryptography libraries known to me, except for MS CSP API, as it seems.
Documentation for <a href="http://msdn.microsoft.com/en-us/library/aa379924(VS.85).aspx" rel="nofollow noreferrer">CryptEncrypt</a> fu... | [
{
"answer_id": 299924,
"author": "Suma",
"author_id": 16673,
"author_profile": "https://Stackoverflow.com/users/16673",
"pm_score": 2,
"selected": false,
"text": "<p>What is generally done in C++ / DirectX to achive this is:</p>\n<p>Preparation (done once)</p>\n<ul>\n<li>Create render ta... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2231145/"
] | I need to encrypt a small block of data (16 bytes) using 512 bit RSA public key -- quite an easy task for most cryptography libraries known to me, except for MS CSP API, as it seems.
Documentation for [CryptEncrypt](http://msdn.microsoft.com/en-us/library/aa379924(VS.85).aspx) function states that
>
> The Microsoft E... | For who still needs this:
I just created this article here that shows how to do it in WPF.
<http://www.codeproject.com/Articles/642151/Pixel-shaders-in-a-background-thread-in-WPF>
The relevant code copied below. it is from a class with some stored variables
* Source: an ImageSource
* DpiX, DpiY: doubles containing Dp... |
295,386 | <p>How can I create a scheduled task to run a PHP file?<br />
Yes, I filled out everything in the scheduled task, but it still doesn't work.</p>
<blockquote>
<p>Run: "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\WEB\4w_website\save.php"</p>
<p>Start in: "C:\Program Files\Apache Software F... | [
{
"answer_id": 295394,
"author": "Fuangwith S.",
"author_id": 24550,
"author_profile": "https://Stackoverflow.com/users/24550",
"pm_score": -1,
"selected": false,
"text": "<p>I think, you must execute your PHP script via URL.\nyou can write batch script for execute URL.\nWhy you don't wr... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38172/"
] | How can I create a scheduled task to run a PHP file?
Yes, I filled out everything in the scheduled task, but it still doesn't work.
>
> Run: "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\WEB\4w\_website\save.php"
>
>
> Start in: "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\WEB\4w... | The Run command should be
```
C:\Path\to\php.exe -f "C:\Path\to\file.php"
```
From the command line help of php.exe:
```
-f Parse and execute <file>.
``` |
295,387 | <p>I am writing a windows service. This service runs another process I've developed through Process class methods, but I want to run this process on debug mode also, using breakpoints, for instance.</p>
<p>How can I do this?</p>
| [
{
"answer_id": 295390,
"author": "Ali Ersöz",
"author_id": 4215,
"author_profile": "https://Stackoverflow.com/users/4215",
"pm_score": 2,
"selected": false,
"text": "<p>From the main menu \"Debug->Attach Process\".</p>\n"
},
{
"answer_id": 295392,
"author": "Jon Skeet",
"... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21668/"
] | I am writing a windows service. This service runs another process I've developed through Process class methods, but I want to run this process on debug mode also, using breakpoints, for instance.
How can I do this? | When debugging a service, DebugBreak() is very nice. You can even debug the startup of the service, which can be very hard to time if you try to attach the process.
In C#
```
#if DEBUG
System.Diagnostics.Debugger.Break();
#endif
```
In C++
```
#if DEBUG
System.Diagnostics.Debugger.Break();
#endif
```
Also ... |
295,417 | <p>I need to have a string, based on an integer, which should always have 5 digits.</p>
<p>Example:</p>
<pre><code>myInteger = 999
formatedInteger = "00999"
</code></pre>
<p>What is the best way of doing this in classic ASP?</p>
| [
{
"answer_id": 295440,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 2,
"selected": false,
"text": "<p>Something like this is what I've seen most of the time:</p>\n\n<pre><code>function PadNumber(number, width)\n... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2019426/"
] | I need to have a string, based on an integer, which should always have 5 digits.
Example:
```
myInteger = 999
formatedInteger = "00999"
```
What is the best way of doing this in classic ASP? | You can use string manipulation functions for this.
This assumes classic ASP with VBScript (original version of the answer).
```vb
Const NUMBER_DIGITS = 5
Dim myInteger
Dim formatedInteger
myInteger = 999
formatedInteger = Right(String(NUMBER_DIGITS, "0") & myInteger, NUMBER_DIGITS)
```
Here an optimized version,... |
295,419 | <p>What is the best free way to get your maintenance plan-generated backups compressed?</p>
<p>I know there are non-free tools that will compress the backups, but I'm not interested in them.</p>
<p>Options:</p>
<ol>
<li>Have a T-SQL task after the backups that will run a script through xp_cmdshell that compresses ev... | [
{
"answer_id": 295435,
"author": "Valerion",
"author_id": 16156,
"author_profile": "https://Stackoverflow.com/users/16156",
"pm_score": 0,
"selected": false,
"text": "<p>I'd schedule a task after the backup to do it as you already suggest. Also, I believe SQL2008 (at least some flavours)... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5190/"
] | What is the best free way to get your maintenance plan-generated backups compressed?
I know there are non-free tools that will compress the backups, but I'm not interested in them.
Options:
1. Have a T-SQL task after the backups that will run a script through xp\_cmdshell that compresses every non compressed backup.... | I'm the author of an open source project (GPL v3) that might be what you are looking for (It's not maintenance-plan based though). It is a command line tool (to schedule in Scheduled Tasks in Windows) and backs up to gzip, zip (specifically zip64 due to the 4GB limitation with regular zip files), or bzip2 files. You ca... |
295,436 | <p>I've got a message contained in an byte[], encrypted with "RSA/ECB/PKCS1Padding". To decrypt it I create a Cipher c and initiate it with</p>
<pre><code>c = Cipher.getInstance("RSA/ECB/PKCS1Padding");
</code></pre>
<p>Untill now I have only decrypted small messages, using the <em>doFinal()</em> method, returning an... | [
{
"answer_id": 8922134,
"author": "Krzysztof Wolny",
"author_id": 209502,
"author_profile": "https://Stackoverflow.com/users/209502",
"pm_score": 2,
"selected": false,
"text": "<p>With RSA you can only encrypt/decrypt block with size up to your key length minus padding length. If you hav... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38218/"
] | I've got a message contained in an byte[], encrypted with "RSA/ECB/PKCS1Padding". To decrypt it I create a Cipher c and initiate it with
```
c = Cipher.getInstance("RSA/ECB/PKCS1Padding");
```
Untill now I have only decrypted small messages, using the *doFinal()* method, returning an byte[] with the decrypted bytes.... | I think using RSA encryption for anything but key transport is abuse.
Generate a new key for a symmetric cipher and encrypt your bulk data with that. Then encrypt the key with RSA. Send the symmetrically-encrypted cipher-text along with the asymmetrically-encrypted content encryption key to your recipient. |
295,438 | <p>I need to test a function that needs to query a page on an external server using urllib.urlopen (it also uses urllib.urlencode). The server could be down, the page could change; I can't rely on it for a test.</p>
<p>What is the best way to control what urllib.urlopen returns?</p>
| [
{
"answer_id": 295465,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 3,
"selected": false,
"text": "<p>Probably the best way to handle this is to split up the code, so that logic that processes the page contents is sp... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1771/"
] | I need to test a function that needs to query a page on an external server using urllib.urlopen (it also uses urllib.urlencode). The server could be down, the page could change; I can't rely on it for a test.
What is the best way to control what urllib.urlopen returns? | Another simple approach is to have your test override urllib's `urlopen()` function. For example, if your module has
```
import urllib
def some_function_that_uses_urllib():
...
urllib.urlopen()
...
```
You could define your test like this:
```
import mymodule
def dummy_urlopen(url):
...
mymodule.... |
295,448 | <p>A number of business areas I work with use a folder structure to organise their Sharepoint housed documents (not ideal I know, but we're stuck with it). </p>
<p>I would like to use a web part page to present a number of views of their document libraries based on the subfolders that the documents appear in, but thi... | [
{
"answer_id": 299451,
"author": "user24912",
"author_id": 24912,
"author_profile": "https://Stackoverflow.com/users/24912",
"pm_score": 0,
"selected": false,
"text": "<p>What kind of document library information do you want in the view?\nHow do you want the user to filter the view?</p>\... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A number of business areas I work with use a folder structure to organise their Sharepoint housed documents (not ideal I know, but we're stuck with it).
I would like to use a web part page to present a number of views of their document libraries based on the subfolders that the documents appear in, but this is provin... | With Sharepoint Designer you can edit the CAML of your XSLT List View.
If you set the Scope attribute of the View element to *Recursive* or *RecursiveAll*, which returns all Files and Folders, you can filter the documents by *FileDirRef*:
```
<Where>
<Contains>
<FieldRef Name='FileDirRef' />
<Value Ty... |
295,455 | <p>In Oracle we can print output by <code>dbms_output.put_line()</code> but I don't know to do the same thing in DB2.</p>
<p>I currently use <code>signal</code> for printing some messages when I debug.</p>
| [
{
"answer_id": 299451,
"author": "user24912",
"author_id": 24912,
"author_profile": "https://Stackoverflow.com/users/24912",
"pm_score": 0,
"selected": false,
"text": "<p>What kind of document library information do you want in the view?\nHow do you want the user to filter the view?</p>\... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24550/"
] | In Oracle we can print output by `dbms_output.put_line()` but I don't know to do the same thing in DB2.
I currently use `signal` for printing some messages when I debug. | With Sharepoint Designer you can edit the CAML of your XSLT List View.
If you set the Scope attribute of the View element to *Recursive* or *RecursiveAll*, which returns all Files and Folders, you can filter the documents by *FileDirRef*:
```
<Where>
<Contains>
<FieldRef Name='FileDirRef' />
<Value Ty... |
295,459 | <p>How do I execute the following shell command using the Python <a href="https://docs.python.org/library/subprocess.html" rel="noreferrer"><code>subprocess</code></a> module?</p>
<pre><code>echo "input data" | awk -f script.awk | sort > outfile.txt
</code></pre>
<p>The input data will come from a string, so I don... | [
{
"answer_id": 295471,
"author": "geocar",
"author_id": 37507,
"author_profile": "https://Stackoverflow.com/users/37507",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://web.archive.org/web/20081222144252/http://www.python.org/doc/2.5.2/lib/node535.html\" rel=\"nofollow no... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3715/"
] | How do I execute the following shell command using the Python [`subprocess`](https://docs.python.org/library/subprocess.html) module?
```
echo "input data" | awk -f script.awk | sort > outfile.txt
```
The input data will come from a string, so I don't actually need `echo`. I've got this far, can anyone explain how I... | You'd be a little happier with the following.
```
import subprocess
awk_sort = subprocess.Popen( "awk -f script.awk | sort > outfile.txt",
stdin=subprocess.PIPE, shell=True )
awk_sort.communicate( b"input data\n" )
```
Delegate part of the work to the shell. Let it connect two processes with a pipeline.
You'd ... |
295,472 | <p>I am using xsl to control the output of my xml file, but the BOM character is being added.</p>
| [
{
"answer_id": 295500,
"author": "Marko",
"author_id": 31141,
"author_profile": "https://Stackoverflow.com/users/31141",
"pm_score": 1,
"selected": false,
"text": "<p>Just strip first two bytes using any hex editor.</p>\n"
},
{
"answer_id": 295520,
"author": "yfeldblum",
... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using xsl to control the output of my xml file, but the BOM character is being added. | ```
# vim file.xml
:set nobomb
:wq
``` |
295,511 | <p>MS Access allows the numeric type GUID (in German it's called 'Replikations-ID', so I guess in English that would be 'replication id') which is stored as a 16 byte binary field in the database.</p>
<p>I found how to access these fields in Delphi with <a href="http://docwiki.embarcadero.com/Libraries/Tokyo/en/Data.W... | [
{
"answer_id": 295571,
"author": "Steve",
"author_id": 22712,
"author_profile": "https://Stackoverflow.com/users/22712",
"pm_score": -1,
"selected": false,
"text": "<p>If you are sure the parameter is a TGuid, then the following should work :</p>\n\n<pre><code>TGuidField(TheQuery.ParamBy... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21506/"
] | MS Access allows the numeric type GUID (in German it's called 'Replikations-ID', so I guess in English that would be 'replication id') which is stored as a 16 byte binary field in the database.
I found how to access these fields in Delphi with [**TADOQuery**](http://docwiki.embarcadero.com/Libraries/Tokyo/en/Data.Win.... | That's correct way to set parameters with ADO. The message you get is most probably due to typo with some of fields (you get same message if field does not exist). |
295,533 | <p>say I have an asynchronous library, written in native C++, with an interface similar to this:</p>
<pre><code>class connection {
public:
boost::signal< void() > sig_connection_made;
boost::signal< void(const std::string&) > sig_error;
void connect(const std::string& host, const std::... | [
{
"answer_id": 295725,
"author": "DreamWerx",
"author_id": 15487,
"author_profile": "https://Stackoverflow.com/users/15487",
"pm_score": 0,
"selected": false,
"text": "<p>I suggest not touching this variable, instead adjusting your storage implementation to handle any size files using th... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35656/"
] | say I have an asynchronous library, written in native C++, with an interface similar to this:
```
class connection {
public:
boost::signal< void() > sig_connection_made;
boost::signal< void(const std::string&) > sig_error;
void connect(const std::string& host, const std::string& port);
};
```
that I wan... | I found this explanation: `http://www.astahost.com/info.php/max_allowed_packet-mysql_t2725.html`
>
> It's safe to increase the value of
> this variable because the extra memory
> is allocated only when needed. For
> example, mysqld allocates more memory
> only when you issue a long query or
> when mysqld must re... |
295,538 | <p>When connecting to a network share for which the current user (in my case, a network enabled service user) has no rights, name and password have to be provided.</p>
<p>I know how to do this with Win32 functions (the <code>WNet*</code> family from <code>mpr.dll</code>), but would like to do it with .Net (2.0) functi... | [
{
"answer_id": 295545,
"author": "GEOCHET",
"author_id": 5640,
"author_profile": "https://Stackoverflow.com/users/5640",
"pm_score": 1,
"selected": false,
"text": "<p>You should be looking at adding a line like this:</p>\n<pre><code><identity impersonate="true" userName=&quo... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23772/"
] | When connecting to a network share for which the current user (in my case, a network enabled service user) has no rights, name and password have to be provided.
I know how to do this with Win32 functions (the `WNet*` family from `mpr.dll`), but would like to do it with .Net (2.0) functionality.
What options are avail... | You can either change the thread identity, or P/Invoke WNetAddConnection2. I prefer the latter, as I sometimes need to maintain multiple credentials for different locations. I wrap it into an IDisposable and call WNetCancelConnection2 to remove the creds afterwards (avoiding the multiple usernames error):
```
using (n... |
295,557 | <p>What's the best way to do it in .NET?
I always forget what I need to <code>Dispose()</code> (or wrap with <code>using</code>).</p>
<p>EDIT: after a long time using <code>WebRequest</code>, I found out about customizing <code>WebClient</code>. Much better.</p>
| [
{
"answer_id": 295558,
"author": "orip",
"author_id": 37020,
"author_profile": "https://Stackoverflow.com/users/37020",
"pm_score": 3,
"selected": false,
"text": "<p>Here's what I use, it seems to work, but I don't know if it's the best way:</p>\n\n<pre><code>public string GetRequest(Uri... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37020/"
] | What's the best way to do it in .NET?
I always forget what I need to `Dispose()` (or wrap with `using`).
EDIT: after a long time using `WebRequest`, I found out about customizing `WebClient`. Much better. | Following Thomas Levesque's comment [here](https://stackoverflow.com/questions/1469805/c-canonical-http-post-code/1474861#1474861), there's a simpler and more generic solution.
We create a `WebClient` subclass with timeout support, and we get all of [WebClient](http://msdn.microsoft.com/en-us/library/system.net.webcli... |
295,563 | <p>I need to disable windows-update service from my installation. I already use vbscript to do some stuff so I would like to do it in vbscript.</p>
<p>My knowledge of vbscript (or any other script language) is very limited so...can anybody help me out with that? I'll really appreciate it!</p>
<p>Thanks.</p>
| [
{
"answer_id": 295586,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 1,
"selected": false,
"text": "<p>If you want to use VBScript, use WMI:</p>\n\n<pre><code>strComputer = \".\" 'could be any computer, not just the local... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14053/"
] | I need to disable windows-update service from my installation. I already use vbscript to do some stuff so I would like to do it in vbscript.
My knowledge of vbscript (or any other script language) is very limited so...can anybody help me out with that? I'll really appreciate it!
Thanks. | Thanks Tomalak and Patrick Cuff. I really appreciate your help. I think this could be a good and complete answer.
Method 1: prevents the "Automatic Updates" service from starting automatically when the machine boots.
```
strComputer = "." 'could be any computer, not just the local one '
Set objWMIService = GetObject... |
295,566 | <p>I need to display external resources loaded via cross domain requests and make sure to only display "<em>safe</em>" content. </p>
<p>Could use Prototype's <a href="http://www.prototypejs.org/api/string/stripScripts" rel="noreferrer">String#stripScripts</a> to remove script blocks. But handlers such as <code>onclick... | [
{
"answer_id": 295863,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 4,
"selected": false,
"text": "<p>You can't anticipate every possible weird type of malformed markup that some browser somewhere might trip over to escap... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28150/"
] | I need to display external resources loaded via cross domain requests and make sure to only display "*safe*" content.
Could use Prototype's [String#stripScripts](http://www.prototypejs.org/api/string/stripScripts) to remove script blocks. But handlers such as `onclick` or `onerror` are still there.
Is there any libr... | Update 2016: There is now a [Google Closure](https://github.com/google/closure-library/blob/master/closure/goog/html/sanitizer/htmlsanitizer.js) package based on the Caja sanitizer.
It has a cleaner API, was rewritten to take into account APIs available on modern browsers, and interacts better with Closure Compiler.
... |
295,576 | <p>I have a LinqDataSource that I use to calculate the number of rows in a table. I would like to update the value of literal with the number, with the following code, taken from MSDN (<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasourcestatuseventargs.totalrowcount.aspx" rel="nofol... | [
{
"answer_id": 297621,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<p>Hook up your method as an event handler for the Selected event in Page_Load.</p>\n\n<pre><code>public void Page_Load... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37147/"
] | I have a LinqDataSource that I use to calculate the number of rows in a table. I would like to update the value of literal with the number, with the following code, taken from MSDN ([linqdatasourcestatuseventargs.totalrowcount.aspx](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasourcestatuse... | I ended up dropping the data source and instead put the code in the code behind. Not really the point-and-click-programming that I was going for, but still quite short. I looks something like this:
```
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
var context = new MyDa... |
295,579 | <p>I'm looking for the fastest way to determine if a <code>long</code> value is a perfect square (i.e. its square root is another integer): </p>
<ol>
<li>I've done it the easy way, by using the built-in <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html#sqrt(double)" rel="norefer... | [
{
"answer_id": 295587,
"author": "Celestial M Weasel",
"author_id": 4125,
"author_profile": "https://Stackoverflow.com/users/4125",
"pm_score": 0,
"selected": false,
"text": "<p>If you want speed, given that your integers are of finite size, I suspect that the quickest way would involve ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18511/"
] | I'm looking for the fastest way to determine if a `long` value is a perfect square (i.e. its square root is another integer):
1. I've done it the easy way, by using the built-in [`Math.sqrt()`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html#sqrt(double))
function, but I'm wondering i... | I figured out a method that works ~35% faster than your 6bits+Carmack+sqrt code, at least with my CPU (x86) and programming language (C/C++). Your results may vary, especially because I don't know how the Java factor will play out.
My approach is threefold:
1. First, filter out obvious answers. This includes negative... |
295,584 | <p>I've found a few pages (some that even link to a number of other pages) on the Microsoft website that I bookmarked last night for reading today, but I'm curious as to other good non-Microsoft resources for discussing ASP.NET web applications, both Forms and MVC (including comparisons/contrasts between the two).</p>
| [
{
"answer_id": 295707,
"author": "Dan Atkinson",
"author_id": 31532,
"author_profile": "https://Stackoverflow.com/users/31532",
"pm_score": 2,
"selected": false,
"text": "<p>As a first port of call, I would use a social bookmarking network site, such as Delicious, to get a list of popula... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] | I've found a few pages (some that even link to a number of other pages) on the Microsoft website that I bookmarked last night for reading today, but I'm curious as to other good non-Microsoft resources for discussing ASP.NET web applications, both Forms and MVC (including comparisons/contrasts between the two). | Keep your eye out on the MVC forums, read up on blogs:
* [Phil Haack](http://haacked.com)
* [Scott Hanselman](http://computerzen.com)
* [Rob Conery](http://blog.wekeroad.com)
* [Simone Chiarretta](http://codeclimber.net.nz/)
* [Derik Whittaker](http://devlicio.us/blogs/derik_whittaker)
* [Me](http://flux88.com) :)
* [... |
295,593 | <p>I have a List containing several keywords.
I foreach through them building my linq query with them like so (boiled down to remove the code noise):</p>
<pre><code>List<string> keys = FillKeys()
foreach (string key in keys){
q = q.Where(c => c.Company.Name.Contains(key));
}
</code></pre>
<p>When I now m... | [
{
"answer_id": 295597,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "<p>You're reusing the same variable (<code>key</code>) in your lambda expression.</p>\n\n<p>See my article on <a href=\"h... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | I have a List containing several keywords.
I foreach through them building my linq query with them like so (boiled down to remove the code noise):
```
List<string> keys = FillKeys()
foreach (string key in keys){
q = q.Where(c => c.Company.Name.Contains(key));
}
```
When I now make my keys contain 2 keys that ret... | You're reusing the same variable (`key`) in your lambda expression.
See my article on [anonymous methods](http://pobox.com/~skeet/csharp/csharp2/delegates.html#anonymous.methods) for more details, and there are a number of related SO questions too:
* [LINQ to SQL bug (or very strange feature)...](https://stackoverflo... |
295,600 | <p>Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database folder is c:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data. </p>
<p>How can VBScript be used to retrieve that folder? </p>
<p>Maybe by using SMO? And if so, how? <- Forget that. SMO uses .NET. Only possible... | [
{
"answer_id": 295692,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 2,
"selected": false,
"text": "<p>If you said why you were doing this it might be easier.</p>\n\n<p>SQL Server will let you place your files on any loc... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23369/"
] | Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database folder is c:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data.
How can VBScript be used to retrieve that folder?
Maybe by using SMO? And if so, how? <- Forget that. SMO uses .NET. Only possible in PowerShell.
---... | The [PrimaryFilePath Property](http://technet.microsoft.com/en-us/library/ms144134.aspx) of [SQL-DMO](http://technet.microsoft.com/en-us/library/ms133993.aspx) looks interesting.
The MSDN states that SQL-DMO is deprecated as of SQL Server 2008, but for now it should still be working.
If you don't want to use SQL-DMO... |
295,611 | <p>I have some questions about basic CSS that I was unable to understand or find an answer for.</p>
<p>First, I tried placing 3 div tags within another div tag. The first main div tag containing the 3 other tags had nothing set for it except a size, which was <code>400px</code> by <code>400px</code>. Of the other 3 di... | [
{
"answer_id": 295630,
"author": "Falco Foxburr",
"author_id": 37266,
"author_profile": "https://Stackoverflow.com/users/37266",
"pm_score": 4,
"selected": true,
"text": "<blockquote>\n <p>My problem is that out of the 2 divs,\n the one that came last in the code,\n would appear first... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have some questions about basic CSS that I was unable to understand or find an answer for.
First, I tried placing 3 div tags within another div tag. The first main div tag containing the 3 other tags had nothing set for it except a size, which was `400px` by `400px`. Of the other 3 divs inside, all were `20px` by `2... | >
> My problem is that out of the 2 divs,
> the one that came last in the code,
> would appear first in a browser, and I
> did not understand the reasoning for
> this.
>
>
>
I think that You misunderstood a "appear first". You set Your divs to be floating right. So a "2" div, which is FIRST in Your code, is FI... |
295,615 | <p>I Have a problem where I occasionally (i.e. not always) see the below error popup from the Debug Flash Player after launching my app:</p>
<pre><code>Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://example.com/myApp.swf cannot load data from localhost:4499.
at org.mydo... | [
{
"answer_id": 298646,
"author": "The.Anti.9",
"author_id": 2128,
"author_profile": "https://Stackoverflow.com/users/2128",
"pm_score": -1,
"selected": false,
"text": "<p>This may not be the issue but you're catching SecurityError and its throwing securityError. Maybe try lowercasing the... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4111/"
] | I Have a problem where I occasionally (i.e. not always) see the below error popup from the Debug Flash Player after launching my app:
```
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://example.com/myApp.swf cannot load data from localhost:4499.
at org.mydomain.mypackage... | I too struggled with this for a couple of hours. The solution is to listen for SecurityErrorEvent.SECURITY\_ERROR. Apparently the SecurityError is only raised if there isn't such an event handler. |
295,620 | <p>Given the following Delphil DLL declaration</p>
<pre><code>function csd_HandleData(aBuf: PChar; aLen: integer): integer; stdcall;
</code></pre>
<p>what would be the VB6 declaration to use it?</p>
<p>I've tried a variety of declarations, e.g.</p>
<pre><code>Declare Function csd_HandleData Lib "chsdet.dll" (ByVal ... | [
{
"answer_id": 295638,
"author": "Steve",
"author_id": 22712,
"author_profile": "https://Stackoverflow.com/users/22712",
"pm_score": 3,
"selected": true,
"text": "<p>try</p>\n\n<pre><code>Declare Function csd_HandleData Lib \"chsdet.dll\" (ByVal aBuf As String, \nByVal aLen As Integer) A... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426/"
] | Given the following Delphil DLL declaration
```
function csd_HandleData(aBuf: PChar; aLen: integer): integer; stdcall;
```
what would be the VB6 declaration to use it?
I've tried a variety of declarations, e.g.
```
Declare Function csd_HandleData Lib "chsdet.dll" (ByVal aBuf As String, ByVal aLen As Integer)
Decla... | try
```
Declare Function csd_HandleData Lib "chsdet.dll" (ByVal aBuf As String,
ByVal aLen As Integer) As Integer
```
Seems you forgot the return value. |
295,621 | <p>I have an iframe inside my main page. There is a modalpopup inside the iframe page. So when the modalpopup is shown, the parent of the modalpopup is the iframe body and the main page parent body. Thus the overlay only covers the iframe and not the entire page.</p>
<p>I tried moving the modalpopup from the iframe to... | [
{
"answer_id": 7395241,
"author": "skunkshow",
"author_id": 908248,
"author_profile": "https://Stackoverflow.com/users/908248",
"pm_score": 2,
"selected": true,
"text": "<p>If you're using the iframe simply for scrollable content you might consider a styled div with <strong>overflow: aut... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25138/"
] | I have an iframe inside my main page. There is a modalpopup inside the iframe page. So when the modalpopup is shown, the parent of the modalpopup is the iframe body and the main page parent body. Thus the overlay only covers the iframe and not the entire page.
I tried moving the modalpopup from the iframe to the paren... | If you're using the iframe simply for scrollable content you might consider a styled div with **overflow: auto** or **scroll**, instead.
A set up such as this makes it easier to modify the appearance of the entire page since you're not working with multiple documents that each essentially have their own window space i... |
295,629 | <p>I'm writing an application which has to be configurable to connect to Oracle, SQL Server and MySQL depending on client whim.</p>
<p>Up till now I'd been planning on using the JDBC-ODBC bridge and just connecting to the databases using different connection strings.</p>
<p><strong>I'm told this is not very efficient... | [
{
"answer_id": 295646,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>If you need anything complex, Hibernate is a good choice.</p>\n\n<p>otherwise, what I would do is store your connection det... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] | I'm writing an application which has to be configurable to connect to Oracle, SQL Server and MySQL depending on client whim.
Up till now I'd been planning on using the JDBC-ODBC bridge and just connecting to the databases using different connection strings.
**I'm told this is not very efficient.**
1. Is there a patt... | I would suggest that you make it configurable and include the three drivers. You can use a pattern like this: Create a super class (lets call it DAO) that provides the functionality of connecting to the database. This could be abstract.
Create a concrete sub class for each type of database that you wish to connect to.... |
295,645 | <p>I'm developing an invisible Java Applet, that will be controlled entirely from JavaScript.</p>
<p>I can call the applet's Java methods easily, and I can call JavaScript methods from within the applet by using <code>netscape.javascript.JSObject.getWindow(this).call()</code>.</p>
<p>But in order to register a JavaSc... | [
{
"answer_id": 296452,
"author": "PhiLho",
"author_id": 15459,
"author_profile": "https://Stackoverflow.com/users/15459",
"pm_score": 3,
"selected": true,
"text": "<p>I am brand new to Java <-> JavaScript communication, as I planned to explore it this week. A good opportunity here... ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30700/"
] | I'm developing an invisible Java Applet, that will be controlled entirely from JavaScript.
I can call the applet's Java methods easily, and I can call JavaScript methods from within the applet by using `netscape.javascript.JSObject.getWindow(this).call()`.
But in order to register a JavaScript callback in the applet,... | I am brand new to Java <-> JavaScript communication, as I planned to explore it this week. A good opportunity here... :-)
After some tests, it seems you cannot pass a JS function to a Java applet. Unless I am doing it the wrong way...
I tried:
```
function CallJava()
{
document.Applet.Call("Does it work?");
docu... |
295,647 | <p>I'm attempting to register an anonymous function when a user clicks a cell in an HTML table. Here's some of the raw, unadulterated code:</p>
<pre><code>document.getElementById(
"course"+displayed_year_index+occurrences_indices[displayed_year_index]).onclick =
eval("function() {PrintReceipt("+result.yea... | [
{
"answer_id": 295666,
"author": "Tom",
"author_id": 26155,
"author_profile": "https://Stackoverflow.com/users/26155",
"pm_score": 3,
"selected": false,
"text": "<p>Have you tried something like this?</p>\n\n<pre><code>document.getElementById('course' + displayed_year_index + occurences_... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/441661/"
] | I'm attempting to register an anonymous function when a user clicks a cell in an HTML table. Here's some of the raw, unadulterated code:
```
document.getElementById(
"course"+displayed_year_index+occurrences_indices[displayed_year_index]).onclick =
eval("function() {PrintReceipt("+result.years[result_year_... | IMHO closures should not be used in this case and there is no need to create a new function for each onlick (uses much more memory than necessary) and eval is the wrong answer.
You know that the element you are getting with getElementById is an object and that you can assign values to it?
```
for ( /* your definition... |
295,660 | <p>I am trying to have one one layer, and center images within. I.E., if I have 3 images and want 3 links beneath them, is there a way to do this without using a separate div tag for each link and image? To automatically make the links be centered under the images, and the images to be spaced evenly within a layer? </p... | [
{
"answer_id": 295669,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, you'll have to put a container element, such as a div, around each image and its caption to keep them together.</p>\n\n... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I am trying to have one one layer, and center images within. I.E., if I have 3 images and want 3 links beneath them, is there a way to do this without using a separate div tag for each link and image? To automatically make the links be centered under the images, and the images to be spaced evenly within a layer?
I wa... | Yes, you'll have to put a container element, such as a div, around each image and its caption to keep them together.
```
<div class="pictureBox">
<div>
<img />
caption caption
</div>
<div>
<img />
more caption
</div>
</div>
--------
.pictureBox div {
text-align: cent... |
295,662 | <p>This is one is for any of you Doctrine users out there. I have a PHP CLI daemon process that checks a table every n seconds to find entries that haven't been processed. It's basically a FIFO. Anyways, I always exceed the memory allocated to PHP becuase Doctrine does not free it's resources. To combat this proble... | [
{
"answer_id": 295954,
"author": "PhiLho",
"author_id": 15459,
"author_profile": "https://Stackoverflow.com/users/15459",
"pm_score": 0,
"selected": false,
"text": "<p>No experience with Doctrine (just some interest as I discovered it this week-end...), so take or leave my guess... ^_^</... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28714/"
] | This is one is for any of you Doctrine users out there. I have a PHP CLI daemon process that checks a table every n seconds to find entries that haven't been processed. It's basically a FIFO. Anyways, I always exceed the memory allocated to PHP becuase Doctrine does not free it's resources. To combat this problem it pr... | The problem is, that `free()` does not remove the Doctrine objects from memory but just eliminates the circular references on those objects, making it possible for the garbage collector to cleanup those objects. Please see [23.6 Free Objects](http://www.doctrine-project.org/documentation/manual/1_0?chapter=improving-pe... |
295,670 | <p>What is and how can it be used in C#.<br/>
Can you use the same concept in Python/Perl?</p>
| [
{
"answer_id": 295676,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": false,
"text": "<p>A <a href=\"http://msdn.microsoft.com/en-us/library/wa80x488.aspx\" rel=\"noreferrer\">partial type</a> (it doesn't h... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31179/"
] | What is and how can it be used in C#.
Can you use the same concept in Python/Perl? | The c# partial class has been already explained here so I'll just cover the python part. You can use multiple inheritance to elegantly distribute the definition of a class.
```
class A_part1:
def m1(self):
print "m1"
class A_part2:
def m2(self):
print "m2"
class A(A_part1, A_part2):
pass
... |
295,686 | <p>The following error is being thrown:</p>
<pre><code>com.sun.jdi.InternalException: Got error code in reply:35 occurred while retrieving value. for all expressions
</code></pre>
<p>I am getting this error for all expressions and cant find anything on it. My guess is that the debugger isn't correctly connecting to ... | [
{
"answer_id": 295747,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 2,
"selected": false,
"text": "<p>Just to be sure: are you remote debugging some instrumented code ?</p>\n\n<p>Because there seem to be some problems with <a ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The following error is being thrown:
```
com.sun.jdi.InternalException: Got error code in reply:35 occurred while retrieving value. for all expressions
```
I am getting this error for all expressions and cant find anything on it. My guess is that the debugger isn't correctly connecting to the remote version, but I a... | It looks like the problem is related to the new debug feature "Show method result after a step operation":
See the thread [Eclipse Oxygen - Debugging Issue](https://www.eclipse.org/forums/index.php?t=msg&th=1088650&goto=1772065&) on the Eclipse forum:
**The workaround is to go to
Preferences -> Java -> Debug and disab... |
295,687 | <p>I would like to get the path to the execution directory of a Windows Forms application. (That is, the directory in which the executable is located.)</p>
<p>Does anyone know of a built-in method in .NET to do this?</p>
| [
{
"answer_id": 295694,
"author": "Tomas Pajonk",
"author_id": 4694,
"author_profile": "https://Stackoverflow.com/users/4694",
"pm_score": 6,
"selected": false,
"text": "<p>In VB.NET</p>\n\n<pre><code>Dim directory as String = My.Application.Info.DirectoryPath\n</code></pre>\n\n<p>In C#</... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51/"
] | I would like to get the path to the execution directory of a Windows Forms application. (That is, the directory in which the executable is located.)
Does anyone know of a built-in method in .NET to do this? | Application.Current results in an appdomain
<http://msdn.microsoft.com/en-us/library/system.appdomain_members.aspx>
Also this should give you the location of the assembly
```
AppDomain.CurrentDomain.BaseDirectory
```
I seem to recall there being multiple ways of getting the location of the application. but this one... |
295,688 | <p>I have 2 tables event + event_artist</p>
<h2>event</h2>
<pre><code>eventId | eventName
-------------------
1 , gig1
2, gig2
</code></pre>
<h2>event_artist</h2>
<pre><code>eventId, artistName
-------------------
1, Led Zip
1, The Beatles
</code></pre>
<p>ie Led Zep and the Beatles are both playing ... | [
{
"answer_id": 295765,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>SQL Server doesn't have anything built in to concatenate values in one statement like that. You could build the st... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461880/"
] | I have 2 tables event + event\_artist
event
-----
```
eventId | eventName
-------------------
1 , gig1
2, gig2
```
event\_artist
-------------
```
eventId, artistName
-------------------
1, Led Zip
1, The Beatles
```
ie Led Zep and the Beatles are both playing @ Gig1
I need to create the SQl to bi... | Saw this in SQL Server Magazine- not great, and the total list will have an upper length limit, but:
```
drop table event
go
drop table event_artist
go
create table event (eventid int, eventname varchar(255))
go
create table event_artist (eventid int, artistname varchar(255))
go
insert into event values (1, 'gig1'... |
295,690 | <p>I've got a section of code on a b2evo PHP site that does the following: </p>
<pre><code>$content = preg_replace_callback(
'/[\x80-\xff]/',
create_function( '$j', 'return "&#".ord($j[0]).";";' ),
$content);
</code></pre>
<p>What does this section of code do? My guess is that it strips out ascii char... | [
{
"answer_id": 295697,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": "<p>It's <code>create_function</code> that's leaking your memory - just use a normal function instead and you'll be fine.</p>\... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726/"
] | I've got a section of code on a b2evo PHP site that does the following:
```
$content = preg_replace_callback(
'/[\x80-\xff]/',
create_function( '$j', 'return "&#".ord($j[0]).";";' ),
$content);
```
What does this section of code do? My guess is that it strips out ascii characters between 128 and 256, bu... | Not really stripping, it replaces high-Ascii characters by their entities.
See [preg\_replace\_callback](http://fr.php.net/manual/en/function.preg-replace-callback.php "PHP: preg_replace_callback - Manual").
create\_function is used to make an anonymous function, but you can use a plain function instead:
```
$cont... |
295,708 | <p>Before I ask my question, here's the offending code:</p>
<pre><code>var coords = dojo.coords(g);
g.style.left = coords.x + "px";
g.style.top = coords.y + "px";
g.style.position = "absolute";
</code></pre>
<p>Now imagine that <code>g</code> is a relatively positioned element with an <code>x</code> position of 70 an... | [
{
"answer_id": 295720,
"author": "José Leal",
"author_id": 37190,
"author_profile": "https://Stackoverflow.com/users/37190",
"pm_score": -1,
"selected": false,
"text": "<p>sorry to not respond your question, (because I do not know dojo) but unless coords.x and coords.y returns a string, ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12549/"
] | Before I ask my question, here's the offending code:
```
var coords = dojo.coords(g);
g.style.left = coords.x + "px";
g.style.top = coords.y + "px";
g.style.position = "absolute";
```
Now imagine that `g` is a relatively positioned element with an `x` position of 70 and a `y` position of 30. If I comment out the las... | I still would love someone to explain why this works, but here's a solution:
```
var coords = dojo.coords(g);
g.style.left = coords.x + "px";
g.style.top = coords.y + "px";
setTimeout(function(h) {
h.style.position = "absolute";
}, 0, g);
```
Cheers |
295,710 | <p>There is a need from a customer to log every data change to a logging table with the actual user who made the modification. The application is using one SQL user to access the database, but we need to log the "real" user id.</p>
<p>We can do this in t-sql by writing triggers for every table insert and update, and u... | [
{
"answer_id": 295868,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 5,
"selected": true,
"text": "<p>How about handling Context.<a href=\"http://msdn.microsoft.com/en-us/library/cc716714.aspx\" rel=\"noreferrer\">Savin... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/968/"
] | There is a need from a customer to log every data change to a logging table with the actual user who made the modification. The application is using one SQL user to access the database, but we need to log the "real" user id.
We can do this in t-sql by writing triggers for every table insert and update, and using conte... | How about handling Context.[SavingChanges](http://msdn.microsoft.com/en-us/library/cc716714.aspx)? |
295,719 | <p>We have a custom REST handler on ASP.NET that is configured like this to handle all incoming requests:</p>
<pre><code><add path="*" verb="*" type="REST.RESTProtocolHandler"/>
</code></pre>
<p>However, passing it a pipe character, properly encoded or not at all, triggers a validation error that seems to come ... | [
{
"answer_id": 295774,
"author": "Slavo",
"author_id": 1801,
"author_profile": "https://Stackoverflow.com/users/1801",
"pm_score": -1,
"selected": false,
"text": "<p>By default IIS does not allow certain characters in the URL and considers them illegal. This is where you problem comes fr... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28917/"
] | We have a custom REST handler on ASP.NET that is configured like this to handle all incoming requests:
```
<add path="*" verb="*" type="REST.RESTProtocolHandler"/>
```
However, passing it a pipe character, properly encoded or not at all, triggers a validation error that seems to come from inside ASP.NET.
Accessing ... | Try to intercept the exception in Global.asax file. Implement there (Global.asax.cs) this method:
```
protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
//do whatever you want with that exception
//or get the url from the context, reformat and redirect
}
`... |
295,740 | <p>I'm now trying to create a xml-rpc server with the CodeIgniter Framework. </p>
<pre><code><?php
$this->load->library('xmlrpc');
$this->load->library('xmlrpcs');
$config['functions']['weblogUpdates.ping'] = array('function' => 'weblogUpdates.ping');
$config['functions']['ping'] = array('function' ... | [
{
"answer_id": 295997,
"author": "inxilpro",
"author_id": 12549,
"author_profile": "https://Stackoverflow.com/users/12549",
"pm_score": 2,
"selected": true,
"text": "<p>Have you looked at <a href=\"http://codeigniter.com/user_guide/libraries/xmlrpc.html\" rel=\"nofollow noreferrer\">the ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38254/"
] | I'm now trying to create a xml-rpc server with the CodeIgniter Framework.
```
<?php
$this->load->library('xmlrpc');
$this->load->library('xmlrpcs');
$config['functions']['weblogUpdates.ping'] = array('function' => 'weblogUpdates.ping');
$config['functions']['ping'] = array('function' => 'weblogUpdates.ping');
$confi... | Have you looked at [the codeigniter user guide](http://codeigniter.com/user_guide/libraries/xmlrpc.html)? |
295,766 | <p>The XML file I want to parse starts with :</p>
<pre><code><!DOCTYPE plist PUBLIC "-//...//DTD PLIST 1.0//EN" "http://www.....dtd">
</code></pre>
<p>So when I start the SAX praser, it tries to access this DTD online, and I get a java.net.UnknownHostException.</p>
<ol>
<li>I cannot modify the XML file before... | [
{
"answer_id": 295840,
"author": "Gowri",
"author_id": 3253,
"author_profile": "https://Stackoverflow.com/users/3253",
"pm_score": 0,
"selected": false,
"text": "<p>You can implement a custom <code>EntityResolver</code> which is what is used to lookup external entities during XML parsing... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/155796/"
] | The XML file I want to parse starts with :
```
<!DOCTYPE plist PUBLIC "-//...//DTD PLIST 1.0//EN" "http://www.....dtd">
```
So when I start the SAX praser, it tries to access this DTD online, and I get a java.net.UnknownHostException.
1. I cannot modify the XML file before feeding it to the SAX parser
2. I have to ... | Ok, turns out the `parse()` method overrides any previously set entity resolvers with the handler passed in to the parse method. The following code should work:
```
javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance();
factory.setValidating(false);
javax.xml.parsers.SAXParser p... |
295,768 | <p>I get the message that the namespace can't be found when I use the code below. Where does the AccessDeniedException live?</p>
<pre><code>try { ... }
catch (SomeKindOfException ex)
{
MessageBox.Show(ex.Message);
}
catch (AccessDeniedException ex)
{
//Do something else
}
</code></pre>
<p>Thanks</p>
| [
{
"answer_id": 295794,
"author": "dpurrington",
"author_id": 5573,
"author_profile": "https://Stackoverflow.com/users/5573",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think that's the exception you're looking for. The only one with this name (that I can find) is in a Sharepo... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I get the message that the namespace can't be found when I use the code below. Where does the AccessDeniedException live?
```
try { ... }
catch (SomeKindOfException ex)
{
MessageBox.Show(ex.Message);
}
catch (AccessDeniedException ex)
{
//Do something else
}
```
Thanks | I don't think that's the exception you're looking for. The only one with this name (that I can find) is in a Sharepoint namespace. Try attaching the debugger and seeing exactly what the type of the thrown exception is.
The type of the exception is going to vary depending on your context. So for example, if it's an "ac... |
295,771 | <p>I have a SQL SELECT query which has a LIKE clause containing an underscore, which should specifically look for an underscore, not treat it as a wildcard: </p>
<pre><code>SELECT * FROM my_table WHERE name LIKE '_H9%';
</code></pre>
<p>I understand that I can change the actual clause to '[_]H9%' for this to work as ... | [
{
"answer_id": 422820,
"author": "Adam Hawkes",
"author_id": 6703,
"author_profile": "https://Stackoverflow.com/users/6703",
"pm_score": 0,
"selected": false,
"text": "<p>Why can you not do a string replacement on the value? How is this being used so that this is a non-workable solution?... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1174/"
] | I have a SQL SELECT query which has a LIKE clause containing an underscore, which should specifically look for an underscore, not treat it as a wildcard:
```
SELECT * FROM my_table WHERE name LIKE '_H9%';
```
I understand that I can change the actual clause to '[\_]H9%' for this to work as I expect, but the problem... | If you're using Criteria to create the query, you can create your own expression which subclasses org.hibernate.criterion.LikeExpression, using one of the protected constructors that takes in 'Character escapeChar', and does substitution in the value for you. Assuming that '!' is a known value that won't be in any sear... |
295,773 | <p>I have a basic ajax application, which will not work, instead the php code is displayed in the browser. The javascript and html seem fine. I have copied the code verbatim from here:</p>
<p><a href="http://arief.aeroven.com/2008/07/30/first-ajax-script-tutorial-connecting-ajax-contain-pure-htmlphpand-javascript-to-m... | [
{
"answer_id": 295784,
"author": "DreamWerx",
"author_id": 15487,
"author_profile": "https://Stackoverflow.com/users/15487",
"pm_score": 2,
"selected": false,
"text": "<p>Perhaps you don't have php short tags enabled? The full php on tag is <code>\"<?php\"</code>\nIs the file extensi... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have a basic ajax application, which will not work, instead the php code is displayed in the browser. The javascript and html seem fine. I have copied the code verbatim from here:
<http://arief.aeroven.com/2008/07/30/first-ajax-script-tutorial-connecting-ajax-contain-pure-htmlphpand-javascript-to-mysql-database/>
a... | I don't know the answer but here's a guide on how to solve these issues:
1. completely remove the file
* create a new file with the same name, containing just html
* rewrite the contents with just a `<?php echo phpinfo(); ?>`
I doubt this has anything to do with PHP and believe it's related to Apache. Are you sure ... |
295,781 | <p>I'm sure there is a quick and easy way to calculate the sum of a column of values on Unix systems (using something like <code>awk</code> or <code>xargs</code> perhaps), but writing a shell script to parse the rows line by line is the only thing that comes to mind at the moment.</p>
<p>For example, what's the simple... | [
{
"answer_id": 295812,
"author": "warren",
"author_id": 4418,
"author_profile": "https://Stackoverflow.com/users/4418",
"pm_score": 1,
"selected": false,
"text": "<p>You could start by running the data through <code>cut</code> - which would at least trim the columns down. </p>\n\n<p>You ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17035/"
] | I'm sure there is a quick and easy way to calculate the sum of a column of values on Unix systems (using something like `awk` or `xargs` perhaps), but writing a shell script to parse the rows line by line is the only thing that comes to mind at the moment.
For example, what's the simplest way to modify the command bel... | ```
ipcs -mb | tail +4 | awk '{ sum += $7 } END { print sum }'
```
Or without tail:
```
ipcs -mb | awk 'NR > 3 { sum += $7 } END { print sum }'
```
Using awk with bc to have arbitrary long results (credits to `Jouni K.`):
```
ipcs -mb | awk 'NR > 3 { print $7 }' | paste -sd+ | bc
``` |
295,811 | <p>I have a .jar file that i've placed in my D:\Coldfusion8\wwwroot\web-inf\lib\ directory. The file is abcdef.jar</p>
<p>This is my first time doing this, not sure what the path should be in my createObject().</p>
<pre><code><cfset abcObj = createObject("java","com.abcdef") />
<cfset result = acbObj.doStuf... | [
{
"answer_id": 295918,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 3,
"selected": true,
"text": "<p>Have you restarted the Coldfusion Service? </p>\n\n<p>Even when in the class path, jars are only loaded at server start.... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26121/"
] | I have a .jar file that i've placed in my D:\Coldfusion8\wwwroot\web-inf\lib\ directory. The file is abcdef.jar
This is my first time doing this, not sure what the path should be in my createObject().
```
<cfset abcObj = createObject("java","com.abcdef") />
<cfset result = acbObj.doStuff("123456") />
```
But when I... | Have you restarted the Coldfusion Service?
Even when in the class path, jars are only loaded at server start.
Info moved up from the comments:
* Make sure the file is in the System class path, or in the one of the configured class paths of ColdFusion.
* As for the class name parameter of `CreateObject()`: The class... |
295,827 | <p><strong>Background</strong></p>
<p>We have a web application in which several developers have written several .js files that manipulate the DOM and the problem of duplicate function names has crept into our application.</p>
<p><strong>Question</strong></p>
<p>Can anyone recommend a tool that will warn us when we ... | [
{
"answer_id": 296180,
"author": "Aaron Digulla",
"author_id": 34088,
"author_profile": "https://Stackoverflow.com/users/34088",
"pm_score": 1,
"selected": false,
"text": "<p>My solution would be a simple HTML parser for Java (I just hacked one with regexps; you may want to try <a href=\... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1181/"
] | **Background**
We have a web application in which several developers have written several .js files that manipulate the DOM and the problem of duplicate function names has crept into our application.
**Question**
Can anyone recommend a tool that will warn us when we accidentally write a web page with two javascript ... | Well, using a parser may not always be ideal as it requires an extra step of copying and pasting your code, and everyone else's, into the parser and even then I'm not sure it would catch what you want. The time tested solution to collaborative Javascript development is to namespace your code.
```
var myNamespace = fu... |
295,832 | <p>Consider the following code in VB9:</p>
<pre><code>Dim text = "Line1<br/>Line2"
Dim markup = <span><%= text %></span>.ToString
</code></pre>
<p>While I was hoping markup would end up being <code><span>Line1<br/>Line2</span></code>, it actually evaluates to <code><span&g... | [
{
"answer_id": 295891,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 3,
"selected": true,
"text": "<p>This behavior is \"By Design.\" When embedding a string expression inside an XML literal the value will be escaped to ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23935/"
] | Consider the following code in VB9:
```
Dim text = "Line1<br/>Line2"
Dim markup = <span><%= text %></span>.ToString
```
While I was hoping markup would end up being `<span>Line1<br/>Line2</span>`, it actually evaluates to `<span>Line1<br/>Line2</span>`.
Is there any way to get the value of the variable not to... | This behavior is "By Design." When embedding a string expression inside an XML literal the value will be escaped to be a legal string value.
To get the behavior you are looking for you'll need to be embedding an XElement/XNode within an XML literal. Take the following example. It will correctly keep the `<br/>` tag a... |
295,833 | <p>Could someone explain why this works in C#.NET 2.0:</p>
<pre><code> Nullable<DateTime> foo;
if (true)
foo = null;
else
foo = new DateTime(0);
</code></pre>
<p>...but this doesn't:</p>
<pre><code> Nullable<DateTime> foo;
foo = true ? null : new DateTime(0);
</code></pr... | [
{
"answer_id": 295842,
"author": "Stewart Johnson",
"author_id": 6408,
"author_profile": "https://Stackoverflow.com/users/6408",
"pm_score": 9,
"selected": true,
"text": "<p>The compiler is telling you that it doesn't know how convert <code>null</code> into a <code>DateTime</code>.</p>\n... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38258/"
] | Could someone explain why this works in C#.NET 2.0:
```
Nullable<DateTime> foo;
if (true)
foo = null;
else
foo = new DateTime(0);
```
...but this doesn't:
```
Nullable<DateTime> foo;
foo = true ? null : new DateTime(0);
```
The latter form gives me an compile error "Type of con... | The compiler is telling you that it doesn't know how convert `null` into a `DateTime`.
The solution is simple:
```
DateTime? foo;
foo = true ? (DateTime?)null : new DateTime(0);
```
Note that `Nullable<DateTime>` can be written `DateTime?` which will save you a bunch of typing. |
295,839 | <p>I am using following code to embed files, video with <code>.wmv</code> extension, that is not working in Firefox. It's working fine in IE.</p>
<pre><code>document.getElementById("QuestionMedia").innerHTML +=
'<OBJECT ID="MediaPlayer" WIDTH="350" HEIGHT="280" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95... | [
{
"answer_id": 295850,
"author": "Slavo",
"author_id": 1801,
"author_profile": "https://Stackoverflow.com/users/1801",
"pm_score": 1,
"selected": false,
"text": "<p>You should have the <a href=\"http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx\" rel=\"nof... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38260/"
] | I am using following code to embed files, video with `.wmv` extension, that is not working in Firefox. It's working fine in IE.
```
document.getElementById("QuestionMedia").innerHTML +=
'<OBJECT ID="MediaPlayer" WIDTH="350" HEIGHT="280" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"STANDBY="Loading Windows Me... | You should have the [Windows Media Player Plugin for Firefox](http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx) to be able to see the video. WMV is a Microsoft/Media Player specific format and needs a plugin for the browser. |
295,849 | <p>In Perl</p>
<pre><code>print "a" x 3; # aaa
</code></pre>
<p>In C# </p>
<pre><code>Console.WriteLine( ??? )
</code></pre>
| [
{
"answer_id": 295856,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "<p>It depends what you need... there is <code>new string('a',3)</code> for example.</p>\n\n<p>For working with strings... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4200/"
] | In Perl
```
print "a" x 3; # aaa
```
In C#
```
Console.WriteLine( ??? )
``` | It depends what you need... there is `new string('a',3)` for example.
For working with strings; you could just loop... not very interesting, but it'll work.
With 3.5, you could use `Enumerable.Repeat("a",3)`, but this gives you a sequence of strings, not a compound string.
If you are going to use this a lot, you cou... |
295,877 |
<p>I'd like to group the digits in a double by thousands, but also output however number of decimals are actually in the number. I cannot figure out the format string. </p>
<pre class="lang-cs prettyprint-override"><code> 1000 => 1,000
100000 => 100,000
123.456 => 123.456
100000.21 => 100,000.21
10... | [
{
"answer_id": 295902,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>Try this one:</p>\n\n<p>VB:</p>\n\n<pre><code>Dim vals() As Double = {1000, 100000, 123.456, 100000.21, 100200.1234... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8435/"
] | I'd like to group the digits in a double by thousands, but also output however number of decimals are actually in the number. I cannot figure out the format string.
```cs
1000 => 1,000
100000 => 100,000
123.456 => 123.456
100000.21 => 100,000.21
100200.123456 => 100,200.123456
```
Disclaimers (it's not as stra... | This appears to do exactly what you want:
```
public void Code(params string[] args)
{
Print(1000);
Print(100000);
Print(123.456);
Print(100000.21 );
Print(100200.123456);
}
void Print(double n)
{
Console.WriteLine("{0:###,###.#######}", n);
}
1,000
100,000
123.456
100,000.21
100,200.123456
... |
295,900 | <p>I am using a System.Random object which is instantiated with a fixed seed all thoughout the application. I am calling the NextDouble method and after some time passed I am getting 0.0 as result.</p>
<p>Is there any remedy to this, has anyone else encountered this ?</p>
<p>EDIT: I have one seed for the whole run wh... | [
{
"answer_id": 295914,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 3,
"selected": false,
"text": "<p>How often are you seeding Random? It should be done only once at the start of the program. </p>\n\n<p>And once s... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4694/"
] | I am using a System.Random object which is instantiated with a fixed seed all thoughout the application. I am calling the NextDouble method and after some time passed I am getting 0.0 as result.
Is there any remedy to this, has anyone else encountered this ?
EDIT: I have one seed for the whole run which is set to 100... | The random number generator in .NET is not thread safe. Other developers have noticed the same behaviour, and one solution is as follows (from [<http://blogs.msdn.com/brada/archive/2003/08/14/50226.aspx>](http://blogs.msdn.com/brada/archive/2003/08/14/50226.aspx)):
```
class ThreadSafeRandom
{
private static Rando... |
295,925 | <pre><code>/* I start with this: */
<Report>
<prop1>4</prop1>
<prop2>2255</prop2>
<prop3>true</prop3>
<prop4>false</prop4>
<prop5>true</prop5>
</Report>
/* I want this result (change the value of node "prop5"): */
<Re... | [
{
"answer_id": 295932,
"author": "Christophe Herreman",
"author_id": 17255,
"author_profile": "https://Stackoverflow.com/users/17255",
"pm_score": -1,
"selected": false,
"text": "<p>Using E4X syntax in ActionScript 3 I guess that would be something like:</p>\n\n<pre><code>report.prop5[0]... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31298/"
] | ```
/* I start with this: */
<Report>
<prop1>4</prop1>
<prop2>2255</prop2>
<prop3>true</prop3>
<prop4>false</prop4>
<prop5>true</prop5>
</Report>
/* I want this result (change the value of node "prop5"): */
<Report>
<prop1>4</prop1>
<prop2>2255</prop2>
<prop3>true</prop3>
... | This seems to be doing exactly what you want. It's just your code with some typos fixed.
```
var reportXML:XML =
<Report>
<prop1>4</prop1>
<prop2>2255</prop2>
<prop3>true</prop3>
<prop4>false</prop4>
<prop5>true</p... |
295,936 | <p>How could I setup a nice indice on <code>cap:deploy</code>?</p>
<p>I want the remote server to nice the <code>cp</code> commands like so: </p>
<pre><code>nice -n 19 cp ...
</code></pre>
| [
{
"answer_id": 295932,
"author": "Christophe Herreman",
"author_id": 17255,
"author_profile": "https://Stackoverflow.com/users/17255",
"pm_score": -1,
"selected": false,
"text": "<p>Using E4X syntax in ActionScript 3 I guess that would be something like:</p>\n\n<pre><code>report.prop5[0]... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How could I setup a nice indice on `cap:deploy`?
I want the remote server to nice the `cp` commands like so:
```
nice -n 19 cp ...
``` | This seems to be doing exactly what you want. It's just your code with some typos fixed.
```
var reportXML:XML =
<Report>
<prop1>4</prop1>
<prop2>2255</prop2>
<prop3>true</prop3>
<prop4>false</prop4>
<prop5>true</p... |
295,938 | <p>I have an issue with EMMA where it is correctly covering all my various Java projects except one.
I am puzzled as to why this occurs as the ANT script appears to be correct. The following expected output is given:</p>
<pre><code> [echo] c:\cc_local_home\emmadata\ProjectName
[instr] processing instrumentation path .... | [
{
"answer_id": 295966,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 1,
"selected": false,
"text": "<p>What does the <code><emma.report></code> element look like?</p>\n\n<p>You may want to look at this <a href=\"htt... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an issue with EMMA where it is correctly covering all my various Java projects except one.
I am puzzled as to why this occurs as the ANT script appears to be correct. The following expected output is given:
```
[echo] c:\cc_local_home\emmadata\ProjectName
[instr] processing instrumentation path ...
[instr] ins... | What does the `<emma.report>` element look like?
You may want to look at this [FAQ](http://emma.sourceforge.net/faq.html#q.report.noop) concerning this exact message: [Why does <report></report> say "nothing to do: no ...data found in any of the data files" and exit without generating anything?](http://emma.sourceforg... |
295,939 | <p>Is there a way to print out the diffs like they show when you open them with "gvim -d", with all the common code folded away and only the diffs showing in context? I tried the print menu option, but it printed the entire file that I was currently "in", rather than printing the folded diffs.</p>
| [
{
"answer_id": 298775,
"author": "Gowri",
"author_id": 3253,
"author_profile": "https://Stackoverflow.com/users/3253",
"pm_score": 3,
"selected": true,
"text": "<p>I dont think theres a way to get a side by side printout of the two files being diffed. But, you could use Vim's \"Convert t... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3333/"
] | Is there a way to print out the diffs like they show when you open them with "gvim -d", with all the common code folded away and only the diffs showing in context? I tried the print menu option, but it printed the entire file that I was currently "in", rather than printing the folded diffs. | I dont think theres a way to get a side by side printout of the two files being diffed. But, you could use Vim's "Convert to HTML" tool on each of the two files being diffed and print those out separately. You could then stack them side by side to get the same effect.
Convert to HTML is kind of "pretty printing" - it ... |
295,952 | <p>Suppose I want to create a set of observers based on type. That is to say, when they are notified of an event, they are told the type of one of the arguments and then decides whether or not to act based on if it can operate on that type.</p>
<p>Are there any simple ways to do this? I figured this would be fairly ... | [
{
"answer_id": 296004,
"author": "Skizz",
"author_id": 1898,
"author_profile": "https://Stackoverflow.com/users/1898",
"pm_score": 3,
"selected": true,
"text": "<p>First off, change the code you've got to the following:</p>\n\n<pre><code>interface IObserver\n{\n}\n\nclass Subject\n{\n p... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | Suppose I want to create a set of observers based on type. That is to say, when they are notified of an event, they are told the type of one of the arguments and then decides whether or not to act based on if it can operate on that type.
Are there any simple ways to do this? I figured this would be fairly simple to do... | First off, change the code you've got to the following:
```
interface IObserver
{
}
class Subject
{
public Subject ()
{
m_observers = new List<IObserver> ();
}
public void Register (IObserver o)
{
m_observers.Add (o);
}
List<IObserver>
m_observers;
}
```
Then, use reflection to find an a... |
295,956 | <p>I have a JEdit (BeanShell) macro which opens a specific file then immediately saves the file to my c:\temp folder (so that I don't accidentally update the real file).</p>
<p>Here is the bean shell code:</p>
<pre><code>logFilePath = "c:\\temp\\aj.txt";
jEdit.openFile( view , logFilePath );
_buffer = jEdit.g... | [
{
"answer_id": 296361,
"author": "Serxipc",
"author_id": 34009,
"author_profile": "https://Stackoverflow.com/users/34009",
"pm_score": 3,
"selected": true,
"text": "<p>You can try <a href=\"http://community.jedit.org/?q=node/view/4026\" rel=\"nofollow noreferrer\">this solution</a>, call... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7211/"
] | I have a JEdit (BeanShell) macro which opens a specific file then immediately saves the file to my c:\temp folder (so that I don't accidentally update the real file).
Here is the bean shell code:
```
logFilePath = "c:\\temp\\aj.txt";
jEdit.openFile( view , logFilePath );
_buffer = jEdit.getBuffer(logFilePath);
_buffe... | You can try [this solution](http://community.jedit.org/?q=node/view/4026), calling `VFSManager.waitForRequests();`. |
295,990 | <p>I'm trying to implement a stateful web service in PHP using the SOAP extension. (Yes I know that web services are supposed to be stateless; all I really care to persist is some form of a session ID so I don't need to authenticate with every call to the service). PHP.net's API documentation is somewhat lacking on th... | [
{
"answer_id": 296026,
"author": "James Anderson",
"author_id": 38207,
"author_profile": "https://Stackoverflow.com/users/38207",
"pm_score": 0,
"selected": false,
"text": "<p>Most soap clients start a new connection for each request so there is no \"session\".</p>\n\n<p>If its your SOAP... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38151/"
] | I'm trying to implement a stateful web service in PHP using the SOAP extension. (Yes I know that web services are supposed to be stateless; all I really care to persist is some form of a session ID so I don't need to authenticate with every call to the service). PHP.net's API documentation is somewhat lacking on this, ... | I actually solved my own problem.
I was working under the assumptions that: 1) .NET handles cookies automatically; and 2) my problem was with the PHP. Neither was the case. My PHP code was fine but I needed to add one more element to my .NET code to handle the session cookie.
After instantiating the web service objec... |
295,992 | <pre><code>var i : integer;
i := 1234567;
</code></pre>
<p>Given the above, I want the string "1,234,567" as output (assuming UK locale). IntToStr just gives me "1234567". I'm sure there's a one-liner for this, but I can't find it...</p>
| [
{
"answer_id": 296045,
"author": "Uwe Raabe",
"author_id": 26833,
"author_profile": "https://Stackoverflow.com/users/26833",
"pm_score": 3,
"selected": false,
"text": "<p>s := FormatFloat('#,##0', i);</p>\n"
},
{
"answer_id": 296047,
"author": "Bruce McGee",
"author_id": ... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] | ```
var i : integer;
i := 1234567;
```
Given the above, I want the string "1,234,567" as output (assuming UK locale). IntToStr just gives me "1234567". I'm sure there's a one-liner for this, but I can't find it... | Try the format function.
```
Label1.Caption := Format('%.0n', [i + 0.0]);
``` |
295,993 | <p>I'm actual looking for a way to get notified about any changes on a SharePoint group. First I though I would be able to this by attaching a event handler to some kind of group list. But unfortunately there are no such list representing SharePoint groups. </p>
<p>My second attempt was to bind a event handler to the ... | [
{
"answer_id": 296208,
"author": "Bjørn Furuknap",
"author_id": 28382,
"author_profile": "https://Stackoverflow.com/users/28382",
"pm_score": 1,
"selected": false,
"text": "<p>What do you mean there is no such list for SharePoint groups? You have the User Information List in which both u... | 2008/11/17 | [
"https://Stackoverflow.com/questions/295993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19601/"
] | I'm actual looking for a way to get notified about any changes on a SharePoint group. First I though I would be able to this by attaching a event handler to some kind of group list. But unfortunately there are no such list representing SharePoint groups.
My second attempt was to bind a event handler to the content ty... | It is really annoying that adding or removing from a group doesn't have an event handler the best work around I have found using Google! is to turn on auditing.
Then periodicaly loop through the audit to fire my event.
```
wssQuery = new SPAuditQuery(site);
wssQuery.AddEventRestriction(SPAudit... |
296,001 | <p>Since I'm sure many people have different standard, I've made this post a community wiki.</p>
<p>My question is, what's a good naming scheme for table aliases? I've been using the first letter of every word from the table name, but it's been getting quite unreadable. Here's a quick example.</p>
<pre><code>FROM inc... | [
{
"answer_id": 296010,
"author": "BQ.",
"author_id": 4632,
"author_profile": "https://Stackoverflow.com/users/4632",
"pm_score": 4,
"selected": true,
"text": "<p>The whole point of an alias is to shorten the name so you don't need verbosity. </p>\n\n<p>It only needs to be unique within a... | 2008/11/17 | [
"https://Stackoverflow.com/questions/296001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25371/"
] | Since I'm sure many people have different standard, I've made this post a community wiki.
My question is, what's a good naming scheme for table aliases? I've been using the first letter of every word from the table name, but it's been getting quite unreadable. Here's a quick example.
```
FROM incidents i
FROM cause_a... | The whole point of an alias is to shorten the name so you don't need verbosity.
It only needs to be unique within a given query, so there's no need for a scheme for naming them.
Edit: Also, the aliases you'd use depend highly on the table naming scheme. If all your tables have a 5-part name where the first 4 are com... |