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 |
|---|---|---|---|---|---|---|
358,826 | <p>I've been trying to fix this for two hours straight and I can't figure it out.</p>
<pre><code>onclick = "location='exceltest.asp?vanjaar=<%=vanjaar%>&vanmaand=<%=vanmaand%>&vandag=<%=vandag%>&totjaar=<%=totjaar%>&totmaand=<%=totmaand%>&totdag=<%=totdag%>'"
</c... | [
{
"answer_id": 358853,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>&</code> inside <code>onclick=\"\"</code> should be html-encoded to <code>&amp;</code></p>\n\n<p>If from... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42389/"
] | I've been trying to fix this for two hours straight and I can't figure it out.
```
onclick = "location='exceltest.asp?vanjaar=<%=vanjaar%>&vanmaand=<%=vanmaand%>&vandag=<%=vandag%>&totjaar=<%=totjaar%>&totmaand=<%=totmaand%>&totdag=<%=totdag%>'"
```
That line of code is in an < input type="button" /> attribute. The ... | Something that might help: [`Server.URLEncode`](http://www.w3schools.com/asp/met_urlencode.asp)
```
fromdate=<%=Server.URLEncode(fromdate)%>
```
But, your Excel file error -- **Item cannot be found in the collection corresponding to the requested name or ordinal.** -- is from **`Recordset.Fields()`**. You're trying ... |
358,834 | <p>If I want to create a .NET object in the powershell I write something like the following:</p>
<pre><code>[System.Reflection.Assembly]::LoadWithPartialName("System.Xml") | out-null"
$doc = new-object -typename System.Xml.XmlDocument"
</code></pre>
<p>If I want to call a static .Net method I use a command similar to... | [
{
"answer_id": 358919,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "<p>I believe you are confusing types and members here.</p>\n\n<pre><code>// type \"Assembly\" in the \"System.Reflection\"... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If I want to create a .NET object in the powershell I write something like the following:
```
[System.Reflection.Assembly]::LoadWithPartialName("System.Xml") | out-null"
$doc = new-object -typename System.Xml.XmlDocument"
```
If I want to call a static .Net method I use a command similar to the following line:
```
... | The brackets are used when you are using a static method on a given class. When you are instantiating a new object of a particular class, you don't need the brackets.
The brackets are also used to cast variables to a certain type
```
PS C:\> $i = [int]"1"
PS C:\> $i.gettype().Name
Int32
PS C:\> $j = "1"
PS C:\> $j.ge... |
358,835 | <p>Assuming the following hypothetical inheritance hierarchy:</p>
<pre><code>public interface IA
{
int ID { get; set; }
}
public interface IB : IA
{
string Name { get; set; }
}
</code></pre>
<p>Using reflection and making the following call: </p>
<pre><code>typeof(IB).GetProperties(BindingFlags.Public | Binding... | [
{
"answer_id": 358857,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "<p>Interface hierarchies are a pain - they don't really \"inherit\" as such, since you can have multiple \"parents\" ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31770/"
] | Assuming the following hypothetical inheritance hierarchy:
```
public interface IA
{
int ID { get; set; }
}
public interface IB : IA
{
string Name { get; set; }
}
```
Using reflection and making the following call:
```
typeof(IB).GetProperties(BindingFlags.Public | BindingFlags.Instance)
```
will only yiel... | I've tweaked @Marc Gravel's example code into a useful extension method encapsulates both classes and interfaces. It also add's the interface properties first which I believe is the expected behaviour.
```
public static PropertyInfo[] GetPublicProperties(this Type type)
{
if (type.IsInterface)
{
var pr... |
358,874 | <p>I'm currently adding verbose tooltips to our site, and I'd like (without having to resort to a whizz-bang jQuery plugin, I know there are many!) to use carriage returns to format the tooltip.</p>
<p>To add the tip I'm using the <code>title</code> attribute. I've looked around the usual sites and using the basic tem... | [
{
"answer_id": 358880,
"author": "Stefan Mai",
"author_id": 13257,
"author_profile": "https://Stackoverflow.com/users/13257",
"pm_score": 7,
"selected": false,
"text": "<p>Try character 10. Until January 2015 it wouldn't work in Firefox.</p>\n<blockquote>\n<p>The text is displayed (if at... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32027/"
] | I'm currently adding verbose tooltips to our site, and I'd like (without having to resort to a whizz-bang jQuery plugin, I know there are many!) to use carriage returns to format the tooltip.
To add the tip I'm using the `title` attribute. I've looked around the usual sites and using the basic template of:
```
<a tit... | It’s simple: just press `Enter`!
```html
<a href="#" title='Tool
Tip
On
New
Line'>link with tip</a>
``` |
358,891 | <p>I want another developer to run a Perl script I have written. The script uses many CPAN modules that have to be installed before the script can be run. Is it possible to make the script (or the <code>perl</code> binary) to dump a list of all the missing modules? Perl prints out the missing modules’ names when I atte... | [
{
"answer_id": 358959,
"author": "innaM",
"author_id": 7498,
"author_profile": "https://Stackoverflow.com/users/7498",
"pm_score": 5,
"selected": true,
"text": "<p>You could dump <code>%INC</code> at the end of your script. It will contain all used and required modules. But of course, th... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17279/"
] | I want another developer to run a Perl script I have written. The script uses many CPAN modules that have to be installed before the script can be run. Is it possible to make the script (or the `perl` binary) to dump a list of all the missing modules? Perl prints out the missing modules’ names when I attempt to run the... | You could dump `%INC` at the end of your script. It will contain all used and required modules. But of course, this will only be helpful if you don't require modules conditionally (require Foo if $bar). |
358,894 | <p>I am wondering if Unittesting and using statements can really go hand in hand as there is no way to mock the disposable object instantiated in the using statement. How would I be able to effectively unittest a method containing the following using statement?</p>
<pre>
public void MyMethod()
{
using(MyDisposableC... | [
{
"answer_id": 358911,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>No, using statements are certainly not forbidden. But what does MyDisposableClass actually do? It strikes me that thi... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32313/"
] | I am wondering if Unittesting and using statements can really go hand in hand as there is no way to mock the disposable object instantiated in the using statement. How would I be able to effectively unittest a method containing the following using statement?
```
public void MyMethod()
{
using(MyDisposableClass dis... | No, using statements are certainly not forbidden. But what does MyDisposableClass actually do? It strikes me that this isn't really a matter of the using statement being a problem - it's a matter of the method creating a new object which you want to mock - *that's* the problem.
Do you genuinely need to mock MyDisposab... |
358,912 | <p>I have a string. I need to replace all instances of a given array of strings from this original string - how would I do that?</p>
<p>Currently I am using...</p>
<pre><code>var inputString = "this is my original string.";
var replacement = "";
var pattern = string.Join("|", arrayOfStringsToRemove);
Regex.Replace(i... | [
{
"answer_id": 358917,
"author": "adam",
"author_id": 33604,
"author_profile": "https://Stackoverflow.com/users/33604",
"pm_score": 0,
"selected": false,
"text": "<p>You need to escape special characters with a backslash</p>\n\n<pre><code>\\\n</code></pre>\n\n<p>Sometimes you may need to... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39561/"
] | I have a string. I need to replace all instances of a given array of strings from this original string - how would I do that?
Currently I am using...
```
var inputString = "this is my original string.";
var replacement = "";
var pattern = string.Join("|", arrayOfStringsToRemove);
Regex.Replace(inputString, pattern, ... | Build the pattern using Regex.Escape:
```
StringBuilder pattern = new StringBuilder();
foreach (string s in arrayOfStringsToRemove)
{
pattern.Append("(");
pattern.Append(Regex.Escape(s));
pattern.Append(")|");
}
Regex.Replace(inputString, pattern.ToString(0, pattern.Length - 1), // remove trailing |
re... |
358,927 | <p>I have a table called ApprovalTasks... Approvals has a status column</p>
<p>I also have a view called ApprovalsView</p>
<p>When I try a straight update :</p>
<pre><code>update ApprovalTasks set Status = 2 where ApprovalTaskID = 48
</code></pre>
<p>I'm getting this error message: </p>
<pre><code>Msg 2601, Level ... | [
{
"answer_id": 358962,
"author": "Nick Kavadias",
"author_id": 40067,
"author_profile": "https://Stackoverflow.com/users/40067",
"pm_score": 3,
"selected": true,
"text": "<p>look at the definition of the index IX_ApprovalTaskID \nIs it possible there is a unique key constraint on Approva... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41291/"
] | I have a table called ApprovalTasks... Approvals has a status column
I also have a view called ApprovalsView
When I try a straight update :
```
update ApprovalTasks set Status = 2 where ApprovalTaskID = 48
```
I'm getting this error message:
```
Msg 2601, Level 14, State 1, Line 1
Cannot insert duplicate key row... | look at the definition of the index IX\_ApprovalTaskID
Is it possible there is a unique key constraint on ApprovalTaskID, StatusID which would mean there is another row in the table with Status = 2 & ApprovalTaskID = 48
I agree with user Learning, it looks like there's a FOR UPDATE trigger on ApprovalTasks that is i... |
358,931 | <p>I need to copy a text from a textbox into the clipboard with ASP.NET. I want a code that is comparable with Mozilla Firefox and IE.</p>
| [
{
"answer_id": 358955,
"author": "Strelok",
"author_id": 2788,
"author_profile": "https://Stackoverflow.com/users/2788",
"pm_score": 3,
"selected": true,
"text": "<p>Internet Explorer clipboard copy is trivial:</p>\n\n<pre><code>// set the clipboard\nvar x = 'Whatever you want on the cli... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44973/"
] | I need to copy a text from a textbox into the clipboard with ASP.NET. I want a code that is comparable with Mozilla Firefox and IE. | Internet Explorer clipboard copy is trivial:
```
// set the clipboard
var x = 'Whatever you want on the clipboard';
window.clipboardData.setData('Text',x);
// get the clipboard data
window.clipboardData.getData('Text');
```
Firefox, not trivial at all. Impossible actually with pure JS unless you have signed scripts... |
358,934 | <pre><code>include("conn.php");
$result = mysql_query("SELECT * FROM sggame");
while($row = mysql_fetch_assoc($result));
{
$id = $row['id'];
echo $id;
echo 'working?';
}
</code></pre>
<p>The above code simply doesn't return anything out of the db. The row name is correct and the loop runs, showing that th... | [
{
"answer_id": 358943,
"author": "Aron Rotteveel",
"author_id": 11568,
"author_profile": "https://Stackoverflow.com/users/11568",
"pm_score": 3,
"selected": true,
"text": "<p>replace</p>\n\n<pre><code>while($row = mysql_fetch_assoc($result));\n</code></pre>\n\n<p>with </p>\n\n<pre><code>... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31677/"
] | ```
include("conn.php");
$result = mysql_query("SELECT * FROM sggame");
while($row = mysql_fetch_assoc($result));
{
$id = $row['id'];
echo $id;
echo 'working?';
}
```
The above code simply doesn't return anything out of the db. The row name is correct and the loop runs, showing that there is something in... | replace
```
while($row = mysql_fetch_assoc($result));
```
with
```
while($row = mysql_fetch_assoc($result))
``` |
358,967 | <p>Under many operating systems Unix-domain sockets allow a process to reliably pass its credentials to another process in a way that can't be maliciously subverted. For instance, this is done on Linux through the <a href="http://linux.die.net/man/7/socket" rel="nofollow noreferrer">SO_PASSCRED and SO_PEERCRED options... | [
{
"answer_id": 359786,
"author": "diciu",
"author_id": 2811,
"author_profile": "https://Stackoverflow.com/users/2811",
"pm_score": 4,
"selected": true,
"text": "<p>I haven't ever worked with it, but I think you're looking for LOCAL_PEERCRED. ( see man unix)</p>\n\n<p><em>You can confirm ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20520/"
] | Under many operating systems Unix-domain sockets allow a process to reliably pass its credentials to another process in a way that can't be maliciously subverted. For instance, this is done on Linux through the [SO\_PASSCRED and SO\_PEERCRED options](http://linux.die.net/man/7/socket), on FreeBSD [by passing messages t... | I haven't ever worked with it, but I think you're looking for LOCAL\_PEERCRED. ( see man unix)
*You can confirm the identity of the program at the other end of the socket using the LOCAL\_PEERCRED socket option, introduced in Mac OS X 10.4.*
See [Technical Note TN2083. Daemons and Agents](http://developer.apple.com/t... |
358,972 | <p>I'm creating a xml-file for display in Excel using _di_IXMLDocument. But for some tags I get an unwanted extra (empty) xmlns attribute witch makes the file unreadable for Excel...
This is what i do:</p>
<pre><code>...
_di_IXMLNode worksheet = workbook->AddChild("Worksheet");
worksheet->SetAttribute("s... | [
{
"answer_id": 359223,
"author": "Edouard A.",
"author_id": 41363,
"author_profile": "https://Stackoverflow.com/users/41363",
"pm_score": 1,
"selected": false,
"text": "<p>xmlns stands for xml name space, if an attribute does not receive an explicit name space, it possesses none. </p>\n\... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2079/"
] | I'm creating a xml-file for display in Excel using \_di\_IXMLDocument. But for some tags I get an unwanted extra (empty) xmlns attribute witch makes the file unreadable for Excel...
This is what i do:
```
...
_di_IXMLNode worksheet = workbook->AddChild("Worksheet");
worksheet->SetAttribute("ss:Name",Now().DateString()... | Ok I had a look at [this](https://stackoverflow.com/questions/135000/how-to-prevent-blank-xmlns-attributes-in-output-from-nets-xmldocument) question. The trick was to create the child nodes and telling the what namespace they belong to, and then not to output it...
```
_di_IXMLNode worksheet = workbook->AddChild("Work... |
358,999 | <p>I need to retrieve the Build Status from TeamCity in the form of XML, RSS format would be ideal.</p>
<p>I am familiar with the RSS feed within Teamcity but that is of no use as it is more of a history view. I am looking for something more like the page generated by the Status Widget but in XML form. (FYI, the statu... | [
{
"answer_id": 359060,
"author": "Dan Vinton",
"author_id": 21849,
"author_profile": "https://Stackoverflow.com/users/21849",
"pm_score": 1,
"selected": false,
"text": "<p><strong>Edit:</strong> as you point out, the RSS feed from TeamCity only includes completed builds.</p>\n\n<p>One po... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20406/"
] | I need to retrieve the Build Status from TeamCity in the form of XML, RSS format would be ideal.
I am familiar with the RSS feed within Teamcity but that is of no use as it is more of a history view. I am looking for something more like the page generated by the Status Widget but in XML form. (FYI, the status widget p... | You can use the `Syndication Feed` tool under `My Settings And Tools` to generate an RSS URL (Documentation [here](http://confluence.jetbrains.net/display/TCD5/Feed+URL+Generator)), and track changes versus build results to determine the status (i.e. building, and previously succeeded/failed)
As an example, I've just ... |
359,029 | <p>I'm having an extremely weird problem with a PHP script of mine.</p>
<p>I'm uploading a couple of files and having PHP put them all in one folder.
I've have trouble with random files being sent and random ones not being sent. So I debugged it and I got a very weird result from the $_FILES[] array.</p>
<p>I tried i... | [
{
"answer_id": 359042,
"author": "benlumley",
"author_id": 39161,
"author_profile": "https://Stackoverflow.com/users/39161",
"pm_score": 2,
"selected": true,
"text": "<p>Relevent, but probably not going to help: but move_uploaded_file is a (slightly) better way to handle uploaded files t... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11795/"
] | I'm having an extremely weird problem with a PHP script of mine.
I'm uploading a couple of files and having PHP put them all in one folder.
I've have trouble with random files being sent and random ones not being sent. So I debugged it and I got a very weird result from the $\_FILES[] array.
I tried it with 3 files.
... | Relevent, but probably not going to help: but move\_uploaded\_file is a (slightly) better way to handle uploaded files than copy.
Are any of the files large? PHP has limits on the filesize and the time it can take to upload them ...
Better to send you here than attempt to write up what it says:
<http://uk3.php.net/m... |
359,031 | <p>Following are the PHP code lines which I am using to open a PDF file:</p>
<pre><code>$pdf_generartor = new PDFlib();
$doc = $pdf_generartor -> open_pdi_document("Report.pdf", "") or die ("ERROR: " . $pdf_generartor -> get_errmsg());
</code></pre>
<p>Though the file is at required location, every time I rece... | [
{
"answer_id": 359049,
"author": "benlumley",
"author_id": 39161,
"author_profile": "https://Stackoverflow.com/users/39161",
"pm_score": 1,
"selected": false,
"text": "<p>I think you've just got the file in the wrong place.</p>\n\n<p>Remember, if its linux, its case sensitive.</p>\n\n<p>... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6561/"
] | Following are the PHP code lines which I am using to open a PDF file:
```
$pdf_generartor = new PDFlib();
$doc = $pdf_generartor -> open_pdi_document("Report.pdf", "") or die ("ERROR: " . $pdf_generartor -> get_errmsg());
```
Though the file is at required location, every time I receive following error:
```
ERROR:... | I know it's a bit overdue, but I ran into this problem myself and managed to "fix" it. Apparently the PDF lib doesn't understand relative paths very well, so you'll have to use realpath().
When you take a look at the samples, you can do this in two ways. You can either use realpath() with the actual file paths, or use... |
359,041 | <p>I need to create a request for a web page delivered to our web sites, but I need to be able to set the host header information too. I have tried this using HttpWebRequest, but the Header information is read only (Or at least the Host part of it is). I need to do this because we want to perform the initial request ... | [
{
"answer_id": 359054,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 0,
"selected": false,
"text": "<p>Alright, little bit of research turns up this:</p>\n\n<p><a href=\"https://connect.microsoft.com/VisualStudio/feedback... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/274/"
] | I need to create a request for a web page delivered to our web sites, but I need to be able to set the host header information too. I have tried this using HttpWebRequest, but the Header information is read only (Or at least the Host part of it is). I need to do this because we want to perform the initial request for a... | I have managed to find out a more long winded route by using sockets. I found the answer in the MSDN page for IPEndPoint:
```
string getString = "GET /path/mypage.htm HTTP/1.1\r\nHost: www.mysite.mobi\r\nConnection: Close\r\n\r\n";
Encoding ASCII = Encoding.ASCII;
Byte[] byteGetString = ASCII.GetBytes(getString);
Byte... |
359,043 | <p>I'm writing code to generate character-based pagination. I have articles in my site that I want to split up based on length.</p>
<p>The code I have so far is working albeit two issues:</p>
<ol>
<li>It's splitting pages in the middle of words and HTML tags; I want it to
only split after a complete word, tag, or a p... | [
{
"answer_id": 359062,
"author": "benlumley",
"author_id": 39161,
"author_profile": "https://Stackoverflow.com/users/39161",
"pm_score": 0,
"selected": false,
"text": "<pre><code>$NoOfPages = round((double)$ArticleLength / (double)$CharsPerPage);\n</code></pre>\n\n<p>That should use ceil... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm writing code to generate character-based pagination. I have articles in my site that I want to split up based on length.
The code I have so far is working albeit two issues:
1. It's splitting pages in the middle of words and HTML tags; I want it to
only split after a complete word, tag, or a punctuation mark.
2. ... | Thanks, guys. I put in the fix for the 1st point and it worked beautifully.
Hm. I guess it is messy to do the second point. I've found some regex on-line. Will think, write, and get back to you when I make some progress.
Thanks again. |
359,047 | <p>How can I detect which request type was used (GET, POST, PUT or DELETE) in PHP?</p>
| [
{
"answer_id": 359050,
"author": "gnud",
"author_id": 27204,
"author_profile": "https://Stackoverflow.com/users/27204",
"pm_score": 12,
"selected": true,
"text": "<p>By using</p>\n\n<pre><code>$_SERVER['REQUEST_METHOD']\n</code></pre>\n\n<h3>Example</h3>\n\n<pre><code>if ($_SERVER['REQUE... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115/"
] | How can I detect which request type was used (GET, POST, PUT or DELETE) in PHP? | By using
```
$_SERVER['REQUEST_METHOD']
```
### Example
```
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// The request is using the POST method
}
```
For more details please see the [documentation for the $\_SERVER variable](http://php.net/manual/en/reserved.variables.server.php). |
359,085 | <p>Which would be faster for say 500 elements.</p>
<p>Or what's the faster data structure/collection for retrieving elements?</p>
<pre><code> List<MyObj> myObjs = new List<MyObj>();
int i = myObjs.BinarySearch(myObjsToFind);
MyObj obj = myObjs[i];
</code></pre>
<p>Or</p>
<pre><cod... | [
{
"answer_id": 359096,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>I assume in your real code you'd actually <em>populate</em> myObjs - and sort it.</p>\n\n<p>Have you just tried it? I... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Which would be faster for say 500 elements.
Or what's the faster data structure/collection for retrieving elements?
```
List<MyObj> myObjs = new List<MyObj>();
int i = myObjs.BinarySearch(myObjsToFind);
MyObj obj = myObjs[i];
```
Or
```
Dictionary<MyObj, MyObj> myObjss = new Diction... | I assume in your real code you'd actually *populate* myObjs - and sort it.
Have you just tried it? It will depend on several factors:
* Do you need to sort the list for any other reason?
* How fast is MyObj.CompareTo(MyObj)?
* How fast is MyObj.GetHashCode()?
* How fast is MyObj.Equals()?
* How likely are you to get ... |
359,086 | <p>i'm trying to create a ObjectDataSource which I can use to bind to a BindingSource which on his turn should be bound to a ComboBox.</p>
<p>I've created a simple class and a simple list for this class (see below)</p>
<ol>
<li>The Times list class is not showing up at my toolbox, so I cannot drag it to the form so I... | [
{
"answer_id": 359096,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>I assume in your real code you'd actually <em>populate</em> myObjs - and sort it.</p>\n\n<p>Have you just tried it? I... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45311/"
] | i'm trying to create a ObjectDataSource which I can use to bind to a BindingSource which on his turn should be bound to a ComboBox.
I've created a simple class and a simple list for this class (see below)
1. The Times list class is not showing up at my toolbox, so I cannot drag it to the form so I can select it as th... | I assume in your real code you'd actually *populate* myObjs - and sort it.
Have you just tried it? It will depend on several factors:
* Do you need to sort the list for any other reason?
* How fast is MyObj.CompareTo(MyObj)?
* How fast is MyObj.GetHashCode()?
* How fast is MyObj.Equals()?
* How likely are you to get ... |
359,087 | <p>If i do jQuery(expr).change( function), then I can get an event function to fire when the user makes a change to the value.</p>
<p>Is it possible to get this to fire if it's changed programatically, ie if I call jQuery(expr).val("moo").</p>
<p>or if some Plain old JavaScript changes it's value?</p>
<p>Thanks for ... | [
{
"answer_id": 359129,
"author": "Sander Versluys",
"author_id": 2172,
"author_profile": "https://Stackoverflow.com/users/2172",
"pm_score": 5,
"selected": true,
"text": "<p>After you've changed the value, you can fire the event yourself, and thus calling all the 'onchange' handlers.</p... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45279/"
] | If i do jQuery(expr).change( function), then I can get an event function to fire when the user makes a change to the value.
Is it possible to get this to fire if it's changed programatically, ie if I call jQuery(expr).val("moo").
or if some Plain old JavaScript changes it's value?
Thanks for any help. | After you've changed the value, you can fire the event yourself, and thus calling all the 'onchange' handlers.
```
jQuery('#element').change();
``` |
359,098 | <p>In Silverlight, I have a Vertical ListBox that has a Horizontal ListBox for each item. I want the items in the HorizontalListbox to space evenly across the width of the parent (Vertical) ListBox. How can I do this?</p>
<pre><code> <ListBox x:Name="MachineListBox" Background="Green">
<ListBox.It... | [
{
"answer_id": 359119,
"author": "user34005",
"author_id": 34005,
"author_profile": "https://Stackoverflow.com/users/34005",
"pm_score": 2,
"selected": false,
"text": "<p>Instead of forking there are two other approaches to handle concurrent connections. Either you use threads or a polli... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5189/"
] | In Silverlight, I have a Vertical ListBox that has a Horizontal ListBox for each item. I want the items in the HorizontalListbox to space evenly across the width of the parent (Vertical) ListBox. How can I do this?
```
<ListBox x:Name="MachineListBox" Background="Green">
<ListBox.ItemTemplate>
<... | Instead of forking there are two other approaches to handle concurrent connections. Either you use threads or a polling approach.
In the thread approach for each connection a new thread is created that handles the I/O of a socket. A thread runs in the same virtual memory of the creating process and can access all of i... |
359,099 | <p>I'm trying to refactor a large, old project and one thing I've noticed is a range of different Iterator implementations:</p>
<pre><code>while($iterator->moveNext()) {
$item = $iterator->current();
// do something with $item;
}
for($iterator = getIterator(), $iterator->HasNext()) {
$item = $... | [
{
"answer_id": 359110,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 4,
"selected": true,
"text": "<p>The SPL version is definitely the way to go. Not only is it the easiest to read, but it's a part of PHP now, so will be fa... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20074/"
] | I'm trying to refactor a large, old project and one thing I've noticed is a range of different Iterator implementations:
```
while($iterator->moveNext()) {
$item = $iterator->current();
// do something with $item;
}
for($iterator = getIterator(), $iterator->HasNext()) {
$item = $iterator->Next();
/... | The SPL version is definitely the way to go. Not only is it the easiest to read, but it's a part of PHP now, so will be familiar to many more people.
There's nothing "wrong" with the others, but as you stated, having all these different versions in one project isn't helping anyone. |
359,109 | <p>How can I set up GNU screen to allow the mouse's scrollwheel to scroll around in the scrollback buffer? I tried to Google about this, but most hits were on how to allow applications inside screen to use the scrollwheel.</p>
| [
{
"answer_id": 475332,
"author": "sleske",
"author_id": 43681,
"author_profile": "https://Stackoverflow.com/users/43681",
"pm_score": 6,
"selected": false,
"text": "<p>In screen, you must first enter \"scrollback mode\" (or \"copy mode\") to be able to scroll around in the scrollback buf... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13051/"
] | How can I set up GNU screen to allow the mouse's scrollwheel to scroll around in the scrollback buffer? I tried to Google about this, but most hits were on how to allow applications inside screen to use the scrollwheel. | I believe you can just add a line like this to your `~/.screenrc`:
```
termcapinfo xterm* ti@:te@
```
Where "xterm\*" is a glob match of your current TERM. To confirm it works, ^A^D to detach from your screen, then `screen -d -r` to reattach, then `ls` a few times, and try to scroll back. It works for me.
---
What... |
359,120 | <p>for testing purposes i need an recursive directory with some files, that comes to maximum path-length.</p>
<p>The Script used for the creation consists only of two for-loops, as followed:</p>
<pre><code>for /L %%a in (1 1 255) do @(
mkdir %%a
&& cd %%a
&& for /L %%b in (1 1 %random%) do... | [
{
"answer_id": 359135,
"author": "Patrick Cuff",
"author_id": 7903,
"author_profile": "https://Stackoverflow.com/users/7903",
"pm_score": 2,
"selected": true,
"text": "<p>I don't think you need the '@'s in front of the parens or the '&&' within the for loop body; the parens take ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44532/"
] | for testing purposes i need an recursive directory with some files, that comes to maximum path-length.
The Script used for the creation consists only of two for-loops, as followed:
```
for /L %%a in (1 1 255) do @(
mkdir %%a
&& cd %%a
&& for /L %%b in (1 1 %random%) do @(
echo %%b >> %%a.txt
... | I don't think you need the '@'s in front of the parens or the '&&' within the for loop body; the parens take care of handling multiple statements in the for loop.
The following works for me:
```
@echo OFF
for /L %%a in (1 1 255) do (
@echo a = %%a
mkdir %%a
cd %%a
for /L %%b in (1 1 %random%) do (
... |
359,122 | <p>I am looking at depency injection, I can see the benefits but I am having problems with the syntax it creates. I have this example</p>
<pre><code>public class BusinessProducts
{
IDataContext _dx;
BusinessProducts(IDataContext dx)
{
_dx = dx;
}
public List<Product> GetProducts()
{
... | [
{
"answer_id": 359130,
"author": "Strelok",
"author_id": 2788,
"author_profile": "https://Stackoverflow.com/users/2788",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://springframework.net/\" rel=\"nofollow noreferrer\">http://springframework.net/</a> and <a href=\"http://... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29519/"
] | I am looking at depency injection, I can see the benefits but I am having problems with the syntax it creates. I have this example
```
public class BusinessProducts
{
IDataContext _dx;
BusinessProducts(IDataContext dx)
{
_dx = dx;
}
public List<Product> GetProducts()
{
return dx.GetProduc... | I use a factory for my context and inject it, providing a suitable default if the provided factory is null. I do this for two reasons. First, I use the data context as a unit of work scoped object so I need to be able to create them when needed, not keep one around. Second, I'm primarily using DI to increase testabilit... |
359,125 | <p>This is a fairly basic question, which for some reason, a proper solution escapes me at the moment. I am dealing with a 3rd-party SDK which declares the following structure:</p>
<pre><code>struct VstEvents
{
VstInt32 numEvents; ///< number of Events in array
VstIntPtr reserved; ///< zero (Reserved ... | [
{
"answer_id": 359136,
"author": "epatel",
"author_id": 842,
"author_profile": "https://Stackoverflow.com/users/842",
"pm_score": 2,
"selected": true,
"text": "<p>If you know how many there are you can allocate it with</p>\n\n<pre><code>struct VstEvents *evnts;\n\nevnts = (struct VstEven... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14302/"
] | This is a fairly basic question, which for some reason, a proper solution escapes me at the moment. I am dealing with a 3rd-party SDK which declares the following structure:
```
struct VstEvents
{
VstInt32 numEvents; ///< number of Events in array
VstIntPtr reserved; ///< zero (Reserved for future use)
V... | If you know how many there are you can allocate it with
```
struct VstEvents *evnts;
evnts = (struct VstEvents*)malloc(sizeof(struct VstEvents) +
numEvents*sizeof(VstEvent*));
```
This will allocate 2 **extra** slots |
359,126 | <p>I'm using Crystal Reports 11 (and VB6) to open a report file, load the data from an Access database and either print the report to a printer or export the report to another .rpt file (for later printing without the database)</p>
<p>Even for small amounts of data the process is somewhat slow. Profiling showed about ... | [
{
"answer_id": 359136,
"author": "epatel",
"author_id": 842,
"author_profile": "https://Stackoverflow.com/users/842",
"pm_score": 2,
"selected": true,
"text": "<p>If you know how many there are you can allocate it with</p>\n\n<pre><code>struct VstEvents *evnts;\n\nevnts = (struct VstEven... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23368/"
] | I'm using Crystal Reports 11 (and VB6) to open a report file, load the data from an Access database and either print the report to a printer or export the report to another .rpt file (for later printing without the database)
Even for small amounts of data the process is somewhat slow. Profiling showed about 1.5 second... | If you know how many there are you can allocate it with
```
struct VstEvents *evnts;
evnts = (struct VstEvents*)malloc(sizeof(struct VstEvents) +
numEvents*sizeof(VstEvent*));
```
This will allocate 2 **extra** slots |
359,128 | <p>When a ComboBox is clicked this causes it to be selected in the window. Is there a way to perform the equivalent of a javascript blur()</p>
| [
{
"answer_id": 359158,
"author": "arul",
"author_id": 15409,
"author_profile": "https://Stackoverflow.com/users/15409",
"pm_score": 3,
"selected": true,
"text": "<p>Not directly. You can try focusing the root parent of the combobox or another element, though.</p>\n\n<pre><code>comboBox1.... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32055/"
] | When a ComboBox is clicked this causes it to be selected in the window. Is there a way to perform the equivalent of a javascript blur() | Not directly. You can try focusing the root parent of the combobox or another element, though.
```
comboBox1.TopLevelControl.Focus();
```
or
```
someControl.Focus();
``` |
359,147 | <p>Related to this question:
<a href="https://stackoverflow.com/questions/353207/url-characters-replacement-in-jsp-with-urlrewrite">URL characters replacement in JSP with UrlRewrite</a></p>
<p>I want to have masked URLs in this JSP Java EE web project.
For example if I had this:</p>
<pre><code>http://mysite.com/prod... | [
{
"answer_id": 359306,
"author": "Yuval",
"author_id": 2819,
"author_profile": "https://Stackoverflow.com/users/2819",
"pm_score": 1,
"selected": true,
"text": "<p>It's been a while since I mucked about with JSPs, but if memory serves you can add URL patterns to your web.xml (or one of t... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1492/"
] | Related to this question:
[URL characters replacement in JSP with UrlRewrite](https://stackoverflow.com/questions/353207/url-characters-replacement-in-jsp-with-urlrewrite)
I want to have masked URLs in this JSP Java EE web project.
For example if I had this:
```
http://mysite.com/products.jsp?id=42&name=Programming_... | It's been a while since I mucked about with JSPs, but if memory serves you can add URL patterns to your web.xml (or one of those XML config files) and have the servlet engine automatically route the request to a valid URL with your choice of paramters. I can look up the details if you like.
In your case, map `http://m... |
359,213 | <p>On a Unix systems it's very easy to compile the CLASSPATH by using find:</p>
<pre><code>LIBDIR=`find lib/ -name \*.jar`
for DIR in $LIBDIR:
do
CLASSPATH="$CLASSPATH:$DIR"
done
java -classpath $CLASSPATH com.example.MyClass
</code></pre>
<p>What would be the aquivalent in a Windows batchfile?</p>
| [
{
"answer_id": 359242,
"author": "MrG",
"author_id": 33429,
"author_profile": "https://Stackoverflow.com/users/33429",
"pm_score": 3,
"selected": true,
"text": "<p>The same can be achieved from Windows XP on with:</p>\n\n<pre><code>setlocal ENABLEDELAYEDEXPANSION\nFOR /R .\\lib %%G IN (*... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33429/"
] | On a Unix systems it's very easy to compile the CLASSPATH by using find:
```
LIBDIR=`find lib/ -name \*.jar`
for DIR in $LIBDIR:
do
CLASSPATH="$CLASSPATH:$DIR"
done
java -classpath $CLASSPATH com.example.MyClass
```
What would be the aquivalent in a Windows batchfile? | The same can be achieved from Windows XP on with:
```
setlocal ENABLEDELAYEDEXPANSION
FOR /R .\lib %%G IN (*.jar) DO set CLASSPATH=!CLASSPATH!;%%G
java -classpath %CLASSPATH% com.example.MyClass
``` |
359,217 | <p>I have a WPF ListView which repeats the data vertically. I cannot figure out how to make it repeat horizontally, like the slideshow view in Windows Explorer. My current ListView definition is:</p>
<pre><code><ListView ItemsSource="{StaticResource MyDataList}" ItemTemplate="{StaticResource ListViewTemplate}">
... | [
{
"answer_id": 359418,
"author": "Boyan",
"author_id": 38106,
"author_profile": "https://Stackoverflow.com/users/38106",
"pm_score": 9,
"selected": true,
"text": "<p>Set the ItemsPanel of the ListView to a horizontal StackPanel. Like this:</p>\n\n<pre><code><ListView.ItemsPanel>\n ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26221/"
] | I have a WPF ListView which repeats the data vertically. I cannot figure out how to make it repeat horizontally, like the slideshow view in Windows Explorer. My current ListView definition is:
```
<ListView ItemsSource="{StaticResource MyDataList}" ItemTemplate="{StaticResource ListViewTemplate}">
</ListView>
```
Th... | Set the ItemsPanel of the ListView to a horizontal StackPanel. Like this:
```
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
``` |
359,229 | <p>I am working on an application which draws a simple dot grid. I would like the mouse to snap between the points on the grid, eventually to draw lines on the grid.</p>
<p>I have a method which takes in the current mouse location (X,Y) and calculates the nearest grid coordinate.</p>
<p>When I create an event and att... | [
{
"answer_id": 359262,
"author": "Vincent Van Den Berghe",
"author_id": 39259,
"author_profile": "https://Stackoverflow.com/users/39259",
"pm_score": 2,
"selected": false,
"text": "<p>Your mouse keeps snapping to the same point if you try to move it -- because it's still closest to that ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am working on an application which draws a simple dot grid. I would like the mouse to snap between the points on the grid, eventually to draw lines on the grid.
I have a method which takes in the current mouse location (X,Y) and calculates the nearest grid coordinate.
When I create an event and attempt to move the ... | I think I understand where you're coming from. You simply need to be some delta away from the original snap point (the left mouse click) before you snap to the new point.
Here's 50 lines of code illustrating what I mean:
(Start a new VB.NET project, add a new module, copy and paste the code, add a reference, to System... |
359,232 | <p>I'm using Windows XP Service Pack 3 and have Command Extensions enabled by default in the Windows Registry.
Somehow, the following command does not work on this version of Windows but if I run it in Windows Server 2003 or Windows Vista Business, it works just fine. Any clue?</p>
<p>The problem is that on Windows XP... | [
{
"answer_id": 359274,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 1,
"selected": false,
"text": "<p>The following does work on my Windows XP computer:</p>\n\n<pre><code>@echo off\nfor /f \"tokens=1 delims=: \" %%A in ('taskl... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using Windows XP Service Pack 3 and have Command Extensions enabled by default in the Windows Registry.
Somehow, the following command does not work on this version of Windows but if I run it in Windows Server 2003 or Windows Vista Business, it works just fine. Any clue?
The problem is that on Windows XP, it seems... | That's because `tasklist.exe` outputs to `STDERR` when no task is found. The `for /f` loop gets to see `STDOUT` only, so in case `python.exe` is not running, it has nothing to loop on.
Redirecting `STDERR` into `STDOUT` (`2>&1`) works:
```
for /F "tokens=1 delims=: " %A in ('tasklist /FI "IMAGENAME eq python.exe" /NH... |
359,257 | <p>In SQL server 2005 this query</p>
<pre><code>select len(cast('the quick brown fox jumped over the lazy dog' as varchar))
</code></pre>
<p>returns 30 as length while the supplied string has more characters. This seems to be the default. Why 30, and not 32 or any other power of 2?</p>
<p><strong>[EDIT]</strong> I a... | [
{
"answer_id": 359289,
"author": "curtisk",
"author_id": 17651,
"author_profile": "https://Stackoverflow.com/users/17651",
"pm_score": 7,
"selected": true,
"text": "<p>Why don't you specify the varchar length? ie:</p>\n\n<pre><code>SELECT CAST('the quick brown fox jumped over the lazy do... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6399/"
] | In SQL server 2005 this query
```
select len(cast('the quick brown fox jumped over the lazy dog' as varchar))
```
returns 30 as length while the supplied string has more characters. This seems to be the default. Why 30, and not 32 or any other power of 2?
**[EDIT]** I am aware that I should always specifiy the leng... | Why don't you specify the varchar length? ie:
```
SELECT CAST('the quick brown fox jumped over the lazy dog' AS VARCHAR(45))
```
As far as why 30, that's the default length in SQL Server for that type.
From [char and varchar (Transact-SQL)](http://msdn.microsoft.com/en-us/library/ms176089.aspx):
>
> When n is not... |
359,276 | <p>I have a game with puzzles. Puzzles are created from script files using a puzzle engine ID. Puzzle engines register themselves using a static variable in a static hash. I'm having reports of crashes and we've tracked down the problem to the hash not having certain keys, which should have been added by the static fun... | [
{
"answer_id": 359297,
"author": "Joris Timmermans",
"author_id": 33987,
"author_profile": "https://Stackoverflow.com/users/33987",
"pm_score": 2,
"selected": false,
"text": "<p>This is probably a <a href=\"http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12\" rel=\"nofollow noref... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39301/"
] | I have a game with puzzles. Puzzles are created from script files using a puzzle engine ID. Puzzle engines register themselves using a static variable in a static hash. I'm having reports of crashes and we've tracked down the problem to the hash not having certain keys, which should have been added by the static functi... | This is probably a [static initialization](http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12) order issue. Try rewriting it as "[construct on first use](http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.13)". |
359,284 | <p>I have a method which prints out the order of a set of images. I need to submit this to a new php page.</p>
<p>I have a form which currently prints out the order to the same page.</p>
<pre><code><form action="mainpage.php" method="post">
<div style="clear:both;padding-bottom:10px">
<input type=... | [
{
"answer_id": 359305,
"author": "jumoel",
"author_id": 1555170,
"author_profile": "https://Stackoverflow.com/users/1555170",
"pm_score": 2,
"selected": false,
"text": "<p>You can submit the form with (note that this isn't tested):</p>\n\n<pre><code>document.formname.submit();\n</code></... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a method which prints out the order of a set of images. I need to submit this to a new php page.
I have a form which currently prints out the order to the same page.
```
<form action="mainpage.php" method="post">
<div style="clear:both;padding-bottom:10px">
<input type="Button" style="width:100px" value="... | You can submit the form with (note that this isn't tested):
```
document.formname.submit();
```
If you need to change the action (the page to submit to) first:
```
document.formname.action = 'some_other_url';
```
If you need to submit the form asynchronously you need to use a XMLHttpRequest or something similar. |
359,287 | <p>I am writing an <a href="http://www.eclipse.com" rel="nofollow noreferrer">Eclipse</a> plug-in that loads resources from a central database. I would like to use <a href="http://www.hibernate.org" rel="nofollow noreferrer">Hibernate</a> to access that database. </p>
<p>So how would I add this as a dependency to my p... | [
{
"answer_id": 359556,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>You could stick to the standard hibernate tutorials like the documentation provided at hibernate.org or Gaven Kings book, f... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1969/"
] | I am writing an [Eclipse](http://www.eclipse.com) plug-in that loads resources from a central database. I would like to use [Hibernate](http://www.hibernate.org) to access that database.
So how would I add this as a dependency to my plug-in project? I've tried Google but only get hits on about plug-ins for editing Hi... | I would create a hibernate plugin, that exposes all the hibernate jar files and exports the classes contained. My configuration and data would then be in another plugin that depends on hibernate.
Then, because hibernate uses reflection like no tomorrow, the Hibernate plug-in needs to be able to load classes from the p... |
359,290 | <p>How is it possible to get the FxCop custom dictionary to work correctly?</p>
<p>I have tried adding words to be recognised to the file 'CustomDictionary.xml', which is kept in the same folder as the FxCop project file. This does not seem to work, as I still get the 'Identifiers should be spelled correctly' FxCop m... | [
{
"answer_id": 371217,
"author": "andypaxo",
"author_id": 46575,
"author_profile": "https://Stackoverflow.com/users/46575",
"pm_score": 2,
"selected": false,
"text": "<p>To my knowledge, FxCop 1.35 and onwards use two sources for the dictionary.</p>\n\n<ul>\n<li>The Microsoft Office dict... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15985/"
] | How is it possible to get the FxCop custom dictionary to work correctly?
I have tried adding words to be recognised to the file 'CustomDictionary.xml', which is kept in the same folder as the FxCop project file. This does not seem to work, as I still get the 'Identifiers should be spelled correctly' FxCop message, eve... | If you use it inside Visual Studio...
From [Visual Studio Code Analysis Team Blog](http://blogs.msdn.com/fxcop/archive/2007/08/20/new-for-visual-studio-2008-custom-dictionaries.aspx)
>
> To add a custom dictionary to a C# and
> Visual Basic project is simple:
>
>
> 1. In Solution Explorer, right-click on the proj... |
359,298 | <p>I have data from a table in a database (string) that contain text and price. I extract the price from the data but my problem is that sometime I can Convert it to float and sometime not.</p>
<p>I have noticed that :</p>
<pre><code>Convert.ToSingle(m.Groups[1].Value);
</code></pre>
<p>It works but not always becau... | [
{
"answer_id": 359311,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 6,
"selected": true,
"text": "<p>You have this problem because the conversion check the language of your PC. You will need to do something lik... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14441/"
] | I have data from a table in a database (string) that contain text and price. I extract the price from the data but my problem is that sometime I can Convert it to float and sometime not.
I have noticed that :
```
Convert.ToSingle(m.Groups[1].Value);
```
It works but not always because sometime the period is the pro... | You have this problem because the conversion check the language of your PC. You will need to do something like :
```
Convert.ToSingle(m.Groups[1].Value, CultureInfo.InvariantCulture.NumberFormat);
```
This ways, it won't check the language of the PC. You can find more information about [InvariantCulture](http://msdn... |
359,303 | <p>I have a IBAction such as:</p>
<pre><code>- (IBAction)showPicker:(id)sender;
</code></pre>
<p>How can I get the name of the control from the sender variable?</p>
<p>I am typically a c# coder so have tried the following to no avail</p>
<pre><code>senderName = ((UIButton *)sender).name;
</code></pre>
<p>I need so... | [
{
"answer_id": 359358,
"author": "Marc Charbonneau",
"author_id": 35136,
"author_profile": "https://Stackoverflow.com/users/35136",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>name</code> field under Interface Builder Identity is something unique to Interface Builder; I'm act... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258/"
] | I have a IBAction such as:
```
- (IBAction)showPicker:(id)sender;
```
How can I get the name of the control from the sender variable?
I am typically a c# coder so have tried the following to no avail
```
senderName = ((UIButton *)sender).name;
```
I need something more descriptive than the control id (not the bu... | You might want to look at using the *tag* property. It's an integer rather than a name, but can be used to differentiate between two controls. It's inherited from UIView so any control that's sending an event should have it.
It's editable in Interface Builder under View attributes.
It's a property so it can be access... |
359,315 | <p>How to configure JAXB unmarshaller so it will trim leading and trailing whitespaces from strings?</p>
<p>For instance let's consider a simple binding between a Java bean and XML using JAXB annotations:</p>
<pre><code>@XmlRootElement(name="bean")
class Bean {
@XmlElement(required=true)
String name;
@XmlEle... | [
{
"answer_id": 359363,
"author": "bruno conde",
"author_id": 31136,
"author_profile": "https://Stackoverflow.com/users/31136",
"pm_score": 4,
"selected": true,
"text": "<p>Use a custom <em>Adapter</em> class. I was thinking that <a href=\"http://java.sun.com/javase/6/docs/api/javax/xml/b... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42201/"
] | How to configure JAXB unmarshaller so it will trim leading and trailing whitespaces from strings?
For instance let's consider a simple binding between a Java bean and XML using JAXB annotations:
```
@XmlRootElement(name="bean")
class Bean {
@XmlElement(required=true)
String name;
@XmlElement(required=true)
... | Use a custom *Adapter* class. I was thinking that [NormalizedStringAdapter](http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.html) would do the work but it's only for unmarshaling and it doesn't do what you want anyway.
```
public class MyNormalizedStringAdapter extends ... |
359,320 | <p>I want to create a delegate type in C# inside a method for the purpose of creating Anonymous methods.</p>
<p>For example:</p>
<pre><code>public void MyMethod(){
delegate int Sum(int a, int b);
Sum mySumImplementation=delegate (int a, int b) {return a+b;}
Console.WriteLine(mySumImplementation(1,1).ToStri... | [
{
"answer_id": 359339,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "<p>Why do you want to create the delegate type within the method? What's wrong with declaring it outside the method? Basi... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32582/"
] | I want to create a delegate type in C# inside a method for the purpose of creating Anonymous methods.
For example:
```
public void MyMethod(){
delegate int Sum(int a, int b);
Sum mySumImplementation=delegate (int a, int b) {return a+b;}
Console.WriteLine(mySumImplementation(1,1).ToString());
}
```
Unfort... | Why do you want to create the delegate type within the method? What's wrong with declaring it outside the method? Basically, you can't do this - you can't declare a *type* (any kind of type) within a method.
One alternative would be to declare all the Func/Action generic delegates which are present in .NET 3.5 - then ... |
359,321 | <p>I have the following SQL query:</p>
<pre><code>select expr1, operator, expr2, count(*) as c
from log_keyword_fulltext
group by expr1, operator, expr2
order by c desc limit 2000;
</code></pre>
<p>Problem: The <code>count(*)</code> as part of my order by is killing my application, probably because it don't use in... | [
{
"answer_id": 359364,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": -1,
"selected": false,
"text": "<p>Trying to count and sort by it is going to be a killer. I would suggest trying to make a temporary table with the ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18642/"
] | I have the following SQL query:
```
select expr1, operator, expr2, count(*) as c
from log_keyword_fulltext
group by expr1, operator, expr2
order by c desc limit 2000;
```
Problem: The `count(*)` as part of my order by is killing my application, probably because it don't use index. I would like to know if there is... | What am I missing? I don't see a WHERE clause. It looks to me you're **requesting** a table scan.
If you are counting on your "LIMIT" clause, you're out of luck - that's the COUNT aggregate calculation. |
359,328 | <p>I have the following javascript code, which loads without error, however the update function does not actually seem functional, as get_Records.php is never loaded. I can not test if get_auction.php is loaded as it is loaded from within get_records.php</p>
<p><strong>One of my main concerns</strong> is that I am doi... | [
{
"answer_id": 359368,
"author": "Jan Aagaard",
"author_id": 37147,
"author_profile": "https://Stackoverflow.com/users/37147",
"pm_score": 0,
"selected": false,
"text": "<p>Have you verified that the PHP code returns something sensible? (I assume, that you can view the source code of you... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have the following javascript code, which loads without error, however the update function does not actually seem functional, as get\_Records.php is never loaded. I can not test if get\_auction.php is loaded as it is loaded from within get\_records.php
**One of my main concerns** is that I am doing the wrong thing b... | You could just take Url as a parameter to update(), then you wouldn't need to build the url within and you wouldn't need the 'optional' parameters
**Edit (response to comment)**
If you have an update() function that just takes url and element id (layer) and updates it based on the result of an AJAX call, you could do... |
359,332 | <p>I refactor my code and I am looking for a solution to grep my source files for something like</p>
<pre><code>if ( user && user.name && user.name.length() < 128 ) ...
</code></pre>
<p>in order to replace it later with ruby's andand or groovy's ?. operator (safe navigation operator).</p>
| [
{
"answer_id": 359367,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 1,
"selected": false,
"text": "<p>IntelliJ idea has a \"structural search & replace\" that will let you do this. This understands the semantics of... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45327/"
] | I refactor my code and I am looking for a solution to grep my source files for something like
```
if ( user && user.name && user.name.length() < 128 ) ...
```
in order to replace it later with ruby's andand or groovy's ?. operator (safe navigation operator). | Here's something to get you started, I wonder if this can be generalized more without having to generate the regexp programatically
```
line = "user && user.name && user.name.length()"
p line.match(/(?:(\w*)(?:\s\&\&\s(\1\.(\w*)))(?:\s\&\&\s(\2\.(\w*))))/).to_a.
reject {|m| m.match(/\./)}.join('.andand.')
=> "user.... |
359,342 | <p>For a web application, I would like to create a simple but effective licensing system. In C#, this is a little difficult, since my decryption method could be viewed by anyone with Reflector installed.</p>
<p>What are some methods for encrypting files in C# that are fairly tamper-proof?</p>
| [
{
"answer_id": 359357,
"author": "Eyvind",
"author_id": 25746,
"author_profile": "https://Stackoverflow.com/users/25746",
"pm_score": 1,
"selected": false,
"text": "<p>Why would you need to encrypt it? If it is tampering you are afraid (for instance someone increasing the number of users... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31516/"
] | For a web application, I would like to create a simple but effective licensing system. In C#, this is a little difficult, since my decryption method could be viewed by anyone with Reflector installed.
What are some methods for encrypting files in C# that are fairly tamper-proof? | It sounds like you want to be using Public/Private cryptography to sign a license token (an XML Fragment or file for example) so you can detect tampering. The simplest way to handle it is to do the following steps:
1) Generate a keypair for your company. You can do this in the Visual Studio command line using the SN t... |
359,347 | <p>I would like to execute multiple commands in a row:</p>
<p>i.e. (just to illustrate my need):</p>
<p><code>cmd</code> (the shell)</p>
<p>then</p>
<p><code>cd dir</code></p>
<p>and</p>
<p><code>ls</code></p>
<p>and read the result of the <code>ls</code>.</p>
<p>Any idea with <code>subprocess</code> module?</p... | [
{
"answer_id": 359355,
"author": "unwind",
"author_id": 28169,
"author_profile": "https://Stackoverflow.com/users/28169",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, the <code><a href=\"http://docs.python.org/library/subprocess.html\" rel=\"nofollow noreferrer\">subprocess.Popen</... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18648/"
] | I would like to execute multiple commands in a row:
i.e. (just to illustrate my need):
`cmd` (the shell)
then
`cd dir`
and
`ls`
and read the result of the `ls`.
Any idea with `subprocess` module?
**Update:**
`cd dir` and `ls` are just an example. I need to run complex commands (following a particular order, w... | There is an easy way to execute a sequence of commands.
Use the following in `subprocess.Popen`
```
"command1; command2; command3"
```
Or, if you're stuck with windows, you have several choices.
* Create a temporary ".BAT" file, and provide this to `subprocess.Popen`
* Create a sequence of commands with "\n" separ... |
359,351 | <p>I have a multi-user eclipse (3.4) installation with a shared master configuration area.
Users need to override <code>user.name</code> with their full name and the usual method (adding -Duser.name=... to eclipse.ini) is not suitable since the override must be per-user.
I've tried setting user.name in config.ini (insi... | [
{
"answer_id": 359417,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": true,
"text": "<p>This <a href=\"http://www.eclipsezone.com/eclipse/forums/t111686.html\" rel=\"nofollow noreferrer\">has been reported before<... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42448/"
] | I have a multi-user eclipse (3.4) installation with a shared master configuration area.
Users need to override `user.name` with their full name and the usual method (adding -Duser.name=... to eclipse.ini) is not suitable since the override must be per-user.
I've tried setting user.name in config.ini (inside each user's... | This [has been reported before](http://www.eclipsezone.com/eclipse/forums/t111686.html) indeed.
Why would you not use use a custom eclipse launcher (a script `.cmd`), which would modify the eclipse.ini, and then call eclipse.exe ?
That script could retrieve the full name with a comand like:
```
net user %username% /... |
359,354 | <p>I'm trying to use the EntLib 3.1 within .net code for a dll which is registered for COM interop. Where do I put the config file? </p>
<p>Alternatively, is there a way to specify within the dll code where it should get the entlib config from? Since my dll will be called from COM I don't always know what exe will be ... | [
{
"answer_id": 359390,
"author": "Samiksha",
"author_id": 29515,
"author_profile": "https://Stackoverflow.com/users/29515",
"pm_score": 0,
"selected": false,
"text": "<p>Check the related issue which i had faced . Maybe its of some help.</p>\n\n<p><a href=\"https://stackoverflow.com/ques... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8479/"
] | I'm trying to use the EntLib 3.1 within .net code for a dll which is registered for COM interop. Where do I put the config file?
Alternatively, is there a way to specify within the dll code where it should get the entlib config from? Since my dll will be called from COM I don't always know what exe will be calling it... | The answer is that Enterprise Library by default uses the exe's config file. If you're producing a dll, including COM, then for good reason you might not want to depend on the calling executable. One solution to this (there might be others) is to create the Enterprise Library objects yourself instead of using the defau... |
359,359 | <p>I am in need of a case insensitive string enumeration type in my XML schema (.xsd) file. I can get case insensitive by doing the following.</p>
<pre><code><xs:simpleType name="setDigitalPointType">
<xs:restriction base="xs:string">
<xs:pattern value="[Oo][Nn]" />
<xs:pattern... | [
{
"answer_id": 359365,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 1,
"selected": false,
"text": "<p>Well, you could just list all the permutations as patterns :)</p>\n"
},
{
"answer_id": 360570,
"author": "jo... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43976/"
] | I am in need of a case insensitive string enumeration type in my XML schema (.xsd) file. I can get case insensitive by doing the following.
```
<xs:simpleType name="setDigitalPointType">
<xs:restriction base="xs:string">
<xs:pattern value="[Oo][Nn]" />
<xs:pattern value="[Oo][Ff][Ff]" />
</xs:r... | IBM developerWorks has [an article](https://web.archive.org/web/20091206195708/http://www.ibm.com/developerworks/xml/library/x-case/) on how to use XSLT to perform the construction of the full set of enumeration alternatives in an automated fashion. It is presented as a workaround to the lack of case-insensitive enumer... |
359,393 | <p>I've got a list of links which have a click event attached to them, I need to get the ID from the child A link. So in the example below if I clicked the first list element I'd need google retuned. </p>
<p>I've tried <code>'$this a'</code> but can't quite work out the syntax.</p>
<pre><code>$("ul li").click(functio... | [
{
"answer_id": 359407,
"author": "smoothdeveloper",
"author_id": 17049,
"author_profile": "https://Stackoverflow.com/users/17049",
"pm_score": 7,
"selected": true,
"text": "<p>I don't see the sample HTML but </p>\n\n<pre><code>$(this).find('a:first').attr('id')\n</code></pre>\n\n<p>would... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45350/"
] | I've got a list of links which have a click event attached to them, I need to get the ID from the child A link. So in the example below if I clicked the first list element I'd need google retuned.
I've tried `'$this a'` but can't quite work out the syntax.
```
$("ul li").click(function(event){
$("input").val($(thi... | I don't see the sample HTML but
```
$(this).find('a:first').attr('id')
```
would do it (fix *a:first* selector if it's not what you meant)
**this** refer to the element that fired your event |
359,400 | <p>I want to get the path name and arguments of running processes using java code. Is there any solution?</p>
| [
{
"answer_id": 359437,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 2,
"selected": false,
"text": "<p>For instance, on Windows, one possibility is to encapsulate the <a href=\"http://www.rgagnon.com/javadetails/java-0593.html\... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to get the path name and arguments of running processes using java code. Is there any solution? | For instance, on Windows, one possibility is to encapsulate the [system call to `TASKLIST.EXE`](http://www.rgagnon.com/javadetails/java-0593.html)
Extract from the code:
```
Process p = Runtime.getRuntime().exec("tasklist.exe /fo csv /nh");
BufferedReader input = new BufferedReader
(new InputStreamRe... |
359,422 | <p>I have an ASP.Net web user control that contains a TextBox and a calendar from the Ajax Control Toolkit.</p>
<p>When I include this user control on my page I would like it to participate in input validation (there is a required filed validator set on the TextBox inside the UC), ie. when the page is validated the co... | [
{
"answer_id": 359455,
"author": "Scott Ivey",
"author_id": 36297,
"author_profile": "https://Stackoverflow.com/users/36297",
"pm_score": 5,
"selected": true,
"text": "<p>Create a property on your new user control that sets the validation group on the contained validator. Then from your... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/77004/"
] | I have an ASP.Net web user control that contains a TextBox and a calendar from the Ajax Control Toolkit.
When I include this user control on my page I would like it to participate in input validation (there is a required filed validator set on the TextBox inside the UC), ie. when the page is validated the content of t... | Create a property on your new user control that sets the validation group on the contained validator. Then from your markup, all you need to do is just set the ValidationGroup property on the control, and that'll roll to the validators contained in the user control. You likely don't need the interface or inheriting fro... |
359,424 | <p>I have a <a href="http://en.wikipedia.org/wiki/Git_%28software%29" rel="noreferrer">Git</a> repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository.</p>
<p>How can I do this while keeping the hist... | [
{
"answer_id": 359759,
"author": "Paul",
"author_id": 23356,
"author_profile": "https://Stackoverflow.com/users/23356",
"pm_score": 11,
"selected": true,
"text": "<p><strong>Update</strong>: This process is so common, that the git team made it much simpler with a new tool, <code>git subt... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23896/"
] | I have a [Git](http://en.wikipedia.org/wiki/Git_%28software%29) repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository.
How can I do this while keeping the history of the files within the subdirecto... | **Update**: This process is so common, that the git team made it much simpler with a new tool, `git subtree`. See here: [Detach (move) subdirectory into separate Git repository](https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository/17864475#17864475)
---
You want to clone your re... |
359,436 | <p>Should be simple and quick: I want a C# equivalent to the following Java code:</p>
<pre><code>orig: for(String a : foo) {
for (String b : bar) {
if (b.equals("buzz")) {
continue orig;
}
}
// other code comes here...
}
</code></pre>
<hr>
<p><strong><em>Edit</em></strong>:
OK it seems there is n... | [
{
"answer_id": 359449,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "<p>I don't believe there's an equivalent, I'm afraid. You'll have to either use a boolean, or just \"goto\" the end of th... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] | Should be simple and quick: I want a C# equivalent to the following Java code:
```
orig: for(String a : foo) {
for (String b : bar) {
if (b.equals("buzz")) {
continue orig;
}
}
// other code comes here...
}
```
---
***Edit***:
OK it seems there is no such equivalent (hey - Jon Skeet himself said... | I don't believe there's an equivalent, I'm afraid. You'll have to either use a boolean, or just "goto" the end of the inside of the outer loop. It's even messier than it sounds, as a label has to be applied to a statement - but we don't want to do anything here. However, I think this does what you want it to:
```
usin... |
359,439 | <p>I want to use HTTP GET and POST commands to retrieve URLs from a website and parse the HTML. How do I do this?</p>
| [
{
"answer_id": 359512,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": 2,
"selected": false,
"text": "<p>The easiest way to do a GET is to use the built in java.net.URL. However, as mentioned, httpclient is the proper w... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16616/"
] | I want to use HTTP GET and POST commands to retrieve URLs from a website and parse the HTML. How do I do this? | You can use [HttpURLConnection](http://java.sun.com/javase/6/docs/api/java/net/HttpURLConnection.html) in combination with [URL](http://java.sun.com/javase/6/docs/api/java/net/URL.html).
```
URL url = new URL("http://example.com");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setR... |
359,452 | <p>I'm creating an email message using CDO object (and VB6, but that doesn't really matter).</p>
<pre class="lang-vb prettyprint-override"><code>With New CDO.Message
.To = "<address>"
.Subject = "Manifest test 8"
.Organization = "<company>"
.From = "<address>"
.Sender = .From
With .Confi... | [
{
"answer_id": 359496,
"author": "Victor",
"author_id": 42518,
"author_profile": "https://Stackoverflow.com/users/42518",
"pm_score": 1,
"selected": false,
"text": "<p>I have not used CDO in a long time, but i remember having this issue in the past. By trying different things, we figured... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11683/"
] | I'm creating an email message using CDO object (and VB6, but that doesn't really matter).
```vb
With New CDO.Message
.To = "<address>"
.Subject = "Manifest test 8"
.Organization = "<company>"
.From = "<address>"
.Sender = .From
With .Configuration
.Fields(cdoSendUsingMethod).Value = cdoSendUsingPort
... | Ok, that was weird.
We used our gmail accounts to test that thing, more specifically, gmail web interface. We clicked attachments links to save reveived files. And the files were corrupted.
As soon as we instead tried some thick clients, it turned out to be fine. All files get download properly without any corruption... |
359,459 | <p>Given the schema:</p>
<pre>
MACHINE_TYPE { machine_type }
MACHINE { machine, machine_type }
SORT_PLAN { sort_plan, machine_type }
SCHEDULE { day_of_week, machine, sort_plan }
</pre>
<p>and the business rule:</p>
<blockquote>
<p>A sort plan can be assigned to any
machine of the same machine_type.</p>
</blockqu... | [
{
"answer_id": 359481,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>I'd use an insert trigger on the SCHEDULE table.</p>\n"
},
{
"answer_id": 359508,
"author": "Charles Bretana",
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21294/"
] | Given the schema:
```
MACHINE_TYPE { machine_type }
MACHINE { machine, machine_type }
SORT_PLAN { sort_plan, machine_type }
SCHEDULE { day_of_week, machine, sort_plan }
```
and the business rule:
>
> A sort plan can be assigned to any
> machine of the same machine\_type.
>
>
>
How do I enforce that, in SCHED... | You could change the plan table so it does not have MachineType, and add a new table called machinePlan, that has a row for every machine that can use that plan, with the MachineId and the PlanId. Then derive MachineType for a plan from this new table's parent machine table instead of from the plan table itself.
Last... |
359,467 | <p>I have a question similar to the one here: <a href="https://stackoverflow.com/questions/341723/event-handlers-inside-a-javascript-loop-need-a-closure#341759">Event handlers inside a Javascript loop - need a closure?</a> but I'm using jQuery and the solution given seems to fire the event when it's bound rather than o... | [
{
"answer_id": 359505,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 5,
"selected": true,
"text": "<p>You're missing a function. The .click function needs a function as a parameter so you need to do this:</p>\n\n<pre><code>.... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4950/"
] | I have a question similar to the one here: [Event handlers inside a Javascript loop - need a closure?](https://stackoverflow.com/questions/341723/event-handlers-inside-a-javascript-loop-need-a-closure#341759) but I'm using jQuery and the solution given seems to fire the event when it's bound rather than on click.
Here... | You're missing a function. The .click function needs a function as a parameter so you need to do this:
```
.click(
function(indGroup,indValue)
{
return function()
{
jQuery(".IndicatorImage").removeClass("active");
_this.Indicator.TrueImage = DisplayGlobals.Indicators[ind... |
359,472 | <p><strong>How can I verify a Google authentication access token?</strong></p>
<p><strong>I need to somehow query Google and ask: Is [given access token] valid for the [example@example.com] Google account?</strong></p>
<h2>Short version</h2>
<p>It's clear how an access token supplied through the <a href="https://code.g... | [
{
"answer_id": 434229,
"author": "Malx",
"author_id": 51086,
"author_profile": "https://Stackoverflow.com/users/51086",
"pm_score": 0,
"selected": false,
"text": "<blockquote>\n <p>I need to somehow query Google and ask: Is this access token valid for example@example.com?</p>\n</blockqu... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5343/"
] | **How can I verify a Google authentication access token?**
**I need to somehow query Google and ask: Is [given access token] valid for the [example@example.com] Google account?**
Short version
-------------
It's clear how an access token supplied through the [Google Authentication Api :: OAuth Authentication for Web... | For user check, just post
get the access token as accessToken and post it and get the response
```
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=accessToken
```
you can try in address bar in browsers too, use httppost and response in java also
response will be like
```
{
"issued_to": "xxxxxxxxx... |
359,492 | <p>Well I am querying my DB, a table called bookBilling, to get a value under the column of billingID. </p>
<p>In my first query I get the customer ID from a table based on what value the cookie holds.
In my second query I take that custID value and am looking to get the billingID associated with it.</p>
<pre><code>... | [
{
"answer_id": 359537,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "<p>Running two separate queries is slow anyway. It's almost always faster to combine them into one statement:</p>\n\n... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27620/"
] | Well I am querying my DB, a table called bookBilling, to get a value under the column of billingID.
In my first query I get the customer ID from a table based on what value the cookie holds.
In my second query I take that custID value and am looking to get the billingID associated with it.
```
query = "SELECT custID... | Hey, is it a typo that you don't have this?
>
> query = "SELECT billingID FROM bookBilling WHERE custID="&custID&""
>
>
> ***objRS =*** objConn.Execute(query)
>
>
>
To reload the recordset with the data and definition of the second query.....
Just a thought, try Setting/Instantiating the ObjRS to a Recordset f... |
359,494 | <p>I'm using <a href="http://en.wikipedia.org/wiki/JSLint" rel="noreferrer">JSLint</a> to go through JavaScript, and it's returning many suggestions to replace <code>==</code> (two equals signs) with <code>===</code> (three equals signs) when doing things like comparing <code>idSele_UNVEHtype.value.length == 0</code> i... | [
{
"answer_id": 359509,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 14,
"selected": true,
"text": "<p>The strict equality operator (<code>===</code>) behaves identically to the abstract equality operator (<code>==</... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44990/"
] | I'm using [JSLint](http://en.wikipedia.org/wiki/JSLint) to go through JavaScript, and it's returning many suggestions to replace `==` (two equals signs) with `===` (three equals signs) when doing things like comparing `idSele_UNVEHtype.value.length == 0` inside of an `if` statement.
Is there a performance benefit to r... | The strict equality operator (`===`) behaves identically to the abstract equality operator (`==`) except no type conversion is done, and the types must be the same to be considered equal.
Reference: [Javascript Tutorial: Comparison Operators](http://www.c-point.com/javascript_tutorial/jsgrpComparison.htm)
The `==` op... |
359,495 | <p>Why are the lists <code>list1Instance</code> and <code>p</code> in the <code>Main</code> method of the below code pointing to the same collection? </p>
<pre><code>class Person
{
public string FirstName = string.Empty;
public string LastName = string.Empty;
public Person(string firstName... | [
{
"answer_id": 359507,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 6,
"selected": true,
"text": "<p>In fact, <code>IEnumerable<T></code> <b>is already readonly</b>. It means you cannot replace any items in the underlyi... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26036/"
] | Why are the lists `list1Instance` and `p` in the `Main` method of the below code pointing to the same collection?
```
class Person
{
public string FirstName = string.Empty;
public string LastName = string.Empty;
public Person(string firstName, string lastName) {
this.FirstName... | In fact, `IEnumerable<T>` **is already readonly**. It means you cannot replace any items in the underlying collection with different items. That is, you cannot alter the *references* to the `Person` objects that are held in the collection. The type `Person` is not read only, however, and since it's a reference type (i.... |
359,497 | <p>I have seen a few suggestions on making emacs portable (on Windows). I have this in my site-start.el:</p>
<pre><code>(defvar program-dir (substring data-directory 0 -4))
(setq inhibit-startup-message t)
(setenv "HOME" program-dir)
</code></pre>
<p>I changed the HOME variable so that not only my .emacs init files ... | [
{
"answer_id": 359554,
"author": "ShreevatsaR",
"author_id": 4958,
"author_profile": "https://Stackoverflow.com/users/4958",
"pm_score": 3,
"selected": false,
"text": "<p>Quoth <a href=\"http://www.gnu.org/software/emacs/manual/html_node/emacs/Invoking-emacsclient.html\" rel=\"nofollow n... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have seen a few suggestions on making emacs portable (on Windows). I have this in my site-start.el:
```
(defvar program-dir (substring data-directory 0 -4))
(setq inhibit-startup-message t)
(setenv "HOME" program-dir)
```
I changed the HOME variable so that not only my .emacs init files (and other init files) are... | Quoth [the Emacs manual](http://www.gnu.org/software/emacs/manual/html_node/emacs/Invoking-emacsclient.html):
> When you start the Emacs server (by calling server-start), Emacs creates a file with information about TCP connection to the server: the host where Emacs is running, the port where it is listening, and an au... |
359,498 | <p>I'm using ctypes to load a DLL in Python. This works great.</p>
<p>Now we'd like to be able to reload that DLL at runtime. </p>
<p>The straightforward approach would seem to be:
1. Unload DLL
2. Load DLL</p>
<p>Unfortunately I'm not sure what the correct way to unload the DLL is.</p>
<p>_ctypes.FreeLibrary is ... | [
{
"answer_id": 359570,
"author": "Piotr Lesnicki",
"author_id": 38796,
"author_profile": "https://Stackoverflow.com/users/38796",
"pm_score": 5,
"selected": true,
"text": "<p>you should be able to do it by disposing the object</p>\n\n<pre><code>mydll = ctypes.CDLL('...')\ndel mydll\nmydl... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6839/"
] | I'm using ctypes to load a DLL in Python. This works great.
Now we'd like to be able to reload that DLL at runtime.
The straightforward approach would seem to be:
1. Unload DLL
2. Load DLL
Unfortunately I'm not sure what the correct way to unload the DLL is.
\_ctypes.FreeLibrary is available, but private.
Is ther... | you should be able to do it by disposing the object
```
mydll = ctypes.CDLL('...')
del mydll
mydll = ctypes.CDLL('...')
```
**EDIT:** Hop's comment is right, this unbinds the name, but garbage collection doesn't happen that quickly, in fact I even doubt it even releases the loaded library.
Ctypes doesn't seem to p... |
359,516 | <p>Id like to be able to write a function that reads an external news site and returns the source code of the target page. Any ideas and/or information to get me started?</p>
| [
{
"answer_id": 359522,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 4,
"selected": true,
"text": "<pre><code>string GetOtherPage(System.Uri url)\n{\n return new System.Net.WebClient().DownloadString(url);\n}\n</cod... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | Id like to be able to write a function that reads an external news site and returns the source code of the target page. Any ideas and/or information to get me started? | ```
string GetOtherPage(System.Uri url)
{
return new System.Net.WebClient().DownloadString(url);
}
``` |
359,541 | <p>I have a small C library in a DLL and I need to call a handful of its methods.</p>
<p>It uses pointers and a few structs but is otherwise quite simple. Problem is I'm not terribly knowledgable on .NET's interop with the unmanaged world and my attempts so far keep hitting memory access violation exceptions (presumab... | [
{
"answer_id": 359559,
"author": "Giovanni Galbo",
"author_id": 4050,
"author_profile": "https://Stackoverflow.com/users/4050",
"pm_score": 1,
"selected": false,
"text": "<p>Maybe you should write your wrapper in C++/CLI, because the interop between managed code and unmanaged code is ver... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41475/"
] | I have a small C library in a DLL and I need to call a handful of its methods.
It uses pointers and a few structs but is otherwise quite simple. Problem is I'm not terribly knowledgable on .NET's interop with the unmanaged world and my attempts so far keep hitting memory access violation exceptions (presumably due to ... | You should check out the [tool](http://download.microsoft.com/download/f/2/7/f279e71e-efb0-4155-873d-5554a0608523/CLRInsideOut2008_01.exe) given in this MSDN Magazine [article](http://msdn.microsoft.com/en-us/magazine/cc164193.aspx) that can translate a C snippet to C# P/Invoke signatures, and of course the post as wel... |
359,590 | <p>How do I get the reference to a folder for storing per-user-per-application settings when writing an Objective-C Cocoa app in Xcode?</p>
<p>In .NET I would use the <code>Environment.SpecialFolder</code> enumeration:</p>
<pre><code>Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
</code></pre>
... | [
{
"answer_id": 359819,
"author": "Marc Charbonneau",
"author_id": 35136,
"author_profile": "https://Stackoverflow.com/users/35136",
"pm_score": 5,
"selected": true,
"text": "<p>In Mac OSX application preferences are stored automatically through NSUserDefaults, which saves them to a .plis... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6408/"
] | How do I get the reference to a folder for storing per-user-per-application settings when writing an Objective-C Cocoa app in Xcode?
In .NET I would use the `Environment.SpecialFolder` enumeration:
```
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
```
What's the Cocoa equivalent? | In Mac OSX application preferences are stored automatically through NSUserDefaults, which saves them to a .plist file `~/Library/Preferences/`. You shouldn't need to do anything with this file, NSUserDefaults will handle everything for you.
If you have a data file in a non-document based application (such as AddressBo... |
359,596 | <p>In a .NET application, how can I identify which network interface is used to communicate to a given IP address?</p>
<p>I am running on workstations with multiple network interfaces, IPv4 and v6, and I need to get the address of the "correct" interface used for traffic to my given database server.</p>
| [
{
"answer_id": 359640,
"author": "Paul Nearney",
"author_id": 24071,
"author_profile": "https://Stackoverflow.com/users/24071",
"pm_score": 2,
"selected": false,
"text": "<p>The info you are after will be in WMI.</p>\n\n<p>This example using WMI may get you most of the way:</p>\n\n<pre><... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38567/"
] | In a .NET application, how can I identify which network interface is used to communicate to a given IP address?
I am running on workstations with multiple network interfaces, IPv4 and v6, and I need to get the address of the "correct" interface used for traffic to my given database server. | The simplest way would be:
```
UdpClient u = new UdpClient(remoteAddress, 1);
IPAddress localAddr = ((IPEndPoint)u.Client.LocalEndPoint).Address;
```
Now, if you want the NetworkInterface object you do something like:
```
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
IPInterface... |
359,601 | <p>I'm looking for a single line regex which does the following:</p>
<p>Given a HTML tag with the "name" attribute, I want to replace it with my own attribute. If that tag lacks the name attribute, I want to implant my own attribute. The result should look like this:</p>
<pre><code><IMG name="img1" ...> => &... | [
{
"answer_id": 359724,
"author": "Tim Pietzcker",
"author_id": 20670,
"author_profile": "https://Stackoverflow.com/users/20670",
"pm_score": 0,
"selected": false,
"text": "<p>If, like in your example, the name attribute is always the first one inside the IMG tag, then it's very easy. Sea... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9941/"
] | I'm looking for a single line regex which does the following:
Given a HTML tag with the "name" attribute, I want to replace it with my own attribute. If that tag lacks the name attribute, I want to implant my own attribute. The result should look like this:
```
<IMG name="img1" ...> => <IMG name="myImg1" ...>
<IMG ..... | The trick is to match every complete "attribute=value" pair, but *capture* only the ones whose attribute name isn't "name". Then plug in your own "name" attribute along with all the captured ones.
```
s/<IMG
((?:\s+(?!name\b)\w+="[^"]+")*)
(?:\s+name="[^"]+")?
((?:\s+(?!name\b)\w+="[^"]+")*)
>
/<IMG name="myN... |
359,612 | <p>How can I convert a RGB Color to HSV using C#?<br/>
I've searched for a fast method without using any external library.</p>
| [
{
"answer_id": 359628,
"author": "BlaM",
"author_id": 999,
"author_profile": "https://Stackoverflow.com/users/999",
"pm_score": 3,
"selected": false,
"text": "<p>There's a C implementation here:</p>\n\n<p><a href=\"http://www.cs.rit.edu/~ncs/color/t_convert.html\" rel=\"noreferrer\">http... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38940/"
] | How can I convert a RGB Color to HSV using C#?
I've searched for a fast method without using any external library. | Have you considered simply using System.Drawing namespace? For example:
```
System.Drawing.Color color = System.Drawing.Color.FromArgb(red, green, blue);
float hue = color.GetHue();
float saturation = color.GetSaturation();
float lightness = color.GetBrightness();
```
Note that it's not exactly what you've asked for... |
359,620 | <p>Can you use a Spring-WS WebserviceTemplate for calling a webservice and avoid that it generates a SOAP-envelope? That is, the message already contains an SOAP-Envelope and I don't want that the WebserviceTemplate wraps another one around it. :-)</p>
<p>The reason I want this is that I'd like to call a webservice th... | [
{
"answer_id": 364744,
"author": "neesh",
"author_id": 43864,
"author_profile": "https://Stackoverflow.com/users/43864",
"pm_score": 0,
"selected": false,
"text": "<p>Interceptors can come in handy for the sort of thing you are trying to do. Take a look at the Interceptor hierarchy here:... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21499/"
] | Can you use a Spring-WS WebserviceTemplate for calling a webservice and avoid that it generates a SOAP-envelope? That is, the message already contains an SOAP-Envelope and I don't want that the WebserviceTemplate wraps another one around it. :-)
The reason I want this is that I'd like to call a webservice that uses ws... | You're using ws-security in a strange way... I guess that you're trying to avoid ws-security dependancy by using pre-generated messages - for simple client might make sense, although it's definitely not by-the-book.
You can configure WebServiceTemplate to use plain XML without SOAP by setting messageFactory on WebServ... |
359,625 | <p>Is there a better, more elegant (and/or possibly faster) way than</p>
<pre><code>boolean isNumber = false;
try{
Double.valueOf(myNumber);
isNumber = true;
} catch (NumberFormatException e) {
}
</code></pre>
<p>...?</p>
<hr>
<p><strong>Edit</strong>:
Since I can't pick two answers I'm going with the regex o... | [
{
"answer_id": 359632,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "<p>You could use a regex, i.e. something like <code>String.matches(\"^[\\\\d\\\\-\\\\.]+$\");</code> (if you're not testing fo... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] | Is there a better, more elegant (and/or possibly faster) way than
```
boolean isNumber = false;
try{
Double.valueOf(myNumber);
isNumber = true;
} catch (NumberFormatException e) {
}
```
...?
---
**Edit**:
Since I can't pick two answers I'm going with the regex one because a) it's elegant and b) saying "Jon S... | I don't believe there's anything built into Java to do it faster and still reliably, assuming that later on you'll want to actually parse it with Double.valueOf (or similar).
I'd use Double.parseDouble instead of Double.valueOf to avoid creating a Double unnecessarily, *and* you can also get rid of blatantly silly num... |
359,635 | <p>What's the best way to implement a classic curry function in actionscript with a nice syntax?</p>
<p>I've tried:</p>
<pre><code>Function.prototype.curry = function()
{
return "helloWorld";
}
trace((function():void {}).curry());
</code></pre>
<p>...approach but that didn't work. </p>
<p>I guess I'm stuck with a ... | [
{
"answer_id": 359774,
"author": "Niels Bosma",
"author_id": 40939,
"author_profile": "https://Stackoverflow.com/users/40939",
"pm_score": 1,
"selected": false,
"text": "<p>Ended up with (heavily inspired by dojo's implementation):</p>\n\n<pre><code>public static function curry(func:Func... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] | What's the best way to implement a classic curry function in actionscript with a nice syntax?
I've tried:
```
Function.prototype.curry = function()
{
return "helloWorld";
}
trace((function():void {}).curry());
```
...approach but that didn't work.
I guess I'm stuck with a ugly approach such as:
```
FunctionUtil... | I must admit I've never understood the difference between "curry" and "partial". I use the following function to do more or less what you want to do:
```
package {
public function partial( func : Function, ...boundArgs ) : Function {
return function( ...dynamicArgs ) : * {
return func.apply(null, boundArgs... |
359,656 | <p>We are trying to develop an application to view and annotate PDF files in ASP.net. </p>
<p>The function involves capturing x,y coordinates from a click and placing the annotation on that specific location.</p>
<p>Are there available components to do this?</p>
<p>Thanks in advance.</p>
| [
{
"answer_id": 359774,
"author": "Niels Bosma",
"author_id": 40939,
"author_profile": "https://Stackoverflow.com/users/40939",
"pm_score": 1,
"selected": false,
"text": "<p>Ended up with (heavily inspired by dojo's implementation):</p>\n\n<pre><code>public static function curry(func:Func... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We are trying to develop an application to view and annotate PDF files in ASP.net.
The function involves capturing x,y coordinates from a click and placing the annotation on that specific location.
Are there available components to do this?
Thanks in advance. | I must admit I've never understood the difference between "curry" and "partial". I use the following function to do more or less what you want to do:
```
package {
public function partial( func : Function, ...boundArgs ) : Function {
return function( ...dynamicArgs ) : * {
return func.apply(null, boundArgs... |
359,660 | <p>I have an xml string </p>
<pre><code><grandparent>
<parent>
<child>dave</child>
<child>laurie</child>
<child>gabrielle</child>
</parent>
</grandparrent>
</code></pre>
<p>What I want to get is the data raw xml that's inside the p... | [
{
"answer_id": 359686,
"author": "Judge Maygarden",
"author_id": 1491,
"author_profile": "https://Stackoverflow.com/users/1491",
"pm_score": 1,
"selected": false,
"text": "<p>Iterate over the child nodes and build the string manually.</p>\n"
},
{
"answer_id": 361142,
"author"... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31325/"
] | I have an xml string
```
<grandparent>
<parent>
<child>dave</child>
<child>laurie</child>
<child>gabrielle</child>
</parent>
</grandparrent>
```
What I want to get is the data raw xml that's inside the parent.
I'm using MSXML
```
iXMLElm->get_xml(&bStr);
```
is returning
```
<parent... | Iterate over the child nodes and build the string manually. |
359,672 | <p>Is there a way other than looping through the Files in a SPFolder to determine if a give filename (string) exists?</p>
| [
{
"answer_id": 359700,
"author": "Paul Nearney",
"author_id": 24071,
"author_profile": "https://Stackoverflow.com/users/24071",
"pm_score": 1,
"selected": false,
"text": "<p>Using a <a href=\"http://msdn.microsoft.com/en-us/library/ms467521.aspx\" rel=\"nofollow noreferrer\">CAML</a> que... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7001/"
] | Is there a way other than looping through the Files in a SPFolder to determine if a give filename (string) exists? | You can, if you know the URL also use the SPFile.Exists property as follows:
```
using (SPSite site = new SPSite("http://server/site"))
using (SPWeb web = site.OpenWeb())
{
SPFile file = web.GetFile("/site/doclib/folder/filename.ext");
if (file.Exists)
{
...
}
}
```
One would on first thought assume SPWe... |
359,675 | <h2>Goal</h2>
<p>Java client for Yahoo's HotJobs <a href="http://developer.yahoo.com/hotjobs/resume_search_user_guide/index.html" rel="nofollow noreferrer">Resumé Search REST API</a>. </p>
<h2>Background</h2>
<p>I'm used to writing web-service clients for SOAP APIs, where <a href="https://jax-ws.dev.java.net/jax-ws-... | [
{
"answer_id": 359721,
"author": "kdgregory",
"author_id": 42126,
"author_profile": "https://Stackoverflow.com/users/42126",
"pm_score": 3,
"selected": true,
"text": "<p>It's interesting that they provide an HTTP URL as the namespace URI for the schema, but don't actually save their sche... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7679/"
] | Goal
----
Java client for Yahoo's HotJobs [Resumé Search REST API](http://developer.yahoo.com/hotjobs/resume_search_user_guide/index.html).
Background
----------
I'm used to writing web-service clients for SOAP APIs, where [wsimport](https://jax-ws.dev.java.net/jax-ws-ea3/docs/wsimport.html) generates proxy stubs a... | It's interesting that they provide an HTTP URL as the namespace URI for the schema, but don't actually save their schema there. That could be an oversight on their part, which an email or discussion-list posting could correct.
One approach is to create your own schema, but this seems like a lot of work for little retu... |
359,699 | <p>I want to pass an enum value as command parameter in WPF, using something like this:</p>
<pre><code><Button
x:Name="uxSearchButton"
Command="{Binding Path=SearchMembersCommand}"
CommandParameter="SearchPageType.First"
Content="Search">
</Button>
</code></pre>
<p><code>SearchPageType<... | [
{
"answer_id": 360076,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 9,
"selected": true,
"text": "<p>Try this</p>\n\n<pre><code><Button CommandParameter=\"{x:Static local:SearchPageType.First}\" .../>\n</code></pre>\... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45382/"
] | I want to pass an enum value as command parameter in WPF, using something like this:
```
<Button
x:Name="uxSearchButton"
Command="{Binding Path=SearchMembersCommand}"
CommandParameter="SearchPageType.First"
Content="Search">
</Button>
```
`SearchPageType` is an enum and this is to know from which ... | Try this
```
<Button CommandParameter="{x:Static local:SearchPageType.First}" .../>
```
`local` - is your [namespace reference](http://msdn.microsoft.com/en-us/library/ms747086.aspx#The_WPF_and_XAML_Namespace_Declarations) in the XAML |
359,706 | <p>I'm using PIL (Python Imaging Library). I'd like to draw transparent polygons. It seems that specifying a fill color that includes alpha level does not work. Are their workarounds?</p>
<p>If it can't be done using PIL I'm willing to use something else.</p>
<p>If there is more than one solution, then performance... | [
{
"answer_id": 378048,
"author": "Antonin ENFRUN",
"author_id": 47434,
"author_profile": "https://Stackoverflow.com/users/47434",
"pm_score": 2,
"selected": false,
"text": "<p>I'm using <a href=\"http://www.cairographics.org/\" rel=\"nofollow noreferrer\" title=\"cairo\">cairo</a> + pyca... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20498/"
] | I'm using PIL (Python Imaging Library). I'd like to draw transparent polygons. It seems that specifying a fill color that includes alpha level does not work. Are their workarounds?
If it can't be done using PIL I'm willing to use something else.
If there is more than one solution, then performance should be factored ... | This is for Pillow, a more maintained fork of PIL. <http://pillow.readthedocs.org/>
If you want to draw polygons that are transparent, relative to each other, the base Image has to be of type RGB, not RGBA, and the ImageDraw has to be of type RGBA. Example:
```
from PIL import Image, ImageDraw
img = Image.new('RGB',... |
359,722 | <p>I own a website and I wonder if there is a script that get files for me from other links on the net a load it to my server.</p>
<p>Suppose I found a file with a size of 400 mb, I want to host it on my server. The normal way I used is to download the file to my pc then upload it to my server but is there a script or... | [
{
"answer_id": 359738,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>wget from your server.</p>\n"
},
{
"answer_id": 359744,
"author": "Neitherman",
"author_id": 40662,
"au... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I own a website and I wonder if there is a script that get files for me from other links on the net a load it to my server.
Suppose I found a file with a size of 400 mb, I want to host it on my server. The normal way I used is to download the file to my pc then upload it to my server but is there a script or a way to ... | As long as you have PHP use:
```
<?php
$remotefh = fopen('http://domain.tld/path/to/file.ext', 'r');
$localfh = fopen('local/file.ext', 'w');
while(!feof($remotefh))
{
fwrite($localfh, fread($remotefh, '4096'));
}
fclose($remotefh);
fclose($localfh);
?>
``` |
359,727 | <p>I've run into strange problem in my Flex/Flashcom application. If client application unexpectedly disconnects from server latter does not call application.onDisconnect handler function. In witch direction should I look? Thank you.</p>
<p><strong>Update</strong> I'm not using server components, but I do host this th... | [
{
"answer_id": 486543,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": true,
"text": "<p>As mentioned by <a href=\"https://stackoverflow.com/users/2313/artem-tikhomirov\">Artem Tikhomirov</a> (the author of the que... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2313/"
] | I've run into strange problem in my Flex/Flashcom application. If client application unexpectedly disconnects from server latter does not call application.onDisconnect handler function. In witch direction should I look? Thank you.
**Update** I'm not using server components, but I do host this thing on Linux. | As mentioned by [Artem Tikhomirov](https://stackoverflow.com/users/2313/artem-tikhomirov) (the author of the question) in his [own answer](https://stackoverflow.com/questions/359727#509843), my answer is not helpful (I keep there below as wiki, for archive).
The real answer has been given by [Ric Tokyo](https://stacko... |
359,732 | <p>Why does everyone tell me writing code like this is a bad practice?</p>
<pre><code>if (foo)
Bar();
//or
for(int i = 0 i < count; i++)
Bar(i);
</code></pre>
<p>My biggest argument for omitting the curly braces is that it can sometimes be twice as many lines with them. For example, here is some code to ... | [
{
"answer_id": 359747,
"author": "Elie",
"author_id": 23249,
"author_profile": "https://Stackoverflow.com/users/23249",
"pm_score": 3,
"selected": false,
"text": "<p>Let's say you have some code:</p>\n\n<pre><code>if (foo)\n bar();\n</code></pre>\n\n<p>and then someone else comes alon... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45/"
] | Why does everyone tell me writing code like this is a bad practice?
```
if (foo)
Bar();
//or
for(int i = 0 i < count; i++)
Bar(i);
```
My biggest argument for omitting the curly braces is that it can sometimes be twice as many lines with them. For example, here is some code to paint a glow effect for a lab... | Actually, the only time that's ever really bit me was when I was debugging, and commented out bar():
```
if(foo)
// bar();
doSomethingElse();
```
Other than that, I tend to use:
```
if(foo) bar();
```
Which takes care of the above case.
**EDIT** Thanks for clarifying the question, I agree, we should not write ... |
359,733 | <p>I recently learnt that oracle has a feature which was pretty useful to me - as the designer/implementator didn't care much about data history - I can query the historical state of a record if it's available yet in the oracle cache, like this:</p>
<pre><code>select *
from ( select *
from sometable whe... | [
{
"answer_id": 359810,
"author": "Dave Costa",
"author_id": 6568,
"author_profile": "https://Stackoverflow.com/users/6568",
"pm_score": 0,
"selected": false,
"text": "<pre><code>SELECT *\n FROM sometable\n VERSIONS BETWEEN TIMESTAMP systimestamp - 1 AND systimestamp\n</code></pre>\n\n<... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11621/"
] | I recently learnt that oracle has a feature which was pretty useful to me - as the designer/implementator didn't care much about data history - I can query the historical state of a record if it's available yet in the oracle cache, like this:
```
select *
from ( select *
from sometable where some_condit... | Yes, like this:
```
SQL> select sal from emp where empno=7369;
SAL
----------
5800
SQL> update emp set sal = sal+100 where empno=7369;
1 row updated.
SQL> commit;
Commit complete.
SQL> update emp set sal = sal-100 where empno=7369;
1 row updated.
SQL> commit;
Commit complete.
SQL> select e... |
359,745 | <p>I have a microcontroller that must download a large file from a PC serial port (115200 baud) and write it to serial flash memory over SPI (~2 MHz). The flash writes must be in 256 byte blocks preceded by a write command and page address. The total RAM available on the system is 1 kB with an 80 byte stack size.</p>
... | [
{
"answer_id": 359800,
"author": "Michael Burr",
"author_id": 12711,
"author_profile": "https://Stackoverflow.com/users/12711",
"pm_score": 2,
"selected": false,
"text": "<p>Does the UART and the PC side of the application support RS-232 handshaking (flow control)? If so, when your recei... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1491/"
] | I have a microcontroller that must download a large file from a PC serial port (115200 baud) and write it to serial flash memory over SPI (~2 MHz). The flash writes must be in 256 byte blocks preceded by a write command and page address. The total RAM available on the system is 1 kB with an 80 byte stack size.
This is... | I'd do something like a scatter gather on a PC. Create a linked list of a struct like this:
```
typedef struct data_buffer {
char flags;
char[128] data;
}
```
Have one of the bits in the flag mean "ReadyToFlash" and one for "Flashing". You should be able to tune the number of buffers in your linked list to k... |
359,758 | <p>How do I set tab ordering in WPF? I have an ItemsControl with some items expanded and some collapsed and would like to skip the collapsed ones when I'm tabbing.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 360585,
"author": "Jab",
"author_id": 29676,
"author_profile": "https://Stackoverflow.com/users/29676",
"pm_score": 7,
"selected": true,
"text": "<p>You can skip elements in the tab sequence by setting <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.input.... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41304/"
] | How do I set tab ordering in WPF? I have an ItemsControl with some items expanded and some collapsed and would like to skip the collapsed ones when I'm tabbing.
Any ideas? | You can skip elements in the tab sequence by setting [KeyboardNavigation.IsTabStop](http://msdn.microsoft.com/en-us/library/system.windows.input.keyboardnavigation.istabstop.aspx) on the element in XAML.
```
KeyboardNavigation.IsTabStop="False"
```
You can setup a trigger that would toggle this property based on the... |
359,763 | <h2>Short version</h2>
<p>How do i use an API call when i cannot guarantee that the window
handle will remain valid? </p>
<p>i can guarantee that i'm holding a reference to my form (so the form is not being disposed). That doesn't guarantee that the form's <strong>handle</strong> will stay valid all that time. </p>
... | [
{
"answer_id": 359785,
"author": "Dror Helper",
"author_id": 11361,
"author_profile": "https://Stackoverflow.com/users/11361",
"pm_score": 0,
"selected": false,
"text": "<p>I think that the form's OnClose function (or related event) should be overriden.</p>\n\n<p>Alternative - each form ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | Short version
-------------
How do i use an API call when i cannot guarantee that the window
handle will remain valid?
i can guarantee that i'm holding a reference to my form (so the form is not being disposed). That doesn't guarantee that the form's **handle** will stay valid all that time.
*How can a form's win... | Have you looked at the functionality in the NativeWindow class? |
359,775 | <p>If I want to display an underlined value in a TextBlock, I have to use a Run element. (If there's a better/easier way, I'd love to hear about it.)</p>
<pre><code><TextBlock>
<Run TextDecorations="Underline" Text="MyText" />
</TextBlock>
</code></pre>
<p>Ideally, to implement this within a DataT... | [
{
"answer_id": 359833,
"author": "Sacha Bruttin",
"author_id": 20761,
"author_profile": "https://Stackoverflow.com/users/20761",
"pm_score": 0,
"selected": false,
"text": "<p>This works for me:</p>\n\n<pre><code><TextBlock Text=\"MyText\" TextDecorations=\"Underline\" />\n</code></... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30095/"
] | If I want to display an underlined value in a TextBlock, I have to use a Run element. (If there's a better/easier way, I'd love to hear about it.)
```
<TextBlock>
<Run TextDecorations="Underline" Text="MyText" />
</TextBlock>
```
Ideally, to implement this within a DataTemplate, it would look something like this:
... | TextDecoration is an attached property so it can be applied to the TextBlock also. You create some pretty cool effects by templating the TextDecorations property.
See this [MSDN article](http://msdn.microsoft.com/en-us/library/system.windows.textdecorations.underline.aspx).
```
<TextBlock TextDecorations="Underline" ... |
359,782 | <p>I have a mysql table that relies on the unix epoch time stamp equivalent of the date of the entry to sort and filter in various parts of the website. I'm trying to implement a date picker that will enter the date into the form field in the mm/dd/yyyy format. I've been struggling with converting that date into the un... | [
{
"answer_id": 359795,
"author": "Vilx-",
"author_id": 41360,
"author_profile": "https://Stackoverflow.com/users/41360",
"pm_score": 2,
"selected": false,
"text": "<p>You should look at the <a href=\"http://lv2.php.net/manual/en/function.mktime.php\" rel=\"nofollow noreferrer\">mktime()<... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45389/"
] | I have a mysql table that relies on the unix epoch time stamp equivalent of the date of the entry to sort and filter in various parts of the website. I'm trying to implement a date picker that will enter the date into the form field in the mm/dd/yyyy format. I've been struggling with converting that date into the unix ... | If you know that it will always be in that format, strtotime will convert it directly into the unix timestamp.
```
strtotime($_POST['app_date']);
```
HTH! |
359,788 | <p>I have the name of a function in JavaScript as a string. How do I convert that into a function pointer so I can call it later?</p>
<p>Depending on the circumstances, I may need to pass various arguments into the method too.</p>
<p>Some of the functions may take the form of <code>namespace.namespace.function(args[.... | [
{
"answer_id": 359799,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 6,
"selected": false,
"text": "<p>The answer to this other question shows you how to do that: <a href=\"https://stackoverflow.com/questions/39960/j... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5791/"
] | I have the name of a function in JavaScript as a string. How do I convert that into a function pointer so I can call it later?
Depending on the circumstances, I may need to pass various arguments into the method too.
Some of the functions may take the form of `namespace.namespace.function(args[...])`. | Don't use `eval` unless you *absolutely, positively* have no other choice.
As has been mentioned, using something like this would be the best way to do it:
```
window["functionName"](arguments);
```
That, however, will not work with a namespace'd function:
```
window["My.Namespace.functionName"](arguments); // fai... |
359,816 | <p>I am very new to grails.I am doing one sample project for image uploading and displaying.Right now my project uploads the images and stores into the images directory.Now i want to display all the images stored in the "image" directory.
I dont know how to write the gsp code for display all images.</p>
<p>For display... | [
{
"answer_id": 359844,
"author": "mat",
"author_id": 42083,
"author_profile": "https://Stackoverflow.com/users/42083",
"pm_score": 2,
"selected": false,
"text": "<p>Depending on what's in your imageList, you can do a :</p>\n\n<pre><code><g:each in=\"${imageList}\" var=\"image\">\n&... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40945/"
] | I am very new to grails.I am doing one sample project for image uploading and displaying.Right now my project uploads the images and stores into the images directory.Now i want to display all the images stored in the "image" directory.
I dont know how to write the gsp code for display all images.
For displaying the im... | If your imageList has list of image objects try the following
**${createLinkTo(dir: 'images', file: image.filename)}.**
If your imageList like this['1.jpg','2.jpg','3.jpg'] try the following
```
**${createLinkTo(dir: 'images', file: image)}**
``` |
359,821 | <p>I want to style the last TD in a table without using a CSS class on the particular TD.</p>
<pre><code><table>
<tbody>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
<td>Five</td>
</t... | [
{
"answer_id": 359838,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 6,
"selected": true,
"text": "<p>You can use relative rules:</p>\n\n<pre><code>table td + td + td + td + td {\n border: none;\n}\n</code></pre>\n\n<p>This... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to style the last TD in a table without using a CSS class on the particular TD.
```
<table>
<tbody>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
<td>Five</td>
</tr>
</tbody>
</table>
table td
{
border: 1px solid black;
}
```
I want the TD containin... | You can use relative rules:
```
table td + td + td + td + td {
border: none;
}
```
This only works if the number of columns isn't determined at runtime. |
359,824 | <p>I have a chunk of <a href="http://en.wikipedia.org/wiki/MultiDimensional_eXpressions" rel="nofollow noreferrer">MDX</a> that I'd like to throw into an ASP.NET form. Hopefully just binding the results to a gridview. Are there any good links or snippets? I'm using VB.NET, but I am able to port from C# if no Visual ... | [
{
"answer_id": 359838,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 6,
"selected": true,
"text": "<p>You can use relative rules:</p>\n\n<pre><code>table td + td + td + td + td {\n border: none;\n}\n</code></pre>\n\n<p>This... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13954/"
] | I have a chunk of [MDX](http://en.wikipedia.org/wiki/MultiDimensional_eXpressions) that I'd like to throw into an ASP.NET form. Hopefully just binding the results to a gridview. Are there any good links or snippets? I'm using VB.NET, but I am able to port from C# if no Visual Basic code is available. | You can use relative rules:
```
table td + td + td + td + td {
border: none;
}
```
This only works if the number of columns isn't determined at runtime. |
359,827 | <p>I need to compare 2 strings in C# and treat accented letters the same as non-accented letters. For example:</p>
<pre><code>string s1 = "hello";
string s2 = "héllo";
s1.Equals(s2, StringComparison.InvariantCultureIgnoreCase);
s1.Equals(s2, StringComparison.OrdinalIgnoreCase);
</code></pre>
<p>These 2 strings need ... | [
{
"answer_id": 359874,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "<p>try this overload on the String.Compare Method. </p>\n\n<p>String.Compare Method (String, String, Boolean, CultureInfo)</... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343/"
] | I need to compare 2 strings in C# and treat accented letters the same as non-accented letters. For example:
```
string s1 = "hello";
string s2 = "héllo";
s1.Equals(s2, StringComparison.InvariantCultureIgnoreCase);
s1.Equals(s2, StringComparison.OrdinalIgnoreCase);
```
These 2 strings need to be the same (as far as ... | *FWIW, [knightfor's answer](https://stackoverflow.com/a/7720903/12379) below (as of this writing) should be the accepted answer.*
Here's a function that strips diacritics from a string:
```
static string RemoveDiacritics(string text)
{
string formD = text.Normalize(NormalizationForm.FormD);
StringBuilder sb = new... |
359,829 | <p>As our PHP5 OO application grew (in both size and traffic), we decided to revisit the __autoload() strategy.</p>
<p>We always name the file by the class definition it contains, so class Customer would be contained within Customer.php. We used to list the directories in which a file can potentially exist, until the ... | [
{
"answer_id": 359906,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>CodeIgniter does something similar with the load_class function. If I recall correctly, it is a static function that holds... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8437/"
] | As our PHP5 OO application grew (in both size and traffic), we decided to revisit the \_\_autoload() strategy.
We always name the file by the class definition it contains, so class Customer would be contained within Customer.php. We used to list the directories in which a file can potentially exist, until the right .p... | I've also been playing with autoload for quite some time, and I ended up implementing some sort of namespaced autoloader (yes, It works also for PHP5.2).
The strategy is quite simple:
First I have a singleton class (loader) which has a call that simulates `import`. This call takes one parameter (the full class name to... |
359,836 | <p>I'm trying to determine if any changes were made to a particular entity object. Essentially, I want to know if SubmitChanges() will actually change anything. I would prefer to be able to determine this after SubmitChanges() has been called, but it doesn't really matter.</p>
<p>Anyone know how I would do this?</p>
| [
{
"answer_id": 359890,
"author": "joshperry",
"author_id": 30587,
"author_profile": "https://Stackoverflow.com/users/30587",
"pm_score": 3,
"selected": false,
"text": "<p>Take a look at the <a href=\"http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.getchangeset.aspx\"... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18866/"
] | I'm trying to determine if any changes were made to a particular entity object. Essentially, I want to know if SubmitChanges() will actually change anything. I would prefer to be able to determine this after SubmitChanges() has been called, but it doesn't really matter.
Anyone know how I would do this? | This is what I came up with:
```
Public Function HasChanges(ByVal obj As Object) As Boolean
Dim cs = GetChangeSet()
If cs.Updates.Contains(obj) Or cs.Inserts.Contains(obj) Or cs.Deletes.Contains(obj) Then Return True
Return False
End Function
``` |
359,880 | <p>I have been tasked with creating a new frontend for a legacy website.</p>
<p>It is written in php (pre-oo), and uses a MySQL database. The hosting provides a .Net package, but does not offer Ms Sql Server. </p>
<p>This is fine, as the database is working fine, but I really want to use Asp.net for the pages. Howeve... | [
{
"answer_id": 359892,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 3,
"selected": false,
"text": "<p>MySql does have <a href=\"http://dev.mysql.com/downloads/connector/net/5.2.html\" rel=\"nofollow noreferrer\... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21124/"
] | I have been tasked with creating a new frontend for a legacy website.
It is written in php (pre-oo), and uses a MySQL database. The hosting provides a .Net package, but does not offer Ms Sql Server.
This is fine, as the database is working fine, but I really want to use Asp.net for the pages. However, most tutorials... | MySql does have [connector](http://dev.mysql.com/downloads/connector/net/5.2.html) for .Net. You do not need to use ODBC,
MySql Connector will let you interact with your MySql database and is fully managed ADO.Net provider. You have the binary (dll) or the source code if you desire. It's pretty simple, once you have i... |
359,881 | <p>What is the most efficient way of setting values in C# multi-dimensional arrays using a linear index? For example given an array...</p>
<pre><code>int[,,] arr2 = { {{0,1,2}, {3,4,5}, {6,7,8}}
, {{9,10,11}, {12,13,14}, {15,16,17}}
, {{18,19,20}, {21,22,23}, {24,25,26}}
};
</... | [
{
"answer_id": 359924,
"author": "Nicholas Mancuso",
"author_id": 8945,
"author_profile": "https://Stackoverflow.com/users/8945",
"pm_score": 0,
"selected": false,
"text": "<p><code>SetValue()</code> should work. Take a look at <a href=\"http://msdn.microsoft.com/en-us/library/758awxk7.a... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39648/"
] | What is the most efficient way of setting values in C# multi-dimensional arrays using a linear index? For example given an array...
```
int[,,] arr2 = { {{0,1,2}, {3,4,5}, {6,7,8}}
, {{9,10,11}, {12,13,14}, {15,16,17}}
, {{18,19,20}, {21,22,23}, {24,25,26}}
};
```
How do I s... | why do you need the IList ?
```
static void SetValue2(this Array a, object value, int i) {
int[] indices = new int[a.Rank];
for (int d = a.Rank - 1; d >= 0; d--) {
var l = a.GetLength(d);
indices[d] = i % l;
i /= l
}
a.SetValue(value, indices);
}
```
Test Code:
```
static vo... |
359,885 | <p>My application has just started exhibiting strange behaviour.</p>
<p>I can boot it through the Carbide Debugger (using TRK) and it works fine with no visible errors and is left installed on the device.</p>
<p>Any further attempts to launch the application fail, even after a restart. Uninstalling and downloading th... | [
{
"answer_id": 359924,
"author": "Nicholas Mancuso",
"author_id": 8945,
"author_profile": "https://Stackoverflow.com/users/8945",
"pm_score": 0,
"selected": false,
"text": "<p><code>SetValue()</code> should work. Take a look at <a href=\"http://msdn.microsoft.com/en-us/library/758awxk7.a... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] | My application has just started exhibiting strange behaviour.
I can boot it through the Carbide Debugger (using TRK) and it works fine with no visible errors and is left installed on the device.
Any further attempts to launch the application fail, even after a restart. Uninstalling and downloading the .sisx file manu... | why do you need the IList ?
```
static void SetValue2(this Array a, object value, int i) {
int[] indices = new int[a.Rank];
for (int d = a.Rank - 1; d >= 0; d--) {
var l = a.GetLength(d);
indices[d] = i % l;
i /= l
}
a.SetValue(value, indices);
}
```
Test Code:
```
static vo... |