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 |
|---|---|---|---|---|---|---|
527,981 | <p>When we upgraded MVC beta to MVC RC1 the development webserver that visual studio has suddenly crashed at some point in the application. After some searching I narrowed the bug to this simple line:</p>
<pre><code>if (!helper.ViewData.ContainsKey("SomeString"))
</code></pre>
<p>SomeString is at that moment present ... | [
{
"answer_id": 2196893,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "<p>You probably want to compile with the <code>-z execstack</code> flag in your GCC compilation, along with <code>-fno-stack-... | 2009/02/09 | [
"https://Stackoverflow.com/questions/527981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64160/"
] | When we upgraded MVC beta to MVC RC1 the development webserver that visual studio has suddenly crashed at some point in the application. After some searching I narrowed the bug to this simple line:
```
if (!helper.ViewData.ContainsKey("SomeString"))
```
SomeString is at that moment present in the viewData so the if ... | You probably want to compile with the `-z execstack` flag in your GCC compilation, along with `-fno-stack-protector` (to disable GCC's SSP/Propolice stack protection), i.e:
```
gcc -fno-stack-protector -z execstack -o vuln vuln.c
```
Everything should probably turn out jake after this. Note that `sysctl -w kernel.ra... |
527,991 | <p>For security reasons, we'd like to limit an oracle user to only connect from a specific IP address. Is this possible?</p>
<p>If so, how can we configure this?</p>
| [
{
"answer_id": 528002,
"author": "Ola Bini",
"author_id": 64081,
"author_profile": "https://Stackoverflow.com/users/64081",
"pm_score": 2,
"selected": false,
"text": "<p>I would recommend that you use your firewall for this purpose. If you're on Linux, it should be possible to use iptabl... | 2009/02/09 | [
"https://Stackoverflow.com/questions/527991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25320/"
] | For security reasons, we'd like to limit an oracle user to only connect from a specific IP address. Is this possible?
If so, how can we configure this? | Put a:
```
SELECT SYS_CONTEXT('USERENV', 'IP_ADDRESS') FROM dual;
```
into your `AFTER LOGON` trigger and throw an exception when it's not allowed. |
527,997 | <p>I want to query our servers to see look for disconnected/idle sessions. I know I can use 'query.exe', but I'd prefer something that's easier to work with from code.</p>
<p>WMI would be my preference.</p>
<p>Thanks.</p>
| [
{
"answer_id": 528011,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 2,
"selected": false,
"text": "<p>For finding things / generating WMI code and queries, get the <a href=\"http://www.microsoft.com/downloads/details.a... | 2009/02/09 | [
"https://Stackoverflow.com/questions/527997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57501/"
] | I want to query our servers to see look for disconnected/idle sessions. I know I can use 'query.exe', but I'd prefer something that's easier to work with from code.
WMI would be my preference.
Thanks. | If you are using a .NET language, you might try [Cassia](http://cassia.googlecode.com/). In C#, the code would be:
```
using System;
using Cassia;
namespace CassiaSample
{
public static class Program
{
public static void Main(string[] args)
{
ITerminalServicesManager manager = new ... |
528,000 | <p>Hi I'm not good in framing questions. I will try my best. I'm creating a website and my question is related to the queries related to the site.This is the current query that I have. </p>
<pre><code>SELECT
GPS_modem.vehicle_no,
vehicle_log.longitude,
vehicle_log.latitude,
vehicle_log.timestamp
FROM
vehi... | [
{
"answer_id": 528010,
"author": "Fredrik Jansson",
"author_id": 58237,
"author_profile": "https://Stackoverflow.com/users/58237",
"pm_score": 1,
"selected": false,
"text": "<p>Depending on DB, </p>\n\n<pre><code>SELECT TOP 1 GPS_modem.vehicle_no, vehicle_log.longitude, vehicle_log.latit... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Hi I'm not good in framing questions. I will try my best. I'm creating a website and my question is related to the queries related to the site.This is the current query that I have.
```
SELECT
GPS_modem.vehicle_no,
vehicle_log.longitude,
vehicle_log.latitude,
vehicle_log.timestamp
FROM
vehicle_log,
GPS... | You can use correlated sub-query:
```
SELECT
m.vehicle_no,
l.longitude,
l.latitude,
l.timestamp
FROM
vehicle_log AS l,
GPS_modem AS m
WHERE
m.modem_ID = l.modem_ID
AND l.timestamp = (
SELECT MAX(timestamp) FROM vehicle_log WHERE modem_ID = l.modem_ID
)
```
---
EDIT: In revision #1 of my ... |
528,014 | <p>I'm using Jetty to test a webservice we have and I am trying to get it to respond with no charset under the content-type header.</p>
<p>Does anyone know how to do this?</p>
<p>I've tried intercepting the Response and setting the CharacterEncoding to null or "" but that gives Exceptions.</p>
<p>I am using Jetty 6.... | [
{
"answer_id": 530532,
"author": "Mihai Nita",
"author_id": 53276,
"author_profile": "https://Stackoverflow.com/users/53276",
"pm_score": 0,
"selected": false,
"text": "<p>The charset is very useful info.\nInstead of trying to force a good product (Jetty) to do the wrong thing I would ra... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6414/"
] | I'm using Jetty to test a webservice we have and I am trying to get it to respond with no charset under the content-type header.
Does anyone know how to do this?
I've tried intercepting the Response and setting the CharacterEncoding to null or "" but that gives Exceptions.
I am using Jetty 6.1.6. | I tried it my self now, but I must admit, my jetty is a very old one (4.2., but does everything the way I need it). I compared it to tomcat (4.1.29, old too). I checked the content type with the following code:
```
URL tomcatUrl = new URL("http://localhost:18080/ppi/jobperform/headertest")//tomcat;
URLConnection tconn... |
528,045 | <p><strong>Scenario:</strong> I have a Javascript-generated web page that someone else wrote a long time ago that I'd like to pretty up using jQuery. My goal is to clean up the Javascript generated html that someone else produces just by using some jQuery calls against that HTML, after it has been generated. </p>
<p>T... | [
{
"answer_id": 528062,
"author": "okoman",
"author_id": 35903,
"author_profile": "https://Stackoverflow.com/users/35903",
"pm_score": 2,
"selected": false,
"text": "<p>You could put the </p>\n\n<pre><code>$(document).ready(function() { ... });\n</code></pre>\n\n<p>At the end of <code>/so... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42223/"
] | **Scenario:** I have a Javascript-generated web page that someone else wrote a long time ago that I'd like to pretty up using jQuery. My goal is to clean up the Javascript generated html that someone else produces just by using some jQuery calls against that HTML, after it has been generated.
This will be *much* simp... | You can delay your cleanup code upto some extend by using following JavaScript function:
```
setTimeout('JS Cleanup Code', number_of_miliseconds);
``` |
528,057 | <p>I have managed to send out (and receive) binary SMSs, but what I want to accomplish is to send Access Point settings or bookmarks or Email settings etc.
Currently I'm sending out messages like:</p>
<pre><code>//udh=0605040B8423F0
//message=FD0601AE02056A0045C60C037777772E676F6F676C65...000101
//udh
iMessag... | [
{
"answer_id": 540360,
"author": "Riho",
"author_id": 44715,
"author_profile": "https://Stackoverflow.com/users/44715",
"pm_score": 2,
"selected": true,
"text": "<p>Asked it also from Nokia and verdict was that I can't be done. :(</p>\n\n<p>It can be done when phone is used as a modem an... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44715/"
] | I have managed to send out (and receive) binary SMSs, but what I want to accomplish is to send Access Point settings or bookmarks or Email settings etc.
Currently I'm sending out messages like:
```
//udh=0605040B8423F0
//message=FD0601AE02056A0045C60C037777772E676F6F676C65...000101
//udh
iMessage->Des().Appen... | Asked it also from Nokia and verdict was that I can't be done. :(
It can be done when phone is used as a modem and commands are sent from the PC.
If I could figure out the way how to emulate all that in phone, then it would be cool. |
528,066 | <p>The following gives me an error of "The server tag is not well formed"</p>
<pre><code><asp:LinkButton ID="DeleteButton" runat="server" CommandName="Delete"
OnClientClick="return confirm('Are you sure you want to delete <%# Eval("Username") %>?');">
Delete
</asp:LinkButton>
</code></pre>
... | [
{
"answer_id": 528076,
"author": "Sachin Gaur",
"author_id": 2572740,
"author_profile": "https://Stackoverflow.com/users/2572740",
"pm_score": 0,
"selected": false,
"text": "<p>You can add the onclick event at run time, like this:</p>\n\n<pre><code>DeleteButton.Attributes.Add(\"onclick\"... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39709/"
] | The following gives me an error of "The server tag is not well formed"
```
<asp:LinkButton ID="DeleteButton" runat="server" CommandName="Delete"
OnClientClick="return confirm('Are you sure you want to delete <%# Eval("Username") %>?');">
Delete
</asp:LinkButton>
```
(This is used in a data bound ListView th... | The problem is the binding nugget and the use of single and double quotes.
```
<asp:LinkButton D="DeleteButton" runat="server" CommandName="Delete" OnClientClick='<%# CreateConfirmation(Eval("Username")) %>'>Delete</asp:LinkButton>
```
Then on the code-behind add the function...
```
Public Function CreateConfirmati... |
528,090 | <p>I'm working on an app that's using <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.mailaddress.aspx" rel="noreferrer">System.Net.Mail.MailAddress</a> and friends for sending emails. Does that parser implement the full <a href="http://www.ietf.org/rfc/rfc5322.txt" rel="noreferrer">RFC5322</a> or a su... | [
{
"answer_id": 528199,
"author": "David Schmitt",
"author_id": 4918,
"author_profile": "https://Stackoverflow.com/users/4918",
"pm_score": 4,
"selected": true,
"text": "<p>I've wrote a little snippet to test the function:</p>\n\n<pre><code>foreach (int i in Enumerable.Range(32,128-32))\n... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4918/"
] | I'm working on an app that's using [System.Net.Mail.MailAddress](http://msdn.microsoft.com/en-us/library/system.net.mail.mailaddress.aspx) and friends for sending emails. Does that parser implement the full [RFC5322](http://www.ietf.org/rfc/rfc5322.txt) or a subset or what? The MSDN is not very forthcoming on this topi... | I've wrote a little snippet to test the function:
```
foreach (int i in Enumerable.Range(32,128-32))
{
char c = (char)i;
string addr = String.Format("par.t1{0}pa.r{0}t2@example.com", c);
try
{
var mailAddr = new MailAddress(addr);
}
catch
{
Console.WriteLine("MailAddress fai... |
528,093 | <p>I've recently installed MbUnit version 2.4.2.355 on our build server which runs via Cruise Control.NET and NAnt, on a Windows Server 2003 machine with .NET Framework 3.5 SP1 installed.</p>
<p>I've checked every nook and cranny of the build scripts, and the NAnt output report on CC.NET tells me that the test project... | [
{
"answer_id": 528841,
"author": "Jeff Brown",
"author_id": 45233,
"author_profile": "https://Stackoverflow.com/users/45233",
"pm_score": 2,
"selected": false,
"text": "<p>There is no fundamental difference as to whether any particular assembly is considered a test assembly.</p>\n\n<p>My... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/372/"
] | I've recently installed MbUnit version 2.4.2.355 on our build server which runs via Cruise Control.NET and NAnt, on a Windows Server 2003 machine with .NET Framework 3.5 SP1 installed.
I've checked every nook and cranny of the build scripts, and the NAnt output report on CC.NET tells me that the test project builds fi... | First of all check [this issue](http://code.google.com/p/mb-unit/issues/detail?id=103).
If this not help, you need to check target platform (project properties, build) to be "Any CPU". After this try to open assembly which is generated on your build machine using Reflector. May be generated files are corrupted. And ... |
528,105 | <p>We are currently using a single command line tool to build our product on both Windows and Linux.</p>
<p>Si far its works nicely, allowing us to build out of source and with finer dependencies than what any of our previous build system allowed. This buys us great incremental and parallel build capabilities.</p>
<p... | [
{
"answer_id": 661804,
"author": "Preet Sangha",
"author_id": 30225,
"author_profile": "https://Stackoverflow.com/users/30225",
"pm_score": 4,
"selected": true,
"text": "<p>I've not done C++ for a long time but from this <a href=\"http://blogs.msdn.com/b/vcblog/archive/2014/03/05/shrink-... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11892/"
] | We are currently using a single command line tool to build our product on both Windows and Linux.
Si far its works nicely, allowing us to build out of source and with finer dependencies than what any of our previous build system allowed. This buys us great incremental and parallel build capabilities.
To describe shor... | I've not done C++ for a long time but from this [article](http://blogs.msdn.com/b/vcblog/archive/2014/03/05/shrink-my-program-database-pdb-file.aspx), it appears that this is a performance trick to stop the recreation of symbols for common headers.
You could try /Z7 to embed info in each obj, and not create a PDB and... |
528,117 | <p>I am not sure whether I am missing something basic. But I am unable to understand why the compiler is generating the error for this code:</p>
<pre><code>class A
{
};
class B
{
public:
B();
A* get() const;
private:
A* m_p;
};
B::B()
{
m_p = new A;
}
A* B::get() const
{
//This is compiling fin... | [
{
"answer_id": 528124,
"author": "John Carter",
"author_id": 8331,
"author_profile": "https://Stackoverflow.com/users/8331",
"pm_score": 2,
"selected": false,
"text": "<p>It's because you're returning a non-const pointer to a member from a const function.</p>\n\n<p>The first part works b... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39742/"
] | I am not sure whether I am missing something basic. But I am unable to understand why the compiler is generating the error for this code:
```
class A
{
};
class B
{
public:
B();
A* get() const;
private:
A* m_p;
};
B::B()
{
m_p = new A;
}
A* B::get() const
{
//This is compiling fine
return m... | `const` in the function signature tells the compiler that the object's members may not be modified. Yet you return a non-`const` pointer to a member, thus allowing a violation of that promise.
In your class `B`, you make/break no promise since you don't return a pointer to a member, you return a copy of it (and the me... |
528,123 | <p>My user have a password field such as “0!ZWQ2” saved in the database.
I must unscramble my User input password from “aA1234” to “0!ZWQ2” and compare it to data in a database.</p>
<p>The 2 strings that I compare is:</p>
<p>“abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 ”
With
“9setybcpqwiuvxr108daj... | [
{
"answer_id": 528133,
"author": "Mark S. Rasmussen",
"author_id": 12469,
"author_profile": "https://Stackoverflow.com/users/12469",
"pm_score": 3,
"selected": false,
"text": "<p>Any special reason not to use a standard hash + salt for storing the passwords, instead of a Caesars cipher?<... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33584/"
] | My user have a password field such as “0!ZWQ2” saved in the database.
I must unscramble my User input password from “aA1234” to “0!ZWQ2” and compare it to data in a database.
The 2 strings that I compare is:
“abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 ”
With
“9setybcpqwiuvxr108daj5'-`~!@#$%^&\*()\... | Following is Quick, Fast, and lesser code example to convert.
Code in C#:
```
char[] OriginalChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
char[] ScrambleChars = "9setybcpqwiuvxr108daj5'-`~!@#$%^&()+|}][{:.?/<>,;ZWQ2@#34KDART".ToCharArray();
string Tex... |
528,161 | <p>I've put together a WPF application using <code>ObservableCollection</code> and <code>Dependency Properties</code> which is cool because I just have to add an item to the <code>ObservableCollection</code> and it shows up automatically, e.g. I display the objects in the collection as boxes on the screen in a wrappane... | [
{
"answer_id": 528178,
"author": "Nicolas Dorier",
"author_id": 19803,
"author_profile": "https://Stackoverflow.com/users/19803",
"pm_score": 3,
"selected": true,
"text": "<p>TitleProperty is not a normal property but a dependency property so if you want to retrieve the value of your Tit... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | I've put together a WPF application using `ObservableCollection` and `Dependency Properties` which is cool because I just have to add an item to the `ObservableCollection` and it shows up automatically, e.g. I display the objects in the collection as boxes on the screen in a wrappanel, each box showing its `Title`.
So... | TitleProperty is not a normal property but a dependency property so if you want to retrieve the value of your TitleProperty you have to do :
```
var title = (string)GetValue(TitleProperty);
```
In WPF guideline, the public property to access a Dependency Property is not called by WPF and the binding engine (not nece... |
528,165 | <p>I'm having a problem passing an entity collection back from LLBLGen to silverlight. My contract looks like this. I don't even know if this is possible.</p>
<p>My web service code looks like this:</p>
<pre><code>public IEnumerable<WaterWorksCustomersEntity> GetCustomer(long custId, string acctKey)
{
var t... | [
{
"answer_id": 530796,
"author": "Scrappydog",
"author_id": 52101,
"author_profile": "https://Stackoverflow.com/users/52101",
"pm_score": 2,
"selected": false,
"text": "<p>There is an example of calling LLBLGEN over WCF on the LLBLGEN website here: <a href=\"http://www.llblgen.com/pages... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm having a problem passing an entity collection back from LLBLGen to silverlight. My contract looks like this. I don't even know if this is possible.
My web service code looks like this:
```
public IEnumerable<WaterWorksCustomersEntity> GetCustomer(long custId, string acctKey)
{
var toReturn = new WaterWorksCus... | There is an example of calling LLBLGEN over WCF on the LLBLGEN website here: <http://www.llblgen.com/pages/secure/ListDownloads.aspx?ProductVersion=6#6>
It's doing synchronous calls over netTcp, but there might be some usefull clues... |
528,168 | <p>How can I change the colour of hyperlinks to white in HTML and CSS?</p>
| [
{
"answer_id": 528170,
"author": "Frost",
"author_id": 63467,
"author_profile": "https://Stackoverflow.com/users/63467",
"pm_score": 3,
"selected": false,
"text": "<p>You use CSS</p>\n\n<pre><code>a\n{\n color: #ffffff;\n}\n</code></pre>\n\n<p>Anchor Pseudo-classes:\n<a href=\"http://... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I change the colour of hyperlinks to white in HTML and CSS? | Use the [color CSS property](http://www.w3.org/TR/CSS2/colors.html#colors).
```
a { color: white; }
```
Problem is, visited links may not be shown as white as well. You may need to add extra rules:
```
a, a:hover, a:active, a:visited { color: white; }
``` |
528,174 | <p>We are planning on adding multi-language support for our ASP.NET Website. I understand the general process of pulling strings from resource files based on the current culture, but what is the best way to deal with the following situation?</p>
<p>Let's say that we want to display to the user how many Stack Overflow ... | [
{
"answer_id": 528213,
"author": "Christian Specht",
"author_id": 6884,
"author_profile": "https://Stackoverflow.com/users/6884",
"pm_score": 3,
"selected": true,
"text": "<p>We are dealing with lots of dynamically generated sentences as well (in 3 languages).<br>\nWe always try to make ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17765/"
] | We are planning on adding multi-language support for our ASP.NET Website. I understand the general process of pulling strings from resource files based on the current culture, but what is the best way to deal with the following situation?
Let's say that we want to display to the user how many Stack Overflow posts they... | We are dealing with lots of dynamically generated sentences as well (in 3 languages).
We always try to make the sentences as neutral as possible to avoid as many conditional statements as possible:
"Your number of posts today: {0}" |
528,210 | <p>I have learned how to format strings in the content attribute of a label like this:</p>
<pre><code><Label Content="{Binding ElementName=theSlider, Path=Value}"
ContentStringFormat="The font size is {0}."/>
</code></pre>
<p>I want to do the same thing in a Setter but "ValueStringFormat" doesn't exist, wha... | [
{
"answer_id": 536346,
"author": "Stefano Driussi",
"author_id": 49209,
"author_profile": "https://Stackoverflow.com/users/49209",
"pm_score": 1,
"selected": false,
"text": "<p>I can't test this but hope it works:</p>\n\n<pre><code>...\nxmlns:local=\"clr-namespace:ValueConverter\"\n...\n... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | I have learned how to format strings in the content attribute of a label like this:
```
<Label Content="{Binding ElementName=theSlider, Path=Value}"
ContentStringFormat="The font size is {0}."/>
```
I want to do the same thing in a Setter but "ValueStringFormat" doesn't exist, what is the correct syntax to do wh... | Can you simply use the StringFormat property of the Binding itself?
```
<DataTrigger Binding="{Binding Path=Kind}" Value="Task">
<Setter TargetName="TheTitle" Property="Text"
Value="{Binding Title,StringFormat='Your title was: {}{0}'}"
/>
</DataTrigger>
``` |
528,241 | <p>My company has purchased a product that renders an ASP.NET control on the page. This control uses jQuery 1.2.3 and adds a script tag to the page to reference it. The developers of the control will not support use of the control if it modified in any way (including modification to reference a different version of jQu... | [
{
"answer_id": 528251,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 8,
"selected": true,
"text": "<p>You can achieve this by running your version of jQuery in <a href=\"http://docs.jquery.com/Using_jQuery_with_Other_Librari... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6651/"
] | My company has purchased a product that renders an ASP.NET control on the page. This control uses jQuery 1.2.3 and adds a script tag to the page to reference it. The developers of the control will not support use of the control if it modified in any way (including modification to reference a different version of jQuery... | You can achieve this by running your version of jQuery in [no-conflict mode](http://docs.jquery.com/Using_jQuery_with_Other_Libraries). "No conflict" mode is the typical solution to get jQuery working on a page with other frameworks like [prototype](http://www.prototypejs.org/), and can be also be used here as it essen... |
528,253 | <p>I have a simple WPF program using the Master-Detail UI pattern, where the Detail shows the currently selected item of a collection in the Master pane. I'm using MVVM, and each XAML page is backed by a ViewModel object which is set as it's DataContext.</p>
<p>Now, I want to add a DELETE button in the Master pane to... | [
{
"answer_id": 528913,
"author": "Paul",
"author_id": 64239,
"author_profile": "https://Stackoverflow.com/users/64239",
"pm_score": 1,
"selected": false,
"text": "<p>One option would be to create each command with a reference to the view model, and create a property on the view model whi... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a simple WPF program using the Master-Detail UI pattern, where the Detail shows the currently selected item of a collection in the Master pane. I'm using MVVM, and each XAML page is backed by a ViewModel object which is set as it's DataContext.
Now, I want to add a DELETE button in the Master pane to delete fro... | Something similiar to what Paul has shown is where your view model will know which item is currently selected. I.e.
```
public class MyVM
{
public ObservableCollection<MyObject> MyCollection { get; set; }
public MyObject CurrentItem { get; set; }
}
```
Your XAML can then be simply
```
CommandParameter="{Binding P... |
528,277 | <p>I have an <code>UIView</code> and I add a editable <code>UITextView</code> to it,</p>
<pre><code>UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(5, 5, 219, 47)];
[self addSubview:textView];
textView.font = [UIFont systemFontOfSize:14];
</code></pre>
<p>When I type it doesn't go down automatic. ... | [
{
"answer_id": 528330,
"author": "Can Berk Güder",
"author_id": 2119,
"author_profile": "https://Stackoverflow.com/users/2119",
"pm_score": 3,
"selected": false,
"text": "<p>I think you'll have to do</p>\n\n<pre><code>[textView scrollRangeToVisible:[textView selectedRange]];\n</code></pr... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62009/"
] | I have an `UIView` and I add a editable `UITextView` to it,
```
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(5, 5, 219, 47)];
[self addSubview:textView];
textView.font = [UIFont systemFontOfSize:14];
```
When I type it doesn't go down automatic. Anybody got an idea? | if found a solution
i put the textview into a view and set the view to clipToBounds = YES
then i put the textView to a height of 70
that fixed the problem.
very strange solution, but it finally works :) |
528,280 | <p>I have an aspx page (page1.aspx) where I set a Session variable and then redirect to another page:</p>
<pre><code>HttpContext.Current.Response.Redirect("page2.aspx");
</code></pre>
<p>On page2.aspx I want to read the session variable, but it doesn't exist until I reload the page. I try to read the session variable... | [
{
"answer_id": 528482,
"author": "Chris Marisic",
"author_id": 37055,
"author_profile": "https://Stackoverflow.com/users/37055",
"pm_score": 3,
"selected": true,
"text": "<p>Try switching your Response Redirect to:</p>\n\n<pre><code>Response.Redirect(\"page2.aspx\",false);\nHttpContext.C... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] | I have an aspx page (page1.aspx) where I set a Session variable and then redirect to another page:
```
HttpContext.Current.Response.Redirect("page2.aspx");
```
On page2.aspx I want to read the session variable, but it doesn't exist until I reload the page. I try to read the session variable in page\_load.
The weir... | Try switching your Response Redirect to:
```
Response.Redirect("page2.aspx",false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
```
The nominal `Redirect(url)` implicitly calls `Redirect("url", true)` which throws a `ThreadAbortException`. The ThreadAbortException raised is a special exception when it... |
528,303 | <p>Deadlocks are hard to find and very uncomfortable to remove.</p>
<p>How can I find error sources for deadlocks in my code? Are there any "deadlock patterns"?</p>
<p>In my special case, it deals with databases, but this question is open for every deadlock.</p>
| [
{
"answer_id": 528310,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 1,
"selected": false,
"text": "<p>The typical scenario are mismatched update plans (tables not always updated in the same order). However it is not ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32043/"
] | Deadlocks are hard to find and very uncomfortable to remove.
How can I find error sources for deadlocks in my code? Are there any "deadlock patterns"?
In my special case, it deals with databases, but this question is open for every deadlock. | Update: This recent MSDN article, [Tools And Techniques to Identify Concurrency Issues](http://msdn.microsoft.com/en-us/magazine/cc546569.aspx), might also be of interest
---
Stephen Toub in the MSDN article [Deadlock monitor](http://msdn.microsoft.com/en-us/magazine/cc163352.aspx) states the following four condition... |
528,312 | <p>I am looking for example Java code that can construct an XML document that uses namespaces. I cannot seem to find anything using my normal <a href="http://www.google.com" rel="noreferrer">favourite tool</a> so was hoping someone may be able to help me out.</p>
| [
{
"answer_id": 528506,
"author": "Kai Huppmann",
"author_id": 2660952,
"author_profile": "https://Stackoverflow.com/users/2660952",
"pm_score": 5,
"selected": true,
"text": "<p>I am not sure, what you trying to do, but I use <a href=\"http://www.jdom.org/\" rel=\"noreferrer\">jdom</a> fo... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] | I am looking for example Java code that can construct an XML document that uses namespaces. I cannot seem to find anything using my normal [favourite tool](http://www.google.com) so was hoping someone may be able to help me out. | I am not sure, what you trying to do, but I use [jdom](http://www.jdom.org/) for most of my xml-issues and it supports namespaces (of course).
The code:
```
Document doc = new Document();
Namespace sNS = Namespace.getNamespace("someNS", "someNamespace");
Element element = new Element("SomeElement", sNS);
element.setA... |
528,327 | <p>I have a maven pom build file in the root directory of my project. When trying to synchronize with SVN repository from Eclipse (Europa), red double directed arrow is being added to the file icon. This means that both my local copy and the one in the repository have been changed since last synchronization.</p>
<p>Wh... | [
{
"answer_id": 528342,
"author": "benlumley",
"author_id": 39161,
"author_profile": "https://Stackoverflow.com/users/39161",
"pm_score": 7,
"selected": true,
"text": "<p>svn cleanup ?</p>\n\n<p>not sure how you'd do that from eclipse though ... but if its a standard svn working copy, you... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32090/"
] | I have a maven pom build file in the root directory of my project. When trying to synchronize with SVN repository from Eclipse (Europa), red double directed arrow is being added to the file icon. This means that both my local copy and the one in the repository have been changed since last synchronization.
When I try t... | svn cleanup ?
not sure how you'd do that from eclipse though ... but if its a standard svn working copy, you should still be able to do it with another tool. |
528,355 | <p>I managed to use ILMerge to merge all the assemblies I have in my project into a single assembly, but the problem is there doesn't seem to be a way to sign the merged assembly.</p>
<p>Is there some sort of command line option or command that I can run that would let me add a strong name to the merged assembly gener... | [
{
"answer_id": 528373,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 3,
"selected": true,
"text": "<p>You need to use the following commandline to sign:</p>\n\n<pre><code>al /out:MyAssembly.dll MyModule.netmodule /keyfile:s... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46265/"
] | I managed to use ILMerge to merge all the assemblies I have in my project into a single assembly, but the problem is there doesn't seem to be a way to sign the merged assembly.
Is there some sort of command line option or command that I can run that would let me add a strong name to the merged assembly generated by IL... | You need to use the following commandline to sign:
```
al /out:MyAssembly.dll MyModule.netmodule /keyfile:sgKey.snk
```
If you would like to learn more, please visit: <http://msdn.microsoft.com/en-us/library/xc31ft41.aspx> |
528,367 | <p>Can I use HQL to get the index of an <em>ordered</em> query result? </p>
<p>The only way I know to do this is to get back all of the results from the database, then iterate through all of the results.</p>
<p>For example, given:</p>
<pre><code><hibernate-mapping>
<class name="Dog" table="DOG">
<... | [
{
"answer_id": 528394,
"author": "tehvan",
"author_id": 61848,
"author_profile": "https://Stackoverflow.com/users/61848",
"pm_score": 0,
"selected": false,
"text": "<p>In a java List, you can do a call to indexOf(Object).</p>\n\n<p>See <a href=\"https://docs.oracle.com/javase/1.5.0/docs/... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62255/"
] | Can I use HQL to get the index of an *ordered* query result?
The only way I know to do this is to get back all of the results from the database, then iterate through all of the results.
For example, given:
```
<hibernate-mapping>
<class name="Dog" table="DOG">
<id name="id" type="int" column="DOG_id">
... | use the List.indexOf() If the list is extra large then make the list "extra-lazy".
But why do you need the index? Maybe you really don't (and thus you will not need to solve this issue)
---
Revised answer:
You are doing it completely wrong. All you need is :
select count(\*) from dog d, dog d1 where d.age <= d1.a... |
528,368 | <p>I'm trying to work out if an account expires in less than 30 days. Am I using DateTime Compare correctly?</p>
<pre><code>if (DateTime.Compare(expiryDate, now) < 30)
{
matchFound = true;
}
</code></pre>
| [
{
"answer_id": 528379,
"author": "Timothy Carter",
"author_id": 4660,
"author_profile": "https://Stackoverflow.com/users/4660",
"pm_score": 0,
"selected": false,
"text": "<p>No, the Compare function will return either 1, 0, or -1. 0 when the two values are equal, -1 and 1 mean less than ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to work out if an account expires in less than 30 days. Am I using DateTime Compare correctly?
```
if (DateTime.Compare(expiryDate, now) < 30)
{
matchFound = true;
}
``` | >
> Am I using DateTime Compare correctly?
>
>
>
No. `Compare` only offers information about the relative position of two dates: less, equal or greater. What you want is something like this:
```
if ((expiryDate - DateTime.Now).TotalDays < 30)
matchFound = true;
```
This subtracts two `DateTime`s. The result... |
528,372 | <p>I don't have much experience with using the yield keyword. I have these IEnumerable<T> extensions for Type Conversion.</p>
<p>My question is does the first overloaded method have the same yield return effect that I'm getting from the second method?</p>
<pre><code>public static IEnumerable<TTo> Convert... | [
{
"answer_id": 528391,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, because <strong>yield return</strong> just generates an IEnumerator class on compile. <code>yield return</code> is... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37881/"
] | I don't have much experience with using the yield keyword. I have these IEnumerable<T> extensions for Type Conversion.
My question is does the first overloaded method have the same yield return effect that I'm getting from the second method?
```
public static IEnumerable<TTo> ConvertFrom<TTo, TFrom>(this IEnumerable<... | When you call the first overload, it will immediately call the second overload. That won't execute any of the code in its body, which will have been moved into a nested class implementing the iterator block. When `GetEnumerator()` and then `MoveNext()` are first called on the returned `IEnumerable<TTo>`, *then* the cod... |
528,399 | <p>I've written a C++ program (command line, portable code) and I'm trying to release a Linux version at the same time as the Windows version. I've written a makefile as follows:</p>
<pre>
ayane: *.cpp *.h
g++ -Wno-write-strings -oayane *.cpp
</pre>
<p>Straightforward enough so far; but I'm given to understand it... | [
{
"answer_id": 528412,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "<p>make install is usually the step that \"installs\" the binary into the correct place.</p>\n\n<p>For example, when compilin... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45843/"
] | I've written a C++ program (command line, portable code) and I'm trying to release a Linux version at the same time as the Windows version. I've written a makefile as follows:
```
ayane: *.cpp *.h
g++ -Wno-write-strings -oayane *.cpp
```
Straightforward enough so far; but I'm given to understand it's customary ... | Installation
------------
A less trivial installer will copy several things into place, first insuring that the appropriate paths exists (using `mkdir -p` or similar). Typically something like this:
* the executable goes in `$INSTALL_PATH/bin`
* any libraries built for external consumption go in `$INSTALL_PATH/lib` o... |
528,430 | <p>I have the following dictionary declared:</p>
<pre><code>private readonly Dictionary<int, Image> dictionary;
</code></pre>
<p>And I have a method, which is causing a compiler error:</p>
<pre><code> public IQueryable<Image> Find(Func<Image, bool> exp)
{
return dictionary.Single(ex... | [
{
"answer_id": 528442,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": 2,
"selected": false,
"text": "<p><code>IDictionary<TKey, TValue></code> implements <code>IEnumerable<KeyValuePair<TKey,TValue>><... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3193/"
] | I have the following dictionary declared:
```
private readonly Dictionary<int, Image> dictionary;
```
And I have a method, which is causing a compiler error:
```
public IQueryable<Image> Find(Func<Image, bool> exp)
{
return dictionary.Single(exp);
}
```
The error i get is:
```
Error 1 T... | What is it you are trying to do? For example, `Single` will return an instance of `T`, not an `IQueryable<T>` (and for objects, you should probably be using `IEnumerable<T>` anyway)...
It feels like you want:
```
public Image Find(Func<Image, bool> predicate)
{
return dictionary.Values.Single(predicate);
}
```
... |
528,436 | <p>What is the best way to remove all the special characters from a string - like these: </p>
<p>!@#$%^&*(){}|:"?><,./;'[]\=-</p>
<p>The items having these characters removed would rather short, so would it be better to use REGEX on each or just use string manipulation?</p>
<p>Thx</p>
<p>Environment == C#/.... | [
{
"answer_id": 528446,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Us the \"tr\" command?</p>\n\n<p>You don't say what enviroment you're in... shell? C program? Java? Each of those would ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29345/"
] | What is the best way to remove all the special characters from a string - like these:
!@#$%^&\*(){}|:"?><,./;'[]\=-
The items having these characters removed would rather short, so would it be better to use REGEX on each or just use string manipulation?
Thx
Environment == C#/.NET | in php:
```
$tests = array(
'hello, world!'
,'this is a test'
,'and so is this'
,'another test with /slashes/ & (parenthesis)'
,'l3375p34k stinks'
);
function strip_non_alphanumerics( $subject )
{
return preg_replace( '/[^a-z0-9]/i', '', $subject );
}
foreach( $tests as $test )
{
printf(... |
528,445 | <p>I have a PHP function that I'm using to output a standard block of HTML. It currently looks like this: </p>
<pre><code><?php function TestBlockHTML ($replStr) { ?>
<html>
<body><h1> <?php echo ($replStr) ?> </h1>
</html>
<?php } ?>
</code></pre>
<p>I want... | [
{
"answer_id": 528453,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 7,
"selected": false,
"text": "<p>Yes, there is: you can capture the <code>echo</code>ed text using <a href=\"http://php.net/ob_start\" rel=\"norefe... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726/"
] | I have a PHP function that I'm using to output a standard block of HTML. It currently looks like this:
```
<?php function TestBlockHTML ($replStr) { ?>
<html>
<body><h1> <?php echo ($replStr) ?> </h1>
</html>
<?php } ?>
```
I want to return (rather than echo) the HTML inside the function. Is there any w... | You can use a [heredoc](http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc), which supports variable interpolation, making it look fairly neat:
```
function TestBlockHTML ($replStr) {
return <<<HTML
<html>
<body><h1>{$replStr}</h1>
</body>
</html>
HTML;
}
```
Pay ... |
528,472 | <p>If I have a unit that is filled with constants like...</p>
<pre><code>unit AConsts;
interface
const
Const1 : WideString = 'Const1';
Const2 : WideString = 'Const2';
Const3 : WideString = 'Const3';
Const4 = 100;
Const5 = 100;
implementation
end.
</code></pre>
<p>and I want to use this unit from anothe... | [
{
"answer_id": 528490,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 1,
"selected": false,
"text": "<p>Items in the uses statement in the interface are visible in the entire unit.</p>\n\n<p>Items in the uses statement... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47716/"
] | If I have a unit that is filled with constants like...
```
unit AConsts;
interface
const
Const1 : WideString = 'Const1';
Const2 : WideString = 'Const2';
Const3 : WideString = 'Const3';
Const4 = 100;
Const5 = 100;
implementation
end.
```
and I want to use this unit from another unit, is there any diffe... | The difference has to do with where you're allowed to refer to the things that `AConsts` has in its interface section. In the first `AUnit`, you could use `Const4` to declare a fixed-size array in *that* interface section. You couldn't do that in the second `AUnit` because `Const4` isn't in scope.
It *can* have an eff... |
528,486 | <p>How can I use Linq to SQL to retrieve @@DBTS using C#?</p>
<p>Here is what I am trying:</p>
<p>IEnumerable<System.Data.Linq.Binary> results = db.ExecuteQuery<System.Data.Linq.Binary>(@"SELECT @@DBTS");</p>
<p>However, this results in "The type 'System.Data.Linq.Binary' must declare a default (parameterless)... | [
{
"answer_id": 528509,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "<p>I suspect you might have to use regular ADO.NET and ExecuteReader/ExecuteScalar...</p>\n\n<pre><code>using(SqlConne... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2716/"
] | How can I use Linq to SQL to retrieve @@DBTS using C#?
Here is what I am trying:
IEnumerable<System.Data.Linq.Binary> results = db.ExecuteQuery<System.Data.Linq.Binary>(@"SELECT @@DBTS");
However, this results in "The type 'System.Data.Linq.Binary' must declare a default (parameterless) constructor in order to be co... | I suspect you might have to use regular ADO.NET and ExecuteReader/ExecuteScalar...
```
using(SqlConnection conn = new SqlConnection(CONN_STRING))
using(SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "SELECT @@DBTS";
cmd.CommandType = CommandType.Text;
conn.Open();
byte[] ts = (byte[]) cmd.E... |
528,487 | <p>How do I call a Javascript function on the body load of a content page? As I can not use the body load of my master page's body <code>onload</code> in this.</p>
| [
{
"answer_id": 528521,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 2,
"selected": false,
"text": "<p>If you're using ASP.NET Ajax, then you can add a load handler on your content page:</p>\n\n<pre><code>Sys.Application.add_l... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64104/"
] | How do I call a Javascript function on the body load of a content page? As I can not use the body load of my master page's body `onload` in this. | If you're using ASP.NET Ajax, then you can add a load handler on your content page:
```
Sys.Application.add_load(contentPageLoadHandler);
function contentPageLoadHandler() {
// do stuff
}
```
Using this approach, every content page or even every control, can setup its own load handler. See [this page](http://ms... |
528,488 | <p>I want to activate/enable GPRS on the iPhone programmatically. What are the APIs I can look into? There is no "Network" option in the settings application on the simulator so do I need to test out the application on the device itself?</p>
| [
{
"answer_id": 528521,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 2,
"selected": false,
"text": "<p>If you're using ASP.NET Ajax, then you can add a load handler on your content page:</p>\n\n<pre><code>Sys.Application.add_l... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44878/"
] | I want to activate/enable GPRS on the iPhone programmatically. What are the APIs I can look into? There is no "Network" option in the settings application on the simulator so do I need to test out the application on the device itself? | If you're using ASP.NET Ajax, then you can add a load handler on your content page:
```
Sys.Application.add_load(contentPageLoadHandler);
function contentPageLoadHandler() {
// do stuff
}
```
Using this approach, every content page or even every control, can setup its own load handler. See [this page](http://ms... |
528,489 | <p>I want to change the user's cursor when they hover over a specific ToolStripButton, but not for the other items on the ToolStrip. How do I set the button's cursor?</p>
| [
{
"answer_id": 528536,
"author": "jgallant",
"author_id": 62923,
"author_profile": "https://Stackoverflow.com/users/62923",
"pm_score": 0,
"selected": false,
"text": "<p>You must set the Toolstrip.Cursor property in order to change the cursor. Yes your are right, it will change the mous... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | I want to change the user's cursor when they hover over a specific ToolStripButton, but not for the other items on the ToolStrip. How do I set the button's cursor? | Because ToolStripItem doesn't inherit from Control, it doesn't have a Cursor property.
You could set the form cursor on the MouseEnter event, and restore the form cursor on the MouseLeave event, VB sample follows:
```
Dim savedCursor As Windows.Forms.Cursor
Private Sub ToolStripButton1_MouseEnter(ByVal sender As Obj... |
528,499 | <p>I inherited some code that is using XPath for which I am a novice. I have it now so that it loads the document, but when the document.selectPath(queryPath) it always fails with the following error:
<code><pre>java.lang.RuntimeException: Trying XBeans path engine... Trying XQRL... Trying delegated path engine... FAI... | [
{
"answer_id": 528716,
"author": "jor",
"author_id": 53326,
"author_profile": "https://Stackoverflow.com/users/53326",
"pm_score": 3,
"selected": true,
"text": "<p>You need an XPath engine in your classpath, which one bepends on the XMLBeans version, see\n<a href=\"http://wiki.apache.org... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/673/"
] | I inherited some code that is using XPath for which I am a novice. I have it now so that it loads the document, but when the document.selectPath(queryPath) it always fails with the following error:
````
java.lang.RuntimeException: Trying XBeans path engine... Trying XQRL... Trying delegated path engine... FAILED on //... | You need an XPath engine in your classpath, which one bepends on the XMLBeans version, see
<http://wiki.apache.org/xmlbeans/XmlBeansFaq#whatJars> |
528,517 | <p>At work we have a native C code responsible for reading and writing to a proprietary flat file database. I have a wrapper written in C# that encapsulates the P/Invoke calls into an OO model. The managed wrappers for the P/Invoke calls have grown in complexity considerably since the project was started. Anecdotally t... | [
{
"answer_id": 528565,
"author": "Maurice Flanagan",
"author_id": 38791,
"author_profile": "https://Stackoverflow.com/users/38791",
"pm_score": 0,
"selected": false,
"text": "<p>One immediate problem seems to be that you will never call dataHandle.Free() if you throw your exception, caus... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7116/"
] | At work we have a native C code responsible for reading and writing to a proprietary flat file database. I have a wrapper written in C# that encapsulates the P/Invoke calls into an OO model. The managed wrappers for the P/Invoke calls have grown in complexity considerably since the project was started. Anecdotally the ... | 1. I'm not sure what the point of your KeepAlive is, since you've already freed teh GCHandle - it seems that the data is no longer needed at that point?
2. Similar to #1, why do you feel you need to call KeepAlive at all? Is tehre something outside of the code you've posted we're not seeing?
3. Probably not. If this is... |
528,525 | <p>Let's say that I have a simple layout such as this:</p>
<pre><code><StackPanel>
<TextBlock Text="{Binding Path=Title}" />
<TextBlock Text="{Binding Path=ShortDescription}" />
<TextBlock Text="{Binding Path=LongDescription}" />
</StackPanel>
</code></pre>
<p>Now when I have Short... | [
{
"answer_id": 528539,
"author": "DavidN",
"author_id": 33662,
"author_profile": "https://Stackoverflow.com/users/33662",
"pm_score": 5,
"selected": true,
"text": "<p>You want to set the visibility of the textbox to \"Collapsed\".</p>\n\n<p>Visibility can be either:<br>\nVisible - Self e... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19546/"
] | Let's say that I have a simple layout such as this:
```
<StackPanel>
<TextBlock Text="{Binding Path=Title}" />
<TextBlock Text="{Binding Path=ShortDescription}" />
<TextBlock Text="{Binding Path=LongDescription}" />
</StackPanel>
```
Now when I have ShortDescription set to null or empty string there's still a ... | You want to set the visibility of the textbox to "Collapsed".
Visibility can be either:
Visible - Self explanatory
Hidden - Invisible but still takes up space
Collapsed - Invisible and takes up no space
Edit: You should probably set up a trigger, like so:
```
<Trigger Property="Text" Value="{x:Null}">
... |
528,534 | <p>I'm trying to pull user data from 2 tables, one locally and one on a linked server, but I get the wrong results when querying the remote server.</p>
<p>I've cut my query down to</p>
<pre><code>select * from SQL2.USER.dbo.people where persId = 475785
</code></pre>
<p>for testing and found that when I run it I get ... | [
{
"answer_id": 529042,
"author": "Godeke",
"author_id": 28006,
"author_profile": "https://Stackoverflow.com/users/28006",
"pm_score": 1,
"selected": false,
"text": "<p>The fact that LIKE operates is not a major clue: LIKE forces integers to string (so you can say WHERE field LIKE '2%' an... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39887/"
] | I'm trying to pull user data from 2 tables, one locally and one on a linked server, but I get the wrong results when querying the remote server.
I've cut my query down to
```
select * from SQL2.USER.dbo.people where persId = 475785
```
for testing and found that when I run it I get no results even though I know the... | The fact that LIKE operates is not a major clue: LIKE forces integers to string (so you can say WHERE field LIKE '2%' and you will get all records that start with a 2, even when field is of integer type). Your incorrect comparisons would lead me to think your indexes are corrupt, but you say they work when not used via... |
528,541 | <p>I am developing a program which gets all Clearcase regions (basically strings) & adds them to Combo box. I compare an existing clearcase region string in newly added items in combo box & if it is found then I want to select it, but because nothing is selected for the first time, selectedItem is null & s... | [
{
"answer_id": 529222,
"author": "Sandeep Datta",
"author_id": 39648,
"author_profile": "https://Stackoverflow.com/users/39648",
"pm_score": 1,
"selected": false,
"text": "<p>Are you sure the following line returns a valid index?</p>\n\n<blockquote>\n <p>clearCaseRegionComboBox.Items.In... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am developing a program which gets all Clearcase regions (basically strings) & adds them to Combo box. I compare an existing clearcase region string in newly added items in combo box & if it is found then I want to select it, but because nothing is selected for the first time, selectedItem is null & selectedIndex = -... | A notification: the SelectedIndexChanged event also occurs when you set SelectedIndex or SelectedItem. So if you have something there, check it out also. :) I've passed several hours on it, because you don't see it while debugging. |
528,545 | <p>Asp.net-MVC now allows for implicit binding of DateTime objects. I have an action along the lines of</p>
<pre><code>public ActionResult DoSomething(DateTime startDate)
{
...
}</code></pre>
<p>This successfully converts a string from an ajax call into a DateTime. However, we use the date format dd/MM/yyyy; MVC i... | [
{
"answer_id": 528560,
"author": "Sam Wessel",
"author_id": 4734,
"author_profile": "https://Stackoverflow.com/users/4734",
"pm_score": 8,
"selected": true,
"text": "<p>I've just found the answer to this with some more exhaustive googling:</p>\n\n<p>Melvyn Harbour has a thorough explanat... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4734/"
] | Asp.net-MVC now allows for implicit binding of DateTime objects. I have an action along the lines of
```
public ActionResult DoSomething(DateTime startDate)
{
...
}
```
This successfully converts a string from an ajax call into a DateTime. However, we use the date format dd/MM/yyyy; MVC is converting to MM/dd/yyyy... | I've just found the answer to this with some more exhaustive googling:
Melvyn Harbour has a thorough explanation of why MVC works with dates the way it does, and how you can override this if necessary:
<http://weblogs.asp.net/melvynharbour/archive/2008/11/21/mvc-modelbinder-and-localization.aspx>
>
> When looking f... |
528,546 | <p>I just discovered a very strange behavior with Type.GetInterface and nested Types.</p>
<p>The following sample code will show the problem, I am using the Type.FullName of an interface to check whether a given type derives from that interface:</p>
<pre><code>public interface IStandardInterface {}
public class Stand... | [
{
"answer_id": 528609,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>It looks like a bug handling the \"+\" marker for nested names... the following (cheating with LINQ) works:</p>\n\... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21566/"
] | I just discovered a very strange behavior with Type.GetInterface and nested Types.
The following sample code will show the problem, I am using the Type.FullName of an interface to check whether a given type derives from that interface:
```
public interface IStandardInterface {}
public class StandardClass : IStandardI... | Expanding on Marc's answer.
Although it's not documented, the GetInterface API will break up the name you pass in based on the position of the last "." in the name. Everything to the right of the "." will be assumed to be the short name of the interface in question.
This poses a problem for nested types as they will... |
528,559 | <p>Profiling my program and the function print is taking a lot of time to perform. How can I send "raw" byte output directly to stdout instead of using fwrite, and making it faster (need to send all 9bytes in the print() at the same time to the stdout) ?</p>
<pre><code>void print(){
unsigned char temp[9];
tem... | [
{
"answer_id": 528585,
"author": "jasedit",
"author_id": 59184,
"author_profile": "https://Stackoverflow.com/users/59184",
"pm_score": 1,
"selected": false,
"text": "<p>All printing is fairly slow, although iostreams are really slow for printing.</p>\n\n<p>Your best bet would be to use p... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62570/"
] | Profiling my program and the function print is taking a lot of time to perform. How can I send "raw" byte output directly to stdout instead of using fwrite, and making it faster (need to send all 9bytes in the print() at the same time to the stdout) ?
```
void print(){
unsigned char temp[9];
temp[0] = matrix[... | IO is not an inexpensive operation. It is, in fact, a **blocking** operation, meaning that the OS can preempt your process when you call `write` to allow more CPU-bound processes to run, before the IO device you're writing to completes the operation.
The only lower level function you can use (if you're developing on ... |
528,564 | <p>I am using a customized user control (that I don't have the permission to modify) which renders the HTML for a table as shown:</p>
<pre><code><tr>
<td></td>
<td></td>
</tr>
</code></pre>
<p>It lets me add any control dynamically within the tags. My question is how would I ... | [
{
"answer_id": 528587,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 0,
"selected": false,
"text": "<p>Try using a SPAN instead of a DIV. A DIV is a block-level element that carries some extra formatting baggage along ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using a customized user control (that I don't have the permission to modify) which renders the HTML for a table as shown:
```
<tr>
<td></td>
<td></td>
</tr>
```
It lets me add any control dynamically within the tags. My question is how would I set the style of the cell for the table cell. Normally, I would ... | If you can, just add a DIV before the table is generated. The class name for the outer div will be inherited by the TD elements:
```
<div class="MyClassName">
//table code here
</div>
```
Then you can use CSS as follows:
```
.MyClassName TD { //CSS here }
``` |
528,579 | <p>How can I tell SQL Server not to raise an error if I insert or update a string longer than the size of the field - I would like silent truncation in this instance.</p>
| [
{
"answer_id": 528606,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 5,
"selected": false,
"text": "<p>The thing you have to do is set ANSI WARNINGS to OFF\nYou can do that by calling</p>\n\n<pre><code>set ANSI_WARNINGS OFF... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9731/"
] | How can I tell SQL Server not to raise an error if I insert or update a string longer than the size of the field - I would like silent truncation in this instance. | The thing you have to do is set ANSI WARNINGS to OFF
You can do that by calling
```
set ANSI_WARNINGS OFF
```
I have also written a practical example:
```
create table bla(id varchar(2))
go
insert bla values ('123') --fails
set ANSI_WARNINGS OFF
insert bla values ('123') --succeeds
```
Do remember to turn th... |
528,590 | <p>I have a table with 10 columns as col_1,col_2,.... col_10. I want to write a select statement that will select a value of one of the row and from one of these 10 columns. I have a variable that will decide which column to select from. Can such query be written where the column name is dynamically decided from a vari... | [
{
"answer_id": 528611,
"author": "user54650",
"author_id": 54650,
"author_profile": "https://Stackoverflow.com/users/54650",
"pm_score": 3,
"selected": true,
"text": "<p>Since I don't have enough details, I can't give code. Instead, I'll explain.</p>\n\n<p>Declare a string variable, some... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20951/"
] | I have a table with 10 columns as col\_1,col\_2,.... col\_10. I want to write a select statement that will select a value of one of the row and from one of these 10 columns. I have a variable that will decide which column to select from. Can such query be written where the column name is dynamically decided from a vari... | Since I don't have enough details, I can't give code. Instead, I'll explain.
Declare a string variable, something like:
```
declare @sql varchar(5000)
```
Set that variable to be the completed SQL string you want (as a string, and not actually querying... so you embed the row-name you want using string concatenatio... |
528,610 | <p>What (if any) is the difference between the results of the following two versions of this VB Linq query?</p>
<p>' assume we have an XElement containing employee details defined somewhere else</p>
<pre><code>Dim ee = From e In someXML.<Employee> _
Select New With {.Surname = e.<Surname>, .Forename = e.&... | [
{
"answer_id": 528621,
"author": "Cameron MacFarland",
"author_id": 3820,
"author_profile": "https://Stackoverflow.com/users/3820",
"pm_score": 2,
"selected": false,
"text": "<p>They're called <a href=\"http://msdn.microsoft.com/en-us/library/bb384767.aspx\" rel=\"nofollow noreferrer\">A... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24209/"
] | What (if any) is the difference between the results of the following two versions of this VB Linq query?
' assume we have an XElement containing employee details defined somewhere else
```
Dim ee = From e In someXML.<Employee> _
Select New With {.Surname = e.<Surname>, .Forename = e.<Forename>}
```
and
```
Dim ee ... | The difference is that the 1st explicitly creates an anonymous type. The 2nd is a query expression, and may use an existing type rather than creating an anonymous type. From the documentation linked by Cameron MacFarland:
>
> Query expressions do not always require the creation of anonymous types. When possible, they... |
528,628 | <p>I'm having trouble with the layout of a simple HTML page. Please help.</p>
<p>Here's the layout I'm going for...</p>
<p><a href="http://img516.imageshack.us/img516/9637/layoutfk5.gif" rel="nofollow noreferrer">Layout http://img516.imageshack.us/img516/9637/layoutfk5.gif</a></p>
<ul>
<li>orange = body</li>
<li>bl... | [
{
"answer_id": 528647,
"author": "Dan",
"author_id": 37078,
"author_profile": "https://Stackoverflow.com/users/37078",
"pm_score": 3,
"selected": true,
"text": "<p>It has to do with the default rules for IMG tags.</p>\n\n<p>I recommend always using this in your stylesheet as a default ru... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] | I'm having trouble with the layout of a simple HTML page. Please help.
Here's the layout I'm going for...
[Layout http://img516.imageshack.us/img516/9637/layoutfk5.gif](http://img516.imageshack.us/img516/9637/layoutfk5.gif)
* orange = body
* blue/red = frame div
* green = header image
* black/white = menu div
It lo... | It has to do with the default rules for IMG tags.
I recommend always using this in your stylesheet as a default rule:
```
img{
display:block;
}
``` |
528,648 | <p>I am toying around with a pretty intensive ajax based jquery web application. It is getting to a point where I almost loose track of what events that should trigger what actions etc.</p>
<p>I am sort of left with a feeling that my javascript structure is wrong, on a more basic level. How do you guys structure your ... | [
{
"answer_id": 528673,
"author": "Steerpike",
"author_id": 60598,
"author_profile": "https://Stackoverflow.com/users/60598",
"pm_score": 5,
"selected": false,
"text": "<p>For javascript code I found the following links from Christian Heilmann indispensable</p>\n\n<ul>\n<li><a href=\"http... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32809/"
] | I am toying around with a pretty intensive ajax based jquery web application. It is getting to a point where I almost loose track of what events that should trigger what actions etc.
I am sort of left with a feeling that my javascript structure is wrong, on a more basic level. How do you guys structure your javascript... | AMDS!
It's been awhile since first answers got posted to this question and many things have changed.
First and foremost, the JS browser world seems to be moving towards AMDs (asynchronous module definition) for code organization.
The way that works is you write ALL your code as AMD modules, e.g.:
```
define('moduleN... |
528,671 | <p>I have an application that opens a new window on clicking a link. This spawns a page that holds a Java applet. The problem I am having is that clicking the same link reloads the page, which resets the Java application. Is there any way to trap this? Two solutions that would be acceptable are:</p>
<ol>
<li>Allow mul... | [
{
"answer_id": 528693,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 3,
"selected": false,
"text": "<p>You can use something like this in the page that opens the new window:</p>\n\n<pre><code>var newWindow = null;\n\nfunction ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8163/"
] | I have an application that opens a new window on clicking a link. This spawns a page that holds a Java applet. The problem I am having is that clicking the same link reloads the page, which resets the Java application. Is there any way to trap this? Two solutions that would be acceptable are:
1. Allow multiple windows... | I'd do it like this - basically store all the referenced opened windows on the function itself. When the function fires, check if the window doesn't exist or has been close - of so, launch the popup. Otherwise, focus on the existing popup window for that request.
```
function launchApplication(l_url, l_windowName)
{
... |
528,676 | <p>As a part of our build process we want to execute SQL Scripts consisting of DDL and DML statements against a fresh database instance. </p>
<p>ADO.NET Connection/Command can't handle this without parsing and splitting the scripts.</p>
<p>The <code>sqlplus</code> command line utility can execute scripts only interac... | [
{
"answer_id": 528715,
"author": "Justin Cave",
"author_id": 10397,
"author_profile": "https://Stackoverflow.com/users/10397",
"pm_score": 3,
"selected": true,
"text": "<p>Why do you believe that the SQL<em>Plus utility isn't suited for batch usage? It's pretty common to use it for runn... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54983/"
] | As a part of our build process we want to execute SQL Scripts consisting of DDL and DML statements against a fresh database instance.
ADO.NET Connection/Command can't handle this without parsing and splitting the scripts.
The `sqlplus` command line utility can execute scripts only interactively, and isn't suited for... | Why do you believe that the SQL*Plus utility isn't suited for batch usage? It's pretty common to use it for running these sorts of scripts-- you can pass the script to SQL*Plus when you invoke it if you'd like, i.e.
```
sqlplus scott/tiger@someDatabase @someScript.sql
```
That is a pretty common way of deploying bui... |
528,680 | <p>Where I work we're <em>finally</em> coming around to the idea of using strongly typed datasets to encapsulate some of our queries to sqlserver. One of the idea's I've been touting is the strength of the strongly typed column's, mainly for not needing to cast any data. Am I wrong in thinking that strongly-typed-data... | [
{
"answer_id": 528694,
"author": "Patrick McDonald",
"author_id": 61989,
"author_profile": "https://Stackoverflow.com/users/61989",
"pm_score": 4,
"selected": true,
"text": "<p>I'm not sure if there will be any performance improvements using the strongly typed datasets, however you get t... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8945/"
] | Where I work we're *finally* coming around to the idea of using strongly typed datasets to encapsulate some of our queries to sqlserver. One of the idea's I've been touting is the strength of the strongly typed column's, mainly for not needing to cast any data. Am I wrong in thinking that strongly-typed-datasets would ... | I'm not sure if there will be any performance improvements using the strongly typed datasets, however you get the added type safety, and with it compiler errors when you mistype a field name, for example.
There's an article in [MSDN magazine](http://msdn.microsoft.com/en-us/magazine/cc163877.aspx) about them, to quote... |
528,682 | <p>I'm looking to convert a string of html entities specifying ASCII codes (ie: &#97;) to the ASCII characters they represent (ie: a). I'm using a property of an object and trying to assign a value. For instance:</p>
<pre><code>object.Text("");
</code></pre>
<p>When I pass is the string representing the entit... | [
{
"answer_id": 528690,
"author": "Josh Stodola",
"author_id": 54420,
"author_profile": "https://Stackoverflow.com/users/54420",
"pm_score": 5,
"selected": true,
"text": "<p>Try the <a href=\"https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/fromCharCode... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21318/"
] | I'm looking to convert a string of html entities specifying ASCII codes (ie: a) to the ASCII characters they represent (ie: a). I'm using a property of an object and trying to assign a value. For instance:
```
object.Text("");
```
When I pass is the string representing the entity, I get the same string back. I c... | Try the [String.fromCharCode()](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/fromCharCode) function.
```
alert(String.fromCharCode(97));
```
As you can see, you'll have to strip out the ampersand and pound sign.
Best regards... |
528,692 | <p>i need to extract frame (can be every number ) from flash swf and convert it to jpg/png/.. programmatically
what is the best way to do that ? never mind the programming lang </p>
| [
{
"answer_id": 528803,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 1,
"selected": false,
"text": "<p>Check out <a href=\"http://www.swftools.org/swfextract.html\" rel=\"nofollow noreferrer\">swfextract</a>, part of <a h... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63898/"
] | i need to extract frame (can be every number ) from flash swf and convert it to jpg/png/.. programmatically
what is the best way to do that ? never mind the programming lang | Do you have the original .fla files or only the .swf ones?
Anyway, if your using Actionscript 3, then every instance of `DisplayObject` and its subclasses (`Stage`, `Sprite`, `MovieClip`...) can be captured to a Bitmap. To do that, create a `BitmapData` object and use its `draw` method.
It would look like something l... |
528,718 | <p>When running a TFS build, will it always download all the files for the project, or can it use a previous builds download (as long as the files didn't change).</p>
| [
{
"answer_id": 528749,
"author": "footose",
"author_id": 53084,
"author_profile": "https://Stackoverflow.com/users/53084",
"pm_score": -1,
"selected": false,
"text": "<p>It should only ever download if you do a \"Get Latest\".</p>\n\n<p>Every other build will do it locally.</p>\n"
},
... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | When running a TFS build, will it always download all the files for the project, or can it use a previous builds download (as long as the files didn't change). | TFS build (2008) will always get all sources specified in build configuration, recreate workspace and force get of sources before doing a build.
If you add
```
<PropertyGroup>
<IncrementalBuild>true</IncrementalBuild>
</PropertyGroup>
```
to your [Build name].proj configuration file then it will do only incremen... |
528,721 | <pre><code>[XmlElement(ElementName = ElementConstants.CreateDate,
Namespace = "http://api.facebook.com/1.0/",
DataType = "date", Type = typeof(DateTime))]
public DateTime CreateDate { get; set; }
</code></pre>
<p>And if I try taking out the DataType in the attribute I get : {"The string '1233469624' is not a ... | [
{
"answer_id": 528731,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "<p>I've already answered this for you <a href=\"https://stackoverflow.com/questions/523245/deserialization-error-the-... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93468/"
] | ```
[XmlElement(ElementName = ElementConstants.CreateDate,
Namespace = "http://api.facebook.com/1.0/",
DataType = "date", Type = typeof(DateTime))]
public DateTime CreateDate { get; set; }
```
And if I try taking out the DataType in the attribute I get : {"The string '1233469624' is not a valid AllXsd value.... | I've already answered this for you [a few days ago](https://stackoverflow.com/questions/523245/deserialization-error-the-xml-element-name-from-namespace-is-already-presen).
In your class, you need to do the translation:
```
static readonly DateTime epoch = new DateTime(1970, 1, 1);
static long SerializeDateTime(DateT... |
528,734 | <p>I'm new to PS so I may get some of the terminology wrong.</p>
<p>If you want to roll out a custom PowerShell environment (snap-in) for a team of 30 developers/DBAs. What is the best way to do this... if you intend to be rolling out new functionality once a week? Does PowerShell 2.0 help in this regards? </p>
<p>As... | [
{
"answer_id": 528746,
"author": "EBGreen",
"author_id": 1358,
"author_profile": "https://Stackoverflow.com/users/1358",
"pm_score": 4,
"selected": true,
"text": "<p>It will depend to a certain extent on the sort of functionality changes that you intend to do. For our environment, we rol... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] | I'm new to PS so I may get some of the terminology wrong.
If you want to roll out a custom PowerShell environment (snap-in) for a team of 30 developers/DBAs. What is the best way to do this... if you intend to be rolling out new functionality once a week? Does PowerShell 2.0 help in this regards?
Assumption:
Ther... | It will depend to a certain extent on the sort of functionality changes that you intend to do. For our environment, we roll out a pretty standard PS install then add one line to everyone's profile to run a script from a shared folder on a server. Then in that script I can do whatever customization that I want to have a... |
528,736 | <p>I have a .NET winforms program that includes a feature to launch a specific web page in the system's default browser window. </p>
<p>It would be desirable for the page to be launched in the user's <em>existing browser window, if one is open</em>. The current means of launching the browser always creates a new win... | [
{
"answer_id": 528746,
"author": "EBGreen",
"author_id": 1358,
"author_profile": "https://Stackoverflow.com/users/1358",
"pm_score": 4,
"selected": true,
"text": "<p>It will depend to a certain extent on the sort of functionality changes that you intend to do. For our environment, we rol... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36307/"
] | I have a .NET winforms program that includes a feature to launch a specific web page in the system's default browser window.
It would be desirable for the page to be launched in the user's *existing browser window, if one is open*. The current means of launching the browser always creates a new window:
```
Process p... | It will depend to a certain extent on the sort of functionality changes that you intend to do. For our environment, we roll out a pretty standard PS install then add one line to everyone's profile to run a script from a shared folder on a server. Then in that script I can do whatever customization that I want to have a... |
528,767 | <p>I'm working on an ASP.NET application which is supposed to output detector data for a chosen interstate, sorted by mile marker. We determined the best way to do this would be sorting it by longitude (West and East) or latitude(North and South) depending on which direction it goes. Here's the query that populates it.... | [
{
"answer_id": 528777,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 2,
"selected": false,
"text": "<p><code>I-55/70</code> corresponds to neither of <code>'%EB%</code>, <code>'%WB%'</code>, <code>'%NB%'</code> or <code>'... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm working on an ASP.NET application which is supposed to output detector data for a chosen interstate, sorted by mile marker. We determined the best way to do this would be sorting it by longitude (West and East) or latitude(North and South) depending on which direction it goes. Here's the query that populates it.
`... | It seems to me your ORDER BY clause should not work in any cases because "CASE @WebName WHEN '%EB%'" etc. should not evaluate to true. The case statement as you are using it does an equivalence comparison but the wildcard operators ("%") are only used for LIKE. Try this instead:
```
ORDER BY CASE
WHEN @WebName LIKE '... |
528,776 | <p>I'm trying to pull some data from a SQL table in my dataset using C#.</p>
<p>In this case I do not need all the columns just a few specific ones, however as I am not pulling back a column with a mandatory NOT NULL, the copy of the table is throwing the exception </p>
<pre><code>"Failed to enable constraints. One... | [
{
"answer_id": 529370,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 0,
"selected": false,
"text": "<p>The column is mandatory because the metadata tells the client that to add any new rows (or alter rows), values for th... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61999/"
] | I'm trying to pull some data from a SQL table in my dataset using C#.
In this case I do not need all the columns just a few specific ones, however as I am not pulling back a column with a mandatory NOT NULL, the copy of the table is throwing the exception
```
"Failed to enable constraints. One or more rows contain v... | I assume
taDevice
is a tableadapter ? generated with the typed dataset ?
You could also generate the "FillDataByDeviceSN" method (you can generate a Get and a Fill)
then you get (pseudo-ish code):
```
tblDeviceDataTable dtService = new tblDeviceDataTable();
dtService.tblLocationID.AllowDbNull = true;
taDevice.FillDa... |
528,781 | <p>How can I tell if STDIN is connected to a terminal in Perl?</p>
| [
{
"answer_id": 528791,
"author": "Glen Solsberry",
"author_id": 16645,
"author_profile": "https://Stackoverflow.com/users/16645",
"pm_score": 5,
"selected": true,
"text": "<pre><code>if (-t *STDIN) {\n # stdin is connected\n} else {\n # stdin is not connected\n}\n</code></pre>\n<p>I us... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61318/"
] | How can I tell if STDIN is connected to a terminal in Perl? | ```
if (-t *STDIN) {
# stdin is connected
} else {
# stdin is not connected
}
```
I usually use this in conjunction with `-t *STDOUT`, to find out if I'm running from an interactive shell, or from cron, to enable more output. |
528,796 | <p>What I am trying to accomplish to to get financial data in my Flex Datagrid to be color-coded--green if it's positive; red if it's negative. This would be fairly straightforward if the column I want colored was part of the dataProvider. Instead, I am calculating it based on two other columns that are part of the d... | [
{
"answer_id": 529053,
"author": "cliff.meyers",
"author_id": 41754,
"author_profile": "https://Stackoverflow.com/users/41754",
"pm_score": 6,
"selected": true,
"text": "<p>You may want to look into <a href=\"http://livedocs.adobe.com/flex/3/langref/mx/core/ClassFactory.html\" rel=\"nofo... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | What I am trying to accomplish to to get financial data in my Flex Datagrid to be color-coded--green if it's positive; red if it's negative. This would be fairly straightforward if the column I want colored was part of the dataProvider. Instead, I am calculating it based on two other columns that are part of the dataPr... | You may want to look into [ClassFactory](http://livedocs.adobe.com/flex/3/langref/mx/core/ClassFactory.html) from the Flex APIs:
This allows you to set a prototype Object with arbitrary types / values each of which will be passed to the item renderer. From the sample:
```
var productRenderer:ClassFactory = new ClassF... |
528,806 | <p>Here is my table:</p>
<pre><code>mysql> describe ps;
+-------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| a | text |... | [
{
"answer_id": 528836,
"author": "benlumley",
"author_id": 39161,
"author_profile": "https://Stackoverflow.com/users/39161",
"pm_score": 1,
"selected": false,
"text": "<p>You can use the limit clause to do this.</p>\n\n<p>But there doesn't seem to be any point in doing this in sql when t... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here is my table:
```
mysql> describe ps;
+-------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| a | text | YES | | NUL... | You can use the limit clause to do this.
But there doesn't seem to be any point in doing this in sql when the data is already in PHP. Why not put the rows into an array with an element per row, and use the array's pointer to achieve this?
The prev(), current() and next() functions should be all you need. |
528,807 | <p>I have a field on a form that takes the following values: -1, 2-10, 99</p>
<p>I have a business rule that's concerned with answers 2-10.</p>
<p>I'm trying to write a regular expression that will match 2-10 but <em>not</em> 99, and I'm having trouble.</p>
<p>The original expression:</p>
<pre><code>^2|3|4|5|6|7|8|... | [
{
"answer_id": 528813,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 3,
"selected": false,
"text": "<p>Use parentheses around the alternations, since concatenation has higher precedence than alternation:</p>\n\n<pre>... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1734/"
] | I have a field on a form that takes the following values: -1, 2-10, 99
I have a business rule that's concerned with answers 2-10.
I'm trying to write a regular expression that will match 2-10 but *not* 99, and I'm having trouble.
The original expression:
```
^2|3|4|5|6|7|8|9|10$
```
Fails because 99 is matched (t... | You need parantheses for that. I would further use ranges to keep things readable:
```
^([2-9]|10)$
``` |
528,820 | <p>I'm looking for a source/spec that can tell me what CSS properties can applied to which HTML elements. For instance, the css property; "overflow". I know I can apply this to div, p, textarea but what other elements can I apply this too? Is there a spec somewhere I can reference?</p>
| [
{
"answer_id": 528826,
"author": "Aron Rotteveel",
"author_id": 11568,
"author_profile": "https://Stackoverflow.com/users/11568",
"pm_score": 3,
"selected": false,
"text": "<p>See <a href=\"http://www.w3.org/TR/CSS2/\" rel=\"nofollow noreferrer\">http://www.w3.org/TR/CSS2/</a> and <a hre... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/70/"
] | I'm looking for a source/spec that can tell me what CSS properties can applied to which HTML elements. For instance, the css property; "overflow". I know I can apply this to div, p, textarea but what other elements can I apply this too? Is there a spec somewhere I can reference? | See <http://www.w3.org/TR/CSS2/> and <http://www.w3.org/TR/CSS/>.
For example, regarding your question about the `overflow` property, see:
<http://www.w3.org/TR/CSS2/visufx.html#overflow-clipping>, stating:
```
'overflow'
Value: visible | hidden | scroll | auto | inherit
Initial: visible
... |
528,830 | <p>I'm trying to create an SQL query that will order the results by a version number (e.g. 1.1, 4.5.10, etc.)</p>
<p>Here's what I tried:</p>
<pre><code>SELECT * FROM Requirements
WHERE Requirements.Release NOT LIKE '%Obsolete%'
ORDER BY Requirements.ReqNum
</code></pre>
<p>Now, the ReqNum field is a strin... | [
{
"answer_id": 528839,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 6,
"selected": true,
"text": "<p>For best results, refactor version number storage so that each section has it's own column: MajorVersion, MinorVersi... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to create an SQL query that will order the results by a version number (e.g. 1.1, 4.5.10, etc.)
Here's what I tried:
```
SELECT * FROM Requirements
WHERE Requirements.Release NOT LIKE '%Obsolete%'
ORDER BY Requirements.ReqNum
```
Now, the ReqNum field is a string field and unfortunately I can't... | For best results, refactor version number storage so that each section has it's own column: MajorVersion, MinorVersion, Revision, Build. Then the ordering problem suddenly becomes trivial. You can also build a computed column for easy retrieval of the full string. |
528,832 | <p>I don't know OWNER object class name. So I must check everywhere in my codes like that :</p>
<pre><code>if TObject(OWNER) is TFirstClass then begin
TFirstClass(OWNER).FirstFunction;
TFirstClass(OWNER).SecondFunction;
...
end else
if TObject(OWNER) is TSecondClass then begin
TSecondClass(OWNER).FirstFunction... | [
{
"answer_id": 528852,
"author": "Uli Gerhardt",
"author_id": 1431618,
"author_profile": "https://Stackoverflow.com/users/1431618",
"pm_score": 4,
"selected": false,
"text": "<p>Derive TFirstClass and TSecondClass from a common base class that declares virtual methods FirstFunction and S... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62313/"
] | I don't know OWNER object class name. So I must check everywhere in my codes like that :
```
if TObject(OWNER) is TFirstClass then begin
TFirstClass(OWNER).FirstFunction;
TFirstClass(OWNER).SecondFunction;
...
end else
if TObject(OWNER) is TSecondClass then begin
TSecondClass(OWNER).FirstFunction;
TSecondCla... | If you have no access to TFirstClass and TSecondClass, but still want to simplify your code, here's a way:
Create an adapter base class:
```
type
TMyAdapter = class(TObject)
public
procedure FirstMethod; virtual; abstract;
procedure SecondMethod; virtual; abstract;
end;
```
Then create descendant clas... |
528,864 | <p>how do i do this with regex?</p>
<p>i want to match this string: <code>-myString</code></p>
<p>but i don't want to match the <code>-myString</code> in this string: <code>--myString</code></p>
<p>myString is of course anything.</p>
<p>is it even possible?</p>
<p>EDIT:</p>
<p>here's a little more info with what ... | [
{
"answer_id": 528879,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 0,
"selected": false,
"text": "<pre><code>/^[^-]*-myString/\n</code></pre>\n\n<p>Testing:</p>\n\n<pre><code>[~]$ echo -myString | egrep -e '^[^-]*-myStr... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31345/"
] | how do i do this with regex?
i want to match this string: `-myString`
but i don't want to match the `-myString` in this string: `--myString`
myString is of course anything.
is it even possible?
EDIT:
here's a little more info with what i got so far since i've posted a question:
```
string to match:
some random s... | Assuming your regex engine supports (negative) lookbehind:
```
/(?<!-)-myString/
```
Perl does, Javascript doesn't, for example. |
528,883 | <p>How can I re-direct the user to the standard SharePoint "access denied" page, similar to the image below?</p>
<p>Currently, I am throwing an UnauthorizedAccessException, but this error message is not as elegant as SP message.</p>
<pre><code>throw new UnauthorizedAccessException("User does not have permission to ac... | [
{
"answer_id": 529031,
"author": "Todd Friedlich",
"author_id": 21816,
"author_profile": "https://Stackoverflow.com/users/21816",
"pm_score": 0,
"selected": false,
"text": "<p>Not exactly sure what you are looking for, but if you throw an <a href=\"http://msdn.microsoft.com/en-us/library... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55503/"
] | How can I re-direct the user to the standard SharePoint "access denied" page, similar to the image below?
Currently, I am throwing an UnauthorizedAccessException, but this error message is not as elegant as SP message.
```
throw new UnauthorizedAccessException("User does not have permission to access this list");
``... | You should be able to use SPUtility.HandleAccessDenied to do this. (You can pass in null for the exception parameter if you just want to force the Access Denied page to be displayed, but aren't actually handling an exception.) |
528,924 | <p>I have setup a GridView inside an UpdatePanel. The GridView has a SELECT CommandField that is tied to Gridview1_SelectedIndexChanged method. I would like the GridView to refresh after a row is selected but it never does. I have tried several different scenarios and none seem to work. </p>
<ul>
<li>I have set Update... | [
{
"answer_id": 532874,
"author": "Barbaros Alp",
"author_id": 51734,
"author_profile": "https://Stackoverflow.com/users/51734",
"pm_score": 1,
"selected": false,
"text": "<p>If i understand you right, you need to bind the datasource to your grid on each postback.</p>\n"
},
{
"ans... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23790/"
] | I have setup a GridView inside an UpdatePanel. The GridView has a SELECT CommandField that is tied to Gridview1\_SelectedIndexChanged method. I would like the GridView to refresh after a row is selected but it never does. I have tried several different scenarios and none seem to work.
* I have set UpdateMode to "Cond... | I think I see your problem. Try adding a DataKeyNames paramater to the GridView with the ID of the row you want to act on. Next remove the Triggers section as you won't need them for what you are doing. Since you are wanting to act on something change the CommandField to one of the other options such as Delete which yo... |
528,941 | <p>This is a follow up to my last question <a href="https://stackoverflow.com/questions/528671/javascript-window-open-only-if-the-window-does-not-already-exist">Open a window if the window does not already exist</a>
Essentially, I am now keeping a list of all the window references that have been opened by a page, and o... | [
{
"answer_id": 528944,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 2,
"selected": false,
"text": "<p>No, this would be a security/privacy issue.</p>\n\n<hr>\n\n<p>Since others have brought up the ownership/cookie state ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8163/"
] | This is a follow up to my last question [Open a window if the window does not already exist](https://stackoverflow.com/questions/528671/javascript-window-open-only-if-the-window-does-not-already-exist)
Essentially, I am now keeping a list of all the window references that have been opened by a page, and only allowing t... | >
> @annakata (and even if you stored them, you wouldn't have permission to close them any more)
>
>
>
Not true. If you have the name of the window, you can use window.open to reestablish a link to the window even if the opener was closed and reopened. For example:
```
<script>
function winOpen(url){
return win... |
528,969 | <p>I have Subversion setup and running on my local network with windows and svnserve. I'd like to use Capistrano to deploy to a remote ubuntu server but am a bit on unsure on what I need to do to get the client end to work on windows. My understanding is that the remote server needs to be able to tunnel into my subve... | [
{
"answer_id": 529026,
"author": "hernan43",
"author_id": 27521,
"author_profile": "https://Stackoverflow.com/users/27521",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not a Windows person, but my understanding is that in Capistrano's normal state, it executes all of its commands o... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6805/"
] | I have Subversion setup and running on my local network with windows and svnserve. I'd like to use Capistrano to deploy to a remote ubuntu server but am a bit on unsure on what I need to do to get the client end to work on windows. My understanding is that the remote server needs to be able to tunnel into my subversion... | You could try having capistrano checkout your code locally, zip and send it to the server. This isn't as efficient has having the server access svn because it has to send the entire codebase every time, but it will save you the trouble of exposing your repository to the outside.
From [this page](http://www.capify.org/... |
528,981 | <p>I dynamically load a UC in the Oninit of the host page. </p>
<p>In the Oninit of the UC, I raise an event. I get a null reference exception. The code is as below:</p>
<pre><code>//In the UC
public event CommandEventHandler DoneProcessing;
protected override void OnInit(EventArgs e)
{
//Raise a event
C... | [
{
"answer_id": 529003,
"author": "Two Bit Gangster",
"author_id": 63694,
"author_profile": "https://Stackoverflow.com/users/63694",
"pm_score": 0,
"selected": false,
"text": "<p>It's a best practice to always to a null check before raising an event, in case there are no handlers.</p>\n\n... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I dynamically load a UC in the Oninit of the host page.
In the Oninit of the UC, I raise an event. I get a null reference exception. The code is as below:
```
//In the UC
public event CommandEventHandler DoneProcessing;
protected override void OnInit(EventArgs e)
{
//Raise a event
CommandEventArgs cmdEv... | I believe you are attempting to do [Event Bubbling](http://msdn.microsoft.com/en-us/library/aa719644(VS.71).aspx). Here is an [Ode to Code Reference](http://www.odetocode.com/code/94.aspx) called Event Bubbling From Web User Controls in ASP.NET (C#)
As already mentioned I suspect you can stop the error by using the s... |
528,999 | <p>Time and time again I find myself having to write thread-safe versions of BindingList and ObservableCollection because, when bound to UI, these controls cannot be changed from multiple threads. What I'm trying to understand is <strong>why</strong> this is the case - is it a design fault or is this behavior intention... | [
{
"answer_id": 529028,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 6,
"selected": true,
"text": "<p>The problem is designing a thread safe collection is not simple. Sure it's simple enough to design a collection which ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9476/"
] | Time and time again I find myself having to write thread-safe versions of BindingList and ObservableCollection because, when bound to UI, these controls cannot be changed from multiple threads. What I'm trying to understand is **why** this is the case - is it a design fault or is this behavior intentional? | The problem is designing a thread safe collection is not simple. Sure it's simple enough to design a collection which can be modified/read from multiple threads without corrupting state. But it's much more difficult to design a collection that is usable given that it's updated from multiple threads. Take the following ... |
529,007 | <p>I'm having trouble generating XML along the lines of this:</p>
<pre><code><Root xmlns:brk="http://somewhere">
<child1>
<brk:node1>123456</brk:node1>
<brk:node2>500000000</brk:node2>
</child1>
</Root>
</code></pre>
<p>This code get me most of the way, but I ca... | [
{
"answer_id": 529074,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 2,
"selected": false,
"text": "<p>You are almost there, but you made one simple error in your first code example. I believe this is what you require:<... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/230/"
] | I'm having trouble generating XML along the lines of this:
```
<Root xmlns:brk="http://somewhere">
<child1>
<brk:node1>123456</brk:node1>
<brk:node2>500000000</brk:node2>
</child1>
</Root>
```
This code get me most of the way, but I can't get the 'brk' namespace in front of the nodes;
```
var rootNode = ne... | You are almost there, but you made one simple error in your first code example. I believe this is what you require:
```
XNamespace brk = "http://somewhere.com";
XElement root = new XElement("Root",
new XAttribute(XNamespace.Xmlns + "brk", "http://somewhere.com"));
XElement childNode = new XElement("child1");
chil... |
529,032 | <p>I'm calling SQL's sp_changeobjectowner from C#. I want to check afterwards if it worked. How do I check if a table's owner is who I want it to be?</p>
| [
{
"answer_id": 529074,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 2,
"selected": false,
"text": "<p>You are almost there, but you made one simple error in your first code example. I believe this is what you require:<... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm calling SQL's sp\_changeobjectowner from C#. I want to check afterwards if it worked. How do I check if a table's owner is who I want it to be? | You are almost there, but you made one simple error in your first code example. I believe this is what you require:
```
XNamespace brk = "http://somewhere.com";
XElement root = new XElement("Root",
new XAttribute(XNamespace.Xmlns + "brk", "http://somewhere.com"));
XElement childNode = new XElement("child1");
chil... |
529,034 | <p>I am writing an queue processing application which uses threads for waiting on and responding to queue messages to be delivered to the app. For the main part of the application, it just needs to stay active. For a code example like:</p>
<pre>
while True:
pass
</pre>
<p>or</p>
<pre>
while True:
time.sleep(1)... | [
{
"answer_id": 529048,
"author": "hernan43",
"author_id": 27521,
"author_profile": "https://Stackoverflow.com/users/27521",
"pm_score": 3,
"selected": false,
"text": "<p>I've always seen/heard that using sleep is the better way to do it. Using sleep will keep your Python interpreter's CP... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13203/"
] | I am writing an queue processing application which uses threads for waiting on and responding to queue messages to be delivered to the app. For the main part of the application, it just needs to stay active. For a code example like:
```
while True:
pass
```
or
```
while True:
time.sleep(1)
```
Which one wil... | I would imagine *time.sleep()* will have less overhead on the system. Using *pass* will cause the loop to immediately re-evaluate and peg the CPU, whereas using time.sleep will allow the execution to be temporarily suspended.
**EDIT**: just to prove the point, if you launch the python interpreter and run this:
```
>... |
529,054 | <p>In addition to the basic <code>*</code>, <code>?</code> and <code>[...]</code> patterns, the Bash shell provides extended pattern matching operators like <code>!(pattern-list)</code> ("match all except one of the given patterns"). The <code>extglob</code> shell option needs to be set to use them. An example:</p>
<p... | [
{
"answer_id": 529096,
"author": "Nietzche-jou",
"author_id": 39892,
"author_profile": "https://Stackoverflow.com/users/39892",
"pm_score": 1,
"selected": false,
"text": "<p>Well, I don't have any real experince with <em>extglob</em>, but I can get it to work by wrapping the <code>echo</... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15770/"
] | In addition to the basic `*`, `?` and `[...]` patterns, the Bash shell provides extended pattern matching operators like `!(pattern-list)` ("match all except one of the given patterns"). The `extglob` shell option needs to be set to use them. An example:
```
~$ mkdir test ; cd test ; touch file1 file2 file3
~/test$ ec... | ```
$ bash -O extglob -c 'echo !(file2)'
file1 file3
``` |
529,056 | <p>I got a question regarding content types and their IDs and how to use them with the object model. </p>
<p>First of all, I defined some site columns, a content type using these columns and a list definition using this content type via CAML. Each of the three components is realized as a feature. Another feature creat... | [
{
"answer_id": 529069,
"author": "Brandon",
"author_id": 63775,
"author_profile": "https://Stackoverflow.com/users/63775",
"pm_score": 4,
"selected": true,
"text": "<p>When you create a list based on a content type, each instance of the list is actually a new content type that inherits f... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19601/"
] | I got a question regarding content types and their IDs and how to use them with the object model.
First of all, I defined some site columns, a content type using these columns and a list definition using this content type via CAML. Each of the three components is realized as a feature. Another feature creates a list ... | When you create a list based on a content type, each instance of the list is actually a new content type that inherits from the parent.
Take a look at this...
<http://soerennielsen.wordpress.com/2007/09/11/propagate-site-content-types-to-list-content-types/>
Update-Regarding finding the instance of the List without u... |
529,065 | <p>Playing with <a href="http://www.sinatrarb.com/" rel="noreferrer">sinatra</a>, I'm stuck on a little problem : when I use params with slashes, it confuses the router engine. So is there a nice way to handle this kind of param without having to encode it ?</p>
<p>The code looks like </p>
<pre><code>get 'add/:url' d... | [
{
"answer_id": 529172,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "<p>Did you try to use splat parameters?</p>\n\n<p>Something like:</p>\n\n<pre><code>get '/add/*' do\n protocol = params[:splat... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58767/"
] | Playing with [sinatra](http://www.sinatrarb.com/), I'm stuck on a little problem : when I use params with slashes, it confuses the router engine. So is there a nice way to handle this kind of param without having to encode it ?
The code looks like
```
get 'add/:url' do
#....
end
```
And I intend to get somethin... | Did you try to use splat parameters?
Something like:
```
get '/add/*' do
protocol = params[:splat].first
address = params[:splat][1..-1].join('/')
url = protocol + "//" + address
end
``` |
529,068 | <p>I have a select box that looks like this (within a form_for)</p>
<pre><code> <%=f.select(:whatever_id, {"blah"=>0, "blah2"=>1, "blah3"=>2, "blah4"=>3}, {:include_blank => true}) %>
</code></pre>
<p>and the output is good, but weird... like this:</p>
<pre><code><select id="personal_informa... | [
{
"answer_id": 529084,
"author": "DanSingerman",
"author_id": 43965,
"author_profile": "https://Stackoverflow.com/users/43965",
"pm_score": 0,
"selected": false,
"text": "<p>The problem is that the options parameter is a hash, and hashes have no guaranteed order.</p>\n\n<p>This should wo... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8047/"
] | I have a select box that looks like this (within a form\_for)
```
<%=f.select(:whatever_id, {"blah"=>0, "blah2"=>1, "blah3"=>2, "blah4"=>3}, {:include_blank => true}) %>
```
and the output is good, but weird... like this:
```
<select id="personal_information_whatever_id" name="personal_information[whatever_id]"><... | Yes, you should use an array of arrays. The easiest way with your example would be something like this:
```
<%=f.select(:whatever_id, [["blah", 0], ["blah2", 1], ["blah3", 2], ["blah4", 3]], {:include_blank => true}) %>
```
This should suffice. Take a look at the docs at [api.rubyonrails.com](http://api.rubyonrails.... |
529,079 | <p>I have read several articles regarding templates for web site content. They all seem to recommend that the columns should be placed on your site via floats. Example: </p>
<pre><code><div id="container" style="width: 1000px;">
<div id="main_content" style="border: solid 1px Black; width: 798px; /* wid... | [
{
"answer_id": 529103,
"author": "David Kolar",
"author_id": 3283,
"author_profile": "https://Stackoverflow.com/users/3283",
"pm_score": 3,
"selected": true,
"text": "<p>A big problem with absolutely-positioned containers is placing content on the page below them when you don't know thei... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23869/"
] | I have read several articles regarding templates for web site content. They all seem to recommend that the columns should be placed on your site via floats. Example:
```
<div id="container" style="width: 1000px;">
<div id="main_content" style="border: solid 1px Black; width: 798px; /* width = 800px -2px for borde... | A big problem with absolutely-positioned containers is placing content on the page below them when you don't know their heights ahead of time. In your example you have defined the heights of your absolutely-positioned elements, so this shouldn't be a problem for you. If it works for you, use it. |
529,085 | <p>Due to the implementation of Java generics, you can't have code like this: </p>
<pre><code>public class GenSet<E> {
private E a[];
public GenSet() {
a = new E[INITIAL_ARRAY_LENGTH]; // error: generic array creation
}
}
</code></pre>
<p>How can I implement this while maintaining type safe... | [
{
"answer_id": 529094,
"author": "Ola Bini",
"author_id": 64081,
"author_profile": "https://Stackoverflow.com/users/64081",
"pm_score": 3,
"selected": false,
"text": "<p>The example is using Java reflection to create an array. Doing this is generally not recommended, since it isn't types... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64250/"
] | Due to the implementation of Java generics, you can't have code like this:
```
public class GenSet<E> {
private E a[];
public GenSet() {
a = new E[INITIAL_ARRAY_LENGTH]; // error: generic array creation
}
}
```
How can I implement this while maintaining type safety?
I saw a solution on the Jav... | I have to ask a question in return: is your `GenSet` "checked" or "unchecked"?
What does that mean?
* **Checked**: *strong typing*. `GenSet` knows explicitly what type of objects it contains (i.e. its constructor was explicitly called with a `Class<E>` argument, and methods will throw an exception when they are passed... |
529,088 | <p>Notice the following code. The offending line has been commented out.</p>
<pre><code>interface I<R> { }
class C : I<int> { }
class Program
{
private static void function<T, R>(T t) where T : class, I<R>
{
}
static void Main(string[] args)
{
// function(new C())... | [
{
"answer_id": 529104,
"author": "Vojislav Stojkovic",
"author_id": 58099,
"author_profile": "https://Stackoverflow.com/users/58099",
"pm_score": 3,
"selected": false,
"text": "<p>Not if you want to keep all the constraints. However, this should serve equally well, unless you have a spec... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9178/"
] | Notice the following code. The offending line has been commented out.
```
interface I<R> { }
class C : I<int> { }
class Program
{
private static void function<T, R>(T t) where T : class, I<R>
{
}
static void Main(string[] args)
{
// function(new C()); // wont compile
function<C, ... | ```
class D : I<int>, I<string> { }
//
function<D, int>(new D());
function<D, string>(new D());
//is R int or string?
function(new D());
``` |
529,098 | <p>I'm testing something in Oracle and populated a table with some sample data, but in the process I accidentally loaded duplicate records, so now I can't create a primary key using some of the columns.</p>
<p>How can I delete all duplicate rows and leave only one of them?</p>
| [
{
"answer_id": 529119,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 10,
"selected": true,
"text": "<p>Use the <code>rowid</code> pseudocolumn.</p>\n\n<pre><code>DELETE FROM your_table\nWHERE rowid not in\n(SELECT MI... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] | I'm testing something in Oracle and populated a table with some sample data, but in the process I accidentally loaded duplicate records, so now I can't create a primary key using some of the columns.
How can I delete all duplicate rows and leave only one of them? | Use the `rowid` pseudocolumn.
```
DELETE FROM your_table
WHERE rowid not in
(SELECT MIN(rowid)
FROM your_table
GROUP BY column1, column2, column3);
```
Where `column1`, `column2`, and `column3` make up the identifying key for each record. You might list all your columns. |
529,105 | <p>The SQL...</p>
<pre><code>UPDATE Threads t
SET t.Content = (
SELECT GROUP_CONCAT(a.Content ORDER BY a.PageID SEPARATOR '<!-- pagebreak -->')
FROM MSarticlepages a
WHERE a.ArticleID = t.MSthreadID GROUP BY a.ArticleID
)
</code></pre>
<p>As you can see it takes all of an article's pages (which ar... | [
{
"answer_id": 529123,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 5,
"selected": true,
"text": "<p>According to the <a href=\"http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat\" re... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5509/"
] | The SQL...
```
UPDATE Threads t
SET t.Content = (
SELECT GROUP_CONCAT(a.Content ORDER BY a.PageID SEPARATOR '<!-- pagebreak -->')
FROM MSarticlepages a
WHERE a.ArticleID = t.MSthreadID GROUP BY a.ArticleID
)
```
As you can see it takes all of an article's pages (which are each
stored as longtext in sep... | According to the [MySQL manual](http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat), the maximum length of `GROUP_CONCAT` is defined by the `group_concat_max_len` system variable, which defaults to 1024.
This value can be increased, by using the following command:
```
SET group_conca... |
529,107 | <p>I am wondering if anyone has any experience in creating a new control based on a WPF text box that could support syntax highlighting, line numbers, etc. </p>
<p>Any links or advice on how i could begin creating something like this would be very helpful.</p>
| [
{
"answer_id": 529123,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 5,
"selected": true,
"text": "<p>According to the <a href=\"http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat\" re... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18811/"
] | I am wondering if anyone has any experience in creating a new control based on a WPF text box that could support syntax highlighting, line numbers, etc.
Any links or advice on how i could begin creating something like this would be very helpful. | According to the [MySQL manual](http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat), the maximum length of `GROUP_CONCAT` is defined by the `group_concat_max_len` system variable, which defaults to 1024.
This value can be increased, by using the following command:
```
SET group_conca... |
529,109 | <p>In main: </p>
<pre><code>char *myData[500][9]; //dynamic rows??
char **tableData[500]={NULL}; //dynamic rows??
int r;
newCallBack(db, &myData, &tableData, &r);
</code></pre>
<p>and passing into function by:</p>
<pre><code>void newCallBack(sqlite3 *db, char** mdat, char*** tdat, int* r )
{
</... | [
{
"answer_id": 529126,
"author": "arnsholt",
"author_id": 62143,
"author_profile": "https://Stackoverflow.com/users/62143",
"pm_score": 3,
"selected": true,
"text": "<p>First of all, the problem with myData is that it's the wrong type. char* [][] would require a prototype char*** (a two-... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52256/"
] | In main:
```
char *myData[500][9]; //dynamic rows??
char **tableData[500]={NULL}; //dynamic rows??
int r;
newCallBack(db, &myData, &tableData, &r);
```
and passing into function by:
```
void newCallBack(sqlite3 *db, char** mdat, char*** tdat, int* r )
{
```
Doesn't seem to like this? Any suggestions? Lo... | First of all, the problem with myData is that it's the wrong type. char\* [][] would require a prototype char\*\*\* (a two-dimensional array of strings) in the function you're calling. The function wants a list of strings, which is char\* [], or alternatively char[][], if you don't mind limiting the size of the strings... |
529,116 | <p>I am working on an existing Java project with a typical services - dao setup for which only a webapplication was available. My job is to add webservices on top of the services layer, but the webservices have their own functional analysis and datamodel. The functional analyses ofcource focuses on what is possible in ... | [
{
"answer_id": 530609,
"author": "Jim Barrows",
"author_id": 45108,
"author_profile": "https://Stackoverflow.com/users/45108",
"pm_score": 0,
"selected": false,
"text": "<p>I think the real question is... how much of the code generators do you want to use in the future, and can you get t... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49431/"
] | I am working on an existing Java project with a typical services - dao setup for which only a webapplication was available. My job is to add webservices on top of the services layer, but the webservices have their own functional analysis and datamodel. The functional analyses ofcource focuses on what is possible in the... | I am experiencing the same issue on my project. I created a factory for the generated objects and use it for creating objects.
```
Customer customer = factory.createCustomer(wsCustomer);
```
Which isolates the construction code, w/o altering the generated code. |
529,144 | <p>I've got a varchar field in SQL Sever 2005 that's storing a time value in the format "hh:mm"ss.mmmm".</p>
<p>What I really want to do is take the average using the built in aggregate function of those time values. However, this:</p>
<pre><code>SELECT AVG(TimeField) FROM TableWithTimeValues
</code></pre>
<p>doesn... | [
{
"answer_id": 529165,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 3,
"selected": false,
"text": "<p>Try this</p>\n\n<pre><code>AVG(CAST(CAST('1900-01-01 ' + TimeField AS DateTime) AS Float))\n</code></pre>\n\n<p>You... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] | I've got a varchar field in SQL Sever 2005 that's storing a time value in the format "hh:mm"ss.mmmm".
What I really want to do is take the average using the built in aggregate function of those time values. However, this:
```
SELECT AVG(TimeField) FROM TableWithTimeValues
```
doesn't work, since (of course) SQL won... | SQL Server can convert a time-only portion of a datetime value from string to datetime, however in your example, you have a precision of 4 decimal places. SQL Server 2005 only recognizes 3 places. Therefore, you will need to truncate the right-most character:
```
create table #TableWithTimeValues
(
TimeField varch... |
529,153 | <p>I'd like to add a little variablility onto the path of my css link everytime my Site.Master view is processed. What is the correct way to do this? My code currently breaks on the Default.aspx saying I have not defined cssLink. Site.Master code below:</p>
<pre><code> <script runat="server">
void Pag... | [
{
"answer_id": 529163,
"author": "xspydr",
"author_id": 55862,
"author_profile": "https://Stackoverflow.com/users/55862",
"pm_score": 3,
"selected": false,
"text": "<p>Just define your css link like you typically would and add some inline processing. You are attempting to do a Page_Load ... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] | I'd like to add a little variablility onto the path of my css link everytime my Site.Master view is processed. What is the correct way to do this? My code currently breaks on the Default.aspx saying I have not defined cssLink. Site.Master code below:
```
<script runat="server">
void Page_Load(object sender... | Consider writing a helper to link that CSS file.
```
public static string DatedStylesheet(this HtmlHelper Html, string url, DateTime date)
{
UrlHelper Url = new UrlHelper(new RequestContext(Html.ViewContext.HttpContext, Html.ViewContext.RouteData));
string html = "<link type=\"text/css\" rel=\"stylesheet\" hre... |
529,182 | <p>Castle Validator uses attributes to specify validation rules. How can you hook these up with Subsonic's generated classes (or any classes where you can't define the attributes on)? Is there a way to programatically specify validation rules without using the attribute method?</p>
| [
{
"answer_id": 699245,
"author": "Bittercoder",
"author_id": 4843,
"author_profile": "https://Stackoverflow.com/users/4843",
"pm_score": 0,
"selected": false,
"text": "<p>There are a few ways to do this - attributes is the lowest friction option, but obviously doesn't deal well with gene... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1574/"
] | Castle Validator uses attributes to specify validation rules. How can you hook these up with Subsonic's generated classes (or any classes where you can't define the attributes on)? Is there a way to programatically specify validation rules without using the attribute method? | I think the best way to do that is using `MetadataType`.
It's a `DataAnnotations` that let's your class have like a pair or something like that. I don't know how to explain it better so, let's for the samples:
You first need to add this directive to your code:
```
using System.ComponentModel.DataAnnotations;
```
Th... |
529,184 | <p>I have a bunch of data, generally in the form
a, b, c, ..., y</p>
<p>where y = f(a, b, c...)</p>
<p>Most of them are three and four variables, and have 10k - 10M records. My general assumption is that they are algebraic in nature, something like:</p>
<p>y = P1 a^E1 + P2 b^E2 + P3 c^E3 </p>
<p>Unfortunately, my... | [
{
"answer_id": 529191,
"author": "Scottie T",
"author_id": 6688,
"author_profile": "https://Stackoverflow.com/users/6688",
"pm_score": 2,
"selected": false,
"text": "<p>The basics of data fitting involve assuming a general form of a solution, guessing some initial values for constants, a... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64258/"
] | I have a bunch of data, generally in the form
a, b, c, ..., y
where y = f(a, b, c...)
Most of them are three and four variables, and have 10k - 10M records. My general assumption is that they are algebraic in nature, something like:
y = P1 a^E1 + P2 b^E2 + P3 c^E3
Unfortunately, my last statistical analysis class... | In case it's useful, here's a Numpy/Scipy (Python) template to do what you want:
```
from numpy import array
from scipy.optimize import leastsq
def __residual(params, y, a, b, c):
p0, e0, p1, e1, p2, e2 = params
return p0 * a ** e0 + p1 * b ** e1 + p2 * c ** e2 - y
# load a, b, c
# guess initial values for p... |
529,188 | <p>I have an <code>Enumerable<T></code> and am looking for a method that allows me to execute an action for each element, kind of like <code>Select</code> but then for side-effects. Something like:</p>
<pre><code>string[] Names = ...;
Names.each(s => Console.Writeline(s));
</code></pre>
<p>or </p>
<pre><cod... | [
{
"answer_id": 529197,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 5,
"selected": false,
"text": "<p><em><sup>Disclaimer: This post no longer resembles my original answer, but rather incorporates the some seven years... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3314/"
] | I have an `Enumerable<T>` and am looking for a method that allows me to execute an action for each element, kind of like `Select` but then for side-effects. Something like:
```
string[] Names = ...;
Names.each(s => Console.Writeline(s));
```
or
```
Names.each(s => GenHTMLOutput(s));
// (where GenHTMLOutput cann... | A quick-and-easy way to get this is:
```
Names.ToList().ForEach(e => ...);
``` |
529,193 | <p>I have a scenario in NHibernate where I have a one-to-many relationship between entities Employee and EmployeeStatus.</p>
<p>Employee has properties eg: ID, Name and an IList of EmployeeStatus, whilst EmployeeStatus, for the purposes of this question, just has it's own ID and some free text.</p>
<p>I don't need to... | [
{
"answer_id": 529232,
"author": "RKitson",
"author_id": 16947,
"author_profile": "https://Stackoverflow.com/users/16947",
"pm_score": -1,
"selected": false,
"text": "<p>Can you post the code for the classes?</p>\n\n<p>Are you trying to keep a history of statuses for an Employee?</p>\n\n... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20524/"
] | I have a scenario in NHibernate where I have a one-to-many relationship between entities Employee and EmployeeStatus.
Employee has properties eg: ID, Name and an IList of EmployeeStatus, whilst EmployeeStatus, for the purposes of this question, just has it's own ID and some free text.
I don't need to hold a reference... | The scenario you've described is just a basic one-to-many mapping. Here is the Fluent NHibernate mapping for this:
```
public class EmployeeMap : ClassMap<Employee>
{
public EmployeeMap()
{
WithTable("Employee");
HasMany(employee => employee.StatusList)
.Cascade.All();
}
}
```
You... |
529,195 | <p>I'm getting a failing test here that I'm having trouble understanding. I'm using Test::Unit with Shoulda enhancement. Action in <code>users_controller.rb</code> I'm trying to test...</p>
<pre><code>def create
unless params[:user][:email] =~ / specific regex needed for this app /i
# ...
render :template ... | [
{
"answer_id": 529226,
"author": "Ola Bini",
"author_id": 64081,
"author_profile": "https://Stackoverflow.com/users/64081",
"pm_score": -1,
"selected": false,
"text": "<p>If you're using default REST-ful URLs, you probably should use PUT, not POST... Since PUT is connected to create, POS... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42595/"
] | I'm getting a failing test here that I'm having trouble understanding. I'm using Test::Unit with Shoulda enhancement. Action in `users_controller.rb` I'm trying to test...
```
def create
unless params[:user][:email] =~ / specific regex needed for this app /i
# ...
render :template => 'sessions/new'
end
e... | @Ola: You're wrong: POST is connected to create. PUT is normally connected to update.
A :forbidden is quiet odd though. Here are some suggestions to find the problem (I've never used Shoulda, but I don't think it is a problem with Shoulda.
1. Make sure the route is defined in *config/routes.rb* and check with *rake r... |
529,196 | <p>I have an XElement with values for mock data. </p>
<p>I have an expression to query the xml:</p>
<pre><code>Expression<Func<XElement, bool>> simpleXmlFunction =
b => int.Parse(b.Element("FooId").Value) == 12;
</code></pre>
<p>used in:</p>
<pre><code>var simpleXml = xml.Elements("Foo").Where(... | [
{
"answer_id": 529213,
"author": "David Morton",
"author_id": 45916,
"author_profile": "https://Stackoverflow.com/users/45916",
"pm_score": 5,
"selected": true,
"text": "<p>Don't make simpleXmlFunction an Expression<Func<XElement, bool>>. Make it a Func<XElement, bool>... | 2009/02/09 | [
"https://Stackoverflow.com/questions/529196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54612/"
] | I have an XElement with values for mock data.
I have an expression to query the xml:
```
Expression<Func<XElement, bool>> simpleXmlFunction =
b => int.Parse(b.Element("FooId").Value) == 12;
```
used in:
```
var simpleXml = xml.Elements("Foo").Where(simpleXmlFunction).First();
```
The design time error is:
... | Don't make simpleXmlFunction an Expression<Func<XElement, bool>>. Make it a Func<XElement, bool>. That's what's expected as a delegate of .Where.
```
Func<XElement, bool> simpleXmlFunction =
new Func<XElement, bool>(b => int.Parse(b.Element("FooId").Value) == 12);
``` |